/// <summary> /// /// </summary> public static void ValidateAndTriggerNew(Spell spell, ObjectReference caster, Unit triggerOwner, WorldObject target, SpellChannel usedChannel = null, Item usedItem = null, IUnitAction action = null, SpellEffect triggerEffect = null) { var cast = SpellCastPool.Obtain(); cast.SetCaster(caster, target.Map, target.Phase, triggerOwner.Position); cast.Selected = target; if (usedChannel != null && usedChannel.Cast.CasterUnit == triggerOwner) { cast.TargetLoc = triggerOwner.ChannelObject.Position; } else { cast.TargetLoc = target.Position; } cast.TargetItem = cast.CasterItem = usedItem; cast.ValidateAndTrigger(spell, triggerOwner, target, action, triggerEffect); }
/// <summary> /// /// </summary> public static void ValidateAndTriggerNew(Spell spell, Unit caster, WorldObject target, SpellChannel usedChannel = null, Item usedItem = null, IUnitAction action = null, SpellEffect triggerEffect = null) { ValidateAndTriggerNew(spell, caster.SharedReference, caster, target, usedChannel, usedItem, action, triggerEffect); }
internal void Dispose() { Cancel(); if (m_channel != null) { m_channel.Dispose(); m_channel = null; } if (m_targets != null) { m_targets.Clear(); } //WorldObject.WorldObjectSetPool.Recycle(m_targets); if (CanCollect) { SourceLoc = Vector3.Zero; Caster = CasterUnit = null; SpellCastPool.Recycle(this); } }
internal void Dispose() { if (CasterReference == null) { LogManager.GetCurrentClassLogger().Warn("Tried to dispose SpellCast twice: " + this); return; } Cancel(); if (m_channel != null) { m_channel.Dispose(); m_channel = null; } if (m_targets != null) { m_targets.Clear(); } //WorldObject.WorldObjectSetPool.Recycle(m_targets); SourceLoc = Vector3.Zero; CasterObject = CasterUnit = null; CasterReference = null; Map = null; Selected = null; GodMode = false; SpellCastPool.Recycle(this); //Context = null; }
/// <summary> /// /// </summary> public static void ValidateAndTriggerNew(Spell spell, ObjectReference caster, Region map, Unit triggerOwner, uint phase, SpellChannel usedChannel = null, Item usedItem = null, IUnitAction action = null) { var cast = SpellCastPool.Obtain(); cast.SetCaster(caster, map, phase); cast.UsedItem = cast.CasterItem = usedItem; cast.ValidateAndTrigger(spell, triggerOwner, action); }