Take, drop and command echo
This commit is contained in:
@@ -2,5 +2,18 @@ export default class Player {
|
||||
constructor() {
|
||||
this.inventory = [];
|
||||
this.currentRoom = "start";
|
||||
this.context = null;
|
||||
}
|
||||
|
||||
addItem(id) {
|
||||
this.inventory.push(id);
|
||||
}
|
||||
|
||||
removeItem(id) {
|
||||
this.inventory = this.inventory.filter((item) => item != id);
|
||||
}
|
||||
|
||||
getInventory() {
|
||||
return this.inventory.map((item) => this.context.getItem(item));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user