summaryrefslogtreecommitdiff
path: root/rules.ts
diff options
context:
space:
mode:
Diffstat (limited to 'rules.ts')
-rw-r--r--rules.ts44
1 files changed, 43 insertions, 1 deletions
diff --git a/rules.ts b/rules.ts
index 45409a6..6ba2470 100644
--- a/rules.ts
+++ b/rules.ts
@@ -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');
}