From 02490b07af89cffbb72c859677dff333a296f5c5 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 3 Sep 2023 23:02:34 +0200 Subject: fix battle lost and on leave area event --- resources/js/game.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/js/game.js b/resources/js/game.js index c2b20da..61e2211 100644 --- a/resources/js/game.js +++ b/resources/js/game.js @@ -27,6 +27,7 @@ const Game = { playerIsChoosingNextMonster: false, isStoryBattle: false, didWinStoryBattle: true, + didJustLoseBattle: false, doBattleAnimation: true, opponentActionTimeout: null, didTechniqueHit: false, @@ -183,6 +184,7 @@ const Game = { // whole party defeated if (!Memory.state.player.monsters.some((monster) => monster.hp > 0)) { Memory.state.Game.isInBattle = false; + Game.didJustLoseBattle = true; Game.didWinStoryBattle = false; Game.isStoryBattle = false; @@ -220,6 +222,8 @@ const Game = { UI.openPlayerDefeatedMonsterSelection(monsterSelectionNode); } } + + Game.didJustLoseBattle = false; }, /** @@ -816,7 +820,7 @@ const Game = { // on leave let onLeaveStoryIsDone = true; - if (Memory.state.currentArea.events?.onLeave?.length > 0) { + if (Memory.state.currentArea.events?.onLeave?.length > 0 && !Game.didJustLoseBattle) { Game.isLoadingArea = false; for (const event of Memory.state.currentArea.events.onLeave) { -- cgit v1.2.3