From 3e87e69e775ce87d619ac8c8ab2eb93cdab1582a Mon Sep 17 00:00:00 2001 From: iainp5 Date: Wed, 23 Oct 2024 17:58:09 +0100 Subject: Updates to Ceausescu events after Tyrant --- rules.js | 73 ++++++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 20 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 1e68bea..aa8cb3a 100644 --- a/rules.js +++ b/rules.js @@ -540,7 +540,7 @@ states.play_card ={ game.vm_infl_to_do = true game.return = game.active game.vm_event = game.played_card - if (auto_resolve_events.includes(game.played_card) || switch_events.includes(game.played_card)) { + if (is_auto_resolve(game.played_card) || switch_events.includes(game.played_card)) { goto_vm(game.vm_event)} else { next_player() @@ -667,7 +667,7 @@ states.resolve_opponent_event = { opp_event() { game.vm_event_to_do = false game.return_state = 'resolve_opponent_event' - if (auto_resolve_events.includes(game.played_card) || switch_events.includes(game.played_card)) { + if (is_auto_resolve(game.played_card) || switch_events.includes(game.played_card)) { game.return = game.active log(`Played C${game.played_card} for the event`) goto_vm(game.played_card)} @@ -1726,7 +1726,17 @@ states.vp_roll = { push_undo() log_h2('Scoring') score_country(game.pwr_struggle_in) - game.state = 'finish_scoring' + + //Check if The Tyrant is Gone occurs + if (game.table_cards.includes(97) && game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(54)) { + game.return_state = 'finish_scoring' + if (game.active !== DEM) { + next_player() + } + game.state = 'the_tyrant_is_gone' + } else { + game.state = 'finish_scoring' + } }, } @@ -2154,7 +2164,7 @@ states.stasi_end_round = { }, card(card) { push_undo() - log_gap(`Democract selected C${cards[card].number} as next card.`) + log_gap(`Democrat selected C${cards[card].number} as next card.`) game.stasi_card = card game.state = 'stasi_finish' }, @@ -3331,6 +3341,25 @@ function find_event(card) { return variable_events.indexOf(card) } +function is_auto_resolve(card) { + //Check for the Tyrant is Gone + let ceausecu_events = [10, 41, 101, 107] + + if (card === 97) { + if (!game.persistent_events.includes(54)) { + return true + } + } + else if (ceausecu_events.includes(card) && game.persistent_events.includes(97)) { + return true + } + else if (auto_resolve_events.includes(card)) { + return true + } else { + return false + } +} + function get_events(card){ if (event_is_playable(card)) { if (cards[card].side === 'D') { @@ -4491,7 +4520,7 @@ function vm_return() { vm_end_event() } //Check if auto-resolve opponent event - else if (auto_resolve_events.includes(game.played_card) && ((cards[game.played_card].side === 'C' && game.active === DEM) || (cards[game.played_card].side === 'D' && game.active === COM) )) { + else if (is_auto_resolve(game.played_card) && ((cards[game.played_card].side === 'C' && game.active === DEM) || (cards[game.played_card].side === 'D' && game.active === COM) )) { vm_end_event() } else { @@ -5935,7 +5964,9 @@ function vm_the_tyrant_is_gone_prep() { } function vm_tyrant_block() { - game.state = 'vm_tyrant_block' + logi(`Has no effect after C97`) + vm_next() + //game.state = 'vm_tyrant_block' } function vm_the_wall () { @@ -6467,7 +6498,7 @@ states.vm_remove_all_infl = { prompt () { if (game.valid_spaces.length === 0 && game.vm_available_ops > 0) { view.prompt = `${clean_name(cards[this_card()].name)}: no SPs to remove.` - gen_action('done') + gen_action('pass') } else if (game.vm_available_ops > 0) { view.prompt = `${clean_name(cards[this_card()].name)}: remove all SPs from ${event_prompt()}.` for (let space_id of game.valid_spaces) { @@ -6485,7 +6516,7 @@ states.vm_remove_all_infl = { vm_next() } }, - done() { + pass() { push_undo() vm_next() } @@ -6750,7 +6781,7 @@ states.vm_brought_in_for_questioning = { game.return = DEM } } - if (!auto_resolve_events.includes(game.vm_event) && !switch_events.includes(game.vm_event)) { + if (!is_auto_resolve(game.vm_event) && !switch_events.includes(game.vm_event)) { next_player() } goto_vm(game.vm_event) @@ -7418,7 +7449,8 @@ states.vm_kiss_of_death = { discard() { clear_undo() game.vm_event = discard_card(game.communist_hand) - if (cards[game.vm_event].side !== "C") { + //Only switch player if a playable non-communist event. Common European Home is not playable here + if (cards[game.vm_event].side !== "C" && event_is_playable(game.vm_event) && game.vm_event !== 21) { next_player() game.state = 'vm_kiss_of_death_finish' } else { @@ -8221,16 +8253,16 @@ states.vm_the_tyrant_is_gone = { return `resolve ${clean_name(cards[game.played_card].name)}.` }, prompt() { - //if (!game.the_tyrant_is_gone) { + if (!game.the_tyrant_is_gone) { view.prompt = 'The Tyrant is Gone: Select a space in Romania for the Ceausescus to flee to.' for (let space_id of game.valid_spaces) { if (!space_id) continue gen_action_infl(space_id); } - /* } else { - view.prompt = 'Select a space: done.' + } else { + view.prompt = 'The Tyrant is Gone: done.' gen_action('done') - }*/ + } }, infl(space) { push_undo() @@ -8238,13 +8270,14 @@ states.vm_the_tyrant_is_gone = { game.the_tyrant_is_gone = space game.valid_spaces = [] game.persistent_events.push(97) - vm_next() + + // vm_next() }, - /*done () { + done () { vm_next() - }*/ + } } - +/* states.vm_tyrant_block ={ get inactive() { return `resolve ${clean_name(cards[this_card()].name)}.` @@ -8257,7 +8290,7 @@ states.vm_tyrant_block ={ push_undo() vm_next() } -} +}*/ states.vm_the_wall_must_go = { @@ -8883,7 +8916,7 @@ states.vm_support_falters = { vm_next() }, done() { - log_msg_gap('Takes initiative') + log_gap('Takes initiative') game.return = game.active vm_next() } -- cgit v1.2.3