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.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/resources/js/game.js b/resources/js/game.js
index 833265e..1a95ce4 100644
--- a/resources/js/game.js
+++ b/resources/js/game.js
@@ -38,8 +38,7 @@ const Game = {
Memory.state.player.activeMonster.levelUp();
}
if (Memory.state.player.activeMonster.canEvolve()) {
- await fetchMonster(Memory.state.player.activeMonster.evolutions[0].monster_slug);
- Memory.state.player.activeMonster.evolve();
+ await Game.evolveMonster(Memory.state.player.activeMonster);
}
await Game.spawnOpponentMonster();
@@ -63,6 +62,7 @@ const Game = {
// recharge
if (technique.isRecharging()) {
const feedbackNode = UI.createActionFeedback('recharge');
+ feedbackNode.classList.add('recharge');
UI.drawActionFeedback(feedbackNode);
canUse = false;
@@ -300,6 +300,14 @@ const Game = {
});
},
+ /**
+ * @param {Monster} monster
+ */
+ async evolveMonster (monster) {
+ await fetchMonster(monster.evolutions[0].monster_slug);
+ monster.evolve(monster.evolutions[0]);
+ },
+
async spawnOpponentMonster () {
Memory.state.opponent.activeMonster = await fetchMonster(DB.allMonsters[Math.floor(Math.random() * DB.allMonsters.length)]);
Memory.state.opponent.activeMonster.level = Math.ceil(Math.random() * Memory.state.player.activeMonster.level);