protected override void Apply(WorldObject target, ref DamageAction[] actions)
 {
     if (this.Effect.MiscValue == 10)
     {
         this.m_cast.CasterChar.Position = target.Position;
     }
     else if (this.Effect.Spell.IsHearthStoneSpell && this.m_cast.CasterChar != null)
     {
         IWorldZoneLocation pos = this.m_cast.CasterChar.BindLocation;
         target.AddMessage((Action)(() => ((Unit)target).TeleportTo((IWorldLocation)pos)));
     }
     else if (this.Effect.ImplicitTargetB == ImplicitSpellTargetType.BehindTargetLocation)
     {
         Unit unit = (Unit)target;
         if (unit == null)
         {
             return;
         }
         float orientation = unit.Orientation;
         this.m_cast.CasterChar.TeleportTo(
             new Vector3(unit.Position.X - (unit.BoundingRadius + 0.5f) * (float)Math.Cos((double)orientation),
                         unit.Position.Y - (unit.BoundingRadius + 0.5f) * (float)Math.Sin((double)orientation),
                         unit.Position.Z), new float?(orientation));
     }
     else
     {
         Map     map = this.m_cast.TargetMap;
         Vector3 pos = this.m_cast.TargetLoc;
         float   ori = this.m_cast.TargetOrientation;
         target.AddMessage((Action)(() => ((Unit)target).TeleportTo(map, pos, new float?(ori))));
     }
 }
Exemplo n.º 2
0
 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, ref DamageAction[] actions)
        {
            var chr = (Character)target;

            if (chr == null)
            {
                return;
            }
            chr.IsMoving = false;
            var newPos = new WorldLocation((MapId)Effect.MiscValue, new Vector3(Effect.MiscValueB, Effect.MiscValueC));

            target.AddMessage(() => chr.TeleportTo(newPos));
        }
        protected override void Apply(WorldObject target, ref DamageAction[] actions)
        {
            Character chr = (Character)target;

            if (chr == null)
            {
                return;
            }
            chr.IsMoving = false;
            WorldLocation newPos = new WorldLocation((MapId)this.Effect.MiscValue,
                                                     new Vector3((float)this.Effect.MiscValueB, (float)this.Effect.MiscValueC), 1U);

            target.AddMessage((Action)(() => chr.TeleportTo((IWorldLocation)newPos)));
        }