From a5052fd596418f01544854c2da8d77d93ddee0be Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 30 Aug 2023 22:04:15 +0200 Subject: backup save --- resources/js/story.js | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'resources/js/story.js') diff --git a/resources/js/story.js b/resources/js/story.js index c5f7add..bdec2e1 100644 --- a/resources/js/story.js +++ b/resources/js/story.js @@ -21,7 +21,11 @@ const Story = { 'grintot', 'ignibus', 'memnomnom', - ].map(async (monsterSlug) => await fetchMonster(monsterSlug)) + ].map(async (monsterSlug) => { + const monster = await fetchMonster(monsterSlug); + monster.level = 5; + return monster; + }) ); const monsterSelection = UI.openStarterMonsterSelection(possibleStarterMonsters, { title: translate('story:introduction:monster_selection:title', true) }); @@ -38,15 +42,9 @@ const Story = { // set rival monster Memory.state.rivalMonster = event.detail.monster.slug; - // initialize state variables + // set initial values Memory.state.money = 250; - Memory.state.opponent = new Trainer({ monsters: [] }); - await Memory.state.opponent.initialize(); - - Memory.state.player = new Trainer({ monsters: [] }); - await Memory.state.player.initialize(); - // go to starting area await Game.goToArea('paper-town'); @@ -66,7 +64,11 @@ const Story = { 'nut', 'agnite', 'rockitten', - ].map(async (monsterSlug) => await fetchMonster(monsterSlug)) + ].map(async (monsterSlug) => { + const monster = await fetchMonster(monsterSlug); + monster.level = 5; + return monster; + }) ); const monsterSelection = UI.openStarterMonsterSelection(possibleStarterMonsters, { title: translate('story:select_starter_monster:monster_selection:title', true) }); @@ -76,14 +78,8 @@ const Story = { return; } - Memory.state.player = new Trainer({ - monsters: [ - event.detail.monster, - ] - }); - await Memory.state.player.initialize(); - - Game.setActivePlayerMonster(Memory.state.player.monsters[0]); + Memory.state.player.monsters.push(event.detail.monster); + Game.setActivePlayerMonster(event.detail.monster); // go to starting area await Game.goToArea('paper-town'); @@ -101,7 +97,9 @@ const Story = { }, async battleRivalOne () { - Memory.state.opponent = new Trainer({ monsters: [ await fetchMonster(Memory.state.rivalMonster) ] }); + const rivalMonster = await fetchMonster(Memory.state.rivalMonster); + rivalMonster.level = 5; + Memory.state.opponent = new Trainer({ monsters: [ rivalMonster ] }); await Memory.state.opponent.initialize(); await UI.buildAndShowStoryPopup({ speaker: await fetchNpc('spyder_rivalbillie'), text: translate('spyder_papertown_firstfight', true) }); -- cgit v1.2.3