internal void EffectSchoolDamage(EffectSchoolDamage effect, int effectIndex, Unit target, SpellEffectHandleMode mode)
        {
            if (mode != SpellEffectHandleMode.HitStart || target == null || !target.IsAlive)
            {
                return;
            }

            float spellDamage = effect.CalculateSpellDamage(SpellInfo, effectIndex, Caster, target);

            if (SpellInfo.HasAttribute(SpellCustomAttributes.ShareDamage))
            {
                spellDamage /= Mathf.Min(1, ImplicitTargets.TargetCountForEffect(effectIndex));
            }

            for (var i = 0; i < effect.ConditionalModifiers.Count; i++)
            {
                ConditionalModifier modifier = effect.ConditionalModifiers[i];
                if (modifier.Condition.With(Caster, target, this).IsApplicableAndValid)
                {
                    modifier.Modify(ref spellDamage);
                }
            }

            EffectDamage += (int)spellDamage;
        }
Пример #2
0
        internal void Dispose()
        {
            SpellState = SpellState.Disposed;

            SpellInfo = null;
            Caster    = OriginalCaster = null;
            appliedModifierAuras.Clear();
            chargeDroppedModifierAuras.Clear();

            ImplicitTargets.Dispose();
            ExplicitTargets.Dispose();
        }
Пример #3
0
        internal void Dispose()
        {
            SpellState = SpellState.Disposed;

            SpellInfo = null;
            Caster    = OriginalCaster = null;
            appliedModifierAuras.Clear();
            chargeDroppedModifierAuras.Clear();
            appliedModifiers.Clear();
            unappliedModifiers.Clear();

            ListPoolContainer <(SpellPowerType, int)> .Return(powerCosts);

            powerCosts = null;

            ImplicitTargets.Dispose();
            ExplicitTargets.Dispose();
        }
Пример #4
0
        internal void HandleUnitDetach(Unit detachedUnit)
        {
            switch (ExecutionState)
            {
            case SpellExecutionState.Casting when SpellInfo.ExplicitTargetType == SpellExplicitTargetType.Target && ExplicitTargets.Target == detachedUnit:
                Caster.SpellCast.HandleSpellCast(this, SpellCast.HandleMode.Finished);
                Cancel();
                break;

            case SpellExecutionState.Processing when Caster == detachedUnit:
                Finish();
                break;

            case SpellExecutionState.Processing when ImplicitTargets.Contains(detachedUnit):
                ImplicitTargets.RemoveTargetIfExists(detachedUnit);

                break;
            }
        }