diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-06-24 14:44:23 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-07-07 18:39:37 +0200 |
commit | f2d64ee016428edf3216b4ffd055151071d6c49a (patch) | |
tree | 1187499e6a8fe25c0a7fc04840e496e17ccf6ad3 /rules.js | |
parent | 8e89ea0ff9f2b257e37c492a471a9eccfa873403 (diff) | |
download | time-of-crisis-f2d64ee016428edf3216b4ffd055151071d6c49a.tar.gz |
Logs and stuff.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 91 |
1 files changed, 54 insertions, 37 deletions
@@ -1319,21 +1319,26 @@ function roll_barbarian_crisis() { let black = game.dice[2] = roll_die() let white = game.dice[3] = roll_die() - if (game.active_event === EVENT_RAIDING_PARTIES) + logi(BARBARIAN_NAME[tribe] + " B" + black + " W" + white) + + if (game.active_event === EVENT_RAIDING_PARTIES) { + logi("E" + EVENT_RAIDING_PARTIES) black = Math.max(1, black - 2) - if (game.active_event === EVENT_PREPARING_FOR_WAR) - black = Math.min(6, black + 2) + } - log(BARBARIAN_NAME[tribe] + " B" + black + " W" + white) + if (game.active_event === EVENT_PREPARING_FOR_WAR) { + logi("E" + EVENT_PREPARING_FOR_WAR) + black = Math.min(6, black + 2) + } if (black <= count_active_barbarians_at_home(tribe)) - goto_barbarian_invasion(tribe) + goto_barbarian_invasion(tribe, black) else goto_take_actions() } -function goto_barbarian_invasion(tribe) { - game.count = game.dice[2] +function goto_barbarian_invasion(tribe, black) { + game.count = black // Ardashir: All active Sassanids invade! if (tribe === SASSANIDS) { @@ -1399,7 +1404,7 @@ function invade_with_barbarian_counter(id, path, where) { function goto_crisis_event() { game.active_event = game.events.pop() - logi(EVENT_NAME[game.active_event]) + log("E" + game.active_event) switch (game.active_event) { case EVENT_ARDASHIR: return goto_crisis_barbarian_leader(ARDASHIR, SASSANIDS_HOMELAND) @@ -1448,7 +1453,7 @@ function goto_crisis_barbarian_leader(id, where) { states.crisis_barbarian_leader = { prompt() { - prompt(EVENT_NAME[game.active_event] + "!") + prompt(EVENT_NAME[game.active_event] + ": Place barbarian leader.") gen_action_region(game.where) }, region(where) { @@ -1467,7 +1472,7 @@ function goto_crisis_rival_emperor(id, where) { states.crisis_rival_emperor = { prompt() { - prompt(EVENT_NAME[game.active_event] + "!") + prompt(EVENT_NAME[game.active_event] + ": Place rival emperor in " + REGION_NAME[game.where] + ".") gen_action_region(game.where) }, region(where) { @@ -1520,6 +1525,7 @@ states.palmyra_allies = { }, barbarian(id) { push_undo() + logi(BARBARIAN_NAME[id] + " in %" + get_barbarian_location(id)) eliminate_barbarian(id) if (--game.count === 0) goto_take_actions() @@ -1549,6 +1555,7 @@ states.ludi_saeculares = { }, card(c) { push_undo() + logi("Discarded " + card_name(c)) set_delete(current_hand(), c) set_add(current_discard(), c) award_legacy(game.current, "Ludi Saeculares", 2 * card_value(c)) @@ -1591,8 +1598,9 @@ states.take_actions = { let where = UNAVAILABLE - if (mip + sip + pip === 0 && current_hand().length > 0) - view.actions.play_all = 1 + // XXX + // if (game.selected_governor < 0 && game.selected_general < 0 && current_hand().length > 0 && mip + sip + pip === 0) + // view.actions.play_all = 1 view.actions.end_actions = 1 @@ -1843,14 +1851,14 @@ states.take_actions = { recruit_governor() { push_undo() - log("Recruited Governor " + (game.selected_governor % 6) + ".") + log("Recruit Governor " + (game.selected_governor % 6) + ".") spend_senate(game.selected_governor % 6) set_governor_location(game.selected_governor, AVAILABLE) }, recruit_general() { push_undo() - log("Recruited General " + (game.selected_general % 6) + ".") + log("Recruit General " + (game.selected_general % 6) + ".") spend_military(game.selected_general % 6) set_general_location(game.selected_general, AVAILABLE) }, @@ -1931,6 +1939,7 @@ states.take_actions = { disperse_mob() { push_undo() + spend_military(1) let where = get_selected_region() let n = 0 if (has_militia(where)) @@ -2023,7 +2032,7 @@ states.occupy_seat_of_power_1 = { }, region(where) { push_undo() - log("Removed Seat of Power in %" + where) + log("Removed Seat of Power in %" + where + ".") remove_seat_of_power(where) remove_governor(where) resume_occupy_seat_of_power() @@ -2040,7 +2049,7 @@ states.occupy_seat_of_power_2 = { }, region(where) { push_undo() - log("Removed Breakaway in %" + where) + log("Removed Breakaway in %" + where + ".") remove_breakaway(where) resume_occupy_seat_of_power() }, @@ -2054,7 +2063,7 @@ states.occupy_breakaway = { }, region(where) { push_undo() - log("Removed Breakaway in %" + where) + log("Removed Breakaway in %" + where + ".") remove_breakaway(where) remove_governor(where) goto_replace_pretender() @@ -2135,7 +2144,7 @@ function increase_support(where) { } function remove_governor(where) { - log("Removed Governor from %" + where) + log("Removed Governor from %" + where + ".") eliminate_militia(where) set_mobs(where, 0) @@ -2227,6 +2236,7 @@ states.place_governor = { game.count += 1 }, roll() { + clear_undo() roll_to_place_governor() }, } @@ -2254,6 +2264,7 @@ states.praetorian_guard = { game.count += 1 }, roll() { + clear_undo() roll_to_place_governor() }, } @@ -2315,6 +2326,7 @@ states.damnatio_memoriae = { prompt("Place Governor: You may play Damnatio Memoriae.") gen_card_event(CARD_S4) gen_card_event(CARD_S4B) + view.actions.pass = 1 }, card(c) { push_undo() @@ -2430,7 +2442,7 @@ function gen_create_army() { function create_army(where) { spend_military(1) - log("Created Army in %" + where + ".") + log("Create Army in %" + where + ".") set_general_location(game.selected_general, where) if (can_enter_capital(where)) set_general_inside_capital(game.selected_general) @@ -2475,7 +2487,7 @@ states.move_army_at_sea = { } function move_army_to(who, to) { - log("Moved Army to %" + to + ".") + log("Move Army to %" + to + ".") remove_general_castra(who) @@ -2519,14 +2531,14 @@ states.castra = { } }, militia(where) { - log("Castra on militia in %" + where) + log("Castra on militia in %" + where + ".") add_militia_castra(where) game.state = "take_actions" }, general(id) { push_undo() let where = get_general_location(id) - log("Castra on army in %" + where) + log("Castra on army in %" + where + ".") add_general_castra(id) game.state = "take_actions" }, @@ -2662,7 +2674,7 @@ states.foederati = { gen_action_general(id) where = get_governor_location(id) if (is_province(where) && has_lone_militia(where) && can_foederati_from_region_or_adjacent(where)) - gen_action_militia(id) + gen_action_militia(where) } }, general(id) { @@ -2753,11 +2765,11 @@ states.mob = { function auto_remove_pretender_empire(seat) { let pretender = get_province_governor(seat) / 6 | 0 - log("Removed Seat of Power in %" + seat) + log("Removed Seat of Power in %" + seat + ".") remove_seat_of_power(seat) for (let where = 1; where < 12; ++where) { if (is_breakaway(where) && (get_province_governor(where) / 6 | 0) === pretender) { - log("Removed Breakaway in %" + where) + log("Removed Breakaway in %" + where + ".") remove_breakaway(where) } } @@ -2832,7 +2844,7 @@ function play_flanking_maneuver() { } function goto_battle_vs_general(where, attacker, target) { - log_h3("Battle " + PLAYER_NAME[target/6|0] + " in %" + where) + log_h3("Battle " + PLAYER_NAMES[target/6|0] + " in %" + where) goto_battle("general", where, attacker, target) } @@ -2920,7 +2932,7 @@ states.battle = { play_card_event(c) }, roll() { - // clear_undo() + clear_undo() roll_combat_dice() if (game.battle.flanking) game.state = "flanking_maneuver" @@ -2936,10 +2948,11 @@ function format_hits() { states.flanking_maneuver = { prompt() { prompt("Flanking Maneuver: " + format_hits() + ".") - view.actions.continue = 1 + view.actions.pass = 1 view.actions.reroll = 1 }, - continue() { + pass() { + push_undo() goto_assign_hits() }, reroll() { @@ -3378,6 +3391,8 @@ states.advance_after_combat = { } function end_battle() { + log_br() + // Deselect eliminated general... if (game.selected_general >= 0 && get_general_location(game.selected_general) === AVAILABLE) game.selected_general = -1 @@ -3395,10 +3410,10 @@ function can_free_increase_support_level(where) { states.free_increase_support_level = { prompt() { - prompt("Combat: Increase support level or save counter to reduce cost of card?") + prompt("Combat: Increase support level or keep counter to reduce cost of card?") view.color = POPULACE gen_action_region(game.where) - view.actions.save = 1 + view.actions.keep = 1 }, region(where) { push_undo() @@ -3406,7 +3421,7 @@ states.free_increase_support_level = { game.battle = null game.state = "take_actions" }, - save() { + keep() { push_undo() log("Saved for cost reduction.") game.killed |= game.battle.killed @@ -3542,7 +3557,7 @@ states.expand_pretender_empire = { // === GAIN LEGACY === function goto_gain_legacy() { - log_h3("Gain Legacy") + log_br() if (is_only_pretender_player()) award_legacy(game.current, "Pretender", count_own_breakaway_provinces()) @@ -3611,6 +3626,8 @@ function count_political_points() { } function goto_buy_trash_cards() { + log_br() + let discard = current_discard() for (let c of game.played) set_add(discard, c) @@ -3717,14 +3734,14 @@ states.buy_trash = { card(c) { push_undo() if (set_has(current_discard(), c)) { - log("Trashed " + card_name(c)) + log("Trashed " + card_name(c) + ".") set_delete(current_discard(), c) game.pp -= 3 } else { let military_bonus = has_military_card_bonus() let senate_bonus = has_senate_card_bonus() - log("Bought " + card_name(c)) + log("Bought " + card_name(c) + ".") set_add(current_discard(), c) set_delete(find_market_with_card(c), c) @@ -3842,7 +3859,7 @@ states.refill_hand = { for (let c of draw) gen_action_card(c) } else { - view.actions.done = 1 + view.actions.end_turn = 1 } }, card(c) { @@ -3854,7 +3871,7 @@ states.refill_hand = { if (draw.length === 0) flip_discard_to_available() }, - done() { + end_turn() { clear_undo() end_refill_hand() } |