From 0779bd97f74d1b058af46eb3a28296553978dcc4 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 14 Jul 2024 13:06:58 +0200 Subject: fix death check events to only allow saving friendly lords --- rules.js | 14 +++++++++----- rules.ts | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/rules.js b/rules.js index 9b738e6..901bfea 100644 --- a/rules.js +++ b/rules.js @@ -7437,7 +7437,8 @@ states.escape_ship = { prompt() { view.prompt = "Escape Ship: Choose lords to go to exile."; for (let lord of game.battle.routed) - gen_action_lord(lord); + if (is_friendly_lord(lord)) + gen_action_lord(lord); view.actions.done = 1; }, lord(lord) { @@ -7465,7 +7466,8 @@ states.talbot_to_the_rescue = { prompt() { view.prompt = "Talbot to the Rescue: Disband routed Lancastrians instead of rolling for death."; for (let lord of game.battle.routed) - gen_action_lord(lord); + if (is_friendly_lord(lord)) + gen_action_lord(lord); view.actions.done = 1; }, lord(lord) { @@ -7507,9 +7509,11 @@ states.warden_of_the_marches = { view.prompt = `Warden of the Marches: Move routed Lancastrians to ${locale_name[game.where]}.`; let done = true; for (let lord of game.battle.routed) { - if (is_move_allowed(lord, game.where)) { - gen_action_lord(lord); - done = false; + if (is_friendly_lord(lord)) { + if (is_move_allowed(lord, game.where)) { + gen_action_lord(lord); + done = false; + } } } if (done) diff --git a/rules.ts b/rules.ts index ed8ad65..8d67771 100644 --- a/rules.ts +++ b/rules.ts @@ -8719,7 +8719,8 @@ states.escape_ship = { prompt() { view.prompt = "Escape Ship: Choose lords to go to exile." for (let lord of game.battle.routed) - gen_action_lord(lord) + if (is_friendly_lord(lord)) + gen_action_lord(lord) view.actions.done = 1 }, lord(lord) { @@ -8753,7 +8754,8 @@ states.talbot_to_the_rescue = { prompt() { view.prompt = "Talbot to the Rescue: Disband routed Lancastrians instead of rolling for death." for (let lord of game.battle.routed) - gen_action_lord(lord) + if (is_friendly_lord(lord)) + gen_action_lord(lord) view.actions.done = 1 }, lord(lord) { @@ -8798,9 +8800,11 @@ states.warden_of_the_marches = { view.prompt = `Warden of the Marches: Move routed Lancastrians to ${locale_name[game.where]}.` let done = true for (let lord of game.battle.routed) { - if (is_move_allowed(lord, game.where)) { - gen_action_lord(lord) - done = false + if (is_friendly_lord(lord)) { + if (is_move_allowed(lord, game.where)) { + gen_action_lord(lord) + done = false + } } } if (done) -- cgit v1.2.3