/// <reference path="../Action.ts" />
/// <reference path="../../../Elements/Modules/HyperlinkHandler.ts" />
class ActionSaveGame extends Action {
    public requiresTurn = false;
    public requiresNoun = false;
    public requiresVisibility = false;
    public static check : Rulebook<ActionSaveGame> = new Rulebook("Check Saving");
    public static carry : Rulebook<ActionSaveGame> = new Rulebook("Carry out Saving");

    public getCommandText () {
        return "save to file";
    }
}

ActionSaveGame.carry.addRule(new Rule({
    name : "Save the game",
    code : runner => {
        SaveHandler.saveToFile();
        runner.noun.say.add("Saved.");
    }
}));

Elements.HyperlinkHandler.CommonActionsRulebook.addRule(new Rule({
    name : "Add Save Command Rule",
    firstPriority : Rule.PRIORITY_LOWEST,
    priority : Rule.PRIORITY_LOWEST,
    code : (rulebook : RulebookRunner<void>) => {
        Elements.HyperlinkHandler.addCommonAction("Save", new ActionSaveGame(WorldState.player));
    }
}));