summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
}
}