Every road, railway and tile work now rises as an economic construction site instead of a queue entry. A site gathers its materials over days from reachable regions, refusing any supplier quoting above the price it was budgeted at (a 1% tolerance); a day that buys nothing stalls the site, raising a red mark and letting the nation raise the budget to current prices or cancel it. The upfront budget covers the build cost plus the market value of its steel and high-tech, energy stays a grid draw, and any money left over stays with the finished work as a maintenance reserve. That reserve now pays the work's own daily steel and high-tech wear before the treasury is billed, so a well funded work spares the state until it runs dry; the spent money is paid into the nation's regions. Building upgrades run through the same gather-build-maintain machinery, sharing the site's kind flag and target level. The legacy tile-work queue and the market building are gone. Bundles the in-progress chart sizing for the central bank panel.
156 lines
5.4 KiB
JavaScript
156 lines
5.4 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",
|
|
};
|
|
|
|
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,
|
|
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",
|
|
},
|
|
];
|
|
|
|
export function buildingById(id) {
|
|
return BUILDINGS.find((b) => b.id === id) || null;
|
|
}
|