コード例 #1
0
ファイル: IntModified.cs プロジェクト: Mhyshka/FFEngine
    internal void NotifyEffectDestroy(EffectOverTime a_effect)
    {
        List <IntModifierFromEffect> modifiersToRemove = new List <IntModifierFromEffect>();

        foreach (IntModifierFromEffect each in _bonusList)
        {
            if (each.source == a_effect)
            {
                modifiersToRemove.Add(each);
            }
        }

        List <IntModifierFromEffect> reductionsToRemove = new List <IntModifierFromEffect>();

        foreach (IntModifierFromEffect each in _malusList)
        {
            if (each.source == a_effect)
            {
                reductionsToRemove.Add(each);
            }
        }

        foreach (IntModifierFromEffect each in modifiersToRemove)
        {
            _bonusList.Remove(each);
            _needsToBeCompute = true;
        }

        foreach (IntModifierFromEffect each in reductionsToRemove)
        {
            _malusList.Remove(each);
            _needsToBeCompute = true;
        }
    }
コード例 #2
0
    internal EffectOverTimeReport TryApplyEffect(EffectOverTime a_effect)
    {
        EffectOverTimeReport report;

        if (a_effect.conf.stackMethod == EUnitEffectStackMethod.OnePerUnit)
        {
            EffectOverTime previousEffect = GetEffectOfType(a_effect);
            if (previousEffect != null)
            {
                ReplaceEffect(previousEffect, a_effect);
                report = a_effect.Refresh();
            }
            else
            {
                AddNewEffect(a_effect);
                report = a_effect.Apply();
            }
        }
        else
        {
            report = new EffectOverTimeReport();
            report.successfullyApplied = false;
        }

        return(report);
    }
コード例 #3
0
 /// <summary>
 /// Will apply a new effect to this unit. The unit will manage it from here.
 /// </summary>
 protected void AddNewEffect(EffectOverTime a_effect)
 {
     _effects.Add(a_effect);
     if (!a_effect.IsPrepared)
     {
         a_effect.Prepare(_unit);
     }
 }
コード例 #4
0
 internal void ReplaceEffect(EffectOverTime a_previous, EffectOverTime a_new)
 {
     if (!a_new.IsPrepared)
     {
         a_new.Prepare(_unit, a_previous.CurrentStackCount);
     }
     a_new.timeElapsed = a_previous.timeElapsed;
     RemoveEffect(a_previous);
     AddNewEffect(a_new);
 }
コード例 #5
0
    internal void Add(EffectOverTime newEffect)
    {
        var sameEffect = effects.Find(eff => eff.type == newEffect.type);

        if (sameEffect != null)
        {
            sameEffect.AddStackElement(newEffect);
        }
        else
        {
            effects.Add(newEffect);
        }
    }
コード例 #6
0
    /// <summary>
    /// Returns null if no effect with the same conf & source is found in the active effects.
    /// Returns the matching effect otherwise.
    /// </summary>
    internal EffectOverTime GetEffectOfType(EffectOverTime a_effect)
    {
        foreach (EffectOverTime each in _effects)
        {
            if (each.conf == a_effect.conf &&
                each.attackInfos.source == a_effect.attackInfos.source)
            {
                return(each);
            }
        }

        return(null);
    }
コード例 #7
0
    /// <summary>
    /// Returns an EffectOverTime
    /// </summary>
    internal virtual EffectOverTime Compute(AttackInfos a_attackInfos)
    {
        EffectOverTime effect = new EffectOverTime();

        effect.attackInfos = a_attackInfos;
        effect.conf        = this;

        foreach (EffectConfWrapper each in effects)
        {
            effect.effects.Add(each.Compute(a_attackInfos));
        }

        return(effect);
    }
コード例 #8
0
ファイル: EffectOverTime.cs プロジェクト: Wivex/Game1
 internal EffectStackElement(EffectOverTime effect)
 {
     delay    = effect.type.delay;
     duration = effect.type.duration;
     value    = effect.type.value;
 }
コード例 #9
0
ファイル: EffectOverTime.cs プロジェクト: Wivex/Game1
 internal void AddStackElement(EffectOverTime effect)
 {
     stack.Add(new EffectStackElement(effect));
     UpdateStack();
 }
コード例 #10
0
 internal void RemoveEffect(EffectOverTime a_effect)
 {
     _effects.Remove(a_effect);
     a_effect.Destroy();
 }