41 lines
1.5 KiB
JavaScript
41 lines
1.5 KiB
JavaScript
// Status effects a unit or city can carry. They are data-driven so new ones can
|
|
// be added without touching the simulation or the renderer: the server derives
|
|
// the active ids, applies their fields, and ships the ids in snapshots; the
|
|
// browser draws one icon per id.
|
|
//
|
|
// A status may define `hpLossPerDay` (a fraction of maximum hit points taken
|
|
// each day), a `cityHpLossPerDay` override for when the unit stands in a city,
|
|
// and an `upkeepMultiplier` applied to the unit's upkeep while it is active.
|
|
|
|
export const STATUS_ENCIRCLED = "encircled";
|
|
export const STATUS_BESIEGED = "besieged";
|
|
export const STATUS_BATTLE = "battle";
|
|
|
|
export const STATUSES = [
|
|
{
|
|
id: STATUS_ENCIRCLED,
|
|
label: "Encircled",
|
|
icon: "encirclement.svg",
|
|
description: "Cut off: every adjacent land tile is held by a hostile unit and no friendly port supplies it by sea. Loses 10% of its maximum hit points each day, or 2% inside a city.",
|
|
hpLossPerDay: 0.10,
|
|
cityHpLossPerDay: 0.02,
|
|
},
|
|
{
|
|
id: STATUS_BESIEGED,
|
|
label: "Besieged",
|
|
icon: "encirclement.svg",
|
|
description: "Cut off: every adjacent land tile is held by a hostile unit and no friendly port supplies it by sea.",
|
|
},
|
|
{
|
|
id: STATUS_BATTLE,
|
|
label: "In battle",
|
|
icon: "icon_battle.svg",
|
|
description: "Fighting an enemy unit on the same tile. Upkeep is tripled and the unit cannot pillage while the battle rages.",
|
|
upkeepMultiplier: 3,
|
|
},
|
|
];
|
|
|
|
export function statusById(id) {
|
|
return STATUSES.find((status) => status.id === id) || null;
|
|
}
|