diff options
-rw-r--r-- | data.js | 2 | ||||
-rw-r--r-- | data.ts | 2 | ||||
-rw-r--r-- | rules.js | 48 | ||||
-rw-r--r-- | rules.ts | 54 |
4 files changed, 102 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(); } @@ -516,6 +517,12 @@ function start_turn() { } next(); } +function player_can_resolve_icon(icon) { + if (icon === 'teamwork_on' && game.bonuses[data_1.TEAMWORK_BONUS] === data_1.ON) { + return false; + } + return true; +} states.activate_icon = { inactive: 'activate an icon', prompt() { @@ -524,6 +531,9 @@ states.activate_icon = { const c = cards[game.played_card]; for (const i of c.icons) { gen_action(i); + if (!player_can_resolve_icon(i)) { + view.actions[i] = 0; + } } }, spend_hp() { @@ -1040,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(); @@ -1105,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; @@ -1260,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(); @@ -2165,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()) { @@ -2175,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(); } @@ -749,6 +752,13 @@ function start_turn() { // region STATES +function player_can_resolve_icon(icon: Icon): boolean { + if (icon === 'teamwork_on' && game.bonuses[TEAMWORK_BONUS] === ON) { + return false; + } + return true; +} + states.activate_icon = { inactive: 'activate an icon', prompt() { @@ -757,6 +767,9 @@ states.activate_icon = { const c = cards[game.played_card] as PlayerCard; for (const i of c.icons) { gen_action(i); + if (!player_can_resolve_icon(i)) { + view.actions[i] = 0; + } } }, spend_hp() { @@ -1319,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(); @@ -1389,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; @@ -1578,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(); @@ -2693,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()) { @@ -2705,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'); } |