SpellTargetCollection CreateSpellTargetCollection() { if (IsAICast) { return(AISpellTargetCollection.ObtainAICollection()); } return(SpellTargetCollection.Obtain()); }
SpellTargetCollection CreateSpellTargetCollection() { /*if (IsAICast) * { * return AISpellTargetCollection.ObtainAICollection(); * }*/ return(SpellTargetCollection.Obtain()); }
/// <summary> /// Cleans up (if there is anything to clean) /// </summary> internal protected virtual void Cleanup() { m_cast = null; if (m_targets != null) { m_targets.Dispose(); m_targets = null; } }
/// <summary>Cleans up (if there is anything to clean)</summary> protected internal virtual void Cleanup() { this.m_cast = (SpellCast)null; if (this.m_targets == null) { return; } this.m_targets.Dispose(); this.m_targets = (SpellTargetCollection)null; }
/// <summary>Cleans up (if there is anything to clean)</summary> protected internal virtual void Cleanup() { m_cast = null; if (m_targets == null) { return; } m_targets.Dispose(); m_targets = null; }
private SpellEffectHandler[] CreateHandlers(ref SpellFailedReason failReason) { var handlers = new SpellEffectHandler[Spell.EffectHandlerCount]; var h = 0; SpellTargetCollection targets = null; foreach (var effect in Spell.Effects.Where(effect => effect.SpellEffectHandlerCreator != null)) { CreateHandler(effect, h, handlers, ref targets, ref failReason); if (failReason != SpellFailedReason.Ok) { return(null); } h++; } return(handlers); }
private void CreateHandler(SpellEffect effect, int h, SpellEffectHandler[] handlers, ref SpellTargetCollection targets, ref SpellFailedReason failReason) { var handler = effect.SpellEffectHandlerCreator(this, effect); handlers[h] = handler; // make sure, we have the right Caster-Type handler.CheckCasterType(ref failReason); if (failReason != SpellFailedReason.Ok) { return; } // find targets and amount SpellTargetCollection if effects have same ImplicitTargetTypes if (InitialTargets != null) { // do we have given targets? if (targets == null) { targets = CreateSpellTargetCollection(); } } else if (handler.HasOwnTargets) { // see if targets are shared between effects targets = null; for (var j = 0; j < h; j++) { var handler2 = handlers[j]; if (handler.Effect.SharesTargetsWith(handler2.Effect, IsAICast)) { // same targets -> share target collection targets = handler2.m_targets; break; } } if (targets == null) { targets = CreateSpellTargetCollection(); } } if (targets != null) { handler.m_targets = targets; targets.m_handlers.Add(handler); } }
private void CreateHandler(SpellEffect effect, int h, SpellEffectHandler[] handlers, ref SpellTargetCollection targets, ref SpellFailedReason failReason) { var handler = effect.SpellEffectHandlerCreator(this, effect); handlers[h] = handler; handler.InitialTarget = (Unit)SelectedTarget; if (targets == null) { targets = CreateSpellTargetCollection(); } // make sure, we have the right Caster-Type /*handler.CheckCasterType(ref failReason); * if (failReason != SpellFailedReason.Ok) * { * return; * } * * // find targets and amount SpellTargetCollection if effects have same ImplicitTargetTypes * if (InitialTargets != null) * { * // do we have given targets? * if (targets == null) * { * targets = CreateSpellTargetCollection(); * } * } * else if (handler.HasOwnTargets) * { * // see if targets are shared between effects * targets = null; * * for (var j = 0; j < h; j++) * { * var handler2 = handlers[j]; * if (handler.Effect.SharesTargetsWith(handler2.Effect)) * { * // same targets -> share target collection * targets = handler2.m_targets; * break; * } * } * * if (targets == null) * { * targets = CreateSpellTargetCollection(); * } * }*/ if (targets != null) { handler.m_targets = targets; targets.m_handlers.Add(handler); } }