Esempio n. 1
0
    // === PUBLIC METHODS ===

    public override CommandOutcome DoAction()
    {
        noSubjectMsg = new NoSubjectMsg("257VerbWhat", parserState.Words);
        string itemToDrink = controller.GetSubject("drink");

        // If no item could be identified then we're either done with this command or we need to continue processing to find a subject
        if (itemToDrink == null)
        {
            return(CommandOutcome.NO_COMMAND);
        }

        string drinkMsg;

        switch (itemToDrink)
        {
        case "44Blood":
            // Destroy the blood and change description of dragon to be sans blood
            itemController.DestroyItem("44Blood");
            itemController.SetItemState("31Dragon", 2);
            itemController.ChangeBirdSound();
            drinkMsg = "240HeadBuzz";
            break;

        case "21Water":
            // If the bottle is here and contains water, drink that
            if (playerController.ItemIsPresent("20Bottle") && itemController.GetItemState("20Bottle") == 0)
            {
                // Remove liquid from bottle
                itemController.SetItemState("20Bottle", 1);
                itemController.DestroyItem("21Water");
                drinkMsg = "74EmptyBottle";
            }
            else
            {
                // Otherwise, force the default message
                parserState.CurrentCommandState = CommandState.DISCARDED;
                return(CommandOutcome.NO_COMMAND);
            }
            break;

        default:
            drinkMsg = "110Ridiculous";
            break;
        }

        textDisplayController.AddTextToLog(playerMessageController.GetMessage(drinkMsg));
        parserState.CommandComplete();
        return(CommandOutcome.MESSAGE);
    }