diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-09-03 23:02:34 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-09-03 23:02:34 +0200 |
commit | 02490b07af89cffbb72c859677dff333a296f5c5 (patch) | |
tree | 4a72dd21253bc77a2f2d3715c9adcd37432944f1 /resources/js | |
parent | 5514b5912143fd96d57eb71525663c630ce57bb3 (diff) |
fix battle lost and on leave area event
Diffstat (limited to 'resources/js')
-rw-r--r-- | resources/js/game.js | 6 |
1 files changed, 5 insertions, 1 deletions
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) { |