summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-15 00:16:27 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commit8d5c0d1f4675e63ccd48c62a853264d2723c2626 (patch)
tree9cf9ff7d2e62ae6a465150336b11e090e11c25f8 /rules.js
parent880660b69fbd90b39d5d35b56fa80a12543b704e (diff)
downloadtable-battles-8d5c0d1f4675e63ccd48c62a853264d2723c2626.tar.gz
Fix game over messages.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/rules.js b/rules.js
index 4545802..869c7cf 100644
--- a/rules.js
+++ b/rules.js
@@ -159,9 +159,9 @@ exports.resign = function (state, player) {
game = state
if (game.state !== 'game_over') {
if (player === P1)
- return goto_game_over(P2, P1 + " resigned.")
+ return goto_game_over(P2, player_name(0) + " resigned.")
if (player === P2)
- return goto_game_over(P1, P2 + " resigned.")
+ return goto_game_over(P1, player_name(1) + " resigned.")
}
}
@@ -693,9 +693,9 @@ function is_impossible_to_attack() {
function check_impossible_to_attack_victory() {
if (is_impossible_to_attack()) {
if (player_index() === 0)
- return goto_game_over(P2, P1 + " has no more attacks!")
+ return goto_game_over(P2, player_name(0) + " has no more attacks!")
else
- return goto_game_over(P1, P2 + " has no more attacks!")
+ return goto_game_over(P1, player_name(1) + " has no more attacks!")
}
return false
}
@@ -705,29 +705,29 @@ function check_victory() {
if (game.scenario === S39_MARSAGLIA) {
if (is_removed_from_play(S39_HOGUETTE) && is_removed_from_play(S39_CATINAT))
- return goto_game_over(P1, P2 + " lost both linked formations.")
+ return goto_game_over(P1, player_name(1) + " lost both linked formations!")
if (is_removed_from_play(S39_DUKE_OF_SAVOY) && is_removed_from_play(S39_EUGENE))
- return goto_game_over(P2, P1 + " lost both linked formations.")
+ return goto_game_over(P2, player_name(0) + " lost both linked formations!")
}
if (game.scenario === S43_DENAIN) {
if (is_removed_from_play(S43_PRINCE_DE_TINGRY))
- return goto_game_over(P1, "Eugene is able to cross.")
+ return goto_game_over(P1, "Eugene is able to cross!")
}
if (game.morale[0] === 0)
- return goto_game_over(P2, P1 + " has run out of morale!")
+ return goto_game_over(P2, player_name(0) + " has run out of morale!")
if (game.morale[1] === 0)
- return goto_game_over(P1, P2 + " has run out of morale!")
+ return goto_game_over(P1, player_name(1) + " has run out of morale!")
let tv0 = info.players[1].lost
let tv1 = info.players[0].lost
if (info.players[0].tactical > 0 && tv0 >= info.players[0].tactical)
- return goto_game_over(P2, P2 + " tactical victory!")
+ return goto_game_over(P1, player_name(0) + " tactical victory!")
if (info.players[1].tactical > 0 && tv1 >= info.players[1].tactical)
- return goto_game_over(P1, P1 + " tactical victory!")
+ return goto_game_over(P2, player_name(1) + " tactical victory!")
return false
}
@@ -1437,7 +1437,7 @@ function end_roll_phase() {
if (game.scenario === S28_CULPS_HILL) {
if (get_cubes(S28_GEARY) === 5)
- return goto_game_over(P2, "Geary's Division arrived.")
+ return goto_game_over(P2, "Geary's Division arrived!")
}
if (game.scenario === S41_BLENHEIM_SCENARIO) {
@@ -3079,20 +3079,20 @@ function end_routing() {
// Instant loss if any card routs for side at 0 morale (S3, S34, S35).
if (game.morale[0] === 0 && game.routed[0])
- return goto_game_over(P2, P1 + " card routed!")
+ return goto_game_over(P2, player_name(0) + " routed!")
if (game.morale[1] === 0 && game.routed[1])
- return goto_game_over(P1, P2 + " card routed!")
+ return goto_game_over(P1, player_name(1) + " routed!")
// Remove instead of take cubes for side at 0 morale
if (game.routed[0]) {
game.morale[0] -= Math.min(game.routed[0], game.morale[0])
if (game.morale[0] === 0)
- return goto_game_over(P2, P1 + " has run out of morale!")
+ return goto_game_over(P2, player_name(0) + " has run out of morale!")
}
if (game.routed[1]) {
game.morale[1] -= Math.min(game.routed[1], game.morale[1])
if (game.morale[1] === 0)
- return goto_game_over(P1, P2 + " has run out of morale!")
+ return goto_game_over(P1, player_name(1) + " has run out of morale!")
}
}