energy upkeep is now 10% of build costs
authorxangelo <git@xangelo.ca>
Thu, 26 May 2022 14:37:50 +0000 (10:37 -0400)
committerxangelo <git@xangelo.ca>
Thu, 26 May 2022 14:37:50 +0000 (10:37 -0400)
src/repository/city.ts
src/tasks/tick.ts

index b2392fcf7f93d345520868519f064968236499cf..168053c473b80c942c38f5c0aa4cac31ec6754e8 100644 (file)
@@ -370,17 +370,17 @@ where l.sector_id = ?`, [sector_id]);
     async energyUsagePerTick(city: City): Promise<number> {
       const buildings = await this.buildingRepository.list();
       const buildingsMap = pluck<Building>(buildings, 'slug');
-      const totalEnergy = _.sum([
-        city.farms * buildingsMap['farms'].energy,
-        city.barracks * buildingsMap['barracks'].energy,
-        city.special_defender_trainer * buildingsMap['special_defender_trainer'].energy,
-        city.special_attacker_trainer * buildingsMap['special_attacker_trainer'].energy,
-        city.homes * buildingsMap['homes'].energy,
-        city.warehouses * buildingsMap['warehouses'].energy,
-        city.solar_panels * buildingsMap['solar_panels'].energy,
-        city.mining_facilities * buildingsMap['mining_facilities'].energy,
-        city.ore_refinery * buildingsMap['ore_refinery'].energy
-      ]);
+      const totalEnergy = Math.ceil(_.sum([
+        city.farms * (buildingsMap['farms'].energy * 0.1),
+        city.barracks * (buildingsMap['barracks'].energy * 0.1),
+        city.special_defender_trainer * (buildingsMap['special_defender_trainer'].energy * 0.1),
+        city.special_attacker_trainer * (buildingsMap['special_attacker_trainer'].energy * 0.1),
+        city.homes * (buildingsMap['homes'].energy * 0.1),
+        city.warehouses * (buildingsMap['warehouses'].energy * 0.1),
+        city.solar_panels * (buildingsMap['solar_panels'].energy * 0.1),
+        city.mining_facilities * (buildingsMap['mining_facilities'].energy * 0.1),
+        city.ore_refinery * (buildingsMap['ore_refinery'].energy * 0.1)
+      ]));
       return totalEnergy;
     }
 
index c61b94504872caad1b6107dbc68d548531b3f86f..5ce69e42beed103b200059f10c5771be00271898 100644 (file)
@@ -30,16 +30,16 @@ export const tick = new Task<Tick>('tick', async (task, job) => {
   energy = min(
     max(
       energy - (
-        farms * 40 + 
-        barracks * 60 + 
-        special_attacker_trainer * 100 + 
-        special_defender_trainer * 80 + 
-        homes * 10 + 
-        warehouses * 30 + 
-        solar_panels * 10 +
-        accumulators * 100 +
-        mining_facilities * 80 + 
-        ore_refinery * 40
+        farms * 4 + 
+        barracks * 6 + 
+        special_attacker_trainer * 10 + 
+        special_defender_trainer * 8 + 
+        homes * 1 + 
+        warehouses * 3 + 
+        solar_panels * 1 +
+        accumulators * 10 +
+        mining_facilities * 8 + 
+        ore_refinery * 4
       ),
       0
     ),