From da2308355d3893ab49651aa1985a6b112ef1640c Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 31 Dec 2023 17:46:58 +0100 Subject: Active player wins if both Tactical Victory conditions are fulfilled. --- rules.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/rules.js b/rules.js index b872423..fbbec3f 100644 --- a/rules.js +++ b/rules.js @@ -829,11 +829,18 @@ function check_victory() { return goto_game_over("Draw", player_name(1) + " secured a draw!") } - if (info.players[0].tactical > 0 && tv0 >= info.players[0].tactical) - return goto_game_over(P1, player_name(0) + " won a tactical victory!") - - if (info.players[1].tactical > 0 && tv1 >= info.players[1].tactical) - return goto_game_over(P2, player_name(1) + " won a tactical victory!") + // Active player gets precedence when both TV conditions apply + if (game.active === P1) { + if (info.players[0].tactical > 0 && tv0 >= info.players[0].tactical) + return goto_game_over(P1, player_name(0) + " won a tactical victory!") + if (info.players[1].tactical > 0 && tv1 >= info.players[1].tactical) + return goto_game_over(P2, player_name(1) + " won a tactical victory!") + } else { + if (info.players[1].tactical > 0 && tv1 >= info.players[1].tactical) + return goto_game_over(P2, player_name(1) + " won a tactical victory!") + if (info.players[0].tactical > 0 && tv0 >= info.players[0].tactical) + return goto_game_over(P1, player_name(0) + " won a tactical victory!") + } return false } -- cgit v1.2.3