summaryrefslogtreecommitdiff
path: root/rules.ts
diff options
context:
space:
mode:
Diffstat (limited to 'rules.ts')
-rw-r--r--rules.ts43
1 files changed, 39 insertions, 4 deletions
diff --git a/rules.ts b/rules.ts
index 3a320c5..277d2b2 100644
--- a/rules.ts
+++ b/rules.ts
@@ -159,12 +159,47 @@ function gen_action_medallion(medallion_id: number) {
gen_action('medallion', medallion_id);
}
+function can_spend_any_hero_points(faction) {
+ let hero_points = game.hero_points[faction];
+ if (hero_points >= 1) {
+ if (can_draw_any_hand_cards(faction))
+ return true;
+ if (can_use_medallion(ARCHIVES_MEDALLION_ID, faction) && game.triggered_track_effects.length > 0)
+ return true;
+ if (can_use_medallion(VOLUNTEERS_MEDALLION_ID, faction))
+ return true;
+ if (hero_points >= 2) {
+ if (game.bonuses[0] === OFF)
+ return true;
+ if (game.bonuses[1] === OFF)
+ return true;
+ if (can_move_track_up(FOREIGN_AID))
+ return true;
+ if (can_move_track_up(SOVIET_SUPPORT))
+ return true;
+ if (hero_points >= 3) {
+ if (can_move_track_up(COLLECTIVIZATION))
+ return true;
+ if (can_move_track_up(LIBERTY))
+ return true;
+ if (hero_points >= 4) {
+ if (can_move_track_up(GOVERNMENT))
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
function gen_spend_hero_points() {
const faction = get_active_faction();
- const can_spend_hp =
- game.faction_turn === faction && game.hero_points[faction] > 0;
- if (can_spend_hp) {
- gen_action('spend_hp');
+ if (game.faction_turn === faction) {
+ if (can_spend_any_hero_points(faction)) {
+ view.actions['spend_hp'] = 1;
+ } else {
+ view.actions['spend_hp'] = 0;
+ }
}
}