diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-05-02 14:49:24 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 12:42:59 +0100 |
commit | a142db65d810ff668ba5b1a48a59c4b2db31499c (patch) | |
tree | ec27cad8e908e711daf999c2cb3d290183fc0c68 | |
parent | 431332295ee2b49299c1c8a501882ca1ed3a8386 (diff) | |
download | 300-earth-and-water-a142db65d810ff668ba5b1a48a59c4b2db31499c.tar.gz |
300: Miltiades as offense.
-rw-r--r-- | rules.js | 48 |
1 files changed, 47 insertions, 1 deletions
@@ -25,6 +25,7 @@ const PELLA = "Pella"; // Greek event numbers const MINES_OF_LAURION = 1; +const MILTIADES = 4; const LEONIDAS = 8; const EVANGELION = 10; const MOLON_LABE = 12; @@ -1077,10 +1078,18 @@ states.greek_land_movement_confirm = { if (is_inactive_player(current)) return view.prompt = "Greek Land Movement."; view.prompt = "Greek Land Movement: Confirm destination."; + if (game.greek.hand.includes(MILTIADES) && can_play_miltiades_attack()) { + view.prompt += " You may also play Miltiades."; + gen_action(view, 'card_event', MILTIADES); + } gen_action(view, 'city', game.where); gen_action(view, 'next'); gen_action(view, 'undo'); }, + card_event: function (card) { + push_undo(); + play_miltiades_attack(); + }, city: function () { clear_undo(); goto_greek_land_battle(); @@ -2200,7 +2209,6 @@ states.leonidas_pay = { }, city: function (space) { push_undo(); - log("Greece removes 1 army in " + space + "."); game.trigger.leonidas = 1; remove_greek_army(space); game.state = 'leonidas'; @@ -2318,6 +2326,44 @@ states.desertion_of_greek_soldiers = { } } +// GREEK REACTION EVENTS + +function can_play_miltiades_attack() { + return !game.trigger.miltiades && count_persian_armies(game.where) > 0; +} + +function play_miltiades_attack() { + play_greek_event_card(MILTIADES); + game.event = MILTIADES; + if (count_greek_armies(RESERVE) > 0) { + remove_greek_army(RESERVE); + game.trigger.miltiades = 1; + } else { + game.state = 'miltiades_attack_pay'; + } +} + +states.miltiades_attack_pay = { + prompt: function (view, current) { + if (is_inactive_player(current)) + return view.prompt = "Leonidas."; + view.prompt = "Miltiades: Remove one Greek army to pay for the event."; + for (let city of CITIES) { + let need = (city == game.where) ? 2 : 1; + if (count_greek_armies(city) >= need) + gen_action(view, 'city', city); + } + gen_action_undo(view); + }, + city: function (space) { + push_undo(); + remove_greek_army(space); + game.trigger.miltiades = 1; + game.state = 'greek_land_movement_confirm'; + }, + undo: pop_undo, +} + // SUPPLY PHASE function goto_supply_phase() { |