コード例 #1
0
    // === PRIVATE METHODS ===

    // Throw the axe and return a message for the player
    private string ThrowAxe()
    {
        string returnMsg = null;
        bool   refresh   = true;

        int firstDwarf = dwarfController.FirstDwarfAt(location);

        if (firstDwarf >= 0)
        {
            returnMsg = "48AttackDwarf";

            // If player has killed dwarf changed message from attacked to killed
            if (dwarfController.AttackDwarf(firstDwarf))
            {
                // First kill gets a slightly more descriptive message
                returnMsg = dwarfController.DwarvesKilled == 1 ? "149KilledDwarf" : "47KilledDwarf";
            }
        }
        else if (itemController.ItemIsAt("31Dragon", location) && itemController.GetItemState("31Dragon") == 0)
        {
            returnMsg = "152DragonAxe";
        }
        else if (itemController.ItemIsAt("33Troll", location))
        {
            returnMsg = "158TrollAxe";
        }
        else if (itemController.ItemIsAt("41Ogre", location))
        {
            returnMsg = "203OgreDodges";
        }
        else if (itemController.ItemIsAt("35Bear", location) && itemController.GetItemState("35Bear") == 0)
        {
            // Make axe inaccessible
            itemController.SetItemState("28Axe", 1);
            itemController.MakeItemImmovable("28Axe");
            returnMsg = "164BearAxe";
            refresh   = false;
        }

        if (refresh)
        {
            outcome = CommandOutcome.DESCRIBE;
        }

        itemController.DropItemAt("28Axe", location);
        return(returnMsg);
    }