123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- /// <reference path="../Action.ts" />
- /// <reference path="../Rule.ts" />
- /// <reference path="../Rulebook.ts" />
- /// <reference path="../Things/Person.ts" />
- class ActionStand extends Action {
- public static check = new Rulebook<ActionStand>("Check Stand");
- public static carry = new Rulebook<ActionStand>("Carry out Stand");
- public constructor (actor : Thing, ...nouns : Array<any>) {
- super(actor, ...nouns);
- this.requiresNoun = false;
- this.requiresVisibility = false;
- }
- public getCommandText () {
- return "stand up"
- }
- public static checkStand = ActionStand.check.createAndAddRule({
- name : "Stand - Can stand?",
- code : (rulebook) => {
- // TODO: Check if being held down
- // TODO: Check if incapacitated
- }
- });
- public static carryStand = ActionStand.carry.createAndAddRule({
- name : "Stand - Rise up!",
- code : (runner : RulebookRunner<ActionStand>) => {
- let actor = runner.noun.actor;
- if (actor instanceof Person) {
- actor.stance = PersonStance.STANDING;
- if (actor == WorldState.player) {
- runner.noun.say.add("You get up.");
- } else {
- runner.noun.say.add(runner.noun.actor, " rises up.");
- }
- }
- }
- });
- }
- Elements.HyperlinkHandler.CommonActionsRulebook.addRule(new Rule(
- {
- name : "Hyperlink - Stand up!",
- firstPriority : Rule.PRIORITY_MEDIUM,
- code : (rulebook : RulebookRunner<void>) => {
- if (WorldState.player.stance == PersonStance.ALLFOURS) {
- Elements.HyperlinkHandler.addCommonAction("Get up", new ActionStand(WorldState.player));
- }
- }
- }
- ));
|