summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-05-02 17:26:58 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:42:59 +0100
commitde93d68b00aaaf41d5661b92616c0a861e58121d (patch)
tree606036085c53d6efe3b28a73fbed1146d2ae82b8
parent30cd1af830e7d5a66dd82011070b5615000b6898 (diff)
download300-earth-and-water-de93d68b00aaaf41d5661b92616c0a861e58121d.tar.gz
300: WIP themistocles
-rw-r--r--rules.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/rules.js b/rules.js
index 4eb7c18..8401677 100644
--- a/rules.js
+++ b/rules.js
@@ -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;