コード例 #1
0
    public void CastCharmAnimal()
    {
        if (!CombatManager.charmedAnimal && combatManager.enemyTypes[0] == CombatScriptable.enemyType.Animal && RollSpellCheck(6))
        {
            mapSceneManager.AlterDamage(6, true);
            overallText.text += "\nYou took <color=#ff0000ff>6</color> damage from casting the Charm Animal spell";

            //Charm the animal
            CombatManager.charmedAnimal = true;
            combatManager.DamageEnemy(CharacterManager.myName, 0, true, false);
        }
        else
        {
            CombatManager.charmedAnimal = false;             //Just to be sure

            overallText.text += "\nYou failed to cast your Charm Animal spell";

            if (combatManager.enemyTypes[0] != CombatScriptable.enemyType.Animal)
            {
                overallText.text += "\nThis spell cannot charm an enemy of this type";
            }
            else if (CombatManager.charmedAnimal)
            {
                overallText.text += "\nYou already have an animal charmed";
            }
        }

        combatManager.EndPlayerTurn();
    }