UNPKG

doggo-quest-logic

Version:

The game logic for the Doggo Quest text-based game sample project

34 lines (33 loc) 1.47 kB
"use strict"; 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 OfficeObject_1 = require("./OfficeObject"); class Entryway extends RoomBase_1.RoomBase { constructor() { super('Entryway', Room_1.Room.Entryway); this.objects = [ new HallwayObject_1.HallwayObject(Room_1.Room.Entryway), new OfficeObject_1.OfficeObject(Room_1.Room.Entryway), new DiningObject_1.DiningObject(Room_1.Room.Entryway) ]; this.south = Room_1.Room.Dining; this.west = Room_1.Room.Office; this.up = Room_1.Room.CantGo; } tryGo(direction, context) { if (direction === 'up') { context.addText(`The gate is in the way and blocks you from climbing the stairs.`); return true; } return super.tryGo(direction, context); } describe(context) { context.addText(`You're in the entryway at the front of the house. A large door leads outside while the office is to the west and a ` + `hallway leads south to the dining room and living area.`); context.addText(`Stairs lead up, but are blocked by a menacing gate that frequently falls on you if you get near it.`); } } exports.Entryway = Entryway;