예제 #1
0
    /// <summary>
    /// passiveEffectをtargetListの中から条件を満たすtargetだけに反映させる
    /// </summary>
    /// <param name="effect">反映させるBattlePassiveEffect</param>
    /// <param name="targetList">効果対象</param>
    /// <param name="func">呼ぶ関数</param>

    private void EffectToAllTarget(BattlePassiveEffect effect, List <BattleCharacter> targetList, Action <BattleCharacter> func)
    {
        foreach (BattleCharacter target in ElementClass.GetListInElementByCondition(targetList, effect.TargetElement)) //属性の条件
        {
            if (!target.IsAlive)
            {
                continue;                   //倒れているキャラに効果は反映しない
            }
            switch (effect.EffectCondition) //属性以外の条件
            {
            case E_BattlePassiveEffectCondition.AnyTime:
                break;

            case E_BattlePassiveEffectCondition.HpHigher:
                if (target.Condition.Hp / target.Condition.MaxHp < effect.ConditionValue)
                {
                    continue;
                }
                break;

            case E_BattlePassiveEffectCondition.HpLower:
                if (target.Condition.Hp / target.Condition.MaxHp > effect.ConditionValue)
                {
                    continue;
                }
                break;

            case E_BattlePassiveEffectCondition.SpHigher:
                if (target.Condition.Sp < effect.ConditionValue)
                {
                    continue;
                }
                break;

            case E_BattlePassiveEffectCondition.SpLower:
                if (target.Condition.Sp > effect.ConditionValue)
                {
                    continue;
                }
                break;

            case E_BattlePassiveEffectCondition _:
                Debug.Log("error");
                continue;
            }
            func(target);
        }
    }