summaryrefslogtreecommitdiff
path: root/resources/js/game.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/js/game.js')
-rw-r--r--resources/js/game.js22
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
*