18 lines
625 B
JavaScript
18 lines
625 B
JavaScript
// Shared constants and tiny helpers. No game logic here.
|
|
|
|
export const STATE_VERSION = 1;
|
|
|
|
export const IND_IDS = [
|
|
"order", "stability", "civilRights", "opinion", "economy",
|
|
"hardPower", "softPower", "unrest", "armyLoyalty",
|
|
];
|
|
export const VAR_IDS = ["growth", "unemployment", "inflation"];
|
|
export const TAX_IDS = ["income", "corporate", "vat"];
|
|
|
|
export const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
|
|
// Saturating curve: overspending has diminishing returns, ratio 0 gives 0.
|
|
export function qualityFromRatio(ratio, bal) {
|
|
return 100 * (1 - Math.exp(-bal.sector.qualityCurve * Math.max(0, ratio)));
|
|
}
|