From 11e9ca1a0d8699dadf296c3bee7f922588a61195 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 10 Mar 2023 12:15:04 +0100 Subject: Add confirmation when approaching enemy Lord. --- play.js | 1 + rules.js | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/play.js b/play.js index 70302bd..b3e2f56 100644 --- a/play.js +++ b/play.js @@ -1755,6 +1755,7 @@ function on_update() { action_button("hold", "Hold") action_button("play", "Play") + action_button("approach", "Approach") action_button("concede", "Concede") action_button("battle", "Battle") diff --git a/rules.js b/rules.js index 4565437..a2e5737 100644 --- a/rules.js +++ b/rules.js @@ -1659,6 +1659,9 @@ exports.setup = function (seed, scenario, options) { spoils: 0, } + if (options.skip_confirm_approach) + game.skip_confirm_approach = 1 + update_aliases() log_h1(scenario) @@ -4867,7 +4870,7 @@ function march_with_group_2() { remove_legate_if_endangered(from) if (has_unbesieged_enemy_lord(to)) { - goto_avoid_battle() + goto_confirm_approach() } else { march_with_group_3() } @@ -4908,6 +4911,26 @@ function march_with_group_3() { update_supply_possible() } +function goto_confirm_approach() { + if (game.skip_confirm_approach) { + goto_avoid_battle() + return + } + game.state = "confirm_approach" +} + +states.confirm_approach = { + inactive: "March", + prompt() { + view.prompt = `March: Confirm Approach to enemy Lord.` + view.group = game.group + view.actions.approach = 1 + }, + approach() { + goto_avoid_battle() + } +} + // === ACTION: MARCH - AVOID BATTLE === function count_besieged_lords(loc) { -- cgit v1.2.3