Central banks now redeem the national money foreign banks hold, sell reserves to defend a weak rate, and cover part of strategic imports from reserves. Five repeatable technologies raise each commodity's output per unit of energy. Hostile troops on a road or sea lane sever trade, power and unit supply. Middlemen buy food to resell to neighbours at a markup, and starving regions buy before those topping up their buffers, which clears the landlocked famines. The economic map's trade graph gains a colour legend.
36 lines
1.6 KiB
JavaScript
36 lines
1.6 KiB
JavaScript
// Stat effects shared by every data-driven entry (buildings, governments,
|
|
// technologies). An effect scales with a level so a building's benefit grows
|
|
// with each upgrade.
|
|
|
|
// Every stat that modifies a tile's or a nation's production, in display order.
|
|
export const EFFECT_PRODUCTION = "production";
|
|
export const EFFECT_RESEARCH = "research";
|
|
export const EFFECT_CULTURE = "culture";
|
|
// Repeatable technology effects. Each is a fraction that stacks with every
|
|
// further level researched.
|
|
export const EFFECT_INFANTRY_ATTACK = "infantry_attack";
|
|
export const EFFECT_INFANTRY_DEFENSE = "infantry_defense";
|
|
export const EFFECT_ARTILLERY_ATTACK = "artillery_attack";
|
|
export const EFFECT_CONSTRUCTION_SPEED = "construction_speed";
|
|
export const EFFECT_RAIL_SPEED = "rail_speed";
|
|
|
|
// Resource efficiency: the national bonus to a commodity's output per unit of
|
|
// energy input. One technology per commodity raises its own stat, and the
|
|
// simulation divides that commodity's energy draw by `1 + bonus`.
|
|
export const EFFECT_ENERGY_EFFICIENCY = "energy_efficiency";
|
|
export const EFFECT_STEEL_EFFICIENCY = "steel_efficiency";
|
|
export const EFFECT_FOOD_EFFICIENCY = "food_efficiency";
|
|
export const EFFECT_LUXURY_EFFICIENCY = "luxury_efficiency";
|
|
export const EFFECT_HIGHTECH_EFFICIENCY = "hightech_efficiency";
|
|
|
|
export function effect(stat, baseValue, exponent = 1.0) {
|
|
return { stat, baseValue, exponent };
|
|
}
|
|
|
|
// The value of an effect at `level`. A level of zero or less contributes
|
|
// nothing, so an unbuilt building never has an effect.
|
|
export function effectValue(e, level) {
|
|
if (level <= 0) return 0;
|
|
return e.baseValue * Math.pow(level, e.exponent);
|
|
}
|