summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js44
1 files changed, 32 insertions, 12 deletions
diff --git a/rules.js b/rules.js
index d2ea215..3a4d303 100644
--- a/rules.js
+++ b/rules.js
@@ -1223,18 +1223,10 @@ 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 play Miltiades.";
- gen_action(view, 'card_event', MILTIADES);
- }
gen_action(view, 'city', game.where);
gen_action(view, 'next');
gen_action_undo(view);
},
- card_event: function () {
- push_undo();
- play_miltiades_attack();
- },
city: end_greek_land_movement,
next: end_greek_land_movement,
undo: pop_undo,
@@ -1695,13 +1687,21 @@ function goto_greek_land_battle() {
log("Greece attacked " + game.where + "!");
game.immortals = Math.min(3, count_persian_armies(game.where));
game.active = GREECE;
- greek_land_battle_round();
+ goto_greek_land_battle_react();
} else {
game.from = null;
end_greek_movement();
}
}
+function goto_greek_land_battle_react() {
+ if (can_play_miltiades_attack()) {
+ game.state = 'greek_land_battle_react';
+ } else {
+ greek_land_battle_round();
+ }
+}
+
states.persian_land_battle_react = {
prompt: function (view, current) {
let m = can_play_miltiades_defense();
@@ -1748,6 +1748,25 @@ states.persian_land_battle_react = {
},
}
+states.greek_land_battle_react = {
+ prompt: function (view, current) {
+ if (is_inactive_player(current))
+ return view.prompt = "Greek Land Battle: Greece may play Miltiades.";
+ view.prompt = "Greek Land Battle: Greece attacks " + game.where + "!";
+
+ gen_action(view, 'next');
+ if (game.greek.hand.includes(MILTIADES)) {
+ gen_action(view, 'card_event', MILTIADES);
+ view.prompt += " You may play Miltiades.";
+ }
+ },
+ card_event: function (card) {
+ play_miltiades_attack();
+ },
+ next: greek_land_battle_round,
+ undo: pop_undo,
+}
+
function greek_battle_dice() {
if (game.greek.battle_event === MILTIADES)
return 3;
@@ -2904,6 +2923,7 @@ function play_miltiades_attack() {
if (count_greek_armies(RESERVE) > 0) {
remove_greek_army(RESERVE);
game.trigger.miltiades = 1;
+ goto_greek_land_battle_react();
} else {
game.state = 'miltiades_attack_pay';
}
@@ -2912,7 +2932,7 @@ function play_miltiades_attack() {
states.miltiades_defense_pay = {
prompt: function (view, current) {
if (is_inactive_player(current))
- return view.prompt = "Leonidas.";
+ return view.prompt = "Miltiades.";
view.prompt = "Miltiades: Remove one Greek army to pay for the event.";
for (let city of CITIES) {
let need = (city === game.where) ? 2 : 1;
@@ -2933,7 +2953,7 @@ states.miltiades_defense_pay = {
states.miltiades_attack_pay = {
prompt: function (view, current) {
if (is_inactive_player(current))
- return view.prompt = "Leonidas.";
+ return view.prompt = "Miltiades.";
view.prompt = "Miltiades: Remove one Greek army to pay for the event.";
for (let city of CITIES) {
let need = (city === game.where) ? 2 : 1;
@@ -2946,7 +2966,7 @@ states.miltiades_attack_pay = {
push_undo();
remove_greek_army(space);
game.trigger.miltiades = 1;
- game.state = 'greek_land_movement_confirm';
+ goto_greek_land_battle_react();
},
undo: pop_undo,
}