diff options
Diffstat (limited to 'resources/js/game.js')
-rw-r--r-- | resources/js/game.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/resources/js/game.js b/resources/js/game.js index c64d744..c463ab8 100644 --- a/resources/js/game.js +++ b/resources/js/game.js @@ -179,7 +179,7 @@ const Game = { else { Game.playerIsChoosingNextMonster = true; const monsterSelectionNode = UI.createPlayerDefeatedMonsterSelection(); - monsterSelectionNode.addEventListener('monster:selected', UI.createEventListener(() => Memory.saveToLocalStorage())); + monsterSelectionNode.addEventListener('monster:selected', UI.wrapCallback(() => Memory.saveToLocalStorage())); UI.openPlayerDefeatedMonsterSelection(monsterSelectionNode); } } @@ -570,7 +570,7 @@ const Game = { else if (levelDifference <= -10) levelDifference = levelDifference / 10; const opponentActiveMonster = Memory.state.opponent.activeMonster; - Game.opponentActionTimeout = setTimeout(async () => { + Game.opponentActionTimeout = setTimeout(UI.wrapCallback(async () => { if (opponentActiveMonster.hp <= 0) { Game.opponentActionTimeout = null; return; @@ -592,7 +592,7 @@ const Game = { } Game.opponentActionTimeout = null; - }, Math.max(levelDifference < 10 ? 500 : 50, Math.min(2000 - (speedDifference * 10) - (levelDifference * 100), 3000))); + }), Math.max(levelDifference < 10 ? 500 : 50, Math.min(2000 - (speedDifference * 10) - (levelDifference * 100), 3000))); console.log( 'Opponent Attack Timeout', Memory.state.opponent.activeMonster.stats.speed, Memory.state.player.activeMonster.stats.speed, @@ -999,7 +999,7 @@ const Game = { }; // Game click bindings -UI.elements.nextTrainer.addEventListener('click', UI.createEventListener(Game.encounterTrainer)); -UI.elements.battleOpponent.addEventListener('click', UI.createEventListener(Game.battleClick)); -UI.elements.techniques.addEventListener('click', UI.createEventListener(Game.techniqueClick)); -UI.elements.menuCatch.addEventListener('click', UI.createEventListener(Game.catchMonster)); +UI.elements.nextTrainer.addEventListener('click', UI.wrapCallback(Game.encounterTrainer)); +UI.elements.battleOpponent.addEventListener('click', UI.wrapCallback(Game.battleClick)); +UI.elements.techniques.addEventListener('click', UI.wrapCallback(Game.techniqueClick)); +UI.elements.menuCatch.addEventListener('click', UI.wrapCallback(Game.catchMonster)); |