powergrid-viewer 2.0.1 → 2.0.2
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "powergrid-viewer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/boardgamers/powergrid.git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"vue": "^2.6.11",
|
|
19
19
|
"vue-class-component": "^7.2.3",
|
|
20
20
|
"vue-property-decorator": "^8.4.2",
|
|
21
|
-
"powergrid-engine": "2.0.
|
|
21
|
+
"powergrid-engine": "2.0.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/assert": "^1.4.7",
|
package/src/components/Game.vue
CHANGED
|
@@ -838,9 +838,16 @@ export default class Game extends Vue {
|
|
|
838
838
|
return;
|
|
839
839
|
}
|
|
840
840
|
if (this.G.phase == Phase.Resources && !this.canPowerAllPlants(player)) {
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
841
|
+
// India's resource market is restrictive (per-step price caps,
|
|
842
|
+
// price tiers, one purchase at a time), so a player often can't
|
|
843
|
+
// buy enough even when trying. Only warn there when they bought
|
|
844
|
+
// nothing this turn — buying some but not enough is a deliberate
|
|
845
|
+
// choice, not a slip.
|
|
846
|
+
if (this.G.map.name !== 'India' || !this.playerBoughtResourceThisTurn()) {
|
|
847
|
+
this.confirmMessage = 'Are you sure you want to skip buying resources without enough to power all your plants?';
|
|
848
|
+
this.confirmVisible = true;
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
844
851
|
}
|
|
845
852
|
|
|
846
853
|
if (
|
|
@@ -1411,6 +1418,20 @@ export default class Game extends Vue {
|
|
|
1411
1418
|
return true;
|
|
1412
1419
|
}
|
|
1413
1420
|
|
|
1421
|
+
// Whether this player has bought at least one resource during their current
|
|
1422
|
+
// resource-buying turn — i.e. the consecutive run of their own moves at the tail
|
|
1423
|
+
// of the log includes a BuyResource. (In the Resources phase only the current
|
|
1424
|
+
// player acts, so their turn is exactly that tail run.)
|
|
1425
|
+
playerBoughtResourceThisTurn(): boolean {
|
|
1426
|
+
const log = this.G!.log;
|
|
1427
|
+
for (let i = log.length - 1; i >= 0; i--) {
|
|
1428
|
+
const entry = log[i];
|
|
1429
|
+
if (entry.type !== 'move' || entry.player !== this.player) return false;
|
|
1430
|
+
if (entry.move.name === MoveName.BuyResource) return true;
|
|
1431
|
+
}
|
|
1432
|
+
return false;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1414
1435
|
toggleSound() {
|
|
1415
1436
|
const newSound = !this.preferences.sound;
|
|
1416
1437
|
|