Exemple #1
0
        public void BeginNextTurn()
        {
            if (CurrentIsHitTarget == true)
            {
                TotalHitTargetCount++;
            }
            CurrentIsHitTarget = false;

            m_energy     = 240;
            m_shootCount = 1;
            m_ballCount  = 1;
            m_flyCoolDown--;

            CurrentDamagePlus = 1;
            CurrentShootMinus = 1;
            if (m_currentBall.ID != m_mainBallId)
            {
                m_currentBall = BallMgr.FindBall(m_mainBallId);
            }

            if (IsLiving == false)
            {
                StartGhostMoving();
                TargetPoint = Point.Empty;
            }
        }
Exemple #2
0
 public override void PrepareNewTurn()
 {
     if (this.CurrentIsHitTarget)
     {
         this.TotalHitTargetCount++;
     }
     this.m_energy             = this.m_player.PlayerCharacter.Agility / 30 + 240;
     this.m_ghostEnergy        = (int)((double)this.m_energy * 1.5);
     this.m_shootCount         = 1;
     this.m_ballCount          = 1;
     this.AttackInformation    = true;
     this.DefenceInformation   = true;
     this.AttackEffectTrigger  = false;
     this.DefenceEffectTrigger = false;
     this.SetCurrentWeapon(this.PlayerDetail.MainWeapon);
     if (this.m_currentBall.ID != this.m_mainBallId)
     {
         this.m_currentBall = BallMgr.FindBall(this.m_mainBallId);
     }
     if (!base.IsLiving)
     {
         this.StartGhostMoving();
     }
     base.PrepareNewTurn();
 }
Exemple #3
0
        public void Reset()
        {
            m_maxBlood = (int)((950 + m_player.PlayerCharacter.Grade * 50) * m_player.BaseBlood);
            if (m_isCaptain)
            {
                m_maxBlood *= 2;
            }
            m_blood = m_maxBlood;



            m_dander    = 0;
            m_delay     = (int)(1000 * m_player.BaseAgility);
            m_energy    = 240;
            m_isCaptain = false;

            m_isFrost  = false;
            m_isHide   = false;
            m_isNoHole = false;

            m_isLiving    = true;
            m_currentBall = BallMgr.FindBall(m_mainBallId);

            m_shootCount = 1;
            m_ballCount  = 1;

            TurnNum             = 0;
            TotalHurt           = 0;
            TotalKill           = 0;
            TotalShootCount     = 0;
            TotalHitTargetCount = 0;

            GainGP    = 0;
            GainOffer = 0;
        }
Exemple #4
0
        public override void PrepareNewTurn()
        {
            if (CurrentIsHitTarget == true)
            {
                TotalHitTargetCount++;
                //Console.WriteLine("TotalHitTargetCount + 1 ------>>>> p.TotalHitTargetCount : {0}", TotalHitTargetCount);
            }

            //Game.SendUpdateUiData(this, game);
            // BufferMgr.BufferList.Clear();
            m_energy     = m_player.PlayerCharacter.Agility / 30 + 240;
            m_shootCount = 1;
            m_ballCount  = 1;
            m_flyCoolDown--;
            m_secondWeapon--;
            //if(m_currentBall.ID!=PlayerDetail.MainWeapon)
            //SetCurrentWeapon(PlayerDetail.MainWeapon);
            SetCurrentWeapon(PlayerDetail.MainWeapon);
            if (m_currentBall.ID != m_mainBallId)
            {
                m_currentBall = BallMgr.FindBall(m_mainBallId);
            }

            if (IsLiving == false)
            {
                StartGhostMoving();
                TargetPoint = Point.Empty;
            }

            base.PrepareNewTurn();
        }
Exemple #5
0
        public override void PrepareNewTurn()
        {
            if (CurrentIsHitTarget == true)
            {
                TotalHitTargetCount++;
            }
            m_energy     = m_player.PlayerCharacter.Agility / 30 + 240;
            m_shootCount = 1;
            m_ballCount  = 1;
            m_flyCoolDown--;
            m_secondWeapon--;
            SetCurrentWeapon(PlayerDetail.MainWeapon);
            if (m_currentBall.ID != m_mainBallId)
            {
                m_currentBall = BallMgr.FindBall(m_mainBallId);
            }

            if (IsLiving == false)
            {
                StartGhostMoving();
                TargetPoint = Point.Empty;
            }

            base.PrepareNewTurn();
        }
Exemple #6
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            //if (player.CurrentGame.Data.CurrentSpell != this)
            if (player.CurrentGame.Data.CurrentFire == null)
            {
                player.CurrentGame.Data.CurrentSpell = this;
                player.CurrentGame.Data.CurrentPorp  = item;
                //player.CurrentGame.Data.CurrentBall = Bussiness.Managers.BallMgr.FindBall(3);
                player.CurrentGame.Data.SetCurrentBall(BallMgr.FindBall(3), false);

                player.CurrentGame.Data.AddAttack = -1;
                player.CurrentGame.Data.AddBall   = 1;
            }
            else
            {
                if (player != player.CurrentGame.Data.CurrentFire)
                {
                    return;
                }

                //player.CurrentGame.Data.Players[player].CarryPoint();
                GSPacketIn pkg = player.Out.SendPlayerCarry(player);
                player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
            }
        }
Exemple #7
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            //if (player.CurrentGame.Data.CurrentSpell != this)
            if (player.CurrentGame.Data.CurrentFire == null)
            {
                player.CurrentGame.Data.CurrentSpell = this;
                player.CurrentGame.Data.CurrentPorp  = item;
                //player.CurrentGame.Data.CurrentBall = Bussiness.Managers.BallMgr.FindBall(1);
                player.CurrentGame.Data.SetCurrentBall(BallMgr.FindBall(1), false);

                player.CurrentGame.Data.AddAttack = -1;
                player.CurrentGame.Data.AddBall   = 1;
            }
            else
            {
                if (player.CurrentGame.Data.Players[player].IsFrost == 0)
                {
                    IceFronzeEffect ice = new IceFronzeEffect(item.Template.Property2);
                    ice.Start(player);
                }
                else
                {
                    player.CurrentGame.Data.Players[player].SetFrost(item.Template.Property2);
                }
            }
        }
Exemple #8
0
        public void SetBall(int ballId)
        {
            if (ballId != m_currentBall.ID)
            {
                m_currentBall = BallMgr.FindBall(ballId);
                GSPacketIn pkg = m_player.Out.SendGameUpdateBall(this);
                m_game.SendToAll(pkg, m_player);

                BallCount = m_currentBall.Amount;
            }
        }
 private void player_AfterPlayerShooted(Player player, int delay)
 {
     if (this.m_oldBall != -1)
     {
         if (BallMgr.IsExist(this.m_oldBall))
         {
             player.CurrentBall = BallMgr.FindBall(this.m_oldBall);
             player.Game.SendGameUpdateBall(player, false);
             this.m_oldBall = -1;
         }
     }
 }
Exemple #10
0
        public override void Reset()
        {
            m_maxBlood = (int)((950 + m_player.PlayerCharacter.Grade * 50 + LevelPlusBlood + m_player.PlayerCharacter.Defence / 10) * m_player.GetBaseBlood());
            if (m_game.RoomType == eRoomType.Treasure || m_game.RoomType == eRoomType.Boss)
            {
                m_game.Cards = new int[21];
            }
            else
            {
                m_game.Cards = new int[8];
            }

            Dander         = 0;
            m_energy       = (m_player.PlayerCharacter.Agility / 30 + 240);
            IsLiving       = true;
            FinishTakeCard = false;
            m_weapon       = m_player.MainWeapon;
            //m_mainBallId = m_weapon.Property1;
            //m_spBallId = m_weapon.Property2;
            var ballConfig = BallConfigMgr.FindBall(m_weapon.TemplateID);

            m_mainBallId = ballConfig.Common;
            m_spBallId   = ballConfig.Special;
            BaseDamage   = m_player.GetBaseAttack();
            BaseGuard    = m_player.GetBaseDefence();

            Attack  = m_player.PlayerCharacter.Attack;
            Defence = m_player.PlayerCharacter.Defence;
            Agility = m_player.PlayerCharacter.Agility;
            Lucky   = m_player.PlayerCharacter.Luck;

            m_currentBall = BallMgr.FindBall(m_mainBallId);
            m_shootCount  = 1;
            m_ballCount   = 1;

            CurrentIsHitTarget = false;

            TotalCure           = 0;
            TotalHitTargetCount = 0;
            TotalHurt           = 0;
            TotalKill           = 0;
            TotalShootCount     = 0;
            LockDirection       = false;
            GainGP    = 0;
            GainOffer = 0;
            Ready     = false;
            PlayerDetail.ClearTempBag();

            LoadingProcess = 0;

            base.Reset();
        }
Exemple #11
0
        public override void Reset()
        {
            this.m_maxBlood = this.m_player.PlayerCharacter.hp;
            if (this.m_game.RoomType == eRoomType.Dungeon)
            {
                this.m_game.Cards = new int[21];
            }
            else
            {
                this.m_game.Cards = new int[9];
            }
            base.Dander         = 0;
            base.PetMP          = 10;
            base.psychic        = 40;
            this.m_energy       = this.m_player.PlayerCharacter.Agility / 30 + 240;
            base.IsLiving       = true;
            this.FinishTakeCard = false;
            this.m_DeputyWeapon = this.m_player.SecondWeapon;
            this.m_weapon       = this.m_player.MainWeapon;
            BallConfigInfo ballConfigInfo = BallConfigMgr.FindBall(this.m_weapon.TemplateID);

            this.m_mainBallId        = ballConfigInfo.Common;
            this.m_spBallId          = ballConfigInfo.Special;
            this.m_sp2BallId         = ballConfigInfo.SpecialII;
            this.m_AddWoundBallId    = ballConfigInfo.CommonAddWound;
            this.m_MultiBallId       = ballConfigInfo.CommonMultiBall;
            this.BaseDamage          = this.m_player.GetBaseAttack();
            this.BaseGuard           = this.m_player.GetBaseDefence();
            this.Attack              = (double)this.m_player.PlayerCharacter.Attack;
            this.Defence             = (double)this.m_player.PlayerCharacter.Defence;
            this.Agility             = (double)this.m_player.PlayerCharacter.Agility;
            this.Lucky               = (double)this.m_player.PlayerCharacter.Luck;
            this.m_currentBall       = BallMgr.FindBall(this.m_mainBallId);
            this.m_shootCount        = 1;
            this.m_ballCount         = 1;
            this.m_prop              = 0;
            this.CurrentIsHitTarget  = false;
            this.TotalCure           = 0;
            this.TotalHitTargetCount = 0;
            this.TotalHurt           = 0;
            this.TotalKill           = 0;
            this.TotalShootCount     = 0;
            this.LockDirection       = false;
            this.GainGP              = 0;
            this.GainOffer           = 0;
            this.Ready               = false;
            this.PlayerDetail.ClearTempBag();
            this.LoadingProcess = 0;
            this.skillcu        = 0;
            base.Reset();
        }
 private void ChangeProperty(Player player, int ball)
 {
     if (player.CurrentBall.ID != 1 && player.CurrentBall.ID != 3 && player.CurrentBall.ID != 5)
     {
         if (AbstractEffect.random.Next(1000000) < this.m_probability * 10000)
         {
             player.AttackEffectTrigger = true;
             player.CurrentBall         = BallMgr.FindBall(4);
             player.Game.SendGameUpdateBall(player, false);
             this.m_oldBall = ball;
             player.Game.AddAction(new LivingSayAction(player, LanguageMgr.GetTranslation("AtomBombEquipEffect.msg", new object[0]), 9, 0, 1000));
         }
     }
 }
Exemple #13
0
 public void SetBall(int ballId, bool special)
 {
     if (ballId != this.m_currentBall.ID)
     {
         if (BallMgr.FindBall(ballId) != null)
         {
             this.m_currentBall = BallMgr.FindBall(ballId);
         }
         this.BallCount = this.m_currentBall.Amount;
         if (!special || ballId == 4)
         {
             this.ShootCount = 1;
         }
         this.m_game.SendGameUpdateBall(this, special);
     }
 }
Exemple #14
0
        public void GetShootForceAndAngle(ref int x, ref int y, int bombId, int minTime, int maxTime, int bombCount, float time, ref int force, ref int angle)
        {
            if (minTime >= maxTime)
            {
                return;
            }

            BallInfo ballInfo = BallMgr.FindBall(bombId);

            if (m_game != null && ballInfo != null)
            {
                Map   map  = m_game.Map;
                Point sp   = GetShootPoint();
                float dx   = x - sp.X;
                float dy   = y - sp.Y;
                float arf  = map.airResistance * ballInfo.DragIndex;
                float gf   = map.gravity * ballInfo.Weight * ballInfo.Mass;
                float wf   = map.wind * ballInfo.Wind;
                float mass = ballInfo.Mass;
                for (float t = time; t <= 4; t += 0.6F)
                {
                    double vx = ComputeVx(dx, mass, arf, wf, t);
                    double vy = ComputeVy(dy, mass, arf, gf, t);

                    if (vy < 0 && vx * m_direction > 0)
                    {
                        double tf = Math.Sqrt(vx * vx + vy * vy);
                        if (tf < 2000)
                        {
                            //Console.WriteLine(string.Format("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< vx:{0}   vy:{1}", vx, vy));
                            force = (int)tf;
                            angle = (int)(Math.Atan(vy / vx) / Math.PI * 180);
                            if (vx < 0)
                            {
                                angle = angle + 180;
                            }
                            break;
                        }
                    }
                }
                x = sp.X;
                y = sp.Y;
            }
        }
Exemple #15
0
 public override void Reset()
 {
     this.m_maxBlood         = (int)((double)(950 + this.m_player.PlayerCharacter.Grade * 50 + this.LevelPlusBlood + this.m_player.PlayerCharacter.Defence / 10) * this.m_player.GetBaseBlood());
     this.HasPaymentTakeCard = false;
     base.Dander             = 0;
     this.m_energy           = this.m_player.PlayerCharacter.Agility / 30 + 240;
     this.m_ghostEnergy      = this.m_energy;
     base.IsLiving           = true;
     this.FinishTakeCard     = false;
     this.m_weapon           = this.m_player.MainWeapon;
     this.m_mainBallId       = this.m_weapon.Property1;
     this.m_spBallId         = this.m_weapon.Property2;
     this.BaseDamage         = this.m_player.GetBaseAttack();
     this.BaseGuard          = this.m_player.GetBaseDefence();
     this.Attack             = (double)this.m_player.PlayerCharacter.Attack;
     this.Defence            = (double)this.m_player.PlayerCharacter.Defence;
     this.Agility            = (double)this.m_player.PlayerCharacter.Agility;
     this.Lucky = (double)this.m_player.PlayerCharacter.Luck;
     this.InitBuffer(this.m_player.EquipEffect);
     this.m_currentBall           = BallMgr.FindBall(this.m_mainBallId);
     this.m_shootCount            = 1;
     this.m_ballCount             = 1;
     this.CurrentIsHitTarget      = false;
     this.m_killedPunishmentOffer = 0;
     this.TotalCure           = 0;
     this.TotalHitTargetCount = 0;
     this.TotalHurt           = 0;
     this.TotalKill           = 0;
     this.TotalShootCount     = 0;
     this.LockDirection       = false;
     this.GainGP    = 0;
     this.GainOffer = 0;
     this.Ready     = false;
     this.PlayerDetail.ClearTempBag();
     this.m_delay        = this.GetInitDelay();
     this.TargetPoint    = Point.Empty;
     this.m_flyCoolDown  = 0;
     this.m_secondWeapon = 0;
     if (this.PlayerDetail.SecondWeapon != null)
     {
         this.AngelCount = this.PlayerDetail.SecondWeapon.StrengthenLevel + 1;
     }
     base.Reset();
 }
Exemple #16
0
        public void GetShootForceAndAngle(ref int x, ref int y, int bombId, int minTime, int maxTime, int bombCount, float time, ref int force, ref int angle)
        {
            if (minTime >= maxTime)
            {
                return;
            }
            BallInfo ballInfo = BallMgr.FindBall(bombId);

            if (this.m_game != null && ballInfo != null)
            {
                Map   map        = this.m_game.Map;
                Point shootPoint = this.GetShootPoint();
                float num        = (float)(x - shootPoint.X);
                float num2       = (float)(y - shootPoint.Y);
                float af         = map.airResistance * (float)ballInfo.DragIndex;
                float f          = map.gravity * (float)ballInfo.Weight * (float)ballInfo.Mass;
                float f2         = map.wind * (float)ballInfo.Wind;
                float m          = (float)ballInfo.Mass;
                for (float num3 = time; num3 <= 4f; num3 += 0.6f)
                {
                    double num4 = Living.ComputeVx((double)num, m, af, f2, num3);
                    double num5 = Living.ComputeVy((double)num2, m, af, f, num3);
                    if (num5 < 0.0 && num4 * (double)this.m_direction > 0.0)
                    {
                        double num6 = Math.Sqrt(num4 * num4 + num5 * num5);
                        if (num6 < 2000.0)
                        {
                            force = (int)num6;
                            angle = (int)(Math.Atan(num5 / num4) / 3.1415926535897931 * 180.0);
                            if (num4 < 0.0)
                            {
                                angle += 180;
                                break;
                            }
                            break;
                        }
                    }
                }
                x = shootPoint.X;
                y = shootPoint.Y;
            }
        }
Exemple #17
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            if (player.CurrentGame.Data.CurrentFire == null)
            {
                player.CurrentGame.Data.CurrentSpell = this;
                player.CurrentGame.Data.CurrentPorp  = item;
                player.CurrentGame.Data.SetCurrentBall(BallMgr.FindBall(4), false);
            }
            //else
            //{
            //    if (player.CurrentGame.Data.Players[player].IsFrost == 0)
            //    {
            //        IceFronzeEffect ice = new IceFronzeEffect(item.Template.Property2);
            //        ice.Start(player);
            //    }
            //    else
            //    {
            //        player.CurrentGame.Data.Players[player].SetFrost(item.Template.Property2);
            //    }

            //}
        }
Exemple #18
0
 public override void PrepareNewTurn()
 {
     if (this.CurrentIsHitTarget)
     {
         this.TotalHitTargetCount++;
     }
     this.m_energy     = this.m_player.PlayerCharacter.Agility / 30 + 240;
     this.m_shootCount = 1;
     this.m_ballCount  = 1;
     this.m_flyCoolDown--;
     this.SetCurrentWeapon(this.PlayerDetail.MainWeapon);
     if (this.m_currentBall.ID != this.m_mainBallId)
     {
         this.m_currentBall = BallMgr.FindBall(this.m_mainBallId);
     }
     if (!base.IsLiving)
     {
         this.StartGhostMoving();
         this.TargetPoint = Point.Empty;
     }
     base.PrepareNewTurn();
 }
Exemple #19
0
 public void GetShootForceAndAngle(ref int x, ref int y, int bombId, int minTime, int maxTime, int bombCount, float time, ref int force, ref int angle)
 {
     if (minTime < maxTime)
     {
         BallInfo ballInfo = BallMgr.FindBall(bombId);
         if (this.m_game != null && ballInfo != null)
         {
             Map   map  = this.m_game.Map;
             Point sp   = this.GetShootPoint();
             float dx   = (float)(x - sp.X);
             float dy   = (float)(y - sp.Y);
             float arf  = map.airResistance * (float)ballInfo.DragIndex;
             float gf   = map.gravity * (float)ballInfo.Weight * (float)ballInfo.Mass;
             float wf   = map.wind * (float)ballInfo.Wind;
             float mass = (float)ballInfo.Mass;
             for (float t = time; t <= 4f; t += 0.6f)
             {
                 double vx = Living.ComputeVx((double)dx, mass, arf, wf, t);
                 double vy = Living.ComputeVy((double)dy, mass, arf, gf, t);
                 if (vy < 0.0 && vx * (double)this.m_direction > 0.0)
                 {
                     double tf = Math.Sqrt(vx * vx + vy * vy);
                     if (tf < 2000.0)
                     {
                         force = (int)tf;
                         angle = (int)(Math.Atan(vy / vx) / 3.1415926535897931 * 180.0);
                         if (vx < 0.0)
                         {
                             angle += 180;
                         }
                         break;
                     }
                 }
             }
             x = sp.X;
             y = sp.Y;
         }
     }
 }
Exemple #20
0
        public bool ShootImp(int bombId, int x, int y, int force, int angle, int bombCount, int shootCount)
        {
            BallInfo ballInfo = BallMgr.FindBall(bombId);
            Tile     shape    = BallMgr.FindTile(bombId);
            BombType ballType = BallMgr.GetBallType(bombId);
            int      _wind    = (int)(m_map.wind * 10);

            if (ballInfo != null)//某些炸弹无图
            {
                GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, Id);
                pkg.Parameter1 = Id;
                pkg.WriteByte((byte)eTankCmdType.FIRE);

                pkg.WriteInt(_wind);
                pkg.WriteBoolean(_wind > 0);
                pkg.WriteByte(m_game.GetVane(_wind, 1));
                pkg.WriteByte(m_game.GetVane(_wind, 2));
                pkg.WriteByte(m_game.GetVane(_wind, 3));
                pkg.WriteInt(bombCount);

                float lifeTime = 0;
                for (int i = 0; i < bombCount; i++)
                {
                    double reforce = 1;
                    int    reangle = 0;
                    if (i == 1)
                    {
                        reforce = 0.9;
                        reangle = -5;
                    }
                    else if (i == 2)
                    {
                        reforce = 1.1;
                        reangle = 5;
                    }

                    int vx = (int)(force * reforce * Math.Cos((double)(angle + reangle) / 180 * Math.PI));
                    int vy = (int)(force * reforce * Math.Sin((double)(angle + reangle) / 180 * Math.PI));

                    SimpleBomb bomb = new SimpleBomb(m_game.PhysicalId++, ballType, this, m_game, ballInfo, shape, ControlBall);

                    bomb.SetXY(x, y);
                    bomb.setSpeedXY(vx, vy);
                    m_map.AddPhysical(bomb);
                    bomb.StartMoving();

                    pkg.WriteInt(1); //number = _loc_2.readInt();
                    pkg.WriteInt(1); //shootCount = _loc_2.readInt();
                    pkg.WriteBoolean(bomb.DigMap);
                    pkg.WriteInt(bomb.Id);
                    pkg.WriteInt(x);
                    pkg.WriteInt(y);
                    pkg.WriteInt(vx);
                    pkg.WriteInt(vy);
                    pkg.WriteInt(bomb.BallInfo.ID);
                    pkg.WriteString(bomb.BallInfo.FlyingPartical);
                    pkg.WriteInt((bomb.BallInfo.Radii * 1000) / 4); //trminhpc
                    pkg.WriteInt((int)bomb.BallInfo.Power * 1000);  //trminhpc
                    pkg.WriteInt(bomb.Actions.Count);
                    foreach (BombAction ac in bomb.Actions)
                    {
                        pkg.WriteInt(ac.TimeInt);
                        pkg.WriteInt(ac.Type);
                        pkg.WriteInt(ac.Param1);
                        pkg.WriteInt(ac.Param2);
                        pkg.WriteInt(ac.Param3);
                        pkg.WriteInt(ac.Param4);
                    }

                    lifeTime = Math.Max(lifeTime, bomb.LifeTime);
                }
                //pet Attack

                pkg.WriteInt(0);
                //foreach (BombAction ac in bombPet.Actions)
                //{
                pkg.WriteInt(1);    //_loc_27 = _loc_2.readInt();//target
                pkg.WriteInt(300);  //_loc_29 = _loc_2.readInt//damage
                pkg.WriteInt(500);  //_loc_30 = _loc_2.readInt();//hp
                pkg.WriteInt(10);   //_loc_31 = _loc_2.readInt();//dander

                //}

                pkg.WriteInt(102);//_loc_2.readInt();//attackid

                m_game.SendToAll(pkg);
                m_game.WaitTime((int)((lifeTime + 2 + bombCount / 3) * 1000));

                return(true);
            }

            return(false);
        }
Exemple #21
0
        public bool ShootImp(int bombId, int x, int y, int force, int angle, int bombCount)
        {
            BallInfo ballInfo = BallMgr.FindBall(bombId);
            Tile     shape    = BallMgr.FindTile(bombId);
            BombType ballType = BallMgr.GetBallType(bombId);

            //if (ballInfo != null && shape != null)
            if (ballInfo != null)//某些炸弹无图
            {
                GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, Id);
                pkg.Parameter1 = Id;
                pkg.WriteByte((byte)eTankCmdType.FIRE);
                pkg.WriteInt(bombCount);

                float lifeTime = 0;
                for (int i = 0; i < bombCount; i++)
                {
                    double reforce = 1;
                    int    reangle = 0;
                    if (i == 1)
                    {
                        reforce = 0.9;
                        reangle = -5;
                    }
                    else if (i == 2)
                    {
                        reforce = 1.1;
                        reangle = 5;
                    }

                    int vx = (int)(force * reforce * Math.Cos((double)(angle + reangle) / 180 * Math.PI));
                    int vy = (int)(force * reforce * Math.Sin((double)(angle + reangle) / 180 * Math.PI));
                    //Console.WriteLine(string.Format("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< vx:{0}   vy:{1}", vx, vy));

                    SimpleBomb bomb = new SimpleBomb(m_game.PhysicalId++, ballType, this, m_game, ballInfo, shape, ControlBall);

                    bomb.SetXY(x, y);
                    bomb.setSpeedXY(vx, vy);
                    m_map.AddPhysical(bomb);
                    bomb.StartMoving();
                    pkg.WriteInt(0);
                    pkg.WriteInt(0);
                    pkg.WriteBoolean(bomb.DigMap);
                    pkg.WriteInt(bomb.Id);
                    pkg.WriteInt(x);
                    pkg.WriteInt(y);
                    pkg.WriteInt(vx);
                    pkg.WriteInt(vy);

                    ////FUnny gun
                    //var random = Game.Random.Next(0, 2);
                    //switch (random)
                    //{

                    //    case 0: pkg.WriteInt(51);
                    //        break;
                    //    case 1: pkg.WriteInt(67);
                    //        break;
                    //    case 2: pkg.WriteInt(16);
                    //        break;
                    //}

                    pkg.WriteInt(bomb.BallInfo.ID);
                    //FlyingPartical
                    //pkg.WriteString(bomb.BallInfo.FlyingPartical);
                    pkg.WriteString("");
                    pkg.WriteInt(5);
                    pkg.WriteInt(5);
                    //pkg.WriteInt(0);
                    pkg.WriteInt(bomb.Actions.Count);
                    foreach (BombAction ac in bomb.Actions)
                    {
                        pkg.WriteInt((ac.TimeInt != null) ? ac.TimeInt : 0);
                        pkg.WriteInt((ac.Type != null) ? ac.Type : 0);
                        pkg.WriteInt((ac.Param1 != null) ? ac.Param1 : 0);
                        pkg.WriteInt((ac.Param2 != null) ? ac.Param2 : 0);
                        pkg.WriteInt((ac.Param3 != null) ? ac.Param3 : 0);
                        pkg.WriteInt((ac.Param3 != null) ? ac.Param4 : 0);
                    }

                    lifeTime = Math.Max(lifeTime, bomb.LifeTime);
                }
                //TrieuLSL
                //pkg.WriteInt(new Random().Next(50)); pkg.WriteInt(new Random().Next(50));
                m_game.SendToAll(pkg);

                //客户端有爆炸效果,多等待2秒

                m_game.WaitTime((int)((lifeTime + 2 + bombCount / 3) * 1000));

                return(true);
            }

            return(false);
        }
Exemple #22
0
        public bool ShootImp(int bombId, int x, int y, int force, int angle, int bombCount, int shootCount)
        {
            BallInfo ballInfo = BallMgr.FindBall(bombId);
            Tile     shape    = BallMgr.FindTile(bombId);
            BombType ballType = BallMgr.GetBallType(bombId);
            int      num      = (int)(this.m_map.wind * 10f);

            if (ballInfo != null)
            {
                GSPacketIn gSPacketIn = new GSPacketIn(91, base.Id);
                gSPacketIn.Parameter1 = base.Id;
                gSPacketIn.WriteByte(2);
                gSPacketIn.WriteInt(num);
                gSPacketIn.WriteBoolean(num > 0);
                gSPacketIn.WriteByte(this.m_game.GetVane(num, 1));
                gSPacketIn.WriteByte(this.m_game.GetVane(num, 2));
                gSPacketIn.WriteByte(this.m_game.GetVane(num, 3));
                gSPacketIn.WriteInt(bombCount);
                float      num2       = 0f;
                SimpleBomb simpleBomb = null;
                for (int i = 0; i < bombCount; i++)
                {
                    double num3 = 1.0;
                    int    num4 = 0;
                    if (i == 1)
                    {
                        num3 = 0.9;
                        num4 = -5;
                    }
                    else
                    {
                        if (i == 2)
                        {
                            num3 = 1.1;
                            num4 = 5;
                        }
                    }
                    int num5 = (int)((double)force * num3 * Math.Cos((double)(angle + num4) / 180.0 * 3.1415926535897931));
                    int num6 = (int)((double)force * num3 * Math.Sin((double)(angle + num4) / 180.0 * 3.1415926535897931));
                    simpleBomb = new SimpleBomb(this.m_game.PhysicalId++, ballType, this, this.m_game, ballInfo, shape, this.ControlBall);
                    simpleBomb.SetXY(x, y);
                    simpleBomb.setSpeedXY(num5, num6);
                    this.m_map.AddPhysical(simpleBomb);
                    simpleBomb.StartMoving();
                    gSPacketIn.WriteInt(0);
                    gSPacketIn.WriteInt(0);
                    gSPacketIn.WriteBoolean(simpleBomb.DigMap);
                    gSPacketIn.WriteInt(simpleBomb.Id);
                    gSPacketIn.WriteInt(x);
                    gSPacketIn.WriteInt(y);
                    gSPacketIn.WriteInt(num5);
                    gSPacketIn.WriteInt(num6);
                    gSPacketIn.WriteInt(simpleBomb.BallInfo.ID);
                    gSPacketIn.WriteString(simpleBomb.BallInfo.FlyingPartical);
                    gSPacketIn.WriteInt(simpleBomb.BallInfo.Radii * 1000 / 4);
                    gSPacketIn.WriteInt((int)simpleBomb.BallInfo.Power * 1000);
                    gSPacketIn.WriteInt(simpleBomb.Actions.Count);
                    foreach (BombAction current in simpleBomb.Actions)
                    {
                        gSPacketIn.WriteInt(current.TimeInt);
                        gSPacketIn.WriteInt(current.Type);
                        gSPacketIn.WriteInt(current.Param1);
                        gSPacketIn.WriteInt(current.Param2);
                        gSPacketIn.WriteInt(current.Param3);
                        gSPacketIn.WriteInt(current.Param4);
                    }
                    num2 = Math.Max(num2, simpleBomb.LifeTime);
                }
                int num7  = 0;
                int count = simpleBomb.PetActions.Count;
                if (count > 0 && this.PetBaseAtt > 0)
                {
                    gSPacketIn.WriteInt(count);
                    foreach (BombAction current2 in simpleBomb.PetActions)
                    {
                        gSPacketIn.WriteInt(current2.Param1);
                        gSPacketIn.WriteInt(current2.Param2);
                        gSPacketIn.WriteInt(current2.Param4);
                        gSPacketIn.WriteInt(current2.Param3);
                    }
                    gSPacketIn.WriteInt(1);
                    num7 = 2;
                }
                else
                {
                    gSPacketIn.WriteInt(0);
                    gSPacketIn.WriteInt(0);
                }
                this.m_game.SendToAll(gSPacketIn);
                this.m_game.WaitTime((int)((num2 + 2f + (float)num7 + (float)(bombCount / 3)) * 1000f));
                return(true);
            }
            return(false);
        }
Exemple #23
0
        public bool ShootImp(int bombId, int x, int y, int force, int angle, int bombCount)
        {
            BallInfo ballInfo = BallMgr.FindBall(bombId);
            Tile     shape    = BallMgr.FindTile(bombId);
            BombType ballType = BallMgr.GetBallType(bombId);
            bool     result;

            if (ballInfo != null)
            {
                GSPacketIn pkg = new GSPacketIn(91);
                pkg.Parameter1 = base.Id;
                pkg.WriteByte(2);
                pkg.WriteInt(bombCount);
                float lifeTime = 0f;
                for (int i = 0; i < bombCount; i++)
                {
                    double reforce = 1.0;
                    int    reangle = 0;
                    if (i == 1)
                    {
                        reforce = 0.9;
                        reangle = -5;
                    }
                    else
                    {
                        if (i == 2)
                        {
                            reforce = 1.1;
                            reangle = 5;
                        }
                    }
                    int        vx   = (int)((double)force * reforce * Math.Cos((double)(angle + reangle) / 180.0 * 3.1415926535897931));
                    int        vy   = (int)((double)force * reforce * Math.Sin((double)(angle + reangle) / 180.0 * 3.1415926535897931));
                    SimpleBomb bomb = new SimpleBomb(this.m_game.physicalId++, ballType, this, this.m_game, ballInfo, shape, this.ControlBall || this.GemControlBall);
                    bomb.SetXY(x, y);
                    bomb.setSpeedXY(vx, vy);
                    this.m_map.AddPhysical(bomb);
                    bomb.StartMoving();
                    pkg.WriteBoolean(bomb.DigMap);
                    pkg.WriteInt(bomb.Id);
                    pkg.WriteInt(x);
                    pkg.WriteInt(y);
                    pkg.WriteInt(vx);
                    pkg.WriteInt(vy);
                    pkg.WriteInt(bomb.BallInfo.ID);
                    if (this.FlyingPartical != 0)
                    {
                        pkg.WriteString(this.FlyingPartical.ToString());
                    }
                    else
                    {
                        pkg.WriteString(ballInfo.FlyingPartical);
                    }
                    pkg.WriteInt(bomb.Actions.Count);
                    foreach (BombAction ac in bomb.Actions)
                    {
                        pkg.WriteInt(ac.TimeInt);
                        pkg.WriteInt(ac.Type);
                        pkg.WriteInt(ac.Param1);
                        pkg.WriteInt(ac.Param2);
                        pkg.WriteInt(ac.Param3);
                        pkg.WriteInt(ac.Param4);
                    }
                    lifeTime = Math.Max(lifeTime, bomb.LifeTime);
                }
                this.m_game.SendToAll(pkg);
                this.m_game.WaitTime((int)((lifeTime + 2f + (float)(bombCount / 3)) * 1000f));
                result = true;
            }
            else
            {
                Living.log.Error(string.Format("Living ShootImpl ballInfo is null. bombId : {0}", bombId));
                result = false;
            }
            return(result);
        }