Пример #1
0
        public void Bomb()
        {
            _actions.Add(new BombAction(_currentTime, ActionType.BOMB, _x, _y, 0, 0));
            //Console.WriteLine(string.Format(">>>>>>{0}  {1}", _x, _y));

            _map.Dig(_x, _y, _shape, null);
            switch (_type)
            {
            case BombType.FORZEN:

                Player[] list = _map.FindPlayers(_x, _y, _radius);
                foreach (Player p in list)
                {
                    p.Forzen();
                    _actions.Add(new BombAction(_currentTime, ActionType.FORZEN, p.Id, 0, 0, 0));
                }
                break;

            case BombType.TRANFORM:
                _owner.X = _x;
                _owner.Y = _y;
                _owner.StartMoving();
                _actions.Add(new BombAction(_currentTime, ActionType.TRANSLATE, _x, _y, 0, 0));
                _actions.Add(new BombAction(_currentTime, ActionType.START_MOVE, _owner.Id, _owner.X, _owner.Y, _owner.IsLiving ? 1 : 0));
                break;

            default:
                Player[] temp = _map.FindPlayers(_x, _y, _radius);
                foreach (Player p in temp)
                {
                    if (p.IsFrost > 0)
                    {
                        _actions.Add(new BombAction(_currentTime, ActionType.UNFORZEN, p.Id, 0, 0, 0));
                    }
                    else
                    {
                        p.KillBy(_owner, _x, _y, _power);
                        _actions.Add(new BombAction(_currentTime, ActionType.KILL_PLAYER, p.Id, p.Blood, _owner.PlayerDetail.CurrentGame.Data.Isforce ? 2 : 1, 0));
                        _actions.Add(new BombAction(_currentTime, ActionType.DANDER, p.Id, p.Dander, 0, 0));
                    }
                    p.IsFrost = 0;
                    p.IsHide  = 0;
                    //被炸死后不需要移动
                    if (p.IsLiving)
                    {
                        p.StartMoving();
                        _actions.Add(new BombAction(_currentTime, ActionType.START_MOVE, p.Id, p.X, p.Y, p.IsLiving ? 1 : 0));
                    }
                }
                break;
            }

            this.Die();
        }
Пример #2
0
        public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
        {
            if (player.IsLiving || player.IsAttacking)
            {
                GSPacketIn pkg = packet.Clone();
                pkg.ClientID = player.Id;
                game.SendToAll(pkg, player.PlayerDetail);

                byte type = packet.ReadByte();
                int tx = packet.ReadInt();
                int ty = packet.ReadInt();
                byte dir = packet.ReadByte();
                bool isLiving = packet.ReadBoolean();

                switch (type)
                {
                    case 0:
                    case 1:
                        //p.X = tx;
                        //p.Y = ty;
                        player.SetXY(tx, ty);
                        player.StartMoving();
                        if (player.Y - ty > 1 || player.IsLiving != isLiving)
                        {
                            //GameServer.log.Error(string.Format("修正掉落: 动作类型  {0}    原始Y:{1}     最新Y:{2}", type, ty, p.Y));
                            //把服务器修正的掉落指令和客户掉落指令加以区分。
                            pkg = player.PlayerDetail.Out.SendPlayerMove(player,3, player.X, player.Y, 0, player.IsLiving);
                            game.SendToAll(pkg, player.PlayerDetail);
                        }
                        break;
                    case 2:
                        if (player.IsLiving == false)
                        {
                            player.TargetPoint = new Point(tx, ty);
                        }
                        break;
                }
            }
        }