From 5214cdfbf26bc0bdee5d669a237fb8aefffb78d5 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 30 Aug 2023 21:35:28 +0200 Subject: story! --- resources/js/main.js | 46 ++-------------------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) (limited to 'resources/js/main.js') 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'); } })(); -- cgit v1.2.3