diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-13 17:13:23 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | 58d9092f805c1e3563a11fc82606d8d0e50b17fe (patch) | |
tree | 7b8fd9534df310bec626d750179c8aeecaa16323 /rules.js | |
parent | 1b00669d128090cc5c12f9a4223a19498fa746c3 (diff) | |
download | table-battles-58d9092f805c1e3563a11fc82606d8d0e50b17fe.tar.gz |
Better action skipping check.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -555,7 +555,7 @@ function is_routed(c) { function card_has_attack_with_valid_target(c) { for (let a of data.cards[c].actions) { if (a.type === "Attack") { - let attack_reserve = card_has_rule("attack_reserve") + let attack_reserve = card_has_rule(c, "attack_reserve") for (let t of a.target_list) { if (is_card_in_play(t)) return true @@ -1450,6 +1450,13 @@ function check_dice_requirement(c, req, wild) { } } +function card_has_any_actions(c) { + for (let a of data.cards[c].actions) + if (is_action(c, a)) + return true + return false +} + function is_action(c, a) { return (a.type === "Bombard" || a.type === "Attack" || a.type === "Command") } @@ -1506,10 +1513,12 @@ function can_take_action(c, a) { function can_take_any_action() { let p = player_index() for (let c of game.front[p]) { - if (has_any_dice_on_card(c)) - return true - if (has_any_cubes_on_card(c)) // TODO: check requirements! - return true + if (card_has_any_actions(c)) { + if (has_any_dice_on_card(c)) + return true + if (has_any_cubes_on_card(c)) // TODO: check requirements! + return true + } } return false } |