To recap:
1) Before doing anything, prices of hand weapons/drugs in market are X
2) Use agent to cause a
stability penalty event (similar to Recent Unrest but longer-lived)
3) Prices of guns/drugs are now Y, where Y < X
4) Undock and redock
5) Prices of guns/drugs are now Z, where Z > X
After doing some fresh searching, I found step 5 results from the code in Population submarket class that increases demand for hand weapons and drugs when stability drops low enough. But calling
market.reapplyConditions() after the stability-reducing event doesn't make the prices update to Z before undocking. Are prices updated based on supply/demand only in an EveryFrameScript somewhere?
Spoiler
public void apply(String id) {
float size = market.getSize();
float pop = getPopulation(market);
//[...]
// TODO : modify this to affect all goods illegal in market
float lowStabilityBonus = getLowStabilityBonusMult(market);
float lowStabilityPenalty = getLowStabilityPenaltyMult(market);
float highStabilityBonus = getHighStabilityBonusMult(market);
float highStabilityPenalty = getHighStabilityPenaltyMult(market);
for (CommodityOnMarketAPI com : market.getAllCommodities()) {
if (market.isIllegal(com) && !com.getId().equals(Commodities.ORGANS)) {
market.getDemand(com.getId()).getDemand().modifyMult("stability_" + id, lowStabilityBonus * highStabilityPenalty);
}
}
if (!market.isIllegal(Commodities.DRUGS)) {
market.getDemand(Commodities.DRUGS).getDemand().modifyMult("stability_" + id, lowStabilityBonus * highStabilityPenalty);
}
if (!market.isIllegal(Commodities.HAND_WEAPONS)) {
market.getDemand(Commodities.HAND_WEAPONS).getDemand().modifyMult("stability_" + id, lowStabilityBonus * highStabilityPenalty);
}
if (!market.isIllegal(Commodities.LUXURY_GOODS)) {
market.getDemand(Commodities.LUXURY_GOODS).getDemand().modifyMult("stability_" + id, highStabilityBonus * lowStabilityPenalty);
}
}