diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-17 17:47:14 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | f269ad25fba3be1af57631df9aa964665e7e2308 (patch) | |
tree | df2b6f12a5590812c18d0301a0d43d6d8a92c320 /rules.js | |
parent | 3a564d1ecff1bb68d7646fd0fd427ca775c7924d (diff) | |
download | table-battles-f269ad25fba3be1af57631df9aa964665e7e2308.tar.gz |
Polish.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -173,6 +173,12 @@ exports.resign = function (state, player) { } function goto_game_over(result, victory) { + if (result === P1) + victory = player_name(0) + " won:\n" + victory + else if (result === P2) + victory = player_name(1) + " won:\n" + victory + else + victory = result + ":\n" + victory game.state = "game_over" game.active = "None" game.result = result @@ -477,13 +483,13 @@ exports.setup = function (seed, scenario, options) { if (info.lore_text) { for (let line of info.lore_text.split("<p>")) - log(".i " + line) + log(".lore " + line) log("") } if (info.rule_text) { for (let line of info.rule_text.split("<p>")) - log(line) + log(".rule " + line) log("") } @@ -1468,6 +1474,7 @@ function goto_roll_phase() { } states.skip_action = { + inactive: "roll", prompt() { view.prompt = "Skipped action phase; roll the dice in your pool." @@ -1489,6 +1496,7 @@ states.skip_action = { } states.roll = { + inactive: "roll", prompt() { view.prompt = "Roll the dice in your pool." view.actions.roll = 1 @@ -1533,6 +1541,7 @@ function gen_place_dice_select_card() { } states.place = { + inactive: "place dice", prompt() { view.prompt = "Place dice on your formations." gen_place_dice_select_card() @@ -1549,6 +1558,7 @@ states.place = { } states.place_on_card = { + inactive: "place dice", prompt() { let card = data.cards[game.selected] view.prompt = "Place dice on " + card.name + "." @@ -2057,7 +2067,7 @@ function count_cards_remaining_from_wing(w) { function goto_start_turn() { let p = player_index() - log(".t" + p) + log(".p" + (p + 1)) if (check_impossible_to_attack_victory()) return @@ -2137,6 +2147,7 @@ function end_action_phase() { } states.action = { + inactive: "take an action", prompt() { view.prompt = "Take an action." view.actions.roll = 1 @@ -2300,6 +2311,7 @@ function can_shift_any_cavalry() { } states.shift_from = { + inactive: "shift sticks", prompt() { view.prompt = "Shift sticks from one Formation to another." let p = player_index() @@ -2320,6 +2332,7 @@ states.shift_from = { } states.shift_to = { + inactive: "shift sticks", prompt() { view.prompt = "Shift sticks from " + card_name(game.selected) + "." let p = player_index() @@ -2556,6 +2569,7 @@ function find_all_targets_of_command(c, a) { } states.bombard = { + inactive: "bombard", prompt() { view.prompt = "Bombard." view.actions.bombard = 1 @@ -2586,6 +2600,7 @@ function goto_attack_choose_target() { } states.attack_choose_target = { + inactive: "attack", prompt() { view.prompt = "Choose the target of your attack." let a = current_action() @@ -2784,6 +2799,7 @@ function update_attack2() { } states.attack = { + inactive: "attack", prompt() { view.prompt = "Attack " + card_name(game.target) + "." gen_action_card(game.target) @@ -2950,6 +2966,7 @@ function goto_command() { } states.command = { + inactive: "command", prompt() { let list = find_all_targets_of_command(game.selected, current_action()) view.prompt = "Bring " + list.map(c => card_name(c)).join(" and ") + " out of reserve." @@ -3162,6 +3179,7 @@ function take_wild_die_if_needed_for_reaction(c, ix) { } states.react = { + inactive: "react", prompt() { view.prompt = card_name(game.selected) + " attacks " + card_name(game.target) + "!" let voluntary = true @@ -3265,6 +3283,7 @@ function goto_screen(c, a) { } states.screen = { + inactive: "screen", prompt() { view.prompt = "Screen attack from " + card_name(game.selected) + "." view.actions.screen = 1 @@ -3345,6 +3364,7 @@ states.s29_meade = { } states.absorb = { + inactive: "absorb", prompt() { view.prompt = "Absorb attack from " + card_name(game.selected) + "." view.actions.absorb = 1 @@ -3413,6 +3433,7 @@ function goto_counterattack(c, a) { } states.counterattack = { + inactive: "counterattack", prompt() { view.prompt = "Counterattack " + card_name(game.selected) + "." view.actions.counterattack = 1 @@ -3631,6 +3652,7 @@ function resume_routing() { } states.routing = { + inactive: "remove routing and pursuing cards", prompt() { view.prompt = "Routing: Remove routing and pursuing cards from play!" for (let p = 0; p <= 1; ++p) { @@ -3762,6 +3784,7 @@ function bring_out_of_reserve(c) { } states.reserve = { + inactive: "enter reserves", prompt() { view.prompt = "Enter reserves!" for (let p = 0; p <= 1; ++p) |