Exemplo n.º 1
0
        protected bool DefaultAI()
        {
            reData = true;
            switch (ai)
            {
            case 0:
                ai   = 0;
                move = Vector2.Zero;
                if (target() != null && target().Distance(npc.position) < range * 3f)
                {
                    move = ArchaeaNPC.FastMove(target());
                }
                if (move != Vector2.Zero)
                {
                    goto case 1;
                }
                return(false);

            case 1:
                ai = 1;
                if (npc.alpha < 250)
                {
                    npc.alpha += 25;
                }
                else
                {
                    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);
        }
Exemplo n.º 2
0
        protected void AttackPattern()
        {
            if (preAttack)
            {
                move      = Vector2.Zero;
                attacks   = 0;
                attack    = -1;
                preAttack = false;
                reData    = true;
            }
            if (attack != FadeOut)
            {
                npc.velocity = Vector2.Zero;
            }
            AttackMovement();
            switch (attack)
            {
            case -1:
                goto case Teleport;

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

            case Teleport:
                attack = Teleport;
                if (BeginTeleport())
                {
                    Vector2 v = ArchaeaNPC.FastMove(target());
                    if (v != Vector2.Zero)
                    {
                        move = v;
                        goto case FadeOut;
                    }
                }
                break;

            case FadeOut:
                attack = FadeOut;
                if (npc.alpha < 200)
                {
                    npc.alpha += 5;
                }
                else
                {
                    if (npc.Distance(target().position) < 800f)
                    {
                        npc.position = move;
                    }
                    goto case FadeIn;
                }
                break;

            case FadeIn:
                attack = FadeIn;
                if (npc.alpha > 0)
                {
                    npc.alpha -= 5;
                }
                else
                {
                    goto case Attack_;
                }
                break;
            }
        }