// A series of checks the might be applied to a given hint before askign the hint question
    public bool QuickChecks(string hintID)
    {
        const string BIRD               = "8Bird";
        string       location           = playerController.CurrentLocation;
        bool         noItemsAtLocations = itemController.ItemsAt(location).Count == 0 && itemController.ItemsAt(playerController.OldLocations[0]).Count == 0 && itemController.ItemsAt(playerController.OldLocations[1]).Count == 0;

        // Whether the checks have been passed
        bool checkPassed;

        switch (hintID)
        {
        case "11TryingToGetIntoCave":
            checkPassed = itemController.GetItemState("3Grate") == 0 && !playerController.ItemIsPresent("1Keys");
            break;

        case "12TryingToCatchBird":
            checkPassed = itemController.ItemIsAt(BIRD, location) && playerController.HasItem("5BlackRod") && commandsController.OldItem == BIRD;
            break;

        case "13TryingToDealWithSnake":
            checkPassed = itemController.ItemIsAt("11Snake", location) && !playerController.ItemIsPresent(BIRD);
            break;

        case "14LostInMaze":
            checkPassed = noItemsAtLocations && playerController.NumberOfItemsCarried > 1;
            break;

        case "15PonderingDarkRoom":
            checkPassed = itemController.TreasureWasSeen("59Emerald") && !itemController.TreasureWasSeen("60Pyramid");
            break;

        case "17CliffWithUrn":
            checkPassed = dwarfController.ActivationLevel == 0;
            break;

        case "18LostInForest":
            checkPassed = noItemsAtLocations;
            break;

        case "19TryingToDealWithOgre":
            checkPassed = itemController.ItemIsAt("41Ogre", location) && dwarfController.CountDwarvesAt(location) == 0;
            break;

        case "20FoundAllTreasuresExceptJade":
            checkPassed = itemController.TreasuresRemaining == 1 && !itemController.TreasureWasSeen("66Necklace");
            break;

        default:
            checkPassed = true;
            break;
        }

        return(checkPassed);
    }
Beispiel #2
0
    // === PUBLIC METHODS ===

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

        // 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 (itemToFind == null)
        {
            return(CommandOutcome.NO_COMMAND);
        }

        string location = playerController.CurrentLocation;
        string findMsg  = null;

        if (gameController.CurrentCaveStatus == CaveStatus.CLOSED)
        {
            findMsg = "138AroundSomewhere";
        }
        else if (playerController.HasItem(itemToFind))
        {
            findMsg = "24AlreadyHaveIt";
        }
        else
        {
            bool foundDwarf = itemToFind == "17Dwarf" && dwarfController.CountDwarvesAt(location) > 0;
            bool foundWater = itemToFind == "21Water" && ((itemController.GetItemState("20Bottle") == 0 && itemController.ItemIsAt("20Bottle", location)) || (locationController.LiquidAtLocation(location) == LiquidType.WATER));
            bool foundOil   = itemToFind == "22Oil" && ((itemController.GetItemState("20Bottle") == 2 && itemController.ItemIsAt("20Bottle", location)) || (locationController.LiquidAtLocation(location) == LiquidType.OIL));
            bool foundItem  = itemController.ItemIsAt(itemToFind, location);

            if (foundDwarf || foundWater || foundOil || foundItem)
            {
                findMsg = "94HaveWhatNeed";
            }
            else
            {
                // Show default message if nothing found
                parserState.CurrentCommandState = CommandState.DISCARDED;
                return(CommandOutcome.NO_COMMAND);
            }
        }

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