From cdf79c9498e7657ad4031b86e9c26dbc86c4126c Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 1 May 2024 21:04:44 +0200 Subject: swift maneuver again --- rules.ts | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) (limited to 'rules.ts') diff --git a/rules.ts b/rules.ts index e27a12c..4f09186 100644 --- a/rules.ts +++ b/rules.ts @@ -6215,6 +6215,9 @@ function action_battle_events(c: Card) { case EVENT_YORK_SWIFT_MANEUVER: resume_battle_events() break + case EVENT_YORK_PATRICK_DE_LA_MOTE: + resume_battle_events() + break } } @@ -6586,17 +6589,36 @@ function is_swift_maneuver_in_play() { return is_event_in_play(EVENT_YORK_SWIFT_MANEUVER) } -states.swift_maneuver = { - inactive: "Swift Maneuver", +states.swift_maneuver_1 = { + get inactive() { + view.engaged = game.battle.engagements[0] + return format_strike_step() + }, prompt() { - view.prompt = "Swift Maneuver: You may end the battle round immediately." - view.actions.end_battle_round = 1 + view.prompt = "Swift Maneuver: Reroll routed retinue?" view.actions.pass = 1 - if (view.battle.reroll) - gen_action_routed_retinue(game.who) + gen_action_routed_retinue(game.who) }, routed_retinue(lord) { action_spend_valour(lord, RETINUE) + if (lord_has_routed_retinue(lord)) + this.pass() + else + finish_action_assign_hits(game.who) + }, + pass() { + game.battle.reroll = 0 + set_active_enemy() + game.state = "swift_maneuver_2" + }, +} + +states.swift_maneuver_2 = { + inactive: "Swift Maneuver", + prompt() { + view.prompt = "Swift Maneuver: You may end the battle round immediately." + view.actions.end_battle_round = 1 + view.actions.pass = 1 }, end_battle_round() { logevent(EVENT_YORK_SWIFT_MANEUVER) @@ -7044,7 +7066,6 @@ const ENGAGEMENTS = [[],[],[],[],[],[],[],[],[],[[0,3]],[[3,1]],[[0,1,3]],[[2,3] const ENGAGEMENTS_61 = [[[0,3,4],[2,5]],[[0,3],[2,4,5]]] const ENGAGEMENTS_47 = [[[0,1,3],[2,5]],[[0,3],[1,2,5]]] - function pack_battle_array() { let bits = 0 for (let p = 0; p < 6; ++p) @@ -7563,8 +7584,12 @@ function action_assign_hits(lord: Lord, type: Force, v=NOVASSAL) { // Swift Maneuver event if (is_swift_maneuver_in_play() && type === RETINUE) { - set_active_enemy() - game.state = "swift_maneuver" + if (game.battle.reroll) { + game.state = "swift_maneuver_1" + } else { + set_active_enemy() + game.state = "swift_maneuver_2" + } return } } -- cgit v1.2.3