예제 #1
0
        /// <summary>
        /// 扇形范围的圆形区域伤害
        /// </summary>
        /// <param name="key"></param>
        /// <param name="magicHelperItem"></param>
        /// <param name="nowTicks"></param>
        public void ExecuteMUFireSector(GridMagicHelperItemKey key, GridMagicHelperItemEx magicHelperItem, long nowTicks)
        {
            int id    = (int)key.MagicActionID;
            int gridX = key.PosX;
            int gridY = key.PosY;

            magicHelperItem.ExecutedNum++;
            magicHelperItem.LastTicks = nowTicks;

            //执行伤害
            //根据敌人ID判断对方是系统爆的怪还是其他玩家
            int    addValue     = (int)magicHelperItem.MagicActionParams[2];
            int    attacker     = (int)magicHelperItem.MagicActionParams[3];
            double baseRate     = magicHelperItem.MagicActionParams[4];
            int    radio        = (int)(magicHelperItem.MagicActionParams[5]); //服务器坐标单位
            int    angel        = (int)(magicHelperItem.MagicActionParams[6]); //角度
            int    direction    = (int)(magicHelperItem.MagicActionParams[7]); //释放时的方向
            int    mapGridWidth = (int)(magicHelperItem.MagicActionParams[9]); //格子宽度

            gridX *= mapGridWidth;
            gridY *= mapGridWidth;
            if (-1 != attacker)
            {
                GameClient client = GameManager.ClientMgr.FindClient(attacker);
                if (null != client)
                {
                    List <Object> enemiesList = new List <object>();
                    GameManager.ClientMgr.LookupEnemiesInCircleByAngle(direction, magicHelperItem.MapCode, client.ClientData.CopyMapID, gridX, gridY, radio, enemiesList, angel, false);
                    GameManager.MonsterMgr.LookupEnemiesInCircleByAngle(direction, magicHelperItem.MapCode, client.ClientData.CopyMapID, gridX, gridY, radio, enemiesList, angel, false);
                    for (int x = 0; x < enemiesList.Count; x++)
                    {
                        IObject obj = enemiesList[x] as IObject;
                        if (obj.CurrentCopyMapID != client.CurrentCopyMapID)
                        {
                            continue;
                        }

                        if (obj is GameClient) //被攻击者是角色
                        {
                            if ((obj as GameClient).ClientData.RoleID != attacker && Global.IsOpposition(client, (obj as GameClient)))
                            {
                                GameManager.ClientMgr.NotifyOtherInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                         client, obj as GameClient, 0, 0, 1.0, 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, false, baseRate, addValue);
                            }
                        }
                        else if (obj is Monster) //被攻击者是怪物
                        {
                            if (Global.IsOpposition(client, (obj as Monster)))
                            {
                                GameManager.MonsterMgr.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                     client, obj as Monster, 0, 0, 1.0, 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, baseRate, addValue);
                            }
                        }
                        else if (obj is BiaoCheItem) //被攻击者是镖车
                        {
                            if (Global.IsOpposition(client, (obj as BiaoCheItem)))
                            {
                                BiaoCheManager.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                             client, obj as BiaoCheItem, 0, 0, 1.0, 1, false, 0, 1.0, 0, 0, baseRate, addValue);
                            }
                        }
                        else if (obj is JunQiItem) //被攻击者是帮旗
                        {
                            if (Global.IsOpposition(client, (obj as JunQiItem)))
                            {
                                JunQiManager.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                           client, obj as JunQiItem, 0, 0, 1.0, 1, false, 0, 0, 0, 0, baseRate, addValue);
                            }
                        }
                        else if (obj is FakeRoleItem) //被攻击者是假人
                        {
                            if (Global.IsOpposition(client, (obj as FakeRoleItem)))
                            {
                                FakeRoleManager.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                              client, obj as FakeRoleItem, 0, 0, 1.0, 1, false, 0, baseRate, addValue, 0);
                            }
                        }
                    }
                }
                else
                {
                    Monster monster = GameManager.MonsterMgr.FindMonster(magicHelperItem.MapCode, attacker);
                    if (null != monster)
                    {
                        List <Object> enemiesList = new List <object>();
                        GameManager.ClientMgr.LookupEnemiesInCircleByAngle(direction, magicHelperItem.MapCode, monster.CopyMapID, gridX, gridY, radio, enemiesList, angel, false);
                        GameManager.MonsterMgr.LookupEnemiesInCircleByAngle(direction, magicHelperItem.MapCode, monster.CopyMapID, gridX, gridY, radio, enemiesList, angel, false);
                        for (int x = 0; x < enemiesList.Count; x++)
                        {
                            IObject obj = enemiesList[x] as IObject;
                            if (obj.CurrentCopyMapID != monster.CurrentCopyMapID)
                            {
                                continue;
                            }

                            if (obj is GameClient) //被攻击者是角色
                            {
                                if ((obj as GameClient).ClientData.RoleID != attacker && Global.IsOpposition(monster, (obj as GameClient)))
                                {
                                    GameManager.ClientMgr.NotifyOtherInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                             monster, obj as GameClient, 0, 0, 1.0, 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, baseRate, addValue);
                                }
                            }
                            else if (obj is Monster) //被攻击者是怪物
                            {
                                if (Global.IsOpposition(monster, (obj as Monster)))
                                {
                                    GameManager.MonsterMgr.Monster_NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                                 monster, obj as Monster, 0, 0, 1.0, 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, baseRate, addValue);
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        /// </summary>
        public void ExecuteMUFireWall(int id, string gridXY, Dictionary <MagicActionIDs, GridMagicHelperItem> dict)
        {
            string[] fields = gridXY.Split('_');
            int      gridX  = Global.SafeConvertToInt32(fields[0]);
            int      gridY  = Global.SafeConvertToInt32(fields[1]);

            GridMagicHelperItem magicHelperItem = null;

            lock (dict)
            {
                dict.TryGetValue((MagicActionIDs)id, out magicHelperItem);
            }

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

            magicHelperItem.ExecutedNum++;
            magicHelperItem.LastTicks = TimeUtil.NOW();

            //执行伤害
            //根据敌人ID判断对方是系统爆的怪还是其他玩家
            int    addValue = (int)magicHelperItem.MagicActionParams[2];
            int    attacker = (int)magicHelperItem.MagicActionParams[3];
            double baseRate = magicHelperItem.MagicActionParams[4];

            if (-1 != attacker)
            {
                GameClient client = GameManager.ClientMgr.FindClient(attacker);
                if (null != client)
                {
                    List <Object> enemiesList = new List <object>();
                    GameManager.ClientMgr.LookupEnemiesAtGridXY(client, gridX, gridY, enemiesList);
                    GameManager.MonsterMgr.LookupEnemiesAtGridXY(client, gridX, gridY, enemiesList);
                    BiaoCheManager.LookupEnemiesAtGridXY(client, gridX, gridY, enemiesList);
                    JunQiManager.LookupEnemiesAtGridXY(client, gridX, gridY, enemiesList);
                    for (int x = 0; x < enemiesList.Count; x++)
                    {
                        IObject obj = enemiesList[x] as IObject;
                        if (obj.CurrentCopyMapID != client.CurrentCopyMapID)
                        {
                            continue;
                        }

                        if (obj is GameClient) //被攻击者是角色
                        {
                            if ((obj as GameClient).ClientData.RoleID != attacker && Global.IsOpposition(client, (obj as GameClient)))
                            {
                                GameManager.ClientMgr.NotifyOtherInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                         client, obj as GameClient, 0, 0, 1.0, 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, false, baseRate, addValue);
                            }
                        }
                        else if (obj is Monster) //被攻击者是怪物
                        {
                            if (Global.IsOpposition(client, (obj as Monster)))
                            {
                                GameManager.MonsterMgr.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                     client, obj as Monster, 0, 0, 1.0, 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, baseRate, addValue);
                            }
                        }
                        else if (obj is BiaoCheItem) //被攻击者是镖车
                        {
                            if (Global.IsOpposition(client, (obj as BiaoCheItem)))
                            {
                                BiaoCheManager.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                             client, obj as BiaoCheItem, 0, 0, 1.0, 1, false, 0, 1.0, 0, 0, baseRate, addValue);
                            }
                        }
                        else if (obj is JunQiItem) //被攻击者是帮旗
                        {
                            if (Global.IsOpposition(client, (obj as JunQiItem)))
                            {
                                JunQiManager.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                           client, obj as JunQiItem, 0, 0, 1.0, 1, false, 0, 0, 0, 0, baseRate, addValue);
                            }
                        }
                        else if (obj is FakeRoleItem) //被攻击者是假人
                        {
                            if (Global.IsOpposition(client, (obj as FakeRoleItem)))
                            {
                                FakeRoleManager.NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                              client, obj as FakeRoleItem, 0, 0, 1.0, 1, false, 0, baseRate, addValue, 0);
                            }
                        }
                    }
                }
                else
                {
                    Monster monster = GameManager.MonsterMgr.FindMonster(magicHelperItem.MapCode, attacker);
                    if (null != monster)
                    {
                        List <Object> enemiesList = new List <object>();
                        GameManager.ClientMgr.LookupEnemiesAtGridXY(monster, gridX, gridY, enemiesList);
                        GameManager.MonsterMgr.LookupEnemiesAtGridXY(monster, gridX, gridY, enemiesList);
                        BiaoCheManager.LookupEnemiesAtGridXY(monster, gridX, gridY, enemiesList);
                        JunQiManager.LookupEnemiesAtGridXY(monster, gridX, gridY, enemiesList);
                        for (int x = 0; x < enemiesList.Count; x++)
                        {
                            IObject obj = enemiesList[x] as IObject;
                            if (obj.CurrentCopyMapID != monster.CurrentCopyMapID)
                            {
                                continue;
                            }

                            if (obj is GameClient) //被攻击者是角色
                            {
                                if ((obj as GameClient).ClientData.RoleID != attacker && Global.IsOpposition(monster, (obj as GameClient)))
                                {
                                    GameManager.ClientMgr.NotifyOtherInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                             monster, obj as GameClient, 0, 0, 1.0, 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, baseRate, addValue);
                                }
                            }
                            else if (obj is Monster) //被攻击者是怪物
                            {
                                if (Global.IsOpposition(monster, (obj as Monster)))
                                {
                                    GameManager.MonsterMgr.Monster_NotifyInjured(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                                 monster, obj as Monster, 0, 0, 1.0, 1, false, 0, 1.0, 0, 0, 0, 0.0, 0.0, false, baseRate, addValue);
                                }
                            }
                        }
                    }
                }
            }
        }