Take, drop and command echo

This commit is contained in:
2021-11-04 22:47:09 +01:00
parent abb3c475db
commit 37759d7b9f
8 changed files with 75 additions and 3 deletions

View File

@@ -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));
}
}