示例#1
0
 public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
 {
     if (rangeOut)
     {
         if (npc.alpha < 250)
         {
             npc.alpha += 25;
         }
         else
         {
             move = ArchaeaNPC.FindEmptyRegion(target(), targetRange);
             if (move != Vector2.Zero)
             {
                 type  = 0;
                 index = 0;
                 if (pattern != Pattern.Attack)
                 {
                     count++;
                 }
                 npc.position = move;
                 rangeOut     = false;
             }
         }
     }
     return(npc.alpha < 250);
 }
示例#2
0
 public override bool PreDefaultMove()
 {
     move = ArchaeaNPC.FindEmptyRegion(target(), targetRange);
     if (move != Vector2.Zero)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#3
0
        public override bool PreFadeOut()
        {
            Vector2 v = ArchaeaNPC.FindEmptyRegion(target(), targetRange);

            if (v != Vector2.Zero)
            {
                move = v;
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#4
0
        protected bool DefaultAI()
        {
            reData = true;
            switch (ai)
            {
            case 0:
                ai = 0;
                if (PreDefaultMove())
                {
                    type  = 0;
                    index = 0;
                    goto case 1;
                }
                return(false);

            case 1:
                ai   = 1;
                move = ArchaeaNPC.FindEmptyRegion(target(), targetRange);
                if (npc.alpha < 225)
                {
                    npc.alpha += 25;
                }
                else
                {
                    if (move != Vector2.Zero)
                    {
                        npc.position = move;
                    }
                    goto case 2;
                }
                return(true);

            case 2:
                ai = 2;
                if (npc.alpha > 0)
                {
                    npc.alpha -= 25;
                }
                else
                {
                    goto case 0;
                }
                return(true);
            }
            return(false);
        }
示例#5
0
        protected void AttackPattern()
        {
            if (preAttack)
            {
                move      = Vector2.Zero;
                attacks   = 0;
                attack    = -1;
                time      = 0;
                preAttack = false;
                reData    = true;
            }
            if (attack != FadeOut)
            {
                npc.velocity = Vector2.Zero;
            }
            switch (attack)
            {
            case -1:
                goto case Teleport;

            case Attack:
                if (BeginAttack() && time++ % attackRate == 0 && time != 0)
                {
                    attacks++;
                    if (attacks > totalAttacks)
                    {
                        pattern   = Pattern.Active;
                        reData    = true;
                        preAttack = true;
                        break;
                    }
                    goto case Teleport;
                }
                break;

            case Teleport:
                attack = Teleport;
                if (PreFadeOut())
                {
                    goto case FadeOut;
                }
                break;

            case FadeOut:
                attack = FadeOut;
                move   = ArchaeaNPC.FindEmptyRegion(target(), targetRange);
                if (npc.alpha < 200)
                {
                    npc.alpha += 5;
                }
                else if (BeginTeleport())
                {
                    if (npc.Distance(target().position) < 800f)
                    {
                        if (move != Vector2.Zero)
                        {
                            npc.position = move;
                        }
                    }
                    goto case FadeIn;
                }
                break;

            case FadeIn:
                attack = FadeIn;
                if (npc.alpha > 0)
                {
                    npc.alpha -= 5;
                }
                else
                {
                    goto case Attack;
                }
                break;
            }
        }
示例#6
0
        protected void Active()
        {
            if (reData)
            {
                oldX       = npc.position.X;
                upperPoint = npc.position.Y - 50f;
                idle       = npc.position;
                upper      = new Vector2(oldX, upperPoint);
                type       = -1;
                points     = new Vector2[5];
                reData     = false;
            }
            switch (type)
            {
            case -1:
                BeginInRange();
                if (BeginActive())
                {
                    type  = 0;
                    index = 0;
                    goto case 0;
                }
                break;

            case 0:
                Vector2 ground = ArchaeaNPC.FindEmptyRegion(target(), targetRange);
                if (index < points.Length)
                {
                    if (ground != Vector2.Zero)
                    {
                        points[index] = ground;
                        index++;
                    }
                }
                else
                {
                    index = 0;
                    goto case 1;
                }
                break;

            case 1:
                type = 1;
                if (index++ > moveRate)
                {
                    rand  = Main.rand.Next(points.Length);
                    index = 0;
                    moveCount++;
                    count++;
                }
                newMove = points[rand];
                ArchaeaNPC.PositionToVel(npc, newMove, 0.6f, 0.4f, true, -5f, 5f);
                if (npc.Distance(target().position) > range * 2f || moveCount > 2)
                {
                    moveCount = 0;
                    type      = 0;
                    goto case 0;
                }
                break;
            }
        }