Example #1
0
        public void MoveToPlayer()
        {
            int dis    = (int)attack.Distance(Body.X, Body.Y);
            int ramdis = Game.Random.Next(((SimpleNpc)Body).NpcInfo.MoveMin, ((SimpleNpc)Body).NpcInfo.MoveMax);

            if (dis > 60)
            {
                if (dis > ((SimpleNpc)Body).NpcInfo.MoveMax)
                {
                    dis = ramdis;
                }
                else
                {
                    dis = dis - 60;
                }

                if (Body.X > attack.X)
                {
                    Body.MoveTo(Body.X - dis, attack.Y, "walk", 1200, new LivingCallBack(MoveBeat));
                }
                else
                {
                    Body.MoveTo(Body.X + dis, attack.Y, "walk", 1200, new LivingCallBack(MoveBeat));
                }
            }
        }
        public void MoveToPlayer()
        {
            m_body.CurrentDamagePlus = 1.5f;
            int dis    = (int)attack.Distance(Body.X, Body.Y);
            int ramdis = Game.Random.Next(((SimpleNpc)Body).NpcInfo.MoveMin, ((SimpleNpc)Body).NpcInfo.MoveMax);

            if (dis > ((SimpleNpc)Body).NpcInfo.MoveMax)
            {
                dis = ramdis;
            }
            else
            {
                dis = dis - 60;
            }

            if (dis == 0)
            {
                MoveBeat();
                return;
            }

            if (Body.X > m_targer.X)
            {
                Body.MoveTo(Body.X - dis, attack.Y, "walk", 500, new LivingCallBack(MoveBeat));
            }
            else
            {
                Body.MoveTo(Body.X + dis, attack.Y, "walk", 500, new LivingCallBack(MoveBeat));
            }
        }
Example #3
0
        public override void OnStartAttacking()
        {
            base.OnStartAttacking();
            int x = int.MaxValue;

            m_target = null;

            if (Body.X >= 900)
            {
                AttackDoor();
                return;
            }

            foreach (Living p in Game.FindAppointDeGreeNpc(2))
            {
                if (Math.Abs(p.X - Body.X) < x && p.X > Body.X - 20)
                {
                    x        = Math.Abs(p.X - Body.X);
                    m_target = p;
                }
            }
            if (m_target == null)
            {
                foreach (Living p in Game.FindAppointDeGreeNpc(1))
                {
                    m_target = p;
                }
            }
            m_targetDis = (int)m_target.Distance(Body.X, Body.Y);
            if (m_targetDis <= 50)
            {
                Body.PlayMovie("beatA", 100, 0);
                Body.RangeAttacking(Body.X - 50, Body.X + 50, "cry", 1500, null);
                Body.Die(1000);
            }
            else
            {
                MoveToPlayer(m_target);
            }
        }