189 lines
6.6 KiB
JavaScript
189 lines
6.6 KiB
JavaScript
// Buildings that can be raised in a city. Build costs are fixed and grow only
|
|
// with the level, with no level cap; upkeep is 1% of that cost, so it follows
|
|
// the level too.
|
|
|
|
import { EFFECT_PRODUCTION, EFFECT_RESEARCH, EFFECT_CULTURE, effect } from "./effects.js";
|
|
|
|
// Buildings whose benefit is a rule rather than a stat effect. Kept as ids so
|
|
// the simulation and the UI can name them without magic strings.
|
|
export const BUILDING_MECHANIC = {
|
|
// Units: one more parallel training line per level.
|
|
PARALLEL_TRAINING: "parallel_training",
|
|
// Buildings: one more parallel construction line per level.
|
|
PARALLEL_BUILDING: "parallel_building",
|
|
// Cuts civilian deaths from bombing, and is very hard to knock down.
|
|
CIVILIAN_SHELTER: "civilian_shelter",
|
|
// Fires one volley at hostile aircraft passing over the city.
|
|
AIR_DEFENSE: "air_defense",
|
|
// Flat production per head for the city's region, per adjacent sea tile.
|
|
PORT_PRODUCTION: "port_production",
|
|
// Lets people fly in from any other city with an airport.
|
|
AIR_IMMIGRATION: "air_immigration",
|
|
// Unlocks the Nuclear Weapons research for the nation that raises one.
|
|
NUCLEAR_ENRICHMENT: "nuclear_enrichment",
|
|
// Each level lets the nation launch one spy satellite (see INTELLIGENCE.md).
|
|
SPACE_LAUNCH: "space_launch",
|
|
};
|
|
|
|
export const BUILDINGS = [
|
|
{
|
|
id: "barracks",
|
|
name: "Barracks",
|
|
description: "Enables training infantry units. Each level allows one more parallel training.",
|
|
baseCost: 10_000_000,
|
|
costAlpha: 1.1,
|
|
refundFraction: 0.5,
|
|
effects: [],
|
|
mechanic: "parallel_training",
|
|
icon: "icon_barracks.svg",
|
|
},
|
|
{
|
|
id: "shelters",
|
|
name: "Wartime shelters",
|
|
description: "Each level reduces civilian life loss from bombing by 10%. Extremely hard to destroy. Does not protect other buildings.",
|
|
baseCost: 100_000_000,
|
|
costAlpha: 2,
|
|
refundFraction: 0.5,
|
|
effects: [],
|
|
mechanic: "civilian_shelter",
|
|
civilianProtectionPerLevel: 0.1,
|
|
// Multiplies the odds of the city losing a level of this building to a
|
|
// bombardment: at a tenth of the normal chance it is very hard to destroy.
|
|
destructionResistance: 0.1,
|
|
// A bunker survives a nuclear blast that flattens everything around it.
|
|
nuclearProof: true,
|
|
icon: "icon_shelters.svg",
|
|
},
|
|
{
|
|
id: "aa_building",
|
|
advanced: true,
|
|
name: "Air defense",
|
|
description: "Damages hostile aircraft that fly above this city.",
|
|
baseCost: 1_000_000_000,
|
|
costAlpha: 2,
|
|
refundFraction: 0.5,
|
|
effects: [],
|
|
mechanic: "air_defense",
|
|
// Cheap to keep ready; the cost is in the ammunition it fires (see the
|
|
// combat consumption rules).
|
|
materialUpkeep: { steel: 0.5, energy: 500, hightech: 0 },
|
|
icon: "icon_aa_building.svg",
|
|
},
|
|
{
|
|
id: "research_lab",
|
|
advanced: true,
|
|
name: "Research lab",
|
|
description: "Applies science to industry and government. Produces research points for the whole nation.",
|
|
baseCost: 100_000_000,
|
|
costAlpha: 1.65,
|
|
refundFraction: 0.5,
|
|
effects: [effect(EFFECT_RESEARCH, 1.0, 0.9)],
|
|
icon: "icon_research_lab.svg",
|
|
},
|
|
{
|
|
id: "university",
|
|
advanced: true,
|
|
name: "University",
|
|
description: "Higher education produces research and a little culture for the whole nation.",
|
|
baseCost: 100_000_000,
|
|
costAlpha: 1.7,
|
|
refundFraction: 0.5,
|
|
effects: [effect(EFFECT_RESEARCH, 2.0, 0.8), effect(EFFECT_CULTURE, 0.5, 0.7)],
|
|
icon: "icon_university.svg",
|
|
},
|
|
{
|
|
id: "museum",
|
|
name: "Museum",
|
|
description: "Preserves the nation's heritage, raising its culture output across the country.",
|
|
baseCost: 50_000_000,
|
|
costAlpha: 1.6,
|
|
refundFraction: 0.5,
|
|
effects: [effect(EFFECT_CULTURE, 1.5, 0.85)],
|
|
icon: "icon_museum.svg",
|
|
},
|
|
{
|
|
id: "cinema_studio",
|
|
name: "Cinema studio",
|
|
description: "Mass media spreads the nation's culture, raising its culture output across the country.",
|
|
baseCost: 50_000_000,
|
|
costAlpha: 1.75,
|
|
refundFraction: 0.5,
|
|
effects: [effect(EFFECT_CULTURE, 3.0, 0.7)],
|
|
icon: "icon_cinema_studio.svg",
|
|
},
|
|
{
|
|
id: "port",
|
|
name: "Port",
|
|
description: "Warm water port. Adds 1000 production per person per adjacent sea tile per level, and brings in extra food.",
|
|
baseCost: 20_000_000,
|
|
costAlpha: 1.7,
|
|
refundFraction: 0.5,
|
|
effects: [],
|
|
// Every person in the city's region produces this much more, for each sea
|
|
// tile next to the city, per port level.
|
|
mechanic: "port_production",
|
|
productionPerSeaTilePerLevel: 1000,
|
|
// The region also grows this much more food, as a fraction of its output,
|
|
// for each sea tile beside the city, per port level.
|
|
foodPerSeaTilePerLevel: 0.05,
|
|
icon: "icon_port.svg",
|
|
coastal: true,
|
|
},
|
|
{
|
|
id: "airport",
|
|
advanced: true,
|
|
name: "Airport",
|
|
description: "An airfield with a control tower. Lets the city train aircraft and serves as a home airbase for them to land and refuel. Immigration can reach this city from any other city in the world with an airport. The effect scales with airport level.",
|
|
baseCost: 250_000_000,
|
|
costAlpha: 1.7,
|
|
refundFraction: 0.5,
|
|
effects: [effect(EFFECT_PRODUCTION, 0.05, 0.8)],
|
|
mechanic: "air_immigration",
|
|
icon: "icon_airport.svg",
|
|
},
|
|
{
|
|
id: "shipyard",
|
|
name: "Shipyard",
|
|
description: "Naval yards that build warships. Only a coastal city can raise one, and it must already have a port. Each level adds one parallel building queue.",
|
|
baseCost: 150_000_000,
|
|
costAlpha: 1.65,
|
|
refundFraction: 0.5,
|
|
effects: [],
|
|
mechanic: "parallel_building",
|
|
icon: "icon_shipyard.svg",
|
|
coastal: true,
|
|
requiresBuilding: "port",
|
|
},
|
|
{
|
|
id: "uranium_enrichment_center",
|
|
advanced: true,
|
|
name: "Uranium enrichment centre",
|
|
description: "Uranium centrifuges. Raising one unlocks the Nuclear Weapons research for the whole nation.",
|
|
baseCost: 2_000_000_000,
|
|
costAlpha: 2,
|
|
refundFraction: 0.5,
|
|
effects: [],
|
|
mechanic: "nuclear_enrichment",
|
|
nuclear: true,
|
|
materialUpkeep: { steel: 3, energy: 4000, hightech: 1 },
|
|
icon: "icon_uranium_enrichment.svg",
|
|
},
|
|
{
|
|
id: "space_launch_center",
|
|
advanced: true,
|
|
name: "Space launch centre",
|
|
description: "A rocket complex. Each level lets the nation launch one spy satellite, which uncovers a random patch of the world every two days. Extremely expensive.",
|
|
baseCost: 10_000_000_000,
|
|
costAlpha: 2,
|
|
refundFraction: 0.5,
|
|
effects: [],
|
|
mechanic: "space_launch",
|
|
materialUpkeep: { steel: 5, energy: 8000, hightech: 4 },
|
|
icon: "icon_space_launch_center.svg",
|
|
},
|
|
];
|
|
|
|
export function buildingById(id) {
|
|
return BUILDINGS.find((b) => b.id === id) || null;
|
|
}
|