diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-05-02 17:26:58 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 12:42:59 +0100 |
commit | de93d68b00aaaf41d5661b92616c0a861e58121d (patch) | |
tree | 606036085c53d6efe3b28a73fbed1146d2ae82b8 | |
parent | 30cd1af830e7d5a66dd82011070b5615000b6898 (diff) | |
download | 300-earth-and-water-de93d68b00aaaf41d5661b92616c0a861e58121d.tar.gz |
300: WIP themistocles
-rw-r--r-- | rules.js | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -1235,6 +1235,7 @@ function roll_battle_dice(who, count, cap) { } function goto_persian_naval_battle() { + // TODO: window to play Themistocles! game.naval_battle = 1; if (count_greek_fleets(game.where) > 0 && count_persian_fleets(game.where) > 0) goto_persian_naval_battle_react(); @@ -2626,6 +2627,45 @@ states.miltiades_defense_pay = { undo: pop_undo, } +function can_play_themistocles() { + if (!game.trigger.themistocles) { + for (let port of PORTS) + if (port != game.where && count_greek_fleets(port) > 0) + return true; + } + return false; +} + +function play_themistocles() { + game.event = THEMISTOCLES; + if (count_greek_armies(RESERVE) > 0) { + game.trigger.themistocles = 1; + remove_greek_army(RESERVE); + goto_themistocles(); + } else { + game.state = 'themistocles_pay'; + } +} + +states.themistocles_pay = { + prompt: function (view, current) { + if (is_inactive_player(current)) + return view.prompt = "Leonidas."; + view.prompt = "Leonidas: Remove one Greek army to pay for the event."; + gen_greek_armies(view); + }, + city: function (space) { + push_undo(); + game.trigger.themistocles = 1; + remove_greek_army(space); + goto_themistocles(); + }, +} + +function goto_themistocles() { + throw Error("Themistocles not implemented!"); +} + function play_pausanias() { play_greek_event_card(PAUSANIAS); game.event = 0; |