summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-07-22 11:34:27 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:39 +0100
commitc5bd03c1c31830e027ff75134ad80f5e2a8caf84 (patch)
treeae75fa7063cd9494254831c9cdc6a9cbed1e0db9
parentd29767d6c588c6ed049b9c62fe84cfbc05ce1b1e (diff)
downloadcrusader-rex-c5bd03c1c31830e027ff75134ad80f5e2a8caf84.tar.gz
crusader: Fix bug in Jihad selection and display.
Enemy of null is null!
-rw-r--r--rules.js9
-rw-r--r--ui.js2
2 files changed, 6 insertions, 5 deletions
diff --git a/rules.js b/rules.js
index 250b6c6..58c0028 100644
--- a/rules.js
+++ b/rules.js
@@ -136,7 +136,9 @@ function print_summary(text, skip_if_empty = false) {
}
function enemy(p) {
- return (p === FRANKS) ? SARACENS : FRANKS;
+ if (p === FRANKS) return SARACENS;
+ if (p === SARACENS) return FRANKS;
+ return null;
}
function is_inactive_player(current) {
@@ -3644,6 +3646,7 @@ function make_battle_view() {
round: game.combat_round,
show_castle: game.show_castle,
show_field: game.show_field,
+ town: game.where,
};
if (is_under_siege(game.where) && !is_contested_battle_field(game.where))
@@ -3654,10 +3657,8 @@ function make_battle_view() {
battle.title += " \u2014 Combat Deployment";
else
battle.title += " \u2014 Round " + game.combat_round + " of 3";
- if (game.where === game.jihad) {
- battle.jihad = game.attacker[game.where];
+ if (game.where === game.jihad)
battle.title += " \u2014 Jihad!";
- }
function fill_cell(cell, owner, fn) {
for (let b in BLOCKS)
diff --git a/ui.js b/ui.js
index 22cbf08..41fe99e 100644
--- a/ui.js
+++ b/ui.js
@@ -668,7 +668,7 @@ function update_battle() {
class_name += " selected";
if (block === game.battle.halfhit)
class_name += " halfhit";
- if (game.battle.jihad === block_owner(block))
+ if (game.jihad === game.battle.town && block_owner(block) === game.p1)
class_name += " jihad";
if (game.battle.sallying.includes(block))