-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.ts
More file actions
31 lines (27 loc) · 698 Bytes
/
Copy pathexample.ts
File metadata and controls
31 lines (27 loc) · 698 Bytes
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
28
29
30
31
import { Equipment } from "./lib/equipment";
import Player from "./player";
const data = await fetch(
"https://67872ba4c4a42c916105c1f4.mockapi.io/api/users/2",
);
const user = await data.json();
const sword = new Equipment(
"sword_warrior",
"Espada do Guerreiro",
1,
{ attack: 30, stamina: 2 },
1.1,
);
const shield = new Equipment(
"resistence_shield",
"Escudo da Resistência",
1,
{ defense: 80, health: 20 },
1.2,
);
const player = new Player(user);
player.addXP(19000);
player.addEquipment([shield, sword]);
const pS = player.equipment[0];
const pS2 = player.equipment[1];
player.levelUpEquipment(pS.id, 10);
player.levelUpEquipment(pS2.id, 4);