From: xangelo Date: Wed, 25 May 2022 13:51:36 +0000 (-0400) Subject: new building: energy accumulator for energy storage X-Git-Url: https://git.xangelo.ca/?a=commitdiff_plain;h=f46523a78c2f16fdb74627dac9534afeac6a6096;p=browser-rts.git new building: energy accumulator for energy storage --- diff --git a/src/render/kingdom-overview.ts b/src/render/kingdom-overview.ts index 08866f1..744afe1 100644 --- a/src/render/kingdom-overview.ts +++ b/src/render/kingdom-overview.ts @@ -61,7 +61,7 @@ export function renderKingomOverview(city: CityWithLocation & Usage, account: Ac Energy ${city.energy.toLocaleString()} (${energyRateOfChange.toLocaleString()}) - @ 0% Battery Utilization + @ ${percent(city.energy, city.accumulators, 100)}% Accumulator Utilization Special Defenders ${city.sp_defenders.toLocaleString()} diff --git a/src/repository/city.ts b/src/repository/city.ts index 1094f10..6e08ff8 100644 --- a/src/repository/city.ts +++ b/src/repository/city.ts @@ -30,6 +30,7 @@ export type City = { farms: number; warehouses: number; solar_panels: number; + accumulators: number; barracks: number; special_attacker_trainer: number; special_defender_trainer: number; @@ -79,6 +80,7 @@ export class CityRepository extends Repository { farms: 5, warehouses: 5, solar_panels: 5, + accumulators: 5, barracks: 0, special_attacker_trainer: 0, special_defender_trainer: 0, @@ -332,6 +334,10 @@ where l.sector_id = ?`, [sector_id]); return city.warehouses * 250; } + maxEnergy(city: City): number { + return city.accumulators * 150; + } + async foodProductionPerTick(city: City): Promise { // eventually we should supply the warehouse formula // to calculate the max amount of food created per tick