///
///
///
///
class ActionRest extends Action {
public static check = new Rulebook("Check Rest");
public static carry = new Rulebook("Carry out Rest");
public constructor (actor : Thing, ...nouns : Array) {
super(actor, ...nouns);
this.requiresNoun = true;
this.requiresVisibility = true;
}
public getCommandText () {
return "rest on " + ( this.getNoun(0)).getPrintedName();
}
public static carryRest = ActionRest.carry.createAndAddRule({
name : "Rest - Restful Moment",
code : (runner : RulebookRunner) => {
let actor = runner.noun.actor;
if (actor instanceof Person) {
// TODO: Run the Rulebook responsible for healing on the person. Resting = 2x healing.
let action = runner.noun;
if (WorldState.isPlayer(actor)) {
runner.noun.say.add("You decide to rest for a bit on ", Say.Mention(runner.noun.getNoun(0)), ".");
} else {
runner.noun.say.add(Say.Mention(action.actor), " rests on ", Say.Mention(action.getNoun(0)), ".");
}
}
}
});
}
Elements.HyperlinkHandler.HyperlinkingRulebook.addRule(new Rule(
{
name : "Hyperlink - Rest",
firstPriority : Rule.PRIORITY_HIGHEST,
code : (rulebook : RulebookRunner) => {
let thing = rulebook.noun;
if (thing instanceof RestingStuff && thing.isVisibleTo(WorldState.player)) {
Elements.HyperlinkHandler.addAvailableAction("Rest", new ActionRest(WorldState.player, thing));
}
}
}
));