First commit, done on M6 from the PLAN.MD
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// Sector quality drifts toward a target set by the budget ratio (alloc / need).
|
||||
// Each sector has its own time constant: police reacts in weeks, infrastructure in years.
|
||||
|
||||
import { clamp, qualityFromRatio } from "./state.js";
|
||||
import { biasFor } from "./modifiers.js";
|
||||
|
||||
export function stepSectors(state, bal, fiscal) {
|
||||
const s = bal.sector;
|
||||
for (const [id, sec] of Object.entries(state.sectors)) {
|
||||
let target = qualityFromRatio(sec.alloc / sec.need, bal) + biasFor(state, "sector", id);
|
||||
if (id === "industry" && fiscal.debtRatio > s.industryDebtPenaltyFrom) {
|
||||
target -= s.industryDebtPenaltyPerPoint * (fiscal.debtRatio - s.industryDebtPenaltyFrom);
|
||||
}
|
||||
sec.quality = clamp(sec.quality + (clamp(target, 0, 100) - sec.quality) / bal.sectorTau[id], 0, 100);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user