powergrid-viewer 2.0.11 → 2.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/components/Game.vue
CHANGED
|
@@ -642,6 +642,11 @@
|
|
|
642
642
|
Starts after building phase where a player has
|
|
643
643
|
<strong>{{ G.citiesToStep2 }}</strong> or more cities
|
|
644
644
|
</li>
|
|
645
|
+
<li v-if="G.map.name !== 'Middle East'">
|
|
646
|
+
Also starts after a building phase where <strong>every city</strong> has a house
|
|
647
|
+
(all Step 1 slots filled), even if no player reached
|
|
648
|
+
{{ G.citiesToStep2 }}
|
|
649
|
+
</li>
|
|
645
650
|
<li><strong>Two</strong> players per city</li>
|
|
646
651
|
<li>
|
|
647
652
|
Resource Resupply: <strong>{{ G.resourceResupply[1] }}</strong>
|
|
@@ -1075,7 +1080,11 @@ export default class Game extends Vue {
|
|
|
1075
1080
|
// scrubber renders reconstructed MID-game states, whose own `ended()` is
|
|
1076
1081
|
// false however long ago the game finished, so it cannot be asked. See
|
|
1077
1082
|
// `moneyIsPublic`.
|
|
1078
|
-
|
|
1083
|
+
// `state` is null until the platform posts the first one: launch() mounts
|
|
1084
|
+
// the viewer with `state: null` and the immediate `@Watch('state')` fires
|
|
1085
|
+
// at mount, so this runs once with null (hard refresh / first load) and
|
|
1086
|
+
// must not dereference it.
|
|
1087
|
+
if (replaceState && state && ended(state)) {
|
|
1079
1088
|
this.gameIsOver = true;
|
|
1080
1089
|
}
|
|
1081
1090
|
|
|
@@ -1148,7 +1157,8 @@ export default class Game extends Vue {
|
|
|
1148
1157
|
const player = this.G.players[this.player];
|
|
1149
1158
|
if (player && player.availableMoves && Object.keys(player.availableMoves).length > 1) {
|
|
1150
1159
|
if (this.G.phase == Phase.Bureaucracy && player.powerPlantsNotUsed.length > 0
|
|
1151
|
-
&& Object.keys(player.availableMoves).includes('UsePowerPlant')
|
|
1160
|
+
&& Object.keys(player.availableMoves).includes('UsePowerPlant')
|
|
1161
|
+
&& !this.canPowerAllCitiesWithUsedPlants(player)) {
|
|
1152
1162
|
this.confirmMessage = 'Are you sure you want to pass? You have unused power plants!';
|
|
1153
1163
|
this.confirmVisible = true;
|
|
1154
1164
|
return;
|
|
@@ -1815,6 +1825,14 @@ export default class Game extends Vue {
|
|
|
1815
1825
|
}
|
|
1816
1826
|
}
|
|
1817
1827
|
|
|
1828
|
+
// Whether the power plants the player has already used this Bureaucracy
|
|
1829
|
+
// phase can cover every city they own — if so, the unused plants are
|
|
1830
|
+
// surplus and passing without them is not worth a warning.
|
|
1831
|
+
canPowerAllCitiesWithUsedPlants(player: Player): boolean {
|
|
1832
|
+
const usedPlants = player.powerPlants.filter((p) => !player.powerPlantsNotUsed.includes(p.number));
|
|
1833
|
+
return usedPlants.reduce((sum, p) => sum + p.citiesPowered, 0) >= player.cities.length;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1818
1836
|
canPowerAllPlants(player: Player): boolean {
|
|
1819
1837
|
// Calculate total resource requirements for all power plants
|
|
1820
1838
|
let coalUsed = 0;
|