123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- class ActionExamine extends Action {
- public requiresTurn = false;
- public static check = new Rulebook<ActionExamine>("Check Examining");
- public static carry = new Rulebook<ActionExamine>("Carry out Examining");
-
- 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));
- }
- }));
|