コード例 #1
0
    public void AddStatusEffect(StatusEffect effectData)
    {
        if (effectData == null)
        {
            return;
        }
        StatusEffect newEffectData = effectData;
        // check to see if enemy has debuff types that are opposites to each other , if so absorb them into a lesser or greater effect
        var absorbedEffect = ElementComboManager.instance.CanAbsorbEffect(this, newEffectData.elementType);

        if (absorbedEffect != null)
        {
            newEffectData = absorbedEffect;
        }

        for (int i = 0; i < statusEffects.Count; i++)
        {
            StatusEffect e = statusEffects[i];
            if (e.name == newEffectData.name)
            {
                if (e is StackableEffect)
                {
                    var stackEffect = e as StackableEffect;
                    AddToStack(stackEffect);
                    return;
                }
                return;
            }
        }

        if (IsDebuffOnCooldown(newEffectData.name))
        {
            return;
        }

        statusEffects.Add(newEffectData);
        newEffectData.BeginEffect(entity);
    }