Ejemplo n.º 1
0
        /// <summary>
        /// 执行延迟的魔法伤害
        /// </summary>
        public void ExecuteDelayMAttack(IObject self)
        {
            MagicHelperItem magicHelperItem = null;

            lock (_MagicHelperDict)
            {
                _MagicHelperDict.TryGetValue(MagicActionIDs.TIME_DELAYMAGIC, out magicHelperItem);
            }

            if (null == magicHelperItem)
            {
                return;
            }

            long nowTicks = DateTime.Now.Ticks;
            long ticks    = magicHelperItem.StartedTicks + ((int)magicHelperItem.MagicActionParams[1] * 1000 * 10000);

            //判断是否超过了时间
            if (nowTicks < ticks)
            {
                return;
            }

            //只执行一次
            lock (_MagicHelperDict)
            {
                _MagicHelperDict.Remove(magicHelperItem.MagicActionID);
            }

            //执行伤害
            //根据敌人ID判断对方是系统爆的怪还是其他玩家
            int enemy = magicHelperItem.ObjectID;

            if (-1 != enemy)
            {
                GSpriteTypes st = Global.GetSpriteType((UInt32)enemy);
                if (st == GSpriteTypes.Monster)
                {
                    Monster enemyMonster = GameManager.MonsterMgr.FindMonster((self as GameClient).ClientData.MapCode, enemy);
                    if (null != enemyMonster)
                    {
                        ; GameManager.MonsterMgr.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                               self as GameClient, enemyMonster, 0, 0, (magicHelperItem.MagicActionParams[0] / 100.0), 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0);
                    }
                }
                else
                {
                    GameClient enemyClient = GameManager.ClientMgr.FindClient(enemy);
                    if (null != enemyClient)
                    {
                        GameManager.ClientMgr.NotifyOtherInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                 self as GameClient, enemyClient, 0, 0, (magicHelperItem.MagicActionParams[0] / 100.0), 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 执行持续的魔法伤害4
        /// </summary>
        public void ExecuteNewMAttack4(IObject self)
        {
            MagicHelperItem magicHelperItem = null;

            lock (_MagicHelperDict)
            {
                _MagicHelperDict.TryGetValue(MagicActionIDs.NEW_TIME_MAGIC4, out magicHelperItem);
            }

            if (null == magicHelperItem)
            {
                return;
            }
            if (!CanExecuteItem(magicHelperItem, (int)magicHelperItem.MagicActionParams[1], (int)magicHelperItem.MagicActionParams[2]))
            {
                return;
            }

            magicHelperItem.ExecutedNum++;
            magicHelperItem.LastTicks = DateTime.Now.Ticks;

            //执行伤害
            //根据敌人ID判断对方是系统爆的怪还是其他玩家
            int enemy = magicHelperItem.ObjectID;

            if (-1 != enemy)
            {
                GSpriteTypes st = Global.GetSpriteType((UInt32)enemy);
                if (st == GSpriteTypes.Monster)
                {
                    Monster enemyMonster = GameManager.MonsterMgr.FindMonster((self as GameClient).ClientData.MapCode, enemy);
                    if (null != enemyMonster)
                    {
                        int injureValue = (int)(magicHelperItem.MagicActionParams[0] / magicHelperItem.MagicActionParams[2]);
                        GameManager.MonsterMgr.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                             self as GameClient, enemyMonster, 0, injureValue, 0.0, 0, false, 0, 1.0, 0, 0, 0, 0.0, 0.0);
                    }
                }
                else
                {
                    GameClient enemyClient = GameManager.ClientMgr.FindClient(enemy);
                    if (null != enemyClient)
                    {
                        int injureValue = (int)(magicHelperItem.MagicActionParams[0] / magicHelperItem.MagicActionParams[2]);
                        GameManager.ClientMgr.NotifyOtherInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                 self as GameClient, enemyClient, 0, injureValue, 0.0, 0, false, 0, 1.0, 0, 0, 0, 0.0, 0.0);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void ExecuteSubLife2(IObject self)
        {
            MagicHelperItem magicHelperItem = null;

            lock (this._MagicHelperDict)
            {
                this._MagicHelperDict.TryGetValue(MagicActionIDs.TIME_DS_INJURE, out magicHelperItem);
            }
            if (null != magicHelperItem)
            {
                if (this.CanExecuteItem(magicHelperItem, (int)magicHelperItem.MagicActionParams[0], (int)magicHelperItem.MagicActionParams[1]))
                {
                    magicHelperItem.ExecutedNum++;
                    magicHelperItem.LastTicks = TimeUtil.NOW() * 10000L;
                    int enemy = magicHelperItem.ObjectID;
                    if (-1 != enemy)
                    {
                        int          nOcc       = Global.CalcOriginalOccupationID(self as GameClient);
                        int          attackType = nOcc;
                        GSpriteTypes st         = Global.GetSpriteType((uint)enemy);
                        if (st == GSpriteTypes.Monster)
                        {
                            Monster enemyMonster = GameManager.MonsterMgr.FindMonster((self as GameClient).ClientData.MapCode, enemy);
                            if (null != enemyMonster)
                            {
                                GameManager.MonsterMgr.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, self as GameClient, enemyMonster, 0, (int)magicHelperItem.MagicActionParams[2], 1.0, attackType, false, 0, 0.0, 0, 0, 0, 0.0, 0.0, false, 1.0, 0, 0, 0, 0.0);
                                if (enemyMonster.VLife <= 0.0)
                                {
                                    magicHelperItem.ExecutedNum = (int)magicHelperItem.MagicActionParams[1];
                                }
                            }
                        }
                        else
                        {
                            GameClient enemyClient = GameManager.ClientMgr.FindClient(enemy);
                            if (null != enemyClient)
                            {
                                GameManager.ClientMgr.NotifyOtherInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, self as GameClient, enemyClient, 0, (int)magicHelperItem.MagicActionParams[2], 1.0, attackType, false, 0, 0.0, 0, 0, 0, 0.0, 0.0, false, false, 1.0, 0, 0, 0, 0.0);
                                if (enemyClient.ClientData.CurrentLifeV <= 0)
                                {
                                    magicHelperItem.ExecutedNum = (int)magicHelperItem.MagicActionParams[1];
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public static void DoEquipExtAttack(GameClient client, int categoriy, int enemy)
 {
     if (-1 != enemy)
     {
         GoodsData goodData = client.UsingEquipMgr.GetGoodsDataByCategoriy(client, categoriy);
         if (null != goodData)
         {
             List <MagicActionItem> magicActionItemList = UsingGoods.GetMagicActionListByGoodsID(goodData.GoodsID);
             if (magicActionItemList != null && magicActionItemList.Count > 0)
             {
                 MagicActionItem item = magicActionItemList[0];
                 if (MagicActionIDs.EXT_ATTACK_MABI == item.MagicActionID)
                 {
                     double percent = item.MagicActionParams[0];
                     double time    = item.MagicActionParams[1];
                     if ((double)Global.GetRandomNumber(0, 101) <= percent)
                     {
                         int nOcc = Global.CalcOriginalOccupationID(client);
                         if (0 != nOcc)
                         {
                             percent *= 0.5;
                         }
                         if (-1 != enemy)
                         {
                             GSpriteTypes st = Global.GetSpriteType((uint)enemy);
                             if (st != GSpriteTypes.Monster)
                             {
                                 if (st == GSpriteTypes.Other)
                                 {
                                     GameClient enemyClient = GameManager.ClientMgr.FindClient(enemy);
                                     if (null != enemyClient)
                                     {
                                         enemyClient.ClientData.DongJieStart   = TimeUtil.NOW();
                                         enemyClient.ClientData.DongJieSeconds = (int)time;
                                         GameManager.ClientMgr.NotifyRoleStatusCmd(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, enemyClient, 2, enemyClient.ClientData.DongJieStart, enemyClient.ClientData.DongJieSeconds, 0.0);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 5
0
        public void ExecuteDelayMAttack(IObject self)
        {
            MagicHelperItem magicHelperItem = null;

            lock (this._MagicHelperDict)
            {
                this._MagicHelperDict.TryGetValue(MagicActionIDs.TIME_DELAYMAGIC, out magicHelperItem);
            }
            if (null != magicHelperItem)
            {
                long nowTicks = TimeUtil.NOW() * 10000L;
                long ticks    = magicHelperItem.StartedTicks + (long)((int)magicHelperItem.MagicActionParams[1] * 1000 * 10000);
                if (nowTicks >= ticks)
                {
                    lock (this._MagicHelperDict)
                    {
                        this._MagicHelperDict.Remove(magicHelperItem.MagicActionID);
                    }
                    int enemy = magicHelperItem.ObjectID;
                    if (-1 != enemy)
                    {
                        GSpriteTypes st = Global.GetSpriteType((uint)enemy);
                        if (st == GSpriteTypes.Monster)
                        {
                            Monster enemyMonster = GameManager.MonsterMgr.FindMonster((self as GameClient).ClientData.MapCode, enemy);
                            if (null != enemyMonster)
                            {
                                GameManager.MonsterMgr.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, self as GameClient, enemyMonster, 0, 0, magicHelperItem.MagicActionParams[0] / 100.0, 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, 1.0, 0, 0, 0, 0.0);
                            }
                        }
                        else
                        {
                            GameClient enemyClient = GameManager.ClientMgr.FindClient(enemy);
                            if (null != enemyClient)
                            {
                                GameManager.ClientMgr.NotifyOtherInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, self as GameClient, enemyClient, 0, 0, magicHelperItem.MagicActionParams[0] / 100.0, 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, false, 1.0, 0, 0, 0, 0.0);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public void ExecuteNewMAttack4(IObject self)
        {
            MagicHelperItem magicHelperItem = null;

            lock (this._MagicHelperDict)
            {
                this._MagicHelperDict.TryGetValue(MagicActionIDs.NEW_TIME_MAGIC4, out magicHelperItem);
            }
            if (null != magicHelperItem)
            {
                if (this.CanExecuteItem(magicHelperItem, (int)magicHelperItem.MagicActionParams[1], (int)magicHelperItem.MagicActionParams[2]))
                {
                    magicHelperItem.ExecutedNum++;
                    magicHelperItem.LastTicks = TimeUtil.NOW() * 10000L;
                    int enemy = magicHelperItem.ObjectID;
                    if (-1 != enemy)
                    {
                        GSpriteTypes st = Global.GetSpriteType((uint)enemy);
                        if (st == GSpriteTypes.Monster)
                        {
                            Monster enemyMonster = GameManager.MonsterMgr.FindMonster((self as GameClient).ClientData.MapCode, enemy);
                            if (null != enemyMonster)
                            {
                                int injureValue = (int)(magicHelperItem.MagicActionParams[0] / magicHelperItem.MagicActionParams[2]);
                                GameManager.MonsterMgr.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, self as GameClient, enemyMonster, 0, injureValue, 0.0, 0, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, 1.0, 0, 0, 0, 0.0);
                            }
                        }
                        else
                        {
                            GameClient enemyClient = GameManager.ClientMgr.FindClient(enemy);
                            if (null != enemyClient)
                            {
                                int injureValue = (int)(magicHelperItem.MagicActionParams[0] / magicHelperItem.MagicActionParams[2]);
                                GameManager.ClientMgr.NotifyOtherInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, self as GameClient, enemyClient, 0, injureValue, 0.0, 0, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, false, 1.0, 0, 0, 0, 0.0);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 持续伤血2
        /// </summary>
        /// <param name="self"></param>
        public void ExecuteSubLife2(IObject self)
        {
            MagicHelperItem magicHelperItem = null;

            lock (_MagicHelperDict)
            {
                _MagicHelperDict.TryGetValue(MagicActionIDs.TIME_DS_INJURE, out magicHelperItem);
            }

            if (null == magicHelperItem)
            {
                return;
            }
            if (!CanExecuteItem(magicHelperItem, (int)magicHelperItem.MagicActionParams[0], (int)magicHelperItem.MagicActionParams[1]))
            {
                return;
            }

            magicHelperItem.ExecutedNum++;
            magicHelperItem.LastTicks = DateTime.Now.Ticks;

            //执行伤害
            //根据敌人ID判断对方是系统爆的怪还是其他玩家
            int enemy = magicHelperItem.ObjectID;

            if (-1 != enemy)
            {
                // 属性改造 加上一级属性公式 区分职业[8/15/2013 LiaoWei]
                int nOcc = Global.CalcOriginalOccupationID((self as GameClient));

                int          attackType = nOcc;
                GSpriteTypes st         = Global.GetSpriteType((UInt32)enemy);
                if (st == GSpriteTypes.Monster)
                {
                    Monster enemyMonster = GameManager.MonsterMgr.FindMonster((self as GameClient).ClientData.MapCode, enemy);
                    if (null != enemyMonster)
                    {
                        //最低伤害1,使用一个外部传入的1的技巧
                        ; GameManager.MonsterMgr.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                               self as GameClient, enemyMonster, 0, (int)magicHelperItem.MagicActionParams[2], 1.0, attackType, false, 0, 0.0, 0, 0, 0, 0.0, 0.0);

                        if (enemyMonster.VLife <= 0)                                                 //如果死亡
                        {
                            magicHelperItem.ExecutedNum = (int)magicHelperItem.MagicActionParams[1]; //终止buffer
                        }
                    }
                }
                else
                {
                    GameClient enemyClient = GameManager.ClientMgr.FindClient(enemy);
                    if (null != enemyClient)
                    {
                        //最低伤害1,使用一个外部传入的1的技巧
                        GameManager.ClientMgr.NotifyOtherInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                 self as GameClient, enemyClient, 0, (int)magicHelperItem.MagicActionParams[2], 1.0, attackType, false, 0, 0.0, 0, 0, 0, 0.0, 0.0);

                        if (enemyClient.ClientData.CurrentLifeV <= 0)                                //如果死亡
                        {
                            magicHelperItem.ExecutedNum = (int)magicHelperItem.MagicActionParams[1]; //终止buffer
                        }
                    }
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 攻击时附加的效果(麻痹戒指附加一定几率的麻痹效果)
        /// </summary>
        /// <param name="client">客户端对象</param>
        /// <param name="categoriy">装备类型</param>
        /// <param name="enemy">释放目标</param>
        public static void DoEquipExtAttack(GameClient client, int categoriy, int enemy)
        {
            if (-1 == enemy)
            {
                return;
            }

            double time    = 0;
            double percent = 0;

            GoodsData goodData = client.UsingEquipMgr.GetGoodsDataByCategoriy(client, categoriy);

            if (null == goodData)
            {
                return;
            }

            // 获取指定物品的公式列表
            List <MagicActionItem> magicActionItemList = UsingGoods.GetMagicActionListByGoodsID(goodData.GoodsID);

            if (null == magicActionItemList || magicActionItemList.Count <= 0)
            {
                return;
            }

            MagicActionItem item = magicActionItemList[0];

            if (MagicActionIDs.EXT_ATTACK_MABI == item.MagicActionID)
            {
                percent = item.MagicActionParams[0];
                time    = item.MagicActionParams[1];
            }
            else
            {
                return;
            }

            if (Global.GetRandomNumber(0, 101) > percent)
            {
                return;
            }

            // 属性改造 加上一级属性公式 区分职业[8/15/2013 LiaoWei]
            int nOcc = Global.CalcOriginalOccupationID(client);

            if (0 != nOcc)
            {
                percent = percent * 0.5;
            }

            //判断是否找到了敌人
            if (-1 != enemy)
            {
                //根据敌人ID判断对方是系统爆的怪还是其他玩家
                GSpriteTypes st = Global.GetSpriteType((UInt32)enemy);
                if (st == GSpriteTypes.Monster)
                {
                    /*Monster enemyMonster = GameManager.MonsterMgr.FindMonster(client.ClientData.MapCode, enemy);
                     * if (null != enemyMonster)
                     * {
                     * }*/
                }
                else if (st == GSpriteTypes.Other)
                {
                    GameClient enemyClient = GameManager.ClientMgr.FindClient(enemy);
                    if (null != enemyClient)
                    {
                        enemyClient.ClientData.DongJieStart   = TimeUtil.NOW();
                        enemyClient.ClientData.DongJieSeconds = (int)time;

                        //发送角色冻结状态命令
                        GameManager.ClientMgr.NotifyRoleStatusCmd(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, enemyClient,
                                                                  (int)RoleStatusIDs.DongJie, enemyClient.ClientData.DongJieStart, enemyClient.ClientData.DongJieSeconds);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 获取敌人位置
        /// </summary>
        /// <param name="enemyID"></param>
        /// <param name="enemyX"></param>
        /// <param name="enemyY"></param>
        /// <returns></returns>
        private static bool GetEnemyPos(int mapCode, int enemyID, out Point pos)
        {
            bool ret = false;

            pos = new Point(0, 0);

            //根据敌人ID判断对方是系统爆的怪还是其他玩家
            GSpriteTypes st = Global.GetSpriteType((UInt32)enemyID);

            if (st == GSpriteTypes.Monster)
            {
                Monster monster = GameManager.MonsterMgr.FindMonster(mapCode, enemyID);
                if (null != monster)
                {
                    ret = true;
                    pos = new Point(monster.SafeCoordinate.X, monster.SafeCoordinate.Y);
                }
            }
            else if (st == GSpriteTypes.Pet)
            {
                ;//
            }
            else if (st == GSpriteTypes.BiaoChe)
            {
                BiaoCheItem biaoCheItem = BiaoCheManager.FindBiaoCheByID(enemyID);
                if (null != biaoCheItem)
                {
                    ret = true;
                    pos = new Point(biaoCheItem.PosX, biaoCheItem.PosY);
                }
                else //如果是宠物
                {
                    ;//
                }
            }
            else if (st == GSpriteTypes.JunQi)
            {
                JunQiItem junQiItem = JunQiManager.FindJunQiByID(enemyID);
                if (null != junQiItem)
                {
                    ret = true;
                    pos = new Point(junQiItem.PosX, junQiItem.PosY);
                }
                else //如果是宠物
                {
                    ;//
                }
            }
            else if (st == GSpriteTypes.FakeRole)
            {
                FakeRoleItem fakeRoleItem = FakeRoleManager.FindFakeRoleByID(enemyID);
                if (null != fakeRoleItem)
                {
                    ret = true;
                    pos = new Point(fakeRoleItem.MyRoleDataMini.PosX, fakeRoleItem.MyRoleDataMini.PosY);
                }
                else //如果是宠物
                {
                    ;//
                }
            }
            else
            {
                GameClient client = GameManager.ClientMgr.FindClient(enemyID);
                if (null != client)
                {
                    ret = true;
                    pos = new Point(client.ClientData.PosX, client.ClientData.PosY);
                }
            }

            return(ret);
        }