From: xangelo Date: Thu, 26 May 2022 14:37:50 +0000 (-0400) Subject: energy upkeep is now 10% of build costs X-Git-Url: https://git.xangelo.ca/?a=commitdiff_plain;h=bb65e92cf7708ba60267fb5aa1e9967913fb7c0a;p=browser-rts.git energy upkeep is now 10% of build costs --- diff --git a/src/repository/city.ts b/src/repository/city.ts index b2392fc..168053c 100644 --- a/src/repository/city.ts +++ b/src/repository/city.ts @@ -370,17 +370,17 @@ where l.sector_id = ?`, [sector_id]); async energyUsagePerTick(city: City): Promise { const buildings = await this.buildingRepository.list(); const buildingsMap = pluck(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; } diff --git a/src/tasks/tick.ts b/src/tasks/tick.ts index c61b945..5ce69e4 100644 --- a/src/tasks/tick.ts +++ b/src/tasks/tick.ts @@ -30,16 +30,16 @@ export const tick = new Task('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 ),