From 218da95a4b387ee5ac25f168d1529419039f2e54 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sat, 19 Aug 2023 13:18:54 +0200 Subject: refactor: enemy -> opponent, State.monsters~ -> State.Trainer.monsters --- resources/js/main.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'resources/js/main.js') diff --git a/resources/js/main.js b/resources/js/main.js index d5bf6fe..a3568bf 100644 --- a/resources/js/main.js +++ b/resources/js/main.js @@ -3,10 +3,13 @@ const possibleStarterMonsters = ['budaye', 'dollfin', 'grintot', 'ignibus', 'memnomnom']; - // state.enemy.monster = await fetchMonster('grintot'); - state.enemy.monster = await fetchMonster(possibleStarterMonsters[Math.round(Math.random() * (possibleStarterMonsters.length - 1))]); + Memory.state.opponent = new Trainer(); + Memory.state.opponent.monsters = [ + await fetchMonster(possibleStarterMonsters[Math.round(Math.random() * (possibleStarterMonsters.length - 1))]) + ]; - state.partyMonsters = [ + Memory.state.player = new Trainer(); + Memory.state.player.monsters = [ await fetchMonster('dollfin'), await fetchMonster(possibleStarterMonsters[Math.round(Math.random() * (possibleStarterMonsters.length - 1))]), await fetchMonster('corvix'), @@ -19,12 +22,10 @@ await fetchMonster('dragarbor'), await fetchMonster('mk01_omega'), await fetchMonster('jelillow'), + await fetchMonster('picc'), ]; - state.activeMonster = state.partyMonsters[0]; - state.activeTechnique = state.activeMonster.activeTechniques[0]; - - state.inventory = [ + Memory.state.player.inventory = [ new InventoryItem(await fetchItem('tuxeball')), new InventoryItem(await fetchItem('ancient_egg')), new InventoryItem(await fetchItem('sweet_sand')), @@ -41,7 +42,11 @@ new InventoryItem(await fetchItem('revive')), ]; - UI.drawEnemyMonster(); + Memory.state.opponent.activeMonster = Memory.state.opponent.monsters[0]; + Memory.state.player.activeMonster = Memory.state.player.monsters[0]; + Memory.state.activeTechnique = Memory.state.player.activeMonster.activeTechniques[0]; + + UI.drawOpponentMonster(); UI.drawActiveMonster(); UI.drawActiveTechniques(); })(); -- cgit v1.2.3