summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js39
1 files changed, 38 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index e85112a..8d0bd80 100644
--- a/rules.js
+++ b/rules.js
@@ -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');