diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 92 |
1 files changed, 36 insertions, 56 deletions
@@ -624,51 +624,19 @@ states.activate_icon = { update_front(f, get_icon_count_in_tableau('add_to_front'), get_active_faction()); resolve_active_and_proceed(); }, - tr0(x) { - if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { - insert_use_organization_medallion_node(data_1.LIBERTY, x); - } - else { - move_track_to(0, x); - } - resolve_active_and_proceed(); - }, - tr1(x) { - if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { - insert_use_organization_medallion_node(data_1.COLLECTIVIZATION, x); - } - else { - move_track_to(1, x); - } - resolve_active_and_proceed(); - }, - tr2(x) { - if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { - insert_use_organization_medallion_node(data_1.GOVERNMENT, x); - } - else { - move_track_to(2, x); - } - resolve_active_and_proceed(); - }, - tr3(x) { + trX(x, track) { + let old = game.tracks[track]; + move_track_to(track, x); if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { - insert_use_organization_medallion_node(data_1.SOVIET_SUPPORT, x); - } - else { - move_track_to(3, x); - } - resolve_active_and_proceed(); - }, - tr4(x) { - if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { - insert_use_organization_medallion_node(data_1.FOREIGN_AID, x); - } - else { - move_track_to(4, x); + insert_use_organization_medallion_node(track, game.tracks[track] - old); } resolve_active_and_proceed(); }, + tr0(x) { this.trX(x, 0); }, + tr1(x) { this.trX(x, 1); }, + tr2(x) { this.trX(x, 2); }, + tr3(x) { this.trX(x, 3); }, + tr4(x) { this.trX(x, 4); }, draw_card() { draw_hand_cards(get_active_faction(), get_icon_count_in_tableau('draw_card')); resolve_active_and_proceed(); @@ -2067,8 +2035,9 @@ function trash_card(faction) { states.use_organization_medallion = { inactive: 'choose to use Organization Medallion', prompt() { - gen_spend_hero_points(); - view.prompt = 'Use Organization Medallion?'; + let { t, v } = get_active_node_args(); + view.prompt = `Organization Medallion: Spend 1 Hero point to increase ${get_track_name(t)} movement?`; + gen_action(track_action_name[t], v); gen_action('yes'); gen_action('no'); }, @@ -2080,32 +2049,34 @@ states.use_organization_medallion = { pay_hero_points(faction, 1); game.used_medallions.push(data_1.ORGANIZATION_MEDALLION_ID); let { t, v } = get_active_node_args(); - if (v > game.tracks[t]) { - v++; - } - else { - v--; - } - move_track(t, v - game.tracks[t]); + log("M" + data_1.ORGANIZATION_MEDALLION_ID + ":"); + move_track_to(t, v); resolve_active_and_proceed(); }, + tr0() { this.yes(); }, + tr1() { this.yes(); }, + tr2() { this.yes(); }, + tr3() { this.yes(); }, + tr4() { this.yes(); }, no() { - const { t, v } = get_active_node_args(); - move_track(t, v); resolve_active_and_proceed(); }, }; states.use_strategy_medallion = { inactive: 'choose to use Strategy Medallion', prompt() { - gen_spend_hero_points(); - view.prompt = 'Use Strategy Medallion?'; + const { f } = get_active_node_args(); + view.prompt = `Strategy Medallion: Add 1 strength to ${front_names[f]}?`; + gen_action_front(f); gen_action('yes'); gen_action('no'); }, spend_hp() { resolve_spend_hp(); }, + front(_) { + this.yes(); + }, yes() { game.used_medallions.push(data_1.STRATEGY_MEDALLION_ID); const { f } = get_active_node_args(); @@ -2600,11 +2571,20 @@ function can_use_medallion(medallion_id, faction) { return can_use; } } -function insert_use_organization_medallion_node(track_id, value) { +function insert_use_organization_medallion_node(track_id, delta) { const faction = get_active_faction(); + if (delta > 0) + delta = 1; + else if (delta < 0) + delta = -1; + else + return; + let v = game.tracks[track_id] + delta; + if (v < 0 || v > 10) + return; insert_after_active_node(create_state_node('use_organization_medallion', faction, { t: track_id, - v: value, + v: v, })); } function update_bonus(bonus_id, status) { |