From ff5c19b5d8cfa592e01c52d061858c0e49cb87d7 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 28 Jul 2023 12:28:56 +0200 Subject: Improve defender continue/retreat prompt when Themistocles is active. --- rules.js | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/rules.js b/rules.js index 3a4d303..63ab65a 100644 --- a/rules.js +++ b/rules.js @@ -1595,14 +1595,19 @@ states.greek_naval_retreat_attacker = { states.persian_naval_retreat_defender = { prompt: function (view, current) { - if (is_inactive_player(current)) - return view.prompt = "Persian Naval Battle: Defender retreat?"; - view.prompt = "Persian Naval Battle: Continue the battle in " + game.where + " or retreat?"; - gen_action(view, 'port', game.where); // shortcut for battle - if (game.greek.event !== THEMISTOCLES) + if (game.greek.event === THEMISTOCLES) { + if (is_inactive_player(current)) + return view.prompt = "Persian Naval Battle: Continue the battle."; + view.prompt = "Persian Naval Battle: Continue the battle in " + game.where + "."; + } else { + if (is_inactive_player(current)) + return view.prompt = "Persian Naval Battle: Defender retreat?"; + view.prompt = "Persian Naval Battle: Continue the battle in " + game.where + " or retreat?"; for (let port of PORTS) if (is_greek_control(port) && count_persian_fleets(port) === 0) gen_action(view, 'port', port); + } + gen_action(view, 'port', game.where); // shortcut for battle gen_action(view, 'battle'); }, port: function (to) { @@ -1623,14 +1628,19 @@ states.persian_naval_retreat_defender = { states.greek_naval_retreat_defender = { prompt: function (view, current) { - if (is_inactive_player(current)) - return view.prompt = "Greek Naval Battle: Defender retreat?"; - view.prompt = "Greek Naval Battle: Continue the battle in " + game.where + " or retreat?"; - gen_action(view, 'port', game.where); // shortcut for battle - if (game.greek.event !== THEMISTOCLES) + if (game.greek.event === THEMISTOCLES) { + if (is_inactive_player(current)) + return view.prompt = "Greek Naval Battle: Continue the battle."; + view.prompt = "Greek Naval Battle: Continue the battle in " + game.where + "."; + } else { + if (is_inactive_player(current)) + return view.prompt = "Greek Naval Battle: Defender retreat?"; + view.prompt = "Greek Naval Battle: Continue the battle in " + game.where + " or retreat?"; for (let port of PORTS) if (is_persian_control(port) && count_greek_fleets(port) === 0) gen_action(view, 'port', port); + } + gen_action(view, 'port', game.where); // shortcut for battle gen_action(view, 'battle'); }, port: function (to) { @@ -3457,8 +3467,6 @@ exports.resign = function (state, current) { return game; } -exports.is_checkpoint = (a, b) => a.campaign !== b.campaign; - exports.view = function(state, current) { game = state; -- cgit v1.2.3