new buildings: mining! increase alloy + max alloy cap
authorxangelo <git@xangelo.ca>
Wed, 25 May 2022 14:58:31 +0000 (10:58 -0400)
committerxangelo <git@xangelo.ca>
Wed, 25 May 2022 14:58:31 +0000 (10:58 -0400)
src/render/kingdom-overview.ts
src/repository/city.ts

index 744afe1b9cd6f2fadfdf8b9c69387e8f713d1663..2e787d6bdf82daaebe49e27d11d21ef142463366 100644 (file)
@@ -53,7 +53,7 @@ export function renderKingomOverview(city: CityWithLocation & Usage, account: Ac
        </tr>
        <tr>
                <th>Alloys</th>
-               <td>${city.alloys.toLocaleString()}</td>
+               <td>${city.alloys.toLocaleString()} @ ${percent(city.alloys, cityRepo.maxAlloy(city), 100)} % Ore Refiniery Utilization</td>
                <th>Special Attackers</th>
                <td>${city.sp_attackers.toLocaleString()}</td>
        </tr>
@@ -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>)
-    @ ${percent(city.energy, city.accumulators, 100)}% Accumulator Utilization
+    @ ${percent(city.energy, cityRepo.maxEnergy(city), 100)}% Accumulator Utilization
     </td>
                <th>Special Defenders</th>
                <td>${city.sp_defenders.toLocaleString()}</td>
@@ -69,7 +69,7 @@ export function renderKingomOverview(city: CityWithLocation & Usage, account: Ac
        <tr>
                <th>Food</th>
                <td>
-    ${city.food.toLocaleString()} (<span class="rate-of-change ${foodRateOfChange < 0 ? 'danger-text' : 'success-text'}">${foodRateOfChange.toLocaleString()}</span>) @ ${percent(city.food, city.warehouses, 100)}% Warehouse utilization
+    ${city.food.toLocaleString()} (<span class="rate-of-change ${foodRateOfChange < 0 ? 'danger-text' : 'success-text'}">${foodRateOfChange.toLocaleString()}</span>) @ ${percent(city.food, cityRepo.maxFood(city), 100)}% Warehouse utilization
     </td>
        </tr>
        </table>
index 0ab8478a6d6ebed98d6c67e10b514a72d88c6bef..c3bcae849b50979254c6b6d418a8f3a0217a1892 100644 (file)
@@ -32,6 +32,7 @@ export type City = {
     solar_panels: number;
     accumulators: number;
     mining_facilities: number;
+    ore_refinery: number;
     barracks: number;
     special_attacker_trainer: number;
     special_defender_trainer: number;
@@ -83,6 +84,7 @@ export class CityRepository extends Repository<City> {
             solar_panels: 5,
             accumulators: 5,
             mining_facilities: 5,
+            ore_refinery: 5,
             barracks: 0,
             special_attacker_trainer: 0,
             special_defender_trainer: 0,
@@ -340,6 +342,10 @@ where l.sector_id = ?`, [sector_id]);
       return city.accumulators * 150;
     }
 
+    maxAlloy(city: City): number {
+      return city.ore_refinery * 75;
+    }
+
     async foodProductionPerTick(city: City): Promise<number> {
       // eventually we should supply the warehouse formula 
       // to calculate the max amount of food created per tick