summaryrefslogtreecommitdiff
path: root/resources/js/main.js
blob: 815d7344acf63acebdaee41728e1bce070afb827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(async function () {
  await initializeDB();

  // Start Game
  const possibleStarterMonsters = ['budaye', 'dollfin', 'grintot', 'ignibus', 'memnomnom'];

  Memory.state.player = new Trainer(
    [
      await fetchMonster(possibleStarterMonsters[Math.round(Math.random() * (possibleStarterMonsters.length - 1))]),
    ],
    [
      new InventoryItem(await fetchItem('tuxeball')),
      new InventoryItem(await fetchItem('potion')),
    ]
  );
  await Memory.state.player.initialize();

  Memory.state.activeTechnique = Memory.state.player.activeMonster.activeTechniques[0];

  Memory.state.rivalMonster = await fetchMonster(possibleStarterMonsters[Math.round(Math.random() * (possibleStarterMonsters.length - 1))]);

  const area = await fetchArea('paper-town');
  await Game.progressToArea(area);

  UI.drawActiveMonster();
  UI.drawActiveTechniques();
})();