summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js27
1 files changed, 17 insertions, 10 deletions
diff --git a/rules.js b/rules.js
index 276bd82..c92b2ba 100644
--- a/rules.js
+++ b/rules.js
@@ -2413,18 +2413,25 @@ function current_action() {
}
function find_target_of_attack(c, a) {
- let in_res = card_has_rule(c, "attack_reserve")
- for (let t of a.target_list) {
- if (set_has(game.front[0], t))
- return t
- if (set_has(game.front[1], t))
- return t
- if (in_res) {
- if (set_has(game.reserve[0], t))
+ if (card_has_rule(c, "attack_reserve")) {
+ for (let t of a.target_list)
+ if (is_card_in_play_or_reserve(t))
return t
- if (set_has(game.reserve[1], t))
+ return -1
+ }
+
+ if (card_has_rule(c, "ignore_reserve")) {
+ for (let t of a.target_list)
+ if (is_card_in_play(t))
return t
- }
+ return -1
+ }
+
+ for (let t of a.target_list) {
+ if (is_card_in_play(t))
+ return t
+ if (is_card_in_reserve(t))
+ return -1
}
return -1
}