doggo-quest-logic
Version:
The game logic for the Doggo Quest text-based game sample project
36 lines (35 loc) • 1.99 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const GameObjectBase_1 = require("../GameObjectBase");
const Room_1 = require("../Room");
class BowlObject extends GameObjectBase_1.GameObjectBase {
constructor(room) {
super('bowl');
if (room === Room_1.Room.Dining) {
this.look = `It's your water bowl! You love this bowl and drinking from it.`;
this.eat = `You don't eat water! Just drink it!`;
this.think = `The water tastes so good after running around the house.`;
this.smell = `I dunno. I guess it smells like water?`;
this.push = `You bat your paws in the water bowl. They get wet.`;
this.pull = `You can't really pull the water bowl.`;
this.lick = context => {
context.addText('You lap up the water eagerly. It is cold, wet, and satisfying.');
};
}
else if (room === Room_1.Room.Kitchen) {
this.look = `It's your food bowl. The food in here is okay, but mommy and daddy eat better food.`;
this.eat = context => {
context.addText('You grudgingly eat the food. It could be better.');
};
this.think = `The kibble in your food bowl tastes okay, but you really wish it was something different.`;
this.smell = `Yep, smells like my food. Not the most appetizing, but it's edible.`;
this.push = `You paw at the food in the bowl, just to make sure there's not anything better underneath it. There isn't.`;
this.pull = `You can't really pull the food bowl.`;
this.lick = 'Yep, it tastes like your food.';
}
}
matches(reduced, room) {
return super.matches(reduced, room) || (room === Room_1.Room.Dining && reduced === 'water') || (room === Room_1.Room.Kitchen && (reduced === 'food' || reduced === 'kibble'));
}
}
exports.BowlObject = BowlObject;