summaryrefslogtreecommitdiff
path: root/resources/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/js/main.js')
-rw-r--r--resources/js/main.js46
1 files changed, 2 insertions, 44 deletions
diff --git a/resources/js/main.js b/resources/js/main.js
index f472a14..1cabab5 100644
--- a/resources/js/main.js
+++ b/resources/js/main.js
@@ -8,50 +8,8 @@ UI.wrapCallback(async function () {
// Start New Game
else {
- const possibleStarterMonsters = await Promise.all(
- [
- 'budaye',
- 'dollfin',
- 'grintot',
- 'ignibus',
- 'memnomnom',
- ].map(async (monsterSlug) => await fetchMonster(monsterSlug))
- );
+ await initializeState();
- const monsterSelection = UI.openStarterMonsterSelection(possibleStarterMonsters);
- monsterSelection.addEventListener('starter:monster:selected', UI.wrapCallback(async (event) => {
- if (!confirm(`Select ${event.detail.monster.name}?`)) {
- return;
- }
-
- Memory.state.player = new Trainer({
- monsters: [
- event.detail.monster,
- ],
- inventory: [
- new InventoryItem(await fetchItem('tuxeball'), 5),
- new InventoryItem(await fetchItem('potion')),
- ]
- });
- await Memory.state.player.initialize();
-
- Game.setActivePlayerMonster(Memory.state.player.monsters[0]);
- Memory.state.activeBall = 'tuxeball';
-
- // set rival monster
- possibleStarterMonsters.splice(possibleStarterMonsters.indexOf(event.detail.monster), 1);
- const rivalMonster = possibleStarterMonsters[Math.round(Math.random() * (possibleStarterMonsters.length - 1))];
- Memory.state.opponent = new Trainer({ monsters: [ rivalMonster ] });
- await Memory.state.opponent.initialize();
- Memory.state.rivalMonster = rivalMonster.slug
-
- // go to starting area
- await Game.goToArea('paper-town');
-
- UI.drawActiveMonster();
- UI.drawActiveTechniques();
-
- event.detail.popup.remove();
- }));
+ await Story.progress('start');
}
})();