summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-10 23:45:17 +0100
committerTor Andersson <tor@ccxvii.net>2023-12-10 23:45:17 +0100
commitdb5719847c9397bc96081ec805354a3dca61a1dd (patch)
tree5f74fd7a640a66bda9a8a861ffb1e900b992aa5a
parentd47baf1c5e9d0792fb17cd7e58cf9b7ca05058c2 (diff)
downloadnevsky-db5719847c9397bc96081ec805354a3dca61a1dd.tar.gz
Only check front choice / rear choice asserts if using that choice.
There may still be a potential problem lurking in strike_left_right or assign_left_right when both fc and rc are unset, and only fc is assigned...
-rw-r--r--rules.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/rules.js b/rules.js
index cb00bc0..5568525 100644
--- a/rules.js
+++ b/rules.js
@@ -8220,12 +8220,15 @@ function find_closest_target(A, B, C) {
}
function find_closest_target_center(T2) {
- if (game.battle.fc < 0) throw Error("unset front l/r choice")
- if (game.battle.rc < 0) throw Error("unset rear l/r choice")
if (filled(T2))
return T2
- if (T2 >= A1 && T2 <= D3)
+ if (T2 >= A1 && T2 <= D3) {
+ if (game.battle.fc < 0)
+ throw Error("unset front l/r choice")
return game.battle.fc
+ }
+ if (game.battle.rc < 0)
+ throw Error("unset rear l/r choice")
return game.battle.rc
}