doggo-quest-logic
Version:
The game logic for the Doggo Quest text-based game sample project
29 lines (28 loc) • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const Room_1 = require("../Room");
const RoomBase_1 = require("../RoomBase");
const CrateObject_1 = require("./CrateObject");
class Crate extends RoomBase_1.RoomBase {
constructor() {
super('In Crate', Room_1.Room.InCrate);
this.north = Room_1.Room.Office;
this.out = Room_1.Room.Office;
this.objects = [
new CrateObject_1.CrateObject(this.id)
];
}
tryGo(direction, context) {
if ((direction == 'north' || direction == 'out') && !context.world.isCrateOpen) {
context.addText('The crate door is shut and blocks your way.');
return true;
}
return false;
}
describe(context) {
context.addText(`You're in your crate yet again. It's a small crate large enough for you to rest comfortably, but not move around in.`);
context.addText('There is a blanket on the floor and a door to the crate in front of you.');
context.addText('You do not like it here.');
}
}
exports.Crate = Crate;