doggo-quest-logic
Version:
The game logic for the Doggo Quest text-based game sample project
40 lines (39 loc) • 2.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const GameObjectBase_1 = require("../GameObjectBase");
const Room_1 = require("../Room");
const OutsideObject_1 = require("./OutsideObject");
class WindowObject extends GameObjectBase_1.GameObjectBase {
constructor(room) {
super('window');
this.room = room;
this.children = [
new OutsideObject_1.OutsideObject(room)
];
switch (this.room) {
case Room_1.Room.Office:
const cantReachFloor = `You can't reach the window from down on the floor.`;
this.lick = cantReachFloor;
this.push = cantReachFloor;
this.eat = cantReachFloor;
this.take = cantReachFloor;
this.smell = `You can't reach the window from down on the floor, but it smells vaguely like outside.`;
this.look = `It's your favorite window. When you're up on the chair you can see out onto the street at bark at anything that ` +
`walks by. You can't see much from down here, however.`;
break;
case Room_1.Room.OnChair:
this.look = `Looking outside you see the empty streets. Something will walk by eventually, you just know it!`;
this.lick = `You can't reach the window from the chair, but even if you could, would you really want to lick it?`;
this.eat = `You can't reach the window from the chair, but even if you could, would you really want to eat it?`;
this.take = `You can't reach the window from the chair, but seriously? How could I possibly pick up a window?`;
this.smell = `The window smells like outside and freedom. You don't smell any intruders out there, but maybe one is coming sooner or later.`;
this.push = `You can't reach the window from the chair.`;
this.pull = `You can't reach the window from the chair.`;
break;
}
}
matches(reduced, room) {
return super.matches(reduced, room) || reduced === 'outside';
}
}
exports.WindowObject = WindowObject;