summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-16 16:54:20 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commit02da527ebfd7455706e0adf79f1ee1a0ec699e1f (patch)
treeb70704cc21c5a2956e0726cb536e14a43570d1c7 /rules.js
parentaf6aa3ec9445ddf8cfeebd0810c6f123c4a11b2a (diff)
downloadtable-battles-02da527ebfd7455706e0adf79f1ee1a0ec699e1f.tar.gz
Strict order for Absorb with ","
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index 29cf2a2..66e0930 100644
--- a/rules.js
+++ b/rules.js
@@ -2400,7 +2400,7 @@ function goto_take_action(c, ix) {
game.action = ix
switch (a.type) {
case "Attack":
- if (card_has_rule(game.selected, "attack_choose_target"))
+ if (a.choice)
goto_attack_choose_target()
else
goto_attack(find_target_of_attack(c, a))
@@ -2436,7 +2436,16 @@ function find_target_of_attack(c, a) {
}
function find_target_of_counterattack(a) {
- // Note: only used for no-choice counterattacks
+ 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
+ }
+ return -1
+}
+
+function find_target_of_absorb(a) {
for (let t of a.target_list) {
if (set_has(game.front[0], t))
return t
@@ -3036,8 +3045,13 @@ function can_take_reaction(c, a, wild) {
case "Absorb":
// if attack target is listed on absorb action
- if (!a.target_list.includes(game.target))
- return false
+ if (a.choice) {
+ if (!a.target_list.includes(game.target))
+ return false
+ } else {
+ if (find_target_of_absorb(a) !== game.target)
+ return false
+ }
break
}