From 11d0624f825a0c3c580e1e3991dfdda274b822b3 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 1 Oct 2024 14:23:07 +0200 Subject: Require at least one Lord to be saved with Escape Ships/Talbot/Warden. A common mistake is to click "Done" too soon and pass on the event effect. --- rules.js | 15 ++++++++++++--- rules.ts | 17 ++++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/rules.js b/rules.js index 2f6287a..1cb802f 100644 --- a/rules.js +++ b/rules.js @@ -7447,6 +7447,7 @@ function search_escape_ship(start) { function goto_play_escape_ship() { game.state = "escape_ship"; game.who = NOBODY; + game.count = 0; } states.escape_ship = { inactive: "Escape Ship", @@ -7455,7 +7456,8 @@ states.escape_ship = { for (let lord of game.battle.routed) if (is_friendly_lord(lord)) gen_action_lord(lord); - view.actions.done = 1; + if (game.count > 0) + view.actions.done = 1; }, lord(lord) { push_undo(); @@ -7463,6 +7465,7 @@ states.escape_ship = { exile_lord(lord, false); set_delete(game.battle.fled, lord); set_delete(game.battle.routed, lord); + game.count++; }, done() { push_undo(); @@ -7476,6 +7479,7 @@ function can_play_talbot_to_the_rescue() { } function goto_play_talbot_to_the_rescue() { game.state = "talbot_to_the_rescue"; + game.count = 0; } states.talbot_to_the_rescue = { inactive: "Talbot to the Rescue", @@ -7484,13 +7488,15 @@ states.talbot_to_the_rescue = { for (let lord of game.battle.routed) if (is_friendly_lord(lord)) gen_action_lord(lord); - view.actions.done = 1; + if (game.count > 0) + view.actions.done = 1; }, lord(lord) { push_undo(); disband_lord(lord); set_delete(game.battle.fled, lord); set_delete(game.battle.routed, lord); + game.count++; }, done() { push_undo(); @@ -7511,6 +7517,7 @@ function can_play_warden_of_the_marches() { function goto_play_warden_of_the_marches() { game.state = "warden_of_the_marches"; game.where = NOWHERE; + game.count = 0; } states.warden_of_the_marches = { inactive: "Warden of the Marches", @@ -7534,7 +7541,8 @@ states.warden_of_the_marches = { } if (done) view.prompt = "Warden of the Marches: All done."; - view.actions.done = 1; + if (game.count > 0) + view.actions.done = 1; } }, locale(loc) { @@ -7553,6 +7561,7 @@ states.warden_of_the_marches = { set_lord_locale(lord, game.where); // vassals are disbanded in usual death check state // lords without troops are disbanded during aftermath + game.count++; }, done() { push_undo(); diff --git a/rules.ts b/rules.ts index 006a8f8..a087429 100644 --- a/rules.ts +++ b/rules.ts @@ -8729,6 +8729,7 @@ function search_escape_ship(start: Locale) { function goto_play_escape_ship() { game.state = "escape_ship" game.who = NOBODY + game.count = 0 } states.escape_ship = { @@ -8738,7 +8739,8 @@ states.escape_ship = { for (let lord of game.battle.routed) if (is_friendly_lord(lord)) gen_action_lord(lord) - view.actions.done = 1 + if (game.count > 0) + view.actions.done = 1 }, lord(lord) { push_undo() @@ -8748,6 +8750,8 @@ states.escape_ship = { set_delete(game.battle.fled, lord) set_delete(game.battle.routed, lord) + + game.count++ }, done() { push_undo() @@ -8764,6 +8768,7 @@ function can_play_talbot_to_the_rescue() { function goto_play_talbot_to_the_rescue() { game.state = "talbot_to_the_rescue" + game.count = 0 } states.talbot_to_the_rescue = { @@ -8773,13 +8778,15 @@ states.talbot_to_the_rescue = { for (let lord of game.battle.routed) if (is_friendly_lord(lord)) gen_action_lord(lord) - view.actions.done = 1 + if (game.count > 0) + view.actions.done = 1 }, lord(lord) { push_undo() disband_lord(lord) set_delete(game.battle.fled, lord) set_delete(game.battle.routed, lord) + game.count++ }, done() { push_undo() @@ -8803,6 +8810,7 @@ function can_play_warden_of_the_marches() { function goto_play_warden_of_the_marches() { game.state = "warden_of_the_marches" game.where = NOWHERE + game.count = 0 } states.warden_of_the_marches = { @@ -8826,7 +8834,8 @@ states.warden_of_the_marches = { } if (done) view.prompt = "Warden of the Marches: All done." - view.actions.done = 1 + if (game.count > 0) + view.actions.done = 1 } }, locale(loc) { @@ -8852,6 +8861,8 @@ states.warden_of_the_marches = { // vassals are disbanded in usual death check state // lords without troops are disbanded during aftermath + + game.count++ }, done() { push_undo() -- cgit v1.2.3