/// /// /// /// class ActionExamine extends Action { public requiresTurn = false; public static check = new Rulebook("Check Examining"); public static carry = new Rulebook("Carry out Examining"); /** * Needs to return a string explaining what the player will do if he does this action. * For instance, ActionTaking should return something like return "take " + this.nouns[0].getName(), * which would read as "take thing". * remember that things implement PRINTABLE interface, so you can get their names. * @returns {Say} */ public getCommandText () { if (this.getNoun(0) == WorldState.player) { return "examine myself"; } return "examine " + (this.getNoun(0) != undefined ? this.getNoun(0).getPrintedName() : ""); } public static PrintDescriptionOfExaminedThingRule = ActionExamine.carry.createAndAddRule({ name : "Examine - Print Description of Examined Thing", code : (rulebook) => { let action = rulebook.noun; let noun = action.getNoun(0); if (noun instanceof Thing && ( noun).image != undefined) { action.say.add(( noun).image, Say.PARAGRAPH_BREAK); } action.say.add(( action.getNoun(0)).getPrintedDescription()); } }); } Elements.HyperlinkHandler.CommonActionsRulebook.addRule(new Rule({ name : "Look at me!", firstPriority : Rule.PRIORITY_LOWEST, priority : Rule.PRIORITY_HIGH, code : (rulebook : RulebookRunner) => { Elements.HyperlinkHandler.addCommonAction("Inspect", new ActionExamine(WorldState.player, WorldState.player)); } }));