diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-07-28 12:28:56 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-07-28 12:28:56 +0200 |
commit | ff5c19b5d8cfa592e01c52d061858c0e49cb87d7 (patch) | |
tree | 0694b37705d581c0aef99566dba3983208b640e7 | |
parent | d81cce8d0d98e17c945f45b596cc42803e5cd201 (diff) | |
download | 300-earth-and-water-ff5c19b5d8cfa592e01c52d061858c0e49cb87d7.tar.gz |
Improve defender continue/retreat prompt when Themistocles is active.
-rw-r--r-- | rules.js | 32 |
1 files changed, 20 insertions, 12 deletions
@@ -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; |