protected override void Apply(WorldObject target) { if (Effect.Spell.IsHearthStoneSpell && m_cast.CasterChar != null) { // teleport back home var pos = m_cast.CasterChar.BindLocation; target.AddMessage(() => ((Unit)target).TeleportTo(pos)); } else { if (Effect.ImplicitTargetB == ImplicitSpellTargetType.BehindTargetLocation) { var unit = (Unit)target; if (unit != null) { var o = unit.Orientation; var newx = unit.Position.X - (unit.BoundingRadius + 0.5f) * (float)Math.Cos(o); var newy = unit.Position.Y - (unit.BoundingRadius + 0.5f) * (float)Math.Sin(o); var newpos = new Util.Graphics.Vector3(newx, newy, unit.Position.Z); m_cast.CasterChar.TeleportTo(newpos, o); } } else { // teleport to given target location var map = m_cast.TargetMap; var pos = m_cast.TargetLoc; var ori = m_cast.TargetOrientation; target.AddMessage(() => ((Unit)target).TeleportTo(map, pos, ori)); } } }
protected override void Apply(WorldObject target) { if (Effect.Spell.IsHearthStoneSpell && m_cast.CasterChar != null) { // teleport back home var pos = m_cast.CasterChar.BindLocation; target.AddMessage(() => ((Unit)target).TeleportTo(pos)); } else { // teleport to given target location var region = m_cast.TargetMap; var pos = m_cast.TargetLoc; var ori = m_cast.TargetOrientation; target.AddMessage(() => ((Unit)target).TeleportTo(region, pos, ori)); } }