diff options
author | Frans Bongers <fransbongers@franss-mbp.home> | 2024-12-22 22:15:57 +0100 |
---|---|---|
committer | Frans Bongers <fransbongers@franss-mbp.home> | 2024-12-22 22:15:57 +0100 |
commit | f321c249f5b9b4f8abc4f519a3666cdda94fad7a (patch) | |
tree | d59a5fe2bdb988a7f155407cd13060333818c0d5 /rules.js | |
parent | fa18a313b5a57b106a8c41a542f08ba4697435ca (diff) | |
download | land-and-freedom-f321c249f5b9b4f8abc4f519a3666cdda94fad7a.tar.gz |
use medallions
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 393 |
1 files changed, 328 insertions, 65 deletions
@@ -28,15 +28,13 @@ const front_names = { v: 'the Front closest to Victory', }; const bonus_names = ['Morale Bonus', 'Teamwork Bonus']; -const { cards, tracks, } = data_1.default; +const { cards, medallions, tracks, } = data_1.default; const bonuses = [data_1.MORALE_BONUS, data_1.TEAMWORK_BONUS]; const faction_cards = { [data_1.ANARCHISTS_ID]: make_list(37, 54), [data_1.COMMUNISTS_ID]: make_list(19, 36), [data_1.MODERATES_ID]: make_list(1, 18), }; -const medaillons = make_list(0, 8); -console.log('medaillons', medaillons); const fascist_decks = { 1: make_list(55, 72), 2: make_list(73, 90), @@ -54,6 +52,9 @@ function gen_action(action, argument) { view.actions[action].push(argument); } } +function gen_action_blank_marker(marker_id) { + gen_action('blank_marker', marker_id); +} function gen_action_bonus(bonus_id) { gen_action('bonus', bonus_id); } @@ -63,6 +64,9 @@ function gen_action_card(card_id) { function gen_action_front(front_id) { gen_action('front', front_id); } +function gen_action_medallion(medallion_id) { + gen_action('medallion', medallion_id); +} function gen_action_standee(track_id) { gen_action('standee', track_id); } @@ -138,8 +142,6 @@ function setup_player_turn() { } function start_of_player_turn() { const args = get_active_node_args(); - console.log('args', args); - console.log('args'); const player = faction_player_map[args.f]; log_h2(player, player); resolve_active_and_proceed(); @@ -187,7 +189,6 @@ function insert_before_or_after_active_node(node, position, engine = game.engine return; } const i = a.parent.indexOf(a.node); - console.log('insert_before_active_node', i); if (i >= 0) { array_insert(a.parent, i + (position == 'after' ? 1 : 0), node); } @@ -216,7 +217,6 @@ function next() { } function resolve_active_node() { const next_node = get_active_node(game.engine); - console.log('resolve_active_node', next_node); if (next_node !== null) { next_node.r = resolved; } @@ -243,11 +243,12 @@ function game_view(state, player) { hand: game.hands[faction_id], hero_points: game.hero_points, initiative: game.initiative, - medaillons: game.medaillons, + medallions: game.medallions, selected_card: game.chosen_cards[faction_id], tableaus: game.tableaus, tracks: game.tracks, triggered_track_effects: game.triggered_track_effects, + used_medallions: game.used_medallions, year: game.year, }; if (game.state === 'game_over') { @@ -328,13 +329,12 @@ function setup(seed, _scenario, _options) { [data_1.MODERATES_ID]: null, }, initiative: data_1.MODERATES_ID, - medaillons: [ - draw_item(medaillons), - draw_item(medaillons), - draw_item(medaillons), - draw_item(medaillons), - draw_item(medaillons), - ], + medallions: { + [data_1.ANARCHISTS_ID]: [], + [data_1.COMMUNISTS_ID]: [], + [data_1.MODERATES_ID]: [], + pool: [], + }, tableaus: { [data_1.ANARCHISTS_ID]: [], [data_1.COMMUNISTS_ID]: [], @@ -346,29 +346,33 @@ function setup(seed, _scenario, _options) { [data_1.COMMUNISTS_ID]: [], [data_1.MODERATES_ID]: [], }, - triggered_track_effects: [[], [], [], [], []], + triggered_track_effects: [], log: [], undo: [], + used_medallions: [], turn: 0, year: 0, state_data: null, }; + draw_medallions(); start_year(); return game; } function draw_hand_cards(faction_id, count) { const deck = list_deck(faction_id); + if (game.medallions[faction_id].includes(data_1.INTELLIGENCE_MEDALLION_ID)) { + count++; + } + const drawn_cards = count; if (deck.length < count) { count = count - deck.length; game.hands[faction_id] = game.hands[faction_id].concat(deck); game.discard[faction_id] = []; } - console.log('draw_hand_cards', count); - const log = count === 1 + const log = drawn_cards === 1 ? `${get_player(faction_id)} draws 1 card` - : `${get_player(faction_id)} draws ${count} cards`; + : `${get_player(faction_id)} draws ${drawn_cards} cards`; logi(log); - console.log('deck', list_deck(faction_id)); for (let i = 0; i < count; i++) { const deck = list_deck(faction_id); game.hands[faction_id].push(draw_card(deck)); @@ -390,7 +394,7 @@ function start_turn() { const card = cards[cardId]; log_h2('Fascist Event', 'fascist'); log(card.title); - game.engine = card.effects.map((effect) => resolve_effect(effect, game.initiative)); + game.engine = card.effects.map((effect) => resolve_effect(effect)); if (game.year === 3 && game.turn === 1) { game.engine.push(create_function_node('setup_final_bid')); } @@ -416,27 +420,63 @@ states.activate_icon = { resolve_active_and_proceed(); }, collectivization() { - move_track(data_1.COLLECTIVIZATION, get_icon_count_in_tableau('collectivization')); + const count = get_icon_count_in_tableau('collectivization'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.COLLECTIVIZATION, count); + } + else { + move_track(data_1.COLLECTIVIZATION, count); + } resolve_active_and_proceed(); }, d_collectivization() { - move_track(data_1.COLLECTIVIZATION, -1 * get_icon_count_in_tableau('d_collectivization')); + const count = -1 * get_icon_count_in_tableau('d_collectivization'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.COLLECTIVIZATION, count); + } + else { + move_track(data_1.COLLECTIVIZATION, count); + } resolve_active_and_proceed(); }, d_foreign_aid() { - move_track(data_1.FOREIGN_AID, -1 * get_icon_count_in_tableau('d_foreign_aid')); + const count = -1 * get_icon_count_in_tableau('d_foreign_aid'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.FOREIGN_AID, count); + } + else { + move_track(data_1.FOREIGN_AID, count); + } resolve_active_and_proceed(); }, d_government() { - move_track(data_1.GOVERNMENT, -1 * get_icon_count_in_tableau('d_government')); + const count = -1 * get_icon_count_in_tableau('d_government'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.GOVERNMENT, count); + } + else { + move_track(data_1.GOVERNMENT, count); + } resolve_active_and_proceed(); }, d_liberty() { - move_track(data_1.LIBERTY, -1 * get_icon_count_in_tableau('d_liberty')); + const count = -1 * get_icon_count_in_tableau('d_liberty'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.LIBERTY, count); + } + else { + move_track(data_1.LIBERTY, count); + } resolve_active_and_proceed(); }, d_soviet_support() { - move_track(data_1.SOVIET_SUPPORT, -1 * get_icon_count_in_tableau('d_soviet_support')); + const count = -1 * get_icon_count_in_tableau('d_soviet_support'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.SOVIET_SUPPORT, count); + } + else { + move_track(data_1.SOVIET_SUPPORT, count); + } resolve_active_and_proceed(); }, draw_card() { @@ -444,12 +484,24 @@ states.activate_icon = { resolve_active_and_proceed(); }, foreign_aid() { - move_track(data_1.FOREIGN_AID, get_icon_count_in_tableau('foreign_aid')); + const count = get_icon_count_in_tableau('foreign_aid'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.FOREIGN_AID, count); + } + else { + move_track(data_1.FOREIGN_AID, count); + } resolve_active_and_proceed(); }, government() { const direction = game.active === data_1.COMMUNIST ? -1 : 1; - move_track(data_1.GOVERNMENT, direction * get_icon_count_in_tableau('government')); + const count = direction * get_icon_count_in_tableau('government'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.GOVERNMENT, count); + } + else { + move_track(data_1.GOVERNMENT, count); + } resolve_active_and_proceed(); }, government_to_center() { @@ -458,11 +510,23 @@ states.activate_icon = { resolve_active_and_proceed(); }, liberty() { - move_track(data_1.LIBERTY, get_icon_count_in_tableau('liberty')); + const count = get_icon_count_in_tableau('liberty'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.LIBERTY, count); + } + else { + move_track(data_1.LIBERTY, count); + } resolve_active_and_proceed(); }, soviet_support() { - move_track(data_1.SOVIET_SUPPORT, get_icon_count_in_tableau('soviet_support')); + const count = get_icon_count_in_tableau('soviet_support'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.SOVIET_SUPPORT, count); + } + else { + move_track(data_1.SOVIET_SUPPORT, count); + } resolve_active_and_proceed(); }, teamwork_on() { @@ -477,18 +541,11 @@ states.add_glory = { gen_action('add_glory'); }, add_glory() { - console.log('add_glory'); let number = 1; if (game.turn === 4) { number++; } - game.bag_of_glory.push(get_active_faction()); - if (number === 1) { - log_h3(`${game.active} adds 1 token to the Bag of Glory`); - } - else { - log_h3(`${game.active} adds ${number} tokens to the Bag of Glory`); - } + add_glory(get_active_faction(), number); resolve_active_and_proceed(); }, }; @@ -699,13 +756,48 @@ states.choose_final_bid = { resolve_active_and_proceed(); }, }; +states.choose_medallion = { + inactive: 'choose a medallion', + prompt() { + view.prompt = 'Choose a medallion'; + for (let m of game.medallions.pool) { + gen_action_medallion(m); + } + if (!game.medallions.pool.some((m) => m !== null)) { + gen_action('skip'); + } + }, + medallion(m) { + const faction = get_active_faction(); + const medallion = medallions[m]; + logi(`${faction_player_map[faction]} earns ${medallion.name}`); + const index = game.medallions.pool.indexOf(m); + game.medallions.pool[index] = null; + switch (m) { + case 0: + add_glory(faction, 1, true); + break; + case 1: + gain_hero_points(faction, 7); + break; + case 2: + break; + default: + game.medallions[faction].push(m); + } + resolve_active_and_proceed(); + }, + skip() { + resolve_active_and_proceed(); + }, +}; states.end_of_year_discard = { inactive: 'discard cards from hand and tableau', prompt() { view.prompt = 'Discard a card'; const faction_id = get_active_faction(); const hand = game.hands[faction_id]; - if (hand.length > game.year) { + if (hand.length > get_hand_limit(faction_id)) { for (let c of hand) gen_action_card(c); } @@ -717,7 +809,6 @@ states.end_of_year_discard = { }, card(c) { const faction_id = get_active_faction(); - console.log('list deck', list_deck(faction_id)); if (game.hands[faction_id].includes(c)) { game.hands[faction_id] = game.hands[faction_id].filter((id) => id !== c); } @@ -725,7 +816,7 @@ states.end_of_year_discard = { game.tableaus[faction_id] = game.tableaus[faction_id].filter((id) => id !== c); } game.discard[faction_id].push(c); - if (game.hands[faction_id].length > game.year || + if (game.hands[faction_id].length > get_hand_limit(faction_id) || game.tableaus[faction_id].length > game.year) { next(); } @@ -763,7 +854,6 @@ states.lose_hero_points = { view.prompt = 'Choose player to lose Hero Points'; if (args.t === data_1.PLAYER_WITH_MOST_HERO_POINTS) { const factions = get_factions_with_most_hero_poins(); - console.log('faction', factions); for (let faction_id of factions) { gen_action(faction_player_map[faction_id]); } @@ -806,7 +896,8 @@ states.move_track = { let value = node.a.v; if (s === data_1.GOVERNMENT && (value === data_1.TOWARDS_CENTER || value === data_1.AWAY_FROM_CENTER)) { - value = get_government_track_direction(value); + const direction = get_government_track_direction(value); + value = direction; } move_track(s, value); resolve_active_and_proceed(); @@ -878,8 +969,8 @@ states.player_turn = { array_remove(game.hands[faction_id], game.hands[faction_id].indexOf(card)); game.trash[faction_id].push(card); log_h3(`${game.active} plays ${cards[card].title} for the Event`); - insert_after_active_node(create_effects_node(cards[card].effects)); - resolve_active_and_proceed(); + insert_before_active_node(create_effects_node(cards[card].effects)); + next(); }, spend_hp() { insert_before_active_node(create_leaf_node('spend_hero_points', get_active_faction())); @@ -887,16 +978,42 @@ states.player_turn = { next(); }, }; +states.remove_blank_marker = { + inactive: 'remove a Blank marker', + prompt() { + view.prompt = 'Remove a Blank marker'; + for (const b of game.triggered_track_effects) { + gen_action_blank_marker(b); + } + }, + blank_marker(b) { + const faction = get_active_faction(); + pay_hero_points(faction, 1); + const track_id = Math.floor(b / 11); + const space_id = b % 11; + logi(`${faction_player_map[faction]} removes a Blank marker from space ${space_id} of ${get_track_name(track_id)}`); + game.triggered_track_effects = game.triggered_track_effects.filter((id) => id !== b); + game.used_medallions.push(data_1.ARCHIVES_MEDALLION_ID); + resolve_active_and_proceed(); + }, +}; states.spend_hero_points = { inactive: 'spend Hero points', prompt() { view.prompt = 'Spend your Hero points'; gen_action('done'); + const faction = get_active_faction(); const hero_points = game.hero_points[get_active_faction()]; if (hero_points === 0) { return; } gen_action('draw_card'); + if (can_use_medallion(data_1.ARCHIVES_MEDALLION_ID, faction)) { + gen_action('remove_blank_marker'); + } + if (can_use_medallion(data_1.VOLUNTEERS_MEDALLION_ID, faction)) { + gen_action('add_to_front'); + } if (hero_points < 2) { return; } @@ -917,6 +1034,18 @@ states.spend_hero_points = { } gen_action_standee(data_1.GOVERNMENT); }, + add_to_front() { + const faction = get_active_faction(); + pay_hero_points(faction, 1); + insert_after_active_node(create_seq_node([ + create_leaf_node('add_to_front', faction, { + t: data_1.ANY, + v: 1, + }), + create_leaf_node('spend_hero_points', faction), + ])); + resolve_active_and_proceed(); + }, done() { resolve_active_and_proceed(); }, @@ -929,6 +1058,20 @@ states.spend_hero_points = { pay_hero_points(faction, 1); draw_hand_cards(faction, 1); }, + remove_blank_marker() { + const faction = get_active_faction(); + if (game.used_medallions) { + game.used_medallions.push(data_1.ARCHIVES_MEDALLION_ID); + } + else { + game.used_medallions = [data_1.ARCHIVES_MEDALLION_ID]; + } + insert_after_active_node(create_seq_node([ + create_leaf_node('remove_blank_marker', faction), + create_leaf_node('spend_hero_points', faction), + ])); + resolve_active_and_proceed(); + }, standee(track_id) { let amount = 2; if (track_id === data_1.LIBERTY || track_id === data_1.COLLECTIVIZATION) { @@ -949,6 +1092,51 @@ states.spend_hero_points = { resolve_active_and_proceed(); }, }; +states.use_organization_medallion = { + inactive: 'use Organization Medallion', + prompt() { + view.prompt = 'Use Organization Medallion?'; + gen_action('yes'); + gen_action('no'); + }, + yes() { + const faction = get_active_faction(); + pay_hero_points(faction, 1); + game.used_medallions.push(data_1.ORGANIZATION_MEDALLION_ID); + let { t, v } = get_active_node_args(); + if (v > 0) { + v++; + } + else { + v--; + } + move_track(t, v); + resolve_active_and_proceed(); + }, + no() { + const { t, v } = get_active_node_args(); + move_track(t, v); + resolve_active_and_proceed(); + }, +}; +states.use_strategy_medallion = { + inactive: 'use Strategy Medallion', + prompt() { + view.prompt = 'Use Strategy Medallion?'; + gen_action('yes'); + gen_action('no'); + }, + yes() { + game.used_medallions.push(data_1.STRATEGY_MEDALLION_ID); + const { f } = get_active_node_args(); + const faction = get_active_faction(); + update_front(f, 1, faction); + resolve_active_and_proceed(); + }, + no() { + resolve_active_and_proceed(); + }, +}; function pop_undo() { const save_log = game.log; const save_undo = game.undo; @@ -957,6 +1145,20 @@ function pop_undo() { game.log = save_log; game.undo = save_undo; } +function add_glory(faction, amount, indent = false) { + for (let i = 0; i < amount; ++i) { + game.bag_of_glory.push(get_active_faction()); + } + let text = amount === 1 + ? `${faction_player_map[faction]} adds 1 token to the Bag of Glory` + : `${faction_player_map[faction]} adds ${amount} tokens to the Bag of Glory`; + if (indent) { + logi(text); + } + else { + log_h3(text); + } +} function check_activate_icon() { if (game.bonuses[data_1.MORALE_BONUS] === data_1.ON) { insert_after_active_node(create_leaf_node('activate_icon', get_active_faction_id())); @@ -1024,6 +1226,7 @@ function end_of_turn() { Object.keys(game.fronts).forEach((front_id) => { game.fronts[front_id].contributions = []; }); + game.used_medallions = []; if (game.turn === 4) { end_of_year(); } @@ -1090,6 +1293,13 @@ function game_over(result, victory) { log_br(); log(game.victory); } +function get_hand_limit(faction) { + let hand_limit = game.year; + if (game.medallions[faction].includes(data_1.INTELLIGENCE_MEDALLION_ID)) { + hand_limit++; + } + return hand_limit; +} function resolve_fascist_test() { log_h2('Fascist Test', 'fascist'); const test = get_current_event().test; @@ -1098,6 +1308,17 @@ function resolve_fascist_test() { (status !== data_1.DEFEAT && game.fronts[test.front].value >= test.value); if (test_passed) { log('The Test is passed'); + for (const faction of get_player_order()) { + let hero_points_gain = game.fronts[test.front].contributions.includes(faction) + ? 2 + : 0; + if (can_use_medallion(data_1.PROPAGANDA_MEDALLION_ID, faction)) { + hero_points_gain += 2; + } + if (hero_points_gain > 0) { + gain_hero_points(faction, hero_points_gain); + } + } } else { log('The Test is failed'); @@ -1138,7 +1359,6 @@ function resolve_final_bid() { resolve_active_and_proceed(); } function get_fronts_to_add_to(target) { - console.log('get_fronts_to_add_to', target); if (target === data_1.CLOSEST_TO_DEFEAT || target === data_1.CLOSEST_TO_VICTORY) { return get_fronts_closest_to(target); } @@ -1152,9 +1372,11 @@ function get_fronts_to_add_to(target) { function get_max_value_for_track(track_id) { switch (track_id) { case data_1.LIBERTY: - return game.tracks[data_1.COLLECTIVIZATION] >= 8 ? 10 : 7; + const max_lib = game.tracks[data_1.COLLECTIVIZATION] >= 8 ? 10 : 7; + return Math.max(max_lib, game.tracks[data_1.LIBERTY]); case data_1.GOVERNMENT: - return game.tracks[data_1.FOREIGN_AID] >= 8 ? 10 : 7; + const max_gov = game.tracks[data_1.FOREIGN_AID] >= 8 ? 10 : 7; + return Math.max(max_gov, game.tracks[data_1.GOVERNMENT]); case data_1.COLLECTIVIZATION: case data_1.SOVIET_SUPPORT: case data_1.FOREIGN_AID: @@ -1165,7 +1387,8 @@ function get_max_value_for_track(track_id) { function get_min_value_for_track(track_id) { switch (track_id) { case data_1.GOVERNMENT: - return game.tracks[data_1.SOVIET_SUPPORT] >= 8 ? 4 : 1; + const min_gov = game.tracks[data_1.SOVIET_SUPPORT] >= 8 ? 4 : 1; + return Math.min(min_gov, game.tracks[data_1.GOVERNMENT]); case data_1.LIBERTY: case data_1.COLLECTIVIZATION: case data_1.SOVIET_SUPPORT: @@ -1198,9 +1421,9 @@ function move_track(track_id, change) { triggered_spaces.forEach((space_id) => { const trigger = tracks[track_id].triggers[space_id]; if (trigger !== null && - !game.triggered_track_effects[track_id].includes(space_id)) { + !game.triggered_track_effects.includes(get_blank_marker_id(track_id, space_id))) { if (space_id !== 0) { - game.triggered_track_effects[track_id].push(space_id); + game.triggered_track_effects.push(get_blank_marker_id(track_id, space_id)); } const node = resolve_effect(trigger); if (node !== null) { @@ -1213,6 +1436,24 @@ function pay_hero_points(faction, amount) { game.hero_points[faction] -= amount; game.hero_points.pool += amount; } +function can_use_medallion(medallion_id, faction) { + faction = faction === undefined ? get_active_faction() : faction; + const can_use = game.medallions[faction].includes(medallion_id) && + !game.used_medallions.includes(medallion_id); + if (medallion_id === data_1.ORGANIZATION_MEDALLION_ID) { + return can_use && game.hero_points[faction] > 0; + } + else { + return can_use; + } +} +function insert_use_organization_medallion_node(track_id, value) { + const faction = get_active_faction(); + insert_after_active_node(create_leaf_node('use_organization_medallion', faction, { + t: track_id, + v: value, + })); +} function update_bonus(bonus_id, status) { if (game.bonuses[bonus_id] === status) { return; @@ -1242,6 +1483,14 @@ function update_front(front_id, change, faction_id = null) { !game.fronts[front_id].contributions.includes(faction_id)) { game.fronts[front_id].contributions.push(faction_id); } + if (change > 0 && + faction_id !== undefined && + game.fronts[front_id].value < 10 && + can_use_medallion(data_1.STRATEGY_MEDALLION_ID)) { + insert_after_active_node(create_leaf_node('use_strategy_medallion', get_active_faction(), { + f: front_id, + })); + } if (game.fronts[front_id].value >= 10) { victory_on_a_front(front_id); } @@ -1276,22 +1525,30 @@ function create_effects_node(effects) { } return accrued; }, []); - return { - t: seq_node, - c: nodes, - }; + return create_seq_node(nodes); +} +function get_faction_to_resolve_effect(effect) { + if (!effect.faction) { + return get_active_faction(); + } + if (effect.faction === data_1.INITIATIVE_PLAYER) { + return game.initiative; + } + return effect.faction; } const effect_type_state_map = { attack: 'attack_front', bonus: 'change_bonus', front: 'add_to_front', + medallion: 'choose_medallion', track: 'move_track', }; -function resolve_effect(effect, faction = get_active_faction()) { +function resolve_effect(effect) { const args = { t: effect.target, v: effect.value, }; + const faction = get_faction_to_resolve_effect(effect); let state = effect_type_state_map[effect.type]; if (state !== undefined) { return create_leaf_node(state, faction, args); @@ -1320,12 +1577,6 @@ function draw_card(deck) { set_delete(deck, c); return c; } -function draw_item(ids) { - let i = random(ids.length); - let r = ids[i]; - set_delete(ids, r); - return r; -} function lose_hero_point(faction, value) { const points_lost = Math.min(game.hero_points[faction], Math.abs(value)); game.hero_points.pool += points_lost; @@ -1370,7 +1621,6 @@ function log_h2(msg, player) { log(`.h2${player ? `.${player}` : ''} ${msg}`); log_br(); } -log; function log_h3(msg) { log_br(); log('.h3 ' + msg); @@ -1386,6 +1636,9 @@ function get_active_faction() { function get_active_faction_id() { return player_faction_map[game.active]; } +function get_blank_marker_id(track_id, space_id) { + return track_id * 11 + space_id; +} function get_faction_id(player) { return player_faction_map[player]; } @@ -1494,7 +1747,8 @@ function list_deck(id) { const deck = []; const card_list = id === 'fascist' ? fascist_decks[game.year] : faction_cards[id]; card_list.forEach((card) => { - if (id === 'fascist' && game.discard.f.includes(card)) { + if (id === 'fascist' && + (game.discard.f.includes(card) || game.current_events.includes(card))) { return; } else if (id !== 'fascist' && @@ -1507,6 +1761,15 @@ function list_deck(id) { }); return deck; } +function draw_medallions() { + const medallion_ids = make_list(0, 8); + for (let m = 0; m < 5; ++m) { + let i = random(medallion_ids.length); + let r = medallion_ids[i]; + set_delete(medallion_ids, r); + game.medallions.pool.push(r); + } +} function array_remove(array, index) { let n = array.length; for (let i = index + 1; i < n; ++i) |