Files
Battle-for-Tismo/shared/data/effects.js
T
adrien ede258d39f Added warfare depth, focused research and a reworked HUD
- Tile improvements (fortifications, radar towers, coastal cannons), trenches,
  zone of control, support-unit capture and launch transports, with parabolic
  barrage arcs drawn between attacker and target.
- Focused research that pours points straight into the chosen technology, with
  per-technology progress kept when the focus changes, plus repeatable levels.
- Popularity reworked to integer points, war and pillage effects, minority
  policies and month-over-month arrows on the nation summary.
- City progress bars, square improvement buttons, a technology tab of wide
  short cards with progress bars, transport cargo readout and double-click to
  open a city panel.
2026-09-21 01:07:36 +02:00

27 lines
1.1 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.
export const EFFECT_GDP = "gdp";
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);
}