diff options
author | Frans Bongers <fransbongers@franss-mbp.home> | 2024-12-30 12:30:26 +0100 |
---|---|---|
committer | Frans Bongers <fransbongers@franss-mbp.home> | 2024-12-30 12:30:26 +0100 |
commit | b952d532d4b84c136e3c3a6893a63b0ed5b5ece3 (patch) | |
tree | f7667fdb7f8e771c7b63fccc6760b5cb37a95376 /rules.js | |
parent | 23beb82e0344d895106351fe6d98f40c8ee50dc5 (diff) | |
download | land-and-freedom-b952d532d4b84c136e3c3a6893a63b0ed5b5ece3.tar.gz |
peek at fascist card event effect
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 45 |
1 files changed, 40 insertions, 5 deletions
@@ -174,6 +174,7 @@ const engine_functions = { card35_event2, card42_event3, card45_event2, + card46_event3, card50_event2, card53_event2, card54_event1, @@ -272,6 +273,7 @@ function game_view(state, player) { initiative: game.initiative, medallions: game.medallions, played_card: game.played_card, + selectable_cards: game.selectable_cards, selected_cards: game.selected_cards[faction_id], tableaus: game.tableaus, tracks: game.tracks, @@ -357,6 +359,7 @@ function setup(seed, _scenario, _options) { pool: [], }, played_card: null, + selectable_cards: [], selected_cards: { a: [], c: [], @@ -377,6 +380,7 @@ function setup(seed, _scenario, _options) { log: [], undo: [], used_medallions: [], + top_of_events_deck: null, turn: 0, year: 0, }; @@ -415,7 +419,7 @@ function start_year() { } function start_turn() { log_h1(`Year ${game.year} - Turn ${game.turn}`); - const cardId = draw_card(list_deck('fascist')); + const cardId = draw_fascist_card(); game.current_events.push(cardId); const card = cards[cardId]; log_h2('Fascist Event', 'fascist'); @@ -1032,6 +1036,19 @@ states.peek_fascist_cards = { inactive: 'peek at Fascist cards', prompt() { view.prompt = 'Choose one card to return to the top of the deck'; + for (const c of game.selectable_cards) { + gen_action_card(c); + } + }, + card(c) { + game.top_of_events_deck = c; + for (const ec of game.selectable_cards) { + if (ec !== c) { + game.discard.f.push(ec); + } + } + game.selectable_cards = []; + resolve_active_and_proceed(); }, }; states.player_turn = { @@ -1368,6 +1385,12 @@ function card45_event2() { } resolve_active_and_proceed(); } +function card46_event3() { + for (let i = 0; i < 3; ++i) { + game.selectable_cards.push(draw_fascist_card()); + } + resolve_active_and_proceed(); +} function card50_event2() { const value = game.tracks[data_1.COLLECTIVIZATION] >= 8 ? 3 : 2; insert_after_active_node(resolve_effect((0, data_1.create_effect)('front', data_1.ARAGON, value))); @@ -1507,6 +1530,7 @@ function end_of_year() { gain_hero_points_in_player_order(players_to_gain_hero_points, game.year); game.engine = get_player_order().map((f) => create_leaf_node('end_of_year_discard', f)); game.engine.push(create_function_node('start_year')); + game.top_of_events_deck = null; next(); } function gain_hero_points_in_player_order(factions, value) { @@ -1934,6 +1958,14 @@ function draw_card(deck) { set_delete(deck, c); return c; } +function draw_fascist_card() { + if (game.top_of_events_deck !== null) { + const card_id = game.top_of_events_deck; + game.top_of_events_deck = null; + return card_id; + } + return draw_card(list_deck(data_1.FASCIST_ID)); +} function lose_hero_point(faction, value) { const points_lost = Math.min(game.hero_points[faction], Math.abs(value)); game.hero_points.pool += points_lost; @@ -2078,13 +2110,16 @@ function make_list(first, last) { } function list_deck(id) { const deck = []; - const card_list = id === 'fascist' ? fascist_decks[game.year] : faction_cards[id]; + const card_list = id === data_1.FASCIST_ID ? fascist_decks[game.year] : faction_cards[id]; card_list.forEach((card) => { - if (id === 'fascist' && - (game.discard.f.includes(card) || game.current_events.includes(card))) { + if (game.discard[id].includes(card) || + game.selectable_cards.includes(card)) { + return; + } + if (id === data_1.FASCIST_ID && game.current_events.includes(card)) { return; } - else if (id !== 'fascist' && + else if (id !== data_1.FASCIST_ID && (game.hands[id].includes(card) || game.discard[id].includes(card) || game.tableaus[id].includes(card) || |