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;
}
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
),