示例#1
0
        public static void LookupRolesInSquare(GameClient client, int mapCode, int radius, int nWidth, List <object> rolesList)
        {
            MapGrid       mapGrid  = GameManager.MapGridMgr.DictGrids[mapCode];
            List <object> objsList = mapGrid.FindObjects(client.ClientData.PosX, client.ClientData.PosY, radius);

            if (null != objsList)
            {
                Point source = new Point((double)client.ClientData.PosX, (double)client.ClientData.PosY);
                Point toPos  = Global.GetAPointInCircle(source, radius, client.ClientData.RoleYAngle);
                int   toX    = (int)toPos.X;
                int   toY    = (int)toPos.Y;
                Point center = default(Point);
                center.X = (double)((client.ClientData.PosX + toX) / 2);
                center.Y = (double)((client.ClientData.PosY + toY) / 2);
                int fDirectionX = toX - client.ClientData.PosX;
                int fDirectionY = toY - client.ClientData.PosY;
                for (int i = 0; i < objsList.Count; i++)
                {
                    if (objsList[i] is FakeRoleItem)
                    {
                        if ((objsList[i] as FakeRoleItem).CurrentLifeV > 0)
                        {
                            if (client == null || client.ClientData.CopyMapID == (objsList[i] as FakeRoleItem).CopyMapID)
                            {
                                Point target = new Point((objsList[i] as FakeRoleItem).CurrentPos.X, (objsList[i] as FakeRoleItem).CurrentPos.Y);
                                if (Global.InSquare(center, target, radius, nWidth, fDirectionX, fDirectionY))
                                {
                                    rolesList.Add(objsList[i]);
                                }
                                else if (Global.InCircle(target, source, 100.0))
                                {
                                    rolesList.Add(objsList[i]);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        protected static bool RunXY(IObject obj, int nX, int nY, Dircetions nDir, string pathStr)
        {
            Point   grid    = obj.CurrentGrid;
            int     nCurrX  = (int)grid.X;
            int     nCurrY  = (int)grid.Y;
            MapGrid mapGrid = GameManager.MapGridMgr.DictGrids[obj.CurrentMapCode];
            bool    result;

            if (mapGrid.MoveObjectEx(nCurrX, nCurrY, nX, nY, obj))
            {
                ChuanQiUtils.NotifyOthersMyMoving(obj, pathStr, nCurrX, nCurrY, nX, nY, nDir);
                obj.CurrentGrid = new Point((double)nX, (double)nY);
                obj.CurrentDir  = nDir;
                ChuanQiUtils.Notify9Grid(obj, false);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
示例#3
0
        /// <summary>
        /// 查找指定圆周范围内的假人
        /// </summary>
        /// <param name="toX"></param>
        /// <param name="toY"></param>
        /// <param name="radius"></param>
        /// <returns></returns>
        public static void LookupEnemiesInCircle(GameClient client, int mapCode, int toX, int toY, int radius, List <Object> enemiesList)
        {
            MapGrid       mapGrid = GameManager.MapGridMgr.DictGrids[mapCode];
            List <Object> objList = mapGrid.FindObjects((int)toX, (int)toY, radius);

            if (null == objList)
            {
                return;
            }

            Point center = new Point(toX, toY);

            for (int i = 0; i < objList.Count; i++)
            {
                if (!(objList[i] is FakeRoleItem))
                {
                    continue;
                }

                //非敌对对象
                if (null != client && !Global.IsOpposition(client, (objList[i] as FakeRoleItem)))
                {
                    continue;
                }

                //不在同一个副本
                if (null != client && client.ClientData.CopyMapID != (objList[i] as FakeRoleItem).CopyMapID)
                {
                    continue;
                }

                Point pt = new Point((objList[i] as FakeRoleItem).MyRoleDataMini.PosX, (objList[i] as FakeRoleItem).MyRoleDataMini.PosY);
                if (Global.InCircle(pt, center, (double)radius))
                {
                    enemiesList.Add((objList[i] as FakeRoleItem));
                }
            }
        }
示例#4
0
        /// <summary>
        /// 加入一个新的特效
        /// </summary>
        /// <param name="myNpc"></param>
        /// <returns></returns>
        public static bool AddDecoToMap(int mapCode, int copyMapID, Point pos, int decoID, int maxLiveTicks, int alphaTicks, bool notifyClients)
        {
            MapGrid mapGrid = GameManager.MapGridMgr.DictGrids[mapCode];

            if (null == mapGrid)
            {
                return(false);
            }

            Decoration deco = new Decoration()
            {
                AutoID       = AutoDecoID++,
                DecoID       = decoID,
                MapCode      = mapCode,
                CopyMapID    = copyMapID,
                Pos          = pos,
                StartTicks   = TimeUtil.NOW(),
                MaxLiveTicks = maxLiveTicks,
                AlphaTicks   = alphaTicks,
            };

            lock (DictDecos)
            {
                DictDecos[deco.AutoID] = deco;
            }

            //加入到地图格子中
            mapGrid.MoveObject(-1, -1, (int)pos.X, (int)pos.Y, deco);

            //通知一下周围的人
            if (notifyClients)
            {
                //对于需要及时通知的,立即刷新
                NotifyNearClientsToAddSelf(deco);
            }

            return(false);
        }
        public static void MonsterMoveStepEMoLaiXiCopySenceCopyMap(Monster monster)
        {
            long ticks = TimeUtil.NOW();

            if (ticks - monster.MoveTime >= 500L)
            {
                int nStep     = monster.Step;
                int nNumStep  = monster.PatrolPath.Count <int[]>() - 1;
                int nNextStep = nStep + 1;
                if (nNextStep >= nNumStep)
                {
                    EMoLaiXiCopySceneManager.IncreaceEscapeCount(monster.CopyMapID);
                    GameManager.MonsterMgr.DeadMonsterImmediately(monster);
                }
                else
                {
                    int     nMapCode  = monster.CurrentMapCode;
                    MapGrid mapGrid   = GameManager.MapGridMgr.DictGrids[nMapCode];
                    int     nNextX    = monster.PatrolPath[nNextStep][0];
                    int     nNextY    = monster.PatrolPath[nNextStep][1];
                    int     gridX     = nNextX / mapGrid.MapGridWidth;
                    int     gridY     = nNextY / mapGrid.MapGridHeight;
                    Point   ToGrid    = new Point((double)gridX, (double)gridY);
                    Point   grid      = monster.CurrentGrid;
                    int     nCurrX    = (int)grid.X;
                    int     nCurrY    = (int)grid.Y;
                    double  Direction = Global.GetDirectionByAspect(gridX, gridY, nCurrX, nCurrY);
                    if (ChuanQiUtils.WalkTo(monster, (Dircetions)Direction) || ChuanQiUtils.WalkTo(monster, (Dircetions)((Direction + 7.0) % 8.0)) || ChuanQiUtils.WalkTo(monster, (Dircetions)((Direction + 9.0) % 8.0)) || ChuanQiUtils.WalkTo(monster, (Dircetions)((Direction + 6.0) % 8.0)) || ChuanQiUtils.WalkTo(monster, (Dircetions)((Direction + 10.0) % 8.0)) || ChuanQiUtils.WalkTo(monster, (Dircetions)((Direction + 5.0) % 8.0)) || ChuanQiUtils.WalkTo(monster, (Dircetions)((Direction + 11.0) % 8.0)))
                    {
                        monster.MoveTime = ticks;
                    }
                    if (Global.GetTwoPointDistance(ToGrid, grid) < 2.0)
                    {
                        monster.Step = nStep + 1;
                    }
                }
            }
        }
示例#6
0
        /// <summary>
        /// 跑到XY坐标,计算时已经验证可移动,这儿不需要再次进行可否移动的判断
        /// </summary>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        /// <param name="nDir"></param>
        /// <returns></returns>
        protected static Boolean RunXY(IObject obj, int nX, int nY, Dircetions nDir, String pathStr)
        {
            Point grid   = obj.CurrentGrid;
            int   nCurrX = (int)grid.X;
            int   nCurrY = (int)grid.Y;

            MapGrid mapGrid = GameManager.MapGridMgr.DictGrids[obj.CurrentMapCode];

            //对象在格子间移动
            if (mapGrid.MoveObjectEx(nCurrX, nCurrY, nX, nY, obj))
            {
                NotifyOthersMyMoving(obj, pathStr, nCurrX, nCurrY, nX, nY, nDir);

                obj.CurrentGrid = new Point(nX, nY);
                obj.CurrentDir  = nDir;

                //进行九宫格通知
                Notify9Grid(obj);
                return(true);
            }

            return(false);
        }
示例#7
0
 public static void RemoveMapNpcs(int mapCode)
 {
     if (mapCode > 0)
     {
         MapGrid mapGrid = GameManager.MapGridMgr.DictGrids[mapCode];
         if (null != mapGrid)
         {
             List <string> keysToDel = new List <string>();
             foreach (KeyValuePair <string, NPC> item in NPCGeneralManager.ListNpc)
             {
                 if (item.Value.MapCode == mapCode)
                 {
                     mapGrid.RemoveObject(item.Value);
                     keysToDel.Add(item.Key);
                 }
             }
             foreach (string key in keysToDel)
             {
                 NPCGeneralManager.ListNpc.Remove(key);
             }
         }
     }
 }
示例#8
0
        /// <summary>
        /// 移除某个地图的所有npc
        /// </summary>
        /// <param name="mapCode"></param>
        public static void RemoveMapNpcs(int mapCode)
        {
            if (mapCode <= 0)
            {
                return;
            }

            MapGrid mapGrid = GameManager.MapGridMgr.DictGrids[mapCode];

            if (null == mapGrid)
            {
                return;
            }

            List <String> keysToDel = new List <string>();

            //先循环进行地图移除通知
            foreach (var item in ListNpc)
            {
                if (item.Value.MapCode == mapCode)
                {
                    //九宫格地图中移除
                    mapGrid.RemoveObject(item.Value);

                    //先移除,再通知
                    //NotifyNearClientsToRemoveSelf(item.Value);

                    keysToDel.Add(item.Key);
                }
            }

            //再移除缓存列表
            foreach (var key in keysToDel)
            {
                ListNpc.Remove(key);
            }
        }
示例#9
0
        public static bool TransportTo(IObject obj, int nX, int nY, Dircetions nDir, int oldMapCode, string pathStr = "")
        {
            Point grid   = obj.CurrentGrid;
            int   nCurrX = (int)grid.X;
            int   nCurrY = (int)grid.Y;

            if (oldMapCode > 0 && oldMapCode != obj.CurrentMapCode)
            {
                MapGrid oldMapGrid = GameManager.MapGridMgr.DictGrids[oldMapCode];
                if (oldMapGrid != null)
                {
                    oldMapGrid.RemoveObject(obj);
                }
                nCurrX = -1;
                nCurrY = -1;
            }
            MapGrid mapGrid = GameManager.MapGridMgr.DictGrids[obj.CurrentMapCode];
            bool    result;

            if (mapGrid.MoveObjectEx(nCurrX, nCurrY, nX, nY, obj))
            {
                obj.CurrentGrid = new Point((double)nX, (double)nY);
                obj.CurrentDir  = nDir;
                if (obj is Monster && (obj as Monster).MonsterType == 1001)
                {
                    GameManager.MonsterMgr.ChangePosition(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, obj as Monster, (int)obj.CurrentPos.X, (int)obj.CurrentPos.Y, (int)nDir, 159, 0);
                }
                ChuanQiUtils.Notify9Grid(obj, true);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
示例#10
0
        private bool StepMove(double toMoveDist, GameClient client)
        {
            StoryBoard4Client sb = StoryBoard4Client.FindStoryBoard(this._RoleID);
            bool result;

            if (null == sb)
            {
                result = false;
            }
            else
            {
                lock (this.mutex)
                {
                    this._PathIndex = Math.Min(this._PathIndex, this._Path.Count - 1);
                    if (!this.DetectNextGrid())
                    {
                        result = true;
                    }
                    else
                    {
                        double targetX          = this._Path[this._PathIndex].X * (double)this._CellSizeX + (double)this._CellSizeX / 2.0;
                        double targetY          = this._Path[this._PathIndex].Y * (double)this._CellSizeY + (double)this._CellSizeY / 2.0;
                        int    direction        = (int)StoryBoard4Client.GetDirectionByTan(targetX, targetY, (double)this._LastTargetX, (double)this._LastTargetY);
                        double dx               = targetX - (double)this._LastTargetX;
                        double dy               = targetY - (double)this._LastTargetY;
                        double thisGridStepDist = Math.Sqrt(dx * dx + dy * dy);
                        bool   needWalking      = false;
                        if (this._Path.Count <= 1)
                        {
                            needWalking = true;
                        }
                        if (null != client)
                        {
                            GameMap gameMap = GameManager.MapMgr.DictMaps[client.ClientData.MapCode];
                            if (gameMap.InSafeRegionList(this._Path[this._PathIndex]))
                            {
                                needWalking = true;
                            }
                        }
                        int action = needWalking ? 1 : 2;
                        if (needWalking)
                        {
                            toMoveDist *= 0.8;
                        }
                        double thisToMoveDist = (thisGridStepDist < toMoveDist) ? thisGridStepDist : toMoveDist;
                        double angle          = Math.Atan2(dy, dx);
                        double speedX         = thisToMoveDist * Math.Cos(angle);
                        double speedY         = thisToMoveDist * Math.Sin(angle);
                        this._CurrentX += speedX;
                        this._CurrentY += speedY;
                        if (null != client)
                        {
                            client.ClientData.CurrentAction = action;
                            if (direction != client.ClientData.RoleDirection)
                            {
                                client.ClientData.RoleDirection = direction;
                            }
                        }
                        if (thisGridStepDist >= toMoveDist)
                        {
                            if (null != client)
                            {
                                GameMap gameMap  = GameManager.MapMgr.DictMaps[client.ClientData.MapCode];
                                int     oldGridX = client.ClientData.PosX / gameMap.MapGridWidth;
                                int     oldGridY = client.ClientData.PosY / gameMap.MapGridHeight;
                                client.ClientData.PosX = (int)this._CurrentX;
                                client.ClientData.PosY = (int)this._CurrentY;
                                int newGridX = client.ClientData.PosX / gameMap.MapGridWidth;
                                int newGridY = client.ClientData.PosY / gameMap.MapGridHeight;
                                if (oldGridX != newGridX || oldGridY != newGridY)
                                {
                                    MapGrid mapGrid = GameManager.MapGridMgr.DictGrids[client.ClientData.MapCode];
                                    mapGrid.MoveObjectEx(oldGridX, oldGridY, newGridX, newGridY, client);
                                }
                            }
                            this._LastTargetX = (int)this._CurrentX;
                            this._LastTargetY = (int)this._CurrentY;
                        }
                        else
                        {
                            this._PathIndex++;
                            if (this._PathIndex >= this._Path.Count)
                            {
                                if (null != client)
                                {
                                    client.ClientData.PosX = (int)targetX;
                                    client.ClientData.PosY = (int)targetY;
                                }
                                return(true);
                            }
                            this._LastTargetX = (int)targetX;
                            this._LastTargetY = (int)targetY;
                            toMoveDist       -= thisGridStepDist;
                            this.StepMove(toMoveDist, client);
                        }
                        result = false;
                    }
                }
            }
            return(result);
        }
示例#11
0
        private bool StepMove(long elapsedTicks)
        {
            //防止外部结束后,这里还在递归处理
            StoryBoard4Client sb = FindStoryBoard(_RoleID);

            if (null == sb)
            {
                return(false);
            }

            lock (mutex)
            {
                //已到最后一个目的地,则停下
                _PathIndex = Math.Min(_PathIndex, _Path.Count - 1);

                //探测下一个格子
                if (!DetectNextGrid())
                {
                    return(true);
                }

                double targetX   = _Path[_PathIndex].X * _CellSizeX + _CellSizeX / 2.0; //根据节点列号求得屏幕坐标
                double targetY   = _Path[_PathIndex].Y * _CellSizeY + _CellSizeY / 2.0; //根据节点行号求得屏幕坐标
                int    direction = (int)(GetDirectionByTan(targetX, targetY, _LastTargetX, _LastTargetY));

                double dx = targetX - _LastTargetX;
                double dy = targetY - _LastTargetY;
                double thisGridStepDist = Math.Sqrt(dx * dx + dy * dy);
                //trace("_PathIndex=" + _PathIndex + ", " + "thisGridStepDist=" + thisGridStepDist);

                bool needWalking = false;// _LastNeedWalking;
                //if (_PathIndex > _ActionIndex)
                //{
                //    int currentGridX = (int)(_LastTargetX / _CellSizeX);
                //    int currentGridY = (int)(_LastTargetY / _CellSizeY);
                //    needWalking = NeedWalking(currentGridX, currentGridY);
                //    _LastNeedWalking = needWalking;
                //}

                if (_Path.Count <= 1)
                {
                    needWalking = true;
                }

                int action = needWalking ? (int)GActions.Walk : (int)GActions.Run;

                long thisGridNeedTicks = GetNeedTicks(needWalking, direction);
                long thisToNeedTicks   = Math.Min(thisGridNeedTicks - _LastUsedTicks, elapsedTicks);
                _LastUsedTicks += thisToNeedTicks;

                //trace(thisToNeedTicks);

                double movePercent  = (double)(thisToNeedTicks) / (double)(thisGridNeedTicks);
                var    realMoveDist = thisGridStepDist * movePercent;
                //trace("_PathIndex=" + _PathIndex + ", " + "movePercent=" + movePercent + ", realMoveDist=" + realMoveDist);

                var angle  = Math.Atan2(dy, dx);
                var speedX = realMoveDist * Math.Cos(angle);
                var speedY = realMoveDist * Math.Sin(angle);

                //trace("_PathIndex=" + _PathIndex + ", " + "speedX=" + speedX + ", speedY=" + speedY);

                _CurrentX = _CurrentX + speedX;
                _CurrentY = _CurrentY + speedY;

                if (thisToNeedTicks >= elapsedTicks)
                {
                    //trace("_PathIndex=" + _PathIndex + ", " + "old_cx=" + _MovingObj.cx + ", old_cy=" + _MovingObj.cy);

                    GameClient client = GameManager.ClientMgr.FindClient(_RoleID);
                    if (null != client)
                    {
                        client.ClientData.CurrentAction = action;

                        //求当前格子到目标格子的方向
                        if ((int)targetX != (int)_CurrentX || (int)targetY != (int)_CurrentY)
                        {
                            if (direction != client.ClientData.RoleDirection)
                            {
                                client.ClientData.RoleDirection = direction;
                            }
                            //Debug.WriteLine("_MovingObj.Direction=" + _MovingObj.Direction + ", targetX=" + targetX + ", targetY=" + targetY + ", _MovingObj.cx=" +  _MovingObj.cx + ",  _MovingObj.cy=" + _MovingObj.cy);
                        }

                        GameMap gameMap  = GameManager.MapMgr.DictMaps[client.ClientData.MapCode];
                        int     oldGridX = client.ClientData.PosX / gameMap.MapGridWidth;
                        int     oldGridY = client.ClientData.PosY / gameMap.MapGridHeight;

                        client.ClientData.PosX = (int)_CurrentX;
                        client.ClientData.PosY = (int)_CurrentY;
                        //_MovingObj.Z = int(_MovingObj.Y); //此处应该非常消耗CPU
                        //trace("_PathIndex=" + _PathIndex + ", " + "now_cx=" + _MovingObj.cx + ", now_cy=" + _MovingObj.cy);
                        //System.Diagnostics.Debug.WriteLine(string.Format("StepMove, toX={0}, toY={1}", client.ClientData.PosX, client.ClientData.PosY));

                        int newGridX = client.ClientData.PosX / gameMap.MapGridWidth;
                        int newGridY = client.ClientData.PosY / gameMap.MapGridHeight;

                        if (oldGridX != newGridX || oldGridY != newGridY)
                        {
                            MapGrid mapGrid = GameManager.MapGridMgr.DictGrids[client.ClientData.MapCode];
                            mapGrid.MoveObjectEx(oldGridX, oldGridY, newGridX, newGridY, client);

                            /// 玩家进行了移动
                            //Global.GameClientMoveGrid(client);
                        }
                    }
                }
                else //到达当前目的地
                {
                    //trace("_PathIndex=" + _PathIndex + ", " + "targetX=" + targetX + ", targetY=" + targetY + ", cx=" + _MovingObj.cx + ", cy=" + _MovingObj.cy );
                    //trace("_PathIndex=" + _PathIndex + ", " + "_LastUsedTicks=" + _LastUsedTicks + ", " + "_LastLostNumberX=" + _LastLostNumberX + ", _LastLostNumberY=" + _LastLostNumberY + ", _TotalMovePercent=" + _TotalMovePercent);
                    //trace("_LastTargetX=" + _LastTargetX + ", " + "_LastTargetY=" + _LastTargetY + ", TargetX=" + targetX + ", " + "targetY=" + targetY + ", cx=" + _MovingObj.cx + ", cy=" + _MovingObj.cy );
                    //trace(_TotalTicksSlot);
                    _PathIndex++;

                    //已到最后一个目的地,则停下
                    if (_PathIndex >= _Path.Count)
                    {
                        GameClient client = GameManager.ClientMgr.FindClient(_RoleID);
                        if (null != client)
                        {
                            client.ClientData.PosX = (int)targetX;
                            client.ClientData.PosY = (int)targetY;
                        }
                        return(true);
                    }

                    _LastTargetX   = (int)targetX;
                    _LastTargetY   = (int)targetY;
                    _LastUsedTicks = 0;
                    //_TotalTicksSlot = "";

                    elapsedTicks = elapsedTicks - thisToNeedTicks; //减去此次移动的距离
                    StepMove(elapsedTicks);
                }

                return(false);
            }
        }
示例#12
0
        /// <summary>
        /// 初始化添加地图
        /// </summary>
        /// <param name="mapWidth"></param>
        /// <param name="mapHeight"></param>
        /// <param name="gridWidth"></param>
        /// <param name="gridHeight"></param>
        public void InitAddMapGrid(int mapCode, int mapWidth, int mapHeight, int gridWidth, int gridHeight, GameMap gameMap)
        {
            MapGrid mapGrid = new MapGrid(mapCode, mapWidth, mapHeight, gridWidth, gridHeight, gameMap);

            _DictGrids.Add(mapCode, mapGrid);
        }
示例#13
0
        /// <summary>
        /// 通知其他人被攻击(单攻),并且被伤害(同一个地图才需要通知)
        /// </summary>
        /// <param name="client"></param>
        public static int NotifyInjured(SocketListener sl, TCPOutPacketPool pool, GameClient client, FakeRoleItem enemy, int burst, int injure, double injurePercent, int attackType, bool forceBurst, int addInjure, double attackPercent, int addAttackMin, int addAttackMax, double baseRate = 1.0, int addVlue = 0, int nHitFlyDistance = 0)
        {
            int    ret = 0;
            object obj = enemy;

            {
                //怪物必须或者才操作
                if ((obj as FakeRoleItem).CurrentLifeV > 0)
                {
                    injure = 1000;

                    // 技能改造[3/13/2014 LiaoWei]
                    //injure = (int)(injure * baseRate + addVlue);

                    // 技能中可配置伤害百分比
                    injure = (int)(injure * injurePercent);
                    ret    = injure;

                    (obj as FakeRoleItem).CurrentLifeV -= (int)injure; //是否需要锁定
                    (obj as FakeRoleItem).CurrentLifeV  = Global.GMax((obj as FakeRoleItem).CurrentLifeV, 0);
                    int enemyLife = (int)(obj as FakeRoleItem).CurrentLifeV;
                    (obj as FakeRoleItem).AttackedRoleID = client.ClientData.RoleID;

                    //判断是否将给敌人的伤害转化成自己的血量增长
                    GameManager.ClientMgr.SpriteInjure2Blood(sl, pool, client, injure);

                    //将攻击者加入历史列表
                    (obj as FakeRoleItem).AddAttacker(client.ClientData.RoleID, Global.GMax(0, injure));

                    GameManager.SystemServerEvents.AddEvent(string.Format("假人减血, Injure={0}, Life={1}", injure, enemyLife), EventLevels.Debug);

                    //判断怪物是否死亡
                    if ((int)(obj as FakeRoleItem).CurrentLifeV <= 0)
                    {
                        GameManager.SystemServerEvents.AddEvent(string.Format("假人死亡, roleID={0}", (obj as FakeRoleItem).FakeRoleID), EventLevels.Debug);

                        /// 处理怪物死亡
                        ProcessFakeRoleDead(sl, pool, client, (obj as FakeRoleItem));
                    }

                    Point hitToGrid = new Point(-1, -1);

                    // 处理击飞 [3/15/2014 LiaoWei]
                    if (nHitFlyDistance > 0)
                    {
                        MapGrid mapGrid = GameManager.MapGridMgr.DictGrids[client.ClientData.MapCode];

                        int nGridNum = nHitFlyDistance * 100 / mapGrid.MapGridWidth;

                        if (nGridNum > 0)
                        {
                            hitToGrid = ChuanQiUtils.HitFly(client, enemy, nGridNum);
                        }
                    }

                    if ((obj as FakeRoleItem).AttackedRoleID >= 0 && (obj as FakeRoleItem).AttackedRoleID != client.ClientData.RoleID)
                    {
                        GameClient findClient = GameManager.ClientMgr.FindClient((obj as FakeRoleItem).AttackedRoleID);
                        if (null != findClient)
                        {
                            //通知其他在线客户端
                            GameManager.ClientMgr.NotifySpriteInjured(sl, pool, findClient, findClient.ClientData.MapCode, findClient.ClientData.RoleID, (obj as FakeRoleItem).FakeRoleID, 0, 0, enemyLife, findClient.ClientData.Level, hitToGrid);

                            //向自己发送敌人受伤的信息
                            ClientManager.NotifySelfEnemyInjured(sl, pool, findClient, findClient.ClientData.RoleID, enemy.FakeRoleID, 0, 0, enemyLife, 0);
                        }
                    }

                    //通知其他在线客户端
                    GameManager.ClientMgr.NotifySpriteInjured(sl, pool, client, client.ClientData.MapCode, client.ClientData.RoleID, (obj as FakeRoleItem).FakeRoleID, burst, injure, enemyLife, client.ClientData.Level, hitToGrid);

                    //向自己发送敌人受伤的信息
                    ClientManager.NotifySelfEnemyInjured(sl, pool, client, client.ClientData.RoleID, enemy.FakeRoleID, burst, injure, enemyLife, 0);

                    //通知紫名信息(限制当前地图)
                    if (!client.ClientData.DisableChangeRolePurpleName)
                    {
                        GameManager.ClientMgr.ForceChangeRolePurpleName2(sl, pool, client);
                    }
                }
            }

            return(ret);
        }