From 989b724efe131bbe8d6d2d58e3979a4800cd3340 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 5 Jan 2023 19:47:25 +0100 Subject: Ambush in Battle. --- rules.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/rules.js b/rules.js index cb19388..9d95887 100644 --- a/rules.js +++ b/rules.js @@ -12,6 +12,7 @@ // FIXME: lift_sieges / besieged needs checking! // FIXME: remove_legate_if_endangered needs checking! +// GUI: show sally/relief sally as unbesieged on map // GUI: show siegeworks + walls on battle mat for protection indication // GUI: show feed x2 on lord mats with > 6 units // GUI: battle mat - optional - either mat in middle, or garrison + siegeworks display @@ -6392,6 +6393,8 @@ function could_play_card(c) { function can_play_battle_events() { if (!game.battle.storm) { if (game.active === TEUTONS) { + if (could_play_card(EVENT_TEUTONIC_AMBUSH)) + return true if (game.active !== game.battle.attacker) { if (could_play_card(EVENT_TEUTONIC_HILL)) return true @@ -6405,6 +6408,8 @@ function can_play_battle_events() { } if (game.active === RUSSIANS) { + if (could_play_card(EVENT_RUSSIAN_AMBUSH)) + return true if (game.active !== game.battle.attacker) { if (could_play_card(EVENT_RUSSIAN_HILL)) return true @@ -6435,6 +6440,7 @@ function prompt_battle_events() { // both attacker and defender events if (game.active === TEUTONS) { if (!game.battle.storm) { + gen_action_card_if_held(EVENT_TEUTONIC_AMBUSH) if (!is_winter()) gen_action_card_if_held(EVENT_TEUTONIC_BRIDGE) } @@ -6443,6 +6449,7 @@ function prompt_battle_events() { if (game.active === RUSSIANS) { if (!game.battle.storm) { + gen_action_card_if_held(EVENT_RUSSIAN_AMBUSH) if (!is_winter()) gen_action_card_if_held(EVENT_RUSSIAN_BRIDGE) if (is_summer()) @@ -6498,8 +6505,10 @@ 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: @@ -7115,10 +7124,44 @@ function pack_battle_array_rear() { return x } +function clear_attacker_flank_bits(x, a, b) { + return x & ~(1<