diff options
author | Frans Bongers <fransbongers@franss-mbp.home> | 2025-02-01 21:38:58 +0100 |
---|---|---|
committer | Frans Bongers <fransbongers@franss-mbp.home> | 2025-02-01 21:38:58 +0100 |
commit | c663569c22315835f280866f9b0bf247233e9901 (patch) | |
tree | b4f7e2535c2d8b283e077c9e80d65096e8f7cd67 | |
parent | 32c5d3a4b5bd208ba620ea336bc4b35835cf391b (diff) | |
download | land-and-freedom-c663569c22315835f280866f9b0bf247233e9901.tar.gz |
-rw-r--r-- | data.js | 2 | ||||
-rw-r--r-- | data.ts | 2 | ||||
-rw-r--r-- | rules.js | 39 | ||||
-rw-r--r-- | rules.ts | 44 |
4 files changed, 83 insertions, 4 deletions
@@ -157,7 +157,7 @@ const data = { ], icons: ['teamwork_on', 'add_to_front', 'draw_card'], strength: 1, - title: '"SI ME OUIERES ESCRIBIR"', + title: '"SI ME QUIERES ESCRIBIR"', type: 'pc', }, { @@ -179,7 +179,7 @@ const data: StaticData = { ], icons: ['teamwork_on', 'add_to_front', 'draw_card'], strength: 1, - title: '"SI ME OUIERES ESCRIBIR"', + title: '"SI ME QUIERES ESCRIBIR"', type: 'pc', }, { @@ -136,6 +136,7 @@ function setup_bag_of_glory() { function setup_choose_card() { const player_order = get_player_order(); game.engine = player_order.map((faction_id) => create_leaf_node('choose_card', faction_id)); + game.engine.push(create_leaf_node('confirm_turn', player_order[2])); game.engine.push(create_function_node('setup_player_turn')); next(); } @@ -1049,6 +1050,11 @@ states.confirm_turn = { }; states.draw_card = { inactive: 'draw a card', + auto_resolve() { + const { v } = get_active_node_args(); + draw_hand_cards(get_active_faction(), v); + return true; + }, prompt() { gen_spend_hero_points(); const { v } = get_active_node_args(); @@ -1114,6 +1120,17 @@ states.end_of_year_discard = { }; states.hero_points = { inactive: 'gain Hero Points', + auto_resolve() { + const { v } = get_active_node_args(); + const faction = get_active_faction(); + if (v < 0) { + lose_hero_points(faction, v); + } + else if (v > 0 && game.hero_points.pool > 0) { + gain_hero_points(faction, v); + } + return true; + }, prompt() { gen_spend_hero_points(); const value = get_active_node_args().v; @@ -1269,6 +1286,21 @@ function can_move_track_down(track_id) { } states.move_track_up_or_down = { inactive: 'move a track', + auto_resolve() { + const { track_id, strength } = get_active_node_args(); + const can_move_up = can_move_track_up(track_id); + const can_move_down = can_move_track_down(track_id); + if (can_move_up && can_move_down) { + return false; + } + if (can_move_up) { + move_track(track_id, strength); + } + else if (can_move_down) { + move_track(track_id, -1 * strength); + } + return true; + }, prompt() { gen_spend_hero_points(); const { track_id } = get_active_node_args(); @@ -2174,6 +2206,7 @@ function resolve_fascist_test() { const status = game.fronts[test.front].status; const test_passed = status === data_1.VICTORY || (status !== data_1.DEFEAT && game.fronts[test.front].value >= test.value); + const hero_point_actions = []; if (test_passed) { log('The Test is passed'); for (const faction of get_player_order()) { @@ -2184,9 +2217,13 @@ function resolve_fascist_test() { hero_points_gain += 2; } if (hero_points_gain > 0) { - gain_hero_points(faction, hero_points_gain); + const node = resolve_effect((0, data_1.create_effect)('hero_points', faction, hero_points_gain)); + hero_point_actions.push(node); } } + if (hero_point_actions.length > 0) { + insert_after_active_node(create_seq_node(hero_point_actions)); + } } else { log('The Test is failed'); @@ -276,6 +276,9 @@ function setup_choose_card() { game.engine = player_order.map((faction_id) => create_leaf_node('choose_card', faction_id) ); + // Add extra confirm, otherwise first players card will be revealed + // before confirm + game.engine.push(create_leaf_node('confirm_turn', player_order[2])); game.engine.push(create_function_node('setup_player_turn')); next(); } @@ -1329,6 +1332,11 @@ states.confirm_turn = { states.draw_card = { inactive: 'draw a card', + auto_resolve() { + const { v } = get_active_node_args(); + draw_hand_cards(get_active_faction(), v); + return true; + }, prompt() { gen_spend_hero_points(); const { v } = get_active_node_args(); @@ -1399,6 +1407,16 @@ states.end_of_year_discard = { states.hero_points = { inactive: 'gain Hero Points', + auto_resolve() { + const { v } = get_active_node_args(); + const faction = get_active_faction(); + if (v < 0) { + lose_hero_points(faction, v); + } else if (v > 0 && game.hero_points.pool > 0) { + gain_hero_points(faction, v); + } + return true; + }, prompt() { gen_spend_hero_points(); const value = get_active_node_args().v; @@ -1588,6 +1606,20 @@ function can_move_track_down(track_id): boolean { states.move_track_up_or_down = { inactive: 'move a track', + auto_resolve() { + const { track_id, strength } = get_active_node_args(); + const can_move_up = can_move_track_up(track_id); + const can_move_down = can_move_track_down(track_id); + if (can_move_up && can_move_down) { + return false; + } + if (can_move_up) { + move_track(track_id, strength); + } else if (can_move_down) { + move_track(track_id, -1 * strength); + } + return true; + }, prompt() { gen_spend_hero_points(); const { track_id } = get_active_node_args(); @@ -2703,6 +2735,9 @@ function resolve_fascist_test() { const test_passed = status === VICTORY || (status !== DEFEAT && game.fronts[test.front].value >= test.value); + + const hero_point_actions: EngineNode[] = []; + if (test_passed) { log('The Test is passed'); for (const faction of get_player_order()) { @@ -2715,9 +2750,16 @@ function resolve_fascist_test() { hero_points_gain += 2; } if (hero_points_gain > 0) { - gain_hero_points(faction, hero_points_gain); + const node = resolve_effect( + create_effect('hero_points', faction, hero_points_gain) + ); + hero_point_actions.push(node); } } + + if (hero_point_actions.length > 0) { + insert_after_active_node(create_seq_node(hero_point_actions)); + } } else { log('The Test is failed'); } |