From d4774e63860985a92ed8b2d449864b4647d983f6 Mon Sep 17 00:00:00 2001 From: teisuru <31881306+teisuru@users.noreply.github.com> Date: Wed, 17 Jan 2024 14:34:35 +0100 Subject: Fuzzer fix clear_undo & game.where Unset game.where after supply and clear_undo after set_active_enemy --- rules.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/rules.js b/rules.js index 9bf401b..eed8d54 100644 --- a/rules.js +++ b/rules.js @@ -709,8 +709,12 @@ function set_active(new_active) { } } -function set_active_enemy() { - set_active(enemy_player()) +function set_active(new_active) { + if (game.active !== new_active) { + clear_undo() // here + game.active = new_active + update_aliases() + } } function enemy_player() { @@ -5887,6 +5891,7 @@ function goto_intercept() { function end_intercept() { game.intercept_group = 0 game.who = NOBODY + clear_undo() set_active_enemy() goto_exiles() } @@ -6026,6 +6031,7 @@ function goto_intercept_exiles() { } function end_intercept_exiles() { + clear_undo() set_active_enemy() end_intercept() } @@ -6396,9 +6402,11 @@ states.select_supply_type = { }, stronghold() { use_stronghold_supply(game.where, get_stronghold_supply_amount(game.where)) + game.where = NOWHERE }, port() { use_port_supply(game.where, get_port_supply_amount(game.where)) + game.where = NOWHERE }, } @@ -7844,7 +7852,6 @@ function end_flee() { end_battle_round() return } - set_active_enemy() if (game.active !== game.battle.attacker) { -- cgit v1.2.3