-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.js
More file actions
37 lines (28 loc) · 676 Bytes
/
player.js
File metadata and controls
37 lines (28 loc) · 676 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
32
33
34
35
36
37
// player.js
const Mochila = require('./mochila');
class Player {
#mochila;
constructor(name, capacidadeMochila = 5) {
this.name = name;
this.#mochila = new Mochila(capacidadeMochila);
}
addItem(item) {
this.#mochila.guarda(item);
}
hasItem(name) {
return this.#mochila.tem(name);
}
showInventory() {
this.#mochila.inventario();
}
getItem(name) {
return this.#mochila.pega(name);
}
removeItem(name) {
this.#mochila.remove(name);
}
setMochilaCapacidade(novaCapacidade) {
this.#mochila.setCapacidade(novaCapacidade);
}
}
module.exports = Player;