doggo-quest-logic
Version:
The game logic for the Doggo Quest text-based game sample project
43 lines (42 loc) • 1.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const Room_1 = require("../Room");
const RoomBase_1 = require("../RoomBase");
const DiningObject_1 = require("./DiningObject");
const HallwayObject_1 = require("./HallwayObject");
const KitchenObject_1 = require("./KitchenObject");
const LivingRoomObject_1 = require("./LivingRoomObject");
class Dining extends RoomBase_1.RoomBase {
constructor() {
super('Dining Room', Room_1.Room.Dining);
this.west = Room_1.Room.Kitchen;
this.east = Room_1.Room.Living;
this.north = Room_1.Room.Entryway;
this.south = Room_1.Room.CantGo;
this.up = Room_1.Room.CantGo;
this.objects = [
new DiningObject_1.DiningObject(Room_1.Room.Dining),
new KitchenObject_1.KitchenObject(Room_1.Room.Dining),
new HallwayObject_1.HallwayObject(Room_1.Room.Dining),
new LivingRoomObject_1.LivingRoomObject(Room_1.Room.Dining),
];
}
tryGo(direction, context) {
if (direction === 'south') {
context.addText('The door is shut. You\'d need mommy or daddy to open it.');
return true;
}
else if (direction === 'up') {
context.addText('The table and chairs are too tall to jump up onto.');
return true;
}
return false;
}
describe(context) {
context.addText(`This is the dining room. I like to beg at the table when mommy and daddy eat, but I usually have to eat out of my ` +
`food bowl instead.`);
context.addText(`The large glass door lets me see outside. I like that door.`);
context.addText(`The kitchen is to the west and the living room is to the west. The hall goes north to the entryway.`);
}
}
exports.Dining = Dining;