예제 #1
0
    public void UseMagic()
    {
        // アニメーション状態を作ってなかったのでDamageにする
        //currentTarget.GetComponent<Animator>().SetTrigger("Damage");

        var magicType = ((Magic)currentSkill).GetSkillType();

        if (magicType == Skill.Type.RecoveryMagic)
        {
            /*
             * if (GetHp() == GetCharacterStatus().GetMaxHp())
             * {
             *  Debug.Log(currentTarget.name + "は全快です。");
             *  battleManager.ShowMessage(currentTarget.name + "は全快です。");
             *  return;
             * }
             */
            var recoveryPoint = ((Magic)currentSkill).GetMagicPower() + characterStatus.GetMagicPower();
            if (targetCharacterStatus as AllyStatus != null)
            {
                targetCharacterBattleScript.SetHp(targetCharacterBattleScript.GetHp() + recoveryPoint);
                battleStatusScript.UpdateStatus(targetCharacterStatus, BattleStatusScript.Status.HP, targetCharacterBattleScript.GetHp());
            }
            else
            {
                targetCharacterBattleScript.SetHp(GetHp() + recoveryPoint);
            }
            battleManager.ShowMessage(gameObject.name + "は" + ((Magic)currentSkill).GetKanjiName() + "を使って" + currentTarget.name + "を" + recoveryPoint + "回復した。");
        }
        else if (magicType == Skill.Type.IncreaseAttackPowerMagic)
        {
            if (IsIncreasePower())
            {
                Debug.Log("既に攻撃力を上げています。");
                battleManager.ShowMessage("既に攻撃力を上げている。");
                return;
            }
            increasePowerPoint = ((Magic)currentSkill).GetMagicPower() + characterStatus.GetMagicPower();
            targetCharacterBattleScript.SetAuxiliaryPower(targetCharacterBattleScript.GetAuxiliaryPower() + increasePowerPoint);
            targetCharacterBattleScript.SetIsIncreasePower(true);
            battleManager.ShowMessage(gameObject.name + "は" + ((Magic)currentSkill).GetKanjiName() + "を使って" + currentTarget.name + "の力を" + increasePowerPoint + "増やした。");
        }
        else if (magicType == Skill.Type.IncreaseDefencePowerMagic)
        {
            if (IsIncreaseStrikingStrength())
            {
                Debug.Log("既に防御力を上げています。");
                battleManager.ShowMessage("既に防御力を上げています。");
                return;
            }
            increaseStrikingStrengthPoint = ((Magic)currentSkill).GetMagicPower() + characterStatus.GetMagicPower();
            targetCharacterBattleScript.SetAuxiliaryStrikingStrength(targetCharacterBattleScript.GetAuxiliaryStrikingStrength() + increaseStrikingStrengthPoint);
            targetCharacterBattleScript.SetIsIncreaseStrikingStrength(true);
            battleManager.ShowMessage(gameObject.name + "は" + ((Magic)currentSkill).GetKanjiName() + "を使って" + currentTarget.name + "の打たれ強さを" + increaseStrikingStrengthPoint + "増やした。");
        }
        else if (magicType == Skill.Type.NumbnessRecoveryMagic)
        {
            if (!IsNumbness())
            {
                Debug.Log(currentTarget.name + "は痺れ状態ではなかった。");
                battleManager.ShowMessage(currentTarget.name + "は痺れ状態ではなかった。");
                return;
            }
            targetCharacterStatus.SetNumbness(false);
            battleManager.ShowMessage(gameObject.name + "は" + ((Magic)currentSkill).GetKanjiName() + "を使って" + currentTarget.name + "の痺れを消した");
        }
        else if (magicType == Skill.Type.PoisonnouRecoveryMagic)
        {
            if (!IsPoison())
            {
                Debug.Log(currentTarget.name + "は毒状態ではなかった。");
                battleManager.ShowMessage(currentTarget.name + "は毒状態ではなかった。");
                return;
            }
            targetCharacterStatus.SetPoisonState(false);
            battleManager.ShowMessage(gameObject.name + "は" + ((Magic)currentSkill).GetKanjiName() + "を使って" + currentTarget.name + "の毒を消した");
        }
    }