Files
Battle-for-Tismo/shared/data/units.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

178 lines
4.2 KiB
JavaScript

// Unit archetypes. `military` units fight, capture cities and may enter an
// enemy military unit's tile. `attack` is the damage dealt per combat round and
// `defense` the damage absorbed per round; a defender's defense is doubled (the
// 100% defensive bonus). `range` is how many tiles away the unit can strike
// (1 is melee).
export const PROTO_UNITS = [
{
id: "modern_infantry",
name: "Modern infantry",
maxHp: 500,
cost: 100_000_000,
upkeep: 5000,
moveable: true,
speed: 0.5,
military: true,
// Marks the unit for the infantry research effects (weapons, body armour).
infantry: true,
attack: 100,
defense: 40,
range: 1,
traversableTerrains: ["Land"],
icon: "icon_modern_infantry.svg",
},
{
id: "worker",
name: "Worker",
maxHp: 100,
cost: 0,
upkeep: 0,
moveable: true,
speed: 0.5,
military: false,
attack: 0,
defense: 0,
range: 1,
traversableTerrains: ["Land"],
icon: "icon_settler.svg",
},
{
id: "artillery",
name: "Artillery",
maxHp: 400,
cost: 300_000_000,
upkeep: 12_000,
moveable: true,
speed: 0.25,
military: true,
// Marks the unit for the artillery research effect.
artillery: true,
attack: 250,
// Barely armoured: nearly every hit gets through.
defense: 5,
// Outranges infantry, so melee units cannot strike back from two tiles.
range: 2,
traversableTerrains: ["Land"],
icon: "icon_artillery.svg",
},
{
id: "jet_fighter",
name: "Jet fighter",
maxHp: 300,
cost: 400_000_000,
upkeep: 20_000,
moveable: true,
speed: 5,
military: true,
attack: 300,
defense: 20,
range: 1,
traversableTerrains: ["Land", "Sea", "Ice"],
// Aircraft only operate near a friendly airport: `enduranceHours` is how
// long they may stay aloft and `missionRange` the furthest they may be
// ordered from home. Both are per-type so a future plane can differ. The
// fighter's 10-tile reach needs 4 hours aloft for the round trip, leaving
// an hour of reserve.
air: true,
enduranceHours: 5,
missionRange: 40,
requiresBuilding: "airport",
icon: "icon_jet_fighter.svg",
},
{
id: "bomber",
name: "Bomber",
maxHp: 350,
cost: 500_000_000,
upkeep: 25_000,
moveable: true,
speed: 5,
military: true,
attack: 450,
defense: 10,
// A bomber strikes from `range` tiles away and never joins the melee.
range: 0,
traversableTerrains: ["Land", "Sea", "Ice"],
air: true,
enduranceHours: 10,
missionRange: 50,
strike: true,
requiresBuilding: "airport",
icon: "icon_bomber.svg",
},
{
id: "battleship",
name: "Battleship",
maxHp: 800,
cost: 600_000_000,
upkeep: 30_000,
moveable: true,
speed: 0.5,
military: true,
attack: 400,
defense: 120,
range: 2,
naval: true,
traversableTerrains: ["Sea"],
requiresBuilding: "shipyard",
icon: "icon_battleship.svg",
},
{
id: "mobile_radar",
name: "Mobile radar",
maxHp: 200,
cost: 50_000_000,
upkeep: 5000,
moveable: true,
speed: 0.5,
military: false,
attack: 0,
defense: 0,
range: 0,
// Watches four tiles out, cannot fight, is taken by any unit that walks
// onto it, and a lone one is destroyed outright by a single ranged hit.
vision: 4,
capturable: true,
destroyedByRangedAlone: true,
traversableTerrains: ["Land"],
icon: "icon_radar.svg",
},
{
id: "launch",
name: "Launch",
maxHp: 150,
cost: 20_000_000,
upkeep: 2000,
moveable: true,
speed: 0.5,
military: false,
attack: 0,
defense: 0,
range: 0,
// Transports one infantry unit and is defenceless on its own.
transportCapacity: 1,
transportKind: "infantry",
capturable: true,
naval: true,
traversableTerrains: ["Sea"],
requiresBuilding: "port",
icon: "icon_launch.svg",
},
];
// Only units in this list can be trained from the city screen.
export const TRAINABLE_UNIT_IDS = [
"modern_infantry",
"artillery",
"jet_fighter",
"bomber",
"battleship",
"mobile_radar",
"launch",
];
export function protoUnitById(id) {
return PROTO_UNITS.find((u) => u.id === id) || null;
}