new building: energy accumulator for energy storage
authorxangelo <git@xangelo.ca>
Wed, 25 May 2022 13:51:36 +0000 (09:51 -0400)
committerxangelo <git@xangelo.ca>
Wed, 25 May 2022 13:51:36 +0000 (09:51 -0400)
src/render/kingdom-overview.ts
src/repository/city.ts

index 08866f1fb4af107aee0fd11f820bb45eff2f4b57..744afe1b9cd6f2fadfdf8b9c69387e8f713d1663 100644 (file)
@@ -61,7 +61,7 @@ export function renderKingomOverview(city: CityWithLocation & Usage, account: Ac
                <th>Energy</th>
                <td>
     ${city.energy.toLocaleString()} (<span class="rate-of-change ${energyRateOfChange < 0 ? 'danger-text' : 'success-text'}">${energyRateOfChange.toLocaleString()}</span>)
-    @ 0% Battery Utilization
+    @ ${percent(city.energy, city.accumulators, 100)}% Accumulator Utilization
     </td>
                <th>Special Defenders</th>
                <td>${city.sp_defenders.toLocaleString()}</td>
index 1094f10cff35e9ee13f205eea58ba82ffa4a5dff..6e08ff8ae8c6af3301605b0a722ae2c4b53aa2ff 100644 (file)
@@ -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<City> {
             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<number> {
       // eventually we should supply the warehouse formula 
       // to calculate the max amount of food created per tick