Beispiel #1
0
        public override void HandleOnSkillCasting(SkillArg arg)
        {
            Map.Map     map = MapManager.Instance.GetMap(arg.Caster.MapInstanceID);
            UpdateEvent evt = UpdateEvent.NewActorAdditionEvent(arg.Caster, arg.Caster, arg.SkillSession, 28673, 65004, UpdateEvent.ExtraUpdateModes.Activate);

            oldX = arg.Caster.X;
            oldY = arg.Caster.Y;
            oldZ = arg.Caster.Z;
            Map.MoveArgument argu = new Map.MoveArgument()
            {
                BNSMoveType = MoveType.StepForward
            };
            distance          = arg.Caster.DistanceToActor(arg.Target);
            argu.SkillSession = arg.SkillSession;
            float deltaX = (float)(arg.Target.X - arg.Caster.X) / distance;
            float deltaY = (float)(arg.Target.Y - arg.Caster.Y) / distance;

            argu.X   = arg.Caster.X + (int)(deltaX * distance);
            argu.Y   = arg.Caster.Y + (int)(deltaY * distance);
            argu.Z   = (short)arg.Target.Z;
            argu.Dir = arg.Caster.Dir;
            map.MoveActor(arg.Caster, argu, true);

            //UpdateEvent evt1 = UpdateEvent.NewActorAdditionExtEvent(arg.Caster, arg.SkillSession, 28673, 15000017, 5000, UpdateEvent.ExtraUpdateModes.Activate);
            //map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt1, arg.Caster, true);
        }
Beispiel #2
0
        public override void HandleSkillActivate(SkillArg arg)
        {
            base.HandleSkillActivate(arg);
            foreach (SkillAffectedActor i in arg.AffectedActors)
            {
                if (arg.Target.Tasks.TryGetValue("ActorCatch", out Task removed))
                {
                    removed.Deactivate();
                }

                //Additions.Throw throws = new Additions.Throw(arg, i.Target);
                //throws.Activate();
                Map.Map          map  = Map.MapManager.Instance.GetMap(arg.Caster.MapInstanceID);
                Map.MoveArgument argu = new Map.MoveArgument()
                {
                    BNSMoveType = Map.MoveType.PushBack
                };
                bool pushed = map.HeightMapBuilder.GetMaximunPushBackPos(arg.Caster.X, arg.Caster.Y, arg.Caster.Z, arg.Caster.Dir, 150, out argu.X, out argu.Y, out argu.Z);
                argu.PushBackSource = arg.Caster;
                argu.Dir            = arg.Caster.Dir;
                argu.SkillSession   = arg.SkillSession;
                map.MoveActor(i.Target, argu, true);
                Common.Additions.ActorDown add = new Common.Additions.ActorDown(arg, i.Target, 12311013, i.Damage, 1000);

                i.Target.Tasks["ActorDown"] = add;
                add.Activate();
            }
        }
        public override void  HandleSkillActivate(SkillArg arg)
        {
            Map.Map          map  = MapManager.Instance.GetMap(arg.Caster.MapInstanceID);
            Map.MoveArgument argu = new Map.MoveArgument()
            {
                BNSMoveType = MoveType.StepForward
            };
            int distance = arg.Caster.DistanceToActor(arg.Target);
            int forward  = 20;

            argu.SkillSession = arg.SkillSession;
            Vec3 vec = -arg.Target.Dir.DirectionToVector();

            argu.X   = arg.Target.X + (int)(vec.X * forward);
            argu.Y   = arg.Target.Y + (int)(vec.Y * forward);
            argu.Z   = (short)arg.Target.Z;
            argu.Dir = arg.Target.Dir;
            map.MoveActor(arg.Caster, argu, true);
            if (arg.Caster.Tasks.ContainsKey("Stealth"))
            {
                Buff buff = arg.Caster.Tasks["Stealth"] as Buff;
                buff.Deactivate();
            }

            Additions.Stealth add = new Additions.Stealth(arg);

            arg.Caster.Tasks["Stealth"] = add;
            add.Activate();
        }
Beispiel #4
0
        public void HandleOnSkillCasting(SkillArg arg)
        {
            Map.Map map = MapManager.Instance.GetMap(arg.Caster.MapInstanceID);
            arg.Caster.Status.StanceFlag1.SetValue(StanceU1.Dash, true);
            UpdateEvent evt = new UpdateEvent()
            {
                Actor             = arg.Caster,
                AdditionID        = 15000030,
                AdditionSession   = 1,
                Target            = arg.Caster,
                Skill             = arg.Skill,
                SkillSession      = arg.SkillSession,
                ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Activate,
                UpdateType        = UpdateTypes.Actor
            };

            //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.Unk7A, arg.Caster.Status.StanceFlag1.Value);
            //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.UnkF4, 1);
            //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.UnkF1, 1);
            map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, arg.Caster, true);

            evt = new UpdateEvent()
            {
                Actor           = arg.Caster,
                Target          = arg.Caster,
                AdditionSession = 1,
                AdditionID      = 15000030,
                RestTime        = arg.ApproachTime,
                UpdateType      = UpdateTypes.ActorExtension
            };
            map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, arg.Caster, true);

            if (isBack)
            {
                arg.Caster.Status.Stealth = true;
            }

            Map.MoveArgument argu = new Map.MoveArgument()
            {
                BNSMoveType = MoveType.StepForward
            };
            int distance = arg.Caster.DistanceToActor(arg.Target);
            int forward  = distance < 40 ? 0 : distance - 20;

            argu.SkillSession = arg.SkillSession;
            float deltaX = (float)(arg.Target.X - arg.Caster.X) / distance;
            float deltaY = (float)(arg.Target.Y - arg.Caster.Y) / distance;

            argu.X   = arg.Caster.X + (int)(deltaX * forward);
            argu.Y   = arg.Caster.Y + (int)(deltaY * forward);
            argu.Z   = (short)arg.Target.Z;
            argu.Dir = arg.Caster.Dir;
            map.MoveActor(arg.Caster, argu, true);
        }
Beispiel #5
0
        public override void HandleOnSkillCasting(SkillArg arg)
        {
            Map.Map map = MapManager.Instance.GetMap(arg.Caster.MapInstanceID);

            Map.MoveArgument argu = new Map.MoveArgument()
            {
                BNSMoveType = MoveType.StepForward
            };
            int distance = arg.Caster.DistanceToActor(arg.Target);
            int forward = distance < 40 ? 0 : distance - 20;
            argu.SkillSession = arg.SkillSession;
            float deltaX = (float)(arg.Target.X - arg.Caster.X) / distance;
            float deltaY = (float)(arg.Target.Y - arg.Caster.Y) / distance;

            argu.X = arg.Caster.X + (int)(deltaX * forward);
            argu.Y = arg.Caster.Y + (int)(deltaY * forward);
            argu.Z = (short)arg.Target.Z;
            argu.Dir = arg.Caster.Dir;
            map.MoveActor(arg.Caster, argu, true);
        }
Beispiel #6
0
        public override void HandleOnSkillCasting(SkillArg arg)
        {
            Map.Map map = MapManager.Instance.GetMap(arg.Caster.MapInstanceID);

            Map.MoveArgument argu = new Map.MoveArgument()
            {
                BNSMoveType = MoveType.StepForward
            };
            int distance = arg.Caster.DistanceToActor(arg.Target);
            int forward  = 20;

            argu.SkillSession = arg.SkillSession;
            Vec3 vec = -arg.Target.Dir.DirectionToVector();

            argu.X   = arg.Target.X + (int)(vec.X * forward);
            argu.Y   = arg.Target.Y + (int)(vec.Y * forward);
            argu.Z   = (short)arg.Target.Z;
            argu.Dir = arg.Target.Dir;
            map.MoveActor(arg.Caster, argu, true);
        }
Beispiel #7
0
        public override void OnAfterSkillCast(SkillArg arg)
        {
            SimpleTask task = new SimpleTask("HighHitDelay", 200, (t) =>
            {
                Map.Map map           = MapManager.Instance.GetMap(arg.Caster.MapInstanceID);
                UpdateEvent evt       = UpdateEvent.NewActorAdditionEvent(arg.Caster, arg.Caster, arg.SkillSession, 28673, 65004, UpdateEvent.ExtraUpdateModes.Cancel);
                Map.MoveArgument argu = new Map.MoveArgument()
                {
                    BNSMoveType  = MoveType.StepForward,
                    SkillSession = arg.SkillSession,
                    X            = oldX,
                    Y            = oldY,
                    Z            = oldZ,
                    Dir          = arg.Caster.Dir
                };
                map.MoveActor(arg.Caster, argu, true);
                // UpdateEvent evt1 = UpdateEvent.NewActorAdditionExtEvent(arg.Caster, arg.SkillSession, 28673, 65004, 1300, UpdateEvent.ExtraUpdateModes.Cancel);
                //map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt1, arg.Caster, true);
            });

            task.Activate();
        }
Beispiel #8
0
 public void Update()
 {
     if (currentPath == null)
     {
         ReCalculatePath();
     }
     if (self.DistanceToPoint(x, y, z) > 30)
     {
         if (currentPath.Count > curPathIdx)
         {
             PathNode     node = currentPath[curPathIdx++];
             MoveArgument arg  = new MoveArgument()
             {
                 X = node.X,
                 Y = node.Y,
                 Z = map.HeightMapBuilder.GetZ((short)node.X, (short)node.Y, (short)node.Z)
             };
             if (arg.Z == 0)
             {
                 status = CommandStatus.Finished;
                 return;
             }
             arg.Dir         = self.DirectionFromTarget(node.X, node.Y);
             arg.Speed       = (ushort)((500 * ((float)500 / self.Speed)) * 2);
             arg.DashID      = 0;
             arg.DashUnknown = 0;
             arg.BNSMoveType = MoveType.Walk;
             map.MoveActor(self, arg);
         }
         else
         {
             status = CommandStatus.Finished;
         }
     }
     else
     {
         status = CommandStatus.Finished;
     }
 }
Beispiel #9
0
        public virtual void HandleSkillActivate(SkillArg arg)
        {
            SkillManager.Instance.DoAttack(arg);
            List <SkillAffectedActor> affected = arg.AffectedActors;
            bool pushedBack = false;

            Map.Map map = Map.MapManager.Instance.GetMap(arg.Caster.MapInstanceID);
            foreach (SkillAffectedActor i in affected)
            {
                SkillAttackResult res = i.Result;
                if (addMana && res != SkillAttackResult.Avoid && res != SkillAttackResult.Miss)
                {
                    if (arg.Caster.ActorType == SmartEngine.Network.Map.ActorType.PC && arg.Caster.MP < arg.Caster.MaxMP)
                    {
                        Network.Client.GameSession client = ((ActorPC)arg.Caster).Client();
                        if (client != null)
                        {
                            Interlocked.Increment(ref arg.Caster.MP);
                            ((ActorPC)arg.Caster).Client().SendPlayerMP();
                        }
                    }
                }
                pushedBack = true;
                bool noPushBack = false;
                if (i.Target is ActorNPC)
                {
                    noPushBack = ((ActorNPC)i.Target).BaseData.NoPushBack;
                }
                if (canPushBack > 0 && !noPushBack && res != SkillAttackResult.Miss && res != SkillAttackResult.Avoid)
                {
                    Map.MoveArgument argu = new Map.MoveArgument()
                    {
                        BNSMoveType = Map.MoveType.PushBack
                    };
                    bool pushed = map.HeightMapBuilder.GetMaximunPushBackPos(i.Target.X, i.Target.Y, i.Target.Z, arg.Caster.Dir, canPushBack, out argu.X, out argu.Y, out argu.Z);
                    int  delta  = Math.Abs(argu.Z - i.Target.Z);

                    if (pushed && delta < 50)
                    {
                        argu.PushBackSource = arg.Caster;
                        argu.Dir            = i.Target.Dir;
                        argu.SkillSession   = arg.SkillSession;
                        //SmartEngine.Core.Logger.Log.Info(argu.Z.ToString());
                        map.MoveActor(i.Target, argu, true);
                        if (stepForward > 0)
                        {
                            argu = new Map.MoveArgument()
                            {
                                BNSMoveType = Map.MoveType.StepForward
                            };
                            pushed   = map.HeightMapBuilder.GetMaximunPushBackPos(arg.Caster.X, arg.Caster.Y, arg.Caster.Z, arg.Caster.Dir, stepForward, out argu.X, out argu.Y, out argu.Z);
                            argu.Dir = arg.Caster.Dir;
                            delta    = Math.Abs(argu.Z - arg.Caster.Z);
                            //SmartEngine.Core.Logger.Log.Info(argu.Z.ToString());
                            if (pushed && delta < 50)
                            {
                                map.MoveActor(arg.Caster, argu, true);
                            }
                        }
                    }
                }
                break;
            }
            if (canPushBack > 0 && !pushedBack && stepForward > 0)
            {
                Map.MoveArgument argu = new Map.MoveArgument()
                {
                    BNSMoveType = Map.MoveType.StepForward
                };
                bool pushed = map.HeightMapBuilder.GetMaximunPushBackPos(arg.Caster.X, arg.Caster.Y, arg.Caster.Z, arg.Caster.Dir, stepForward, out argu.X, out argu.Y, out argu.Z);
                argu.SkillSession = arg.SkillSession;
                int delta = Math.Abs(argu.Z - arg.Caster.Z);
                //SmartEngine.Core.Logger.Log.Info(argu.Z.ToString());
                if (pushed && delta < 50)
                {
                    argu.Dir = arg.Caster.Dir;
                    map.MoveActor(arg.Caster, argu, true);
                }
            }
        }