Exemplo n.º 1
0
        public override void StartMoving()
        {
            base.StartMoving();
            m_actions = new List <BombAction>();
            int oldLifeTime = m_game.LifeTime;

            while (m_isMoving && m_isLiving)
            {
                m_lifeTime += 0.04F;
                // Console.WriteLine(string.Format("af:{0},wf:{1},gf:{2} vx: {3} vy:{4} x:{5},y:{6}", Arf, Wf, Gf, vX, vY, X, Y));
                Point pos = CompleteNextMovePoint(0.04F);
                MoveTo(pos.X, pos.Y);

                if (m_isLiving)
                {
                    if (Math.Round(m_lifeTime * 100) % 40 == 0 && pos.Y > 0)
                    {
                        m_game.AddTempPoint(pos.X, pos.Y);
                    }

                    if (m_controled && vY > 0)//瞄准
                    {
                        Living player = m_map.FindNearestEnemy(m_x, m_y, 150, m_owner);
                        Point  v;
                        if (player != null)
                        {
                            if (player is SimpleBoss)
                            {
                                Rectangle dis = player.GetDirectDemageRect();
                                v = new Point(dis.X - m_x, dis.Y - m_y);
                            }
                            else
                            {
                                v = new Point(player.X - m_x, player.Y - m_y);
                            }
                            v = v.Normalize(1000);

                            setSpeedXY(v.X, v.Y);
                            //使炮弹不受重力和风力和空气阻力的影响
                            UpdateForceFactor(0, 0, 0);
                            m_controled = false;
                            m_actions.Add(new BombAction(m_lifeTime, ActionType.CHANGE_SPEED, v.X, v.Y, 0, 0));
                        }
                    }
                }

                if (m_bombed)
                {
                    m_bombed = false;
                    BombImp();
                }
            }
        }
Exemplo n.º 2
0
        public override void StartMoving()
        {
            base.StartMoving();
            this.m_actions    = new List <BombAction>();
            this.m_petActions = new List <BombAction>();
            int arg_27_0 = this.m_game.LifeTime;

            while (this.m_isMoving && this.m_isLiving)
            {
                this.m_lifeTime += 0.04f;
                Point point = base.CompleteNextMovePoint(0.04f);
                base.MoveTo(point.X, point.Y);
                if (this.m_isLiving)
                {
                    if (Math.Round((double)(this.m_lifeTime * 100f)) % 40.0 == 0.0 && point.Y > 0)
                    {
                        this.m_game.AddTempPoint(point.X, point.Y);
                    }
                    if (this.m_controled && base.vY > 0f)
                    {
                        Living living = this.m_map.FindNearestEnemy(this.m_x, this.m_y, 150.0, this.m_owner);
                        if (living != null)
                        {
                            Point point2;
                            if (living is SimpleBoss)
                            {
                                Rectangle directDemageRect = living.GetDirectDemageRect();
                                point2 = new Point(directDemageRect.X - this.m_x, directDemageRect.Y - this.m_y);
                            }
                            else
                            {
                                point2 = new Point(living.X - this.m_x, living.Y - this.m_y);
                            }
                            point2 = point2.Normalize(1000);
                            base.setSpeedXY(point2.X, point2.Y);
                            base.UpdateForceFactor(0f, 0f, 0f);
                            this.m_controled = false;
                            this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.CHANGE_SPEED, point2.X, point2.Y, 0, 0));
                        }
                    }
                }
                if (this.m_bombed)
                {
                    this.m_bombed = false;
                    this.BombImp();
                }
            }
        }
Exemplo n.º 3
0
        public override void StartMoving()
        {
            base.StartMoving();
            this.m_actions = new List <BombAction>();
            int oldLifeTime = this.m_game.LifeTime;

            while (this.m_isMoving && this.m_isLiving && this.m_lifeTime < 80f)
            {
                this.m_lifeTime += 0.04f;
                Point pos = base.CompleteNextMovePoint(0.04f);
                base.MoveTo(pos.X, pos.Y);
                if (this.m_isLiving)
                {
                    if (Math.Round((double)(this.m_lifeTime * 100f)) % 40.0 == 0.0 && pos.Y > 0)
                    {
                        this.m_game.AddTempPoint(pos.X, pos.Y);
                    }
                    if (this.m_controled && base.vY > 0f)
                    {
                        Living player = this.m_map.FindNearestEnemy(this.m_x, this.m_y, 150.0, this.m_owner);
                        if (player != null)
                        {
                            Point v;
                            if (player is SimpleBoss)
                            {
                                Rectangle dis = player.GetDirectDemageRect();
                                v = new Point(dis.X - this.m_x + 20, dis.Y + dis.Height - this.m_y);
                            }
                            else
                            {
                                v = new Point(player.X - this.m_x, player.Y - this.m_y);
                            }
                            v = v.Normalize(1000);
                            base.setSpeedXY(v.X, v.Y);
                            base.UpdateForceFactor(0f, 0f, 0f);
                            this.m_controled = false;
                            this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.CHANGE_SPEED, v.X, v.Y, 0, 0));
                        }
                    }
                }
                if (this.m_bombed)
                {
                    this.m_bombed = false;
                    this.BombImp();
                }
            }
        }
        private int MakeDamage(Living p)
        {
            double baseDamage = m_living.BaseDamage;
            double baseGuard = p.BaseGuard;

            double defence = p.Defence;
            double attack = m_living.Attack;

            if (m_living.IgnoreArmor)
            {
                baseGuard = 0;
                defence = 0;
            }

            float damagePlus = m_living.CurrentDamagePlus;
            float shootMinus = m_living.CurrentShootMinus;


            double DR1 = 0.95 * (p.BaseGuard - 3 * m_living.Grade) / (500 + p.BaseGuard - 3 * m_living.Grade);//护甲提供伤害减免
            double DR2 = 0;
            if ((p.Defence - m_living.Lucky) < 0)
            {
                DR2 = 0;
            }
            else
            {
                DR2 = 0.95 * (p.Defence - m_living.Lucky) / (600 + p.Defence - m_living.Lucky); //防御提供的伤害减免
            }
            //DR2 = DR2 < 0 ? 0 : DR2;

            double damage = (baseDamage * (1 + attack * 0.001) * (1 - (DR1 + DR2 - DR1 * DR2))) * damagePlus * shootMinus;

            Rectangle rect = p.GetDirectDemageRect();
            double distance = Math.Sqrt((rect.X - m_living.X) * (rect.X - m_living.X) + (rect.Y - m_living.Y) * (rect.Y - m_living.Y));
            damage = damage * (1 - distance /Math.Abs(m_tx - m_fx) / 4);
            
            if (damage < 0)
            {
                return 1;
            }
            else
            {
                return (int)damage;
            }
        }