summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorteisuru <31881306+teisuru@users.noreply.github.com>2024-01-17 14:34:35 +0100
committerteisuru <31881306+teisuru@users.noreply.github.com>2024-01-17 14:34:35 +0100
commitd4774e63860985a92ed8b2d449864b4647d983f6 (patch)
treec4625980c6bf8896182258684a6db61212d4259b
parentb446b7f31d0b6e965362369f85ac6c812b451c2d (diff)
downloadplantagenet-d4774e63860985a92ed8b2d449864b4647d983f6.tar.gz
Fuzzer fix clear_undo & game.where
Unset game.where after supply and clear_undo after set_active_enemy
-rw-r--r--rules.js13
1 files 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) {