Files
Battle-for-Tismo/shared/data/effects.js
T
adrien e7ee5dbf0e Added the resource economy, its works and their icons
- Five resources (energy, steel, food, luxury, high-tech) with per-city stores, a world market, delivery and material upkeep.
- Resource-producing tile works built outside cities; every nation opens with the works its economy needs.
- Real game-icons.net art replacing the dummy icons for the new resources and works, with the credits updated.
2026-09-22 05:27:11 +02:00

28 lines
1.2 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";
export const EFFECT_BUDGET_INCOME = "budget_income";
// 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";
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);
}