123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- /// <reference path="../Action.ts" />
- /// <reference path="../Rule.ts" />
- /// <reference path="../Rulebook.ts" />
- /// <reference path="../../../Elements/Classes/Say/SayBold.ts" />
- class ActionExamine extends Action {
- public requiresTurn = false;
- public static check = new Rulebook<ActionExamine>("Check Examining");
- public static carry = new Rulebook<ActionExamine>("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 && (<Thing> noun).image != undefined) {
- action.say.add((<Thing> noun).image, Say.PARAGRAPH_BREAK);
- }
- action.say.add((<Thing> 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<void>) => {
- Elements.HyperlinkHandler.addCommonAction("Inspect", new ActionExamine(WorldState.player, WorldState.player));
- }
- }));
|