From dfd3c5d2237016b630885a0d78b9b3a6aed05611 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 18 Feb 2023 01:42:19 +0100 Subject: Fix graying out of ambushed lords. --- play.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'play.js') 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) } } -- cgit v1.2.3