diff options
-rw-r--r-- | rules.js | 50 |
1 files changed, 35 insertions, 15 deletions
@@ -397,26 +397,28 @@ exports.setup = function (seed, scenario, options) { log(".h1 " + info.name) log(".h2 " + info.date) log("") + + if (info.players[0].tactical > 0 || info.players[1].tactical > 0) { + log("Tactical Victory:") + if (info.players[0].tactical > 0) + log(">" + player_name(0) + ": " + info.players[0].tactical) + if (info.players[1].tactical > 0) + log(">" + player_name(1) + ": " + info.players[1].tactical) + log("") + } + if (info.lore_text) { for (let line of info.lore_text.split("<p>")) log(line) log("") } + if (info.rule_text) { for (let line of info.rule_text.split("<p>")) log(line) log("") } - if (info.players[0].tactical > 0 || info.players[1].tactical > 0) { - log("Tactical Victory:") - if (info.players[0].tactical > 0) - log(">" + player_name(0) + ": " + info.players[0].tactical) - if (info.players[1].tactical > 0) - log(">" + player_name(1) + ": " + info.players[1].tactical) - log("") - } - if (game.scenario === S37_INKERMAN) { map_set(game.cubes, S37_THE_FOG, 3) } @@ -435,6 +437,14 @@ function count_total_cubes() { return n } +function is_infantry(c) { + return !!data.cards[c].infantry +} + +function is_cavalry(c) { + return !!data.cards[c].cavalry +} + function card_has_rule(c, name) { let rules = data.cards[c].rules if (rules) @@ -1598,6 +1608,8 @@ function check_cube_requirement(c, req) { function check_dice_requirement(c, req, wild) { switch (req) { + case "Three Dice": + return count_dice_on_card(c) >= 3 case "Full House": return require_full_house(c) case "Pair": @@ -2046,7 +2058,7 @@ function find_first_target_of_command(c, a) { return -1 } -function find_all_targets_of_command(a) { +function find_all_targets_of_command(c, a) { let list = [] for (let t of a.target_list) { if (is_card_in_reserve(t)) @@ -2211,17 +2223,25 @@ function update_attack1() { game.hits *= 2 } + // Oblique Attack (CAL expansion rule) + if (is_infantry(game.selected)) { + if (get_sticks(game.selected) >= get_sticks(game.target) + 3) + game.hits += 1 + } + let extra = card_has_rule(game.selected, "extra_hit_if_dice_on") if (extra && has_any_dice_on_card(extra[0])) game.hits += 1 - if (card_has_rule(game.target, "suffer_1_less_1_max")) - game.hits = clamp(game.hits - 1, 0, 1) - if (card_has_rule(game.target, "suffer_1_less")) + // Linked Formations (TGA and CAL expansion rule) + if (card_has_active_link(game.target)) game.hits = Math.max(0, game.hits - 1) - if (card_has_active_link(game.target)) + if (card_has_rule(game.target, "suffer_1_less")) game.hits = Math.max(0, game.hits - 1) + + if (card_has_rule(game.target, "suffer_1_less_1_max")) + game.hits = clamp(game.hits - 1, 0, 1) } // Update hits and self hits for defensive abilities that redirect or steal hits. @@ -2354,7 +2374,7 @@ function goto_command() { states.command = { prompt() { - let list = find_all_targets_of_command(current_action()) + 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." for (let t of list) gen_action_card(t) |