Refactor parser for some added flexibility.

This commit is contained in:
2021-05-17 19:59:21 -07:00
parent 09e10e94b5
commit 03eddfcd74
9 changed files with 279 additions and 61 deletions

View File

@ -10,13 +10,17 @@ export default class Player extends Container {
this.#user = new User();
}
drop(item: Item) {
put(item: Item) {
this.items.push(item);
}
async look(): Promise<void> {
look(): string {
const description = super.description(this.items);
await this.#user.tell(`You have ${description}`);
if (description) {
return `You have ${description}`;
} else {
return "You have nothing.";
}
}
}