diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-08-31 20:23:06 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-08-31 20:23:06 +0200 |
commit | c657c77d0cf49afba627b93848e1915e2ce7d3ff (patch) | |
tree | 5d96a65df277f52558cd5ff84f2fefbf4480a926 /resources/js/game.js | |
parent | 7f6ab8779bd143b1b5f3465e3681abcbc113d19d (diff) |
story and npcs
Diffstat (limited to 'resources/js/game.js')
-rw-r--r-- | resources/js/game.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/resources/js/game.js b/resources/js/game.js index fb25ea4..2c6ecc0 100644 --- a/resources/js/game.js +++ b/resources/js/game.js @@ -26,6 +26,7 @@ const Game = { isProgressingTurn: false, playerIsChoosingNextMonster: false, isStoryBattle: false, + didWinStoryBattle: true, doBattleAnimation: true, opponentActionTimeout: null, didTechniqueHit: false, @@ -127,6 +128,7 @@ const Game = { UI.showMap(); } + Game.didWinStoryBattle = true; Game.isStoryBattle = false; } else { await Game.encounterNextTrainerMonster(); @@ -151,6 +153,7 @@ const Game = { // whole party defeated if (!Memory.state.player.monsters.some((monster) => monster.hp > 0)) { Memory.state.Game.isInBattle = false; + Game.didWinStoryBattle = false; Game.isStoryBattle = false; if (Memory.state.currentArea.monsterProgress < Memory.state.currentArea.requiredEncounters) { @@ -161,16 +164,10 @@ const Game = { await Game.goToArea(Memory.state.lastVisitedTown); // heal all monsters full - let totalHealingCenterPrice = 0; - for (const monster of Memory.state.player.monsters) { - monster.hp = monster.stats.hp; - monster.statusEffect = null; - - // pay healing center - const healingCenterPrice = Object.values(Memory.state.currentArea.locations).find((location) => location.type === 'healingCenter').price; - totalHealingCenterPrice += healingCenterPrice; - } + Game.healParty(); + const healingCenterPrice = Object.values(Memory.state.currentArea.locations).find((location) => location.type === 'healingCenter').price; + const totalHealingCenterPrice = healingCenterPrice * Memory.state.player.monsters.length; Memory.state.money -= totalHealingCenterPrice; Game.addPhaseEvent('postTurnEnd', () => { @@ -1006,6 +1003,13 @@ const Game = { monster.evolve(monster.evolutions[0]); }, + healParty () { + for (const monster of Memory.state.player.monsters) { + monster.hp = monster.stats.hp; + monster.statusEffect = null; + } + }, + /** * @param {string} type * |