summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js181
1 files changed, 32 insertions, 149 deletions
diff --git a/rules.js b/rules.js
index a64ade8..93daeaf 100644
--- a/rules.js
+++ b/rules.js
@@ -1195,103 +1195,6 @@ function goto_strategy_phase(new_active) {
log("=b Britain")
}
-states.strategy_phase_OLD = {
- inactive: "to play a strategy card",
- prompt() {
- view.prompt = "Play a strategy card."
- for (let c of active_hand()) {
- let card = CARDS[c]
- switch (card.type) {
- case "mandatory-event":
- gen_action_card("card_play_event", c)
- break
- case "campaign":
- gen_action_card("card_campaign", c)
- break
- case "ops":
- if (can_exchange_for_discard(c))
- gen_action_card("exchange_for_discard", c)
- if (can_activate_general(c))
- gen_action_card("card_ops_general", c)
- gen_action_card("card_ops_pc", c)
- if (can_play_reinforcements())
- gen_action_card("card_ops_reinforcements", c)
- if (card.count < 3)
- gen_action_card("card_ops_queue", c)
- break
- case "british-event":
- case "british-event-or-battle":
- if (game.active === P_BRITAIN)
- if (can_play_event(c))
- gen_action_card("card_play_event", c)
- gen_action_card("card_discard_event", c)
- break
- case "american-event":
- if (game.active === P_AMERICA)
- if (can_play_event(c))
- gen_action_card("card_play_event", c)
- gen_action_card("card_discard_event", c)
- break
- case "british-battle":
- case "american-battle":
- gen_action_card("card_discard_event", c)
- break
- }
- }
- },
- card_campaign(c) {
- game.did_discard_event = 0
- clear_queue()
- },
- card_play_event(c) {
- push_undo()
- game.did_discard_event = 0
- clear_queue()
- do_event(c)
- },
- card_discard_event(c) {
- push_undo()
- game.did_discard_event = c
- clear_queue()
- discard_card(c, "PC action")
- game.state = "discard_event_pc_action"
- },
- card_ops_pc(c) {
- push_undo()
- game.did_discard_event = 0
- clear_queue()
- play_card(c, "for PC")
- goto_ops_pc(CARDS[c].count)
- },
- card_ops_reinforcements(c) {
- push_undo()
- game.did_discard_event = 0
- clear_queue()
- goto_ops_reinforcements(c)
- },
- card_ops_queue(c) {
- game.did_discard_event = 0
- play_card(c, "to queue")
- if (game.active === P_BRITAIN)
- game.b_queue += CARDS[c].count
- else
- game.a_queue += CARDS[c].count
- end_strategy_card()
- },
- card_ops_general(c) {
- push_undo()
- game.did_discard_event = 0
- goto_ops_general(c)
- },
- exchange_for_discard(c) {
- let d = game.did_discard_event
- game.did_discard_event = 0
- discard_card(c, "exchange")
- set_add(active_hand(), d)
- logp("picked up up #" + d)
- },
-}
-
states.strategy_phase = {
inactive: "to play a strategy card",
prompt() {
@@ -2757,37 +2660,6 @@ states.play_defender_battle_card_confirm = {
},
}
-function gen_battle_card_OLD() {
- for (let c of active_hand()) {
- let card = CARDS[c]
- if (game.active === P_BRITAIN) {
- switch (card.type) {
- case "british-battle":
- case "british-event-or-battle":
- gen_action_card("card_battle_play", c)
- break
- case "british-event":
- case "american-event":
- case "american-battle":
- gen_action_card("card_battle_discard", c)
- break
- }
- } else {
- switch (card.type) {
- case "british-battle":
- case "british-event-or-battle":
- case "british-event":
- case "american-event":
- gen_action_card("card_battle_discard", c)
- break
- case "american-battle":
- gen_action_card("card_battle_play", c)
- break
- }
- }
- }
-}
-
function play_battle_card(st, c) {
let card = CARDS[c]
if (game.active === P_BRITAIN) {
@@ -3731,15 +3603,9 @@ function goto_george_washington_captured() {
delete game.washington_captured
}
-function goto_george_washington_captured_during_move() {
- game.state = "george_washington_captured_during_move"
- game.count = 5
- delete game.washington_captured
-}
-
states.george_washington_captured = {
prompt() {
- view.prompt = "George Washington is captured! Remove American PC markers. " + game.count + " left."
+ view.prompt = "George Washington captured! Remove American PC markers. " + game.count + " left."
for (let space of all_spaces)
if (has_american_pc(space) && has_no_american_unit(space))
gen_action_space(space)
@@ -3749,17 +3615,46 @@ states.george_washington_captured = {
push_undo()
remove_pc(where)
if (--game.count === 0)
- end_george_washington_captured()
+ game.state = "george_washington_captured_done"
},
pass() {
push_undo()
+ game.state = "george_washington_captured_done"
+ },
+}
+
+states.george_washington_captured_done = {
+ prompt() {
+ view.prompt = "George Washington captured! Remove American PC markers. Done."
+ view.actions.next = 1
+ },
+ next() {
+ clear_undo()
end_george_washington_captured()
},
}
+function end_george_washington_captured() {
+ game.active = game.save
+ delete game.save
+ if (game.active === P_AMERICA) {
+ // skip end turn pause after britain removed washington at end of strategy card
+ if (end_strategy_card())
+ next_strategy_card()
+ } else {
+ end_strategy_card()
+ }
+}
+
+function goto_george_washington_captured_during_move() {
+ game.state = "george_washington_captured_during_move"
+ game.count = 5
+ delete game.washington_captured
+}
+
states.george_washington_captured_during_move = {
prompt() {
- view.prompt = "George Washington is captured! Remove American PC markers. " + game.count + " left."
+ view.prompt = "George Washington captured! Remove American PC markers. " + game.count + " left."
for (let space of all_spaces)
if (has_american_pc(space) && has_no_american_unit(space))
gen_action_space(space)
@@ -3777,18 +3672,6 @@ states.george_washington_captured_during_move = {
},
}
-function end_george_washington_captured() {
- game.active = game.save
- delete game.save
- if (game.active === P_AMERICA) {
- // skip end turn pause after britain removed washington at end of strategy card
- if (end_strategy_card())
- next_strategy_card()
- } else {
- end_strategy_card()
- }
-}
-
/* WINTER ATTRITION PHASE */
function apply_single_winter_attrition(remove_cu, space) {