From 708bc14b8bb408e9ea916869ee90d0b9c29450d2 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 5 Jan 2023 20:23:47 +0100 Subject: Ambush in Battle - Relief Sally. --- rules.js | 71 +++++++++++++++++++++------------------------------------------- 1 file changed, 23 insertions(+), 48 deletions(-) diff --git a/rules.js b/rules.js index 394f01d..99d828a 100644 --- a/rules.js +++ b/rules.js @@ -5987,6 +5987,7 @@ function init_battle(here, is_storm, is_sally) { sally: is_sally, relief: 0, attacker: game.active, + ambush: 0, conceded: 0, loser: 0, array: [ @@ -6513,10 +6514,8 @@ function action_battle_events(c) { set_delete(current_hand(), c) set_add(game.events, c) switch (c) { - case EVENT_TEUTONIC_AMBUSH: case EVENT_TEUTONIC_HILL: case EVENT_TEUTONIC_MARSH: - case EVENT_RUSSIAN_AMBUSH: case EVENT_RUSSIAN_HILL: case EVENT_RUSSIAN_MARSH: case EVENT_RUSSIAN_RAVENS_ROCK: @@ -6524,6 +6523,14 @@ function action_battle_events(c) { log(`Played E${c}.`) resume_battle_events() break + case EVENT_TEUTONIC_AMBUSH: + case EVENT_RUSSIAN_AMBUSH: + log(`Played E${c}.`) + if (game.active === game.battle.attacker) + game.battle.ambush |= 2 + else + game.battle.ambush |= 1 + break case EVENT_TEUTONIC_BRIDGE: case EVENT_RUSSIAN_BRIDGE: // must select target lord @@ -7113,7 +7120,9 @@ function select_lone_defender() { return D2 if (array[D1] === NOBODY && array[D2] === NOBODY && array[D3] !== NOBODY) return D3 - return -1 + if (array[D1] === NOBODY && array[D2] === NOBODY && array[D3] === NOBODY) + return 0 // no target! + return -1 // choice of target } function pack_battle_array_front() { @@ -7132,43 +7141,9 @@ function pack_battle_array_rear() { return x } -function clear_attacker_flank_bits(x, a, b) { - return x & ~(1< count_siege_markers(game.battle.where)) { game.battle.loser = game.battle.attacker -- cgit v1.2.3