summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-01-02 14:05:39 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 13:02:38 +0100
commit8079668cc99b1567d27a7373c19d02baf306c3a7 (patch)
treea9a8bba096d75c7e30fb43399ae41b96f9da2997 /rules.js
parentbb70ac09b955ab1ee3783d73181f9f0a32d4b764 (diff)
downloadnevsky-8079668cc99b1567d27a7373c19d02baf306c3a7.tar.gz
Fix valid target check.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index e8ea2ee..8dce106 100644
--- a/rules.js
+++ b/rules.js
@@ -3,6 +3,10 @@
// TODO: hit remainders
// TODO: choose crossbow/normal hit application order
+// TODO: Halbbruder
+// TODO: Trebuchets
+// TODO: Warrior Monks
+
// TODO: precompute distance to supply lines for faster supply path rejection
// TODO - precompute possible supply lines for faster rejections
// Use BFS for winter/rasputitsa supply
@@ -6951,11 +6955,19 @@ function is_flanked_target() {
return false
}
+function has_valid_target() {
+ if (game.battle.storm && game.active === game.battle.attacker && game.battle.garrison)
+ return true
+ return game.battle.hg.length > 0
+}
+
function goto_apply_hits() {
set_active_enemy()
- if (game.battle.hg.length === 0)
+ if (!has_valid_target()) {
end_apply_hits()
+ return
+ }
if (has_sa_without_rd()) {
console.log("SA without RD (getting hit)")