summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-02-18 01:42:19 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 13:02:40 +0100
commitdfd3c5d2237016b630885a0d78b9b3a6aed05611 (patch)
treeee25a6675fbf8dd55de372e5e136be5e51059430
parent61c16c14e65695d8f1c7808f29948eac94975a6b (diff)
downloadnevsky-dfd3c5d2237016b630885a0d78b9b3a6aed05611.tar.gz
Fix graying out of ambushed lords.
-rw-r--r--play.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/play.js b/play.js
index b75109b..d7e851b 100644
--- a/play.js
+++ b/play.js
@@ -271,15 +271,17 @@ function is_lord_on_left_or_right(lord) {
function is_lord_ambushed(lord) {
if (view.battle) {
+ // ambush & 2 = attacker played ambush
+ // ambush & 1 = defender played ambush
if (view.battle.attacker === "Teutons") {
- if ((view.battle.ambush & 2) && is_p1_lord(lord))
+ if ((view.battle.ambush & 1) && is_p1_lord(lord))
return is_lord_on_left_or_right(lord)
- if ((view.battle.ambush & 1) && is_p2_lord(lord))
+ if ((view.battle.ambush & 2) && is_p2_lord(lord))
return is_lord_on_left_or_right(lord)
} else {
- if ((view.battle.ambush & 2) && is_p2_lord(lord))
+ if ((view.battle.ambush & 1) && is_p2_lord(lord))
return is_lord_on_left_or_right(lord)
- if ((view.battle.ambush & 1) && is_p1_lord(lord))
+ if ((view.battle.ambush & 2) && is_p1_lord(lord))
return is_lord_on_left_or_right(lord)
}
}