Ejemplo n.º 1
0
        public override void Teleport()
        {
            var dusts = ArchaeaNPC.DustSpread(npc.Center, dustType, 10, 3f);

            foreach (Dust d in dusts)
            {
                d.noGravity = true;
            }
        }
Ejemplo n.º 2
0
        public override bool JustSpawned()
        {
            elapse   = 120;
            dustType = 6;
            var dusts = ArchaeaNPC.DustSpread(npc.Center, dustType, 10, 3f);

            foreach (Dust d in dusts)
            {
                d.noGravity = true;
            }
            return(true);
        }
Ejemplo n.º 3
0
        public override void AI()
        {
            int attackTime = 180 + 90 * maxAttacks;

            if (timer++ > 60 + attackTime)
            {
                timer = 0;
            }
            ArchaeaNPC.SlowDown(ref npc.velocity, 0.1f);
            if (!init)
            {
                npc.target = ArchaeaNPC.FindClosest(npc, true).whoAmI;
                SyncNPC(npc.position.X, npc.position.Y);
                dustType = 6;
                var dusts = ArchaeaNPC.DustSpread(npc.Center, 1, 1, dustType, 10);
                foreach (Dust d in dusts)
                {
                    d.noGravity = true;
                }
                init = true;
            }
            if (!fade)
            {
                if (npc.alpha > 0)
                {
                    npc.alpha -= 255 / 60;
                }
            }
            else
            {
                if (npc.alpha < 255)
                {
                    npc.alpha += 255 / 50;
                }
                else
                {
                    timer = attackTime + 50;
                    move  = ArchaeaNPC.FindAny(npc, npcTarget, true);
                    if (move != Vector2.Zero)
                    {
                        SyncNPC(move.X, move.Y);
                        var dusts = ArchaeaNPC.DustSpread(npc.Center - new Vector2(npc.width / 4, npc.height / 4), npc.width / 2, npc.height / 2, dustType, 10, 2.4f);
                        foreach (Dust d in dusts)
                        {
                            d.noGravity = true;
                        }
                        fade  = false;
                        timer = 0;
                    }
                }
            }
            if (timer > 180 && timer <= attackTime)
            {
                OrbGrow();
                if (timer >= 180 + 60 && timer % 90 == 0)
                {
                    Attack();
                }
            }
            if (timer >= attackTime)
            {
                fade = true;
            }
            else
            {
                fade = false;
            }
        }
Ejemplo n.º 4
0
 public override void AI()
 {
     time++;
     if (!init)
     {
         int i = (int)npc.position.X / 16;
         int j = (int)npc.position.Y / 16;
         if (ArchaeaWorld.Inbounds(i, j) && Main.tile[i, j].wall != ArchaeaWorld.skyBrickWall)
         {
             newPosition = ArchaeaNPC.FindAny(npc, ArchaeaNPC.FindClosest(npc, true), true, 800);
             if (newPosition != Vector2.Zero)
             {
                 npc.netUpdate = true;
                 init          = true;
             }
         }
     }
     if (newPosition != Vector2.Zero && ai == Idle)
     {
         npc.position = newPosition;
     }
     if (time > 150)
     {
         if (npc.alpha > 12)
         {
             npc.alpha -= 12;
         }
         else
         {
             npc.alpha = 0;
         }
     }
     if (npc.target == 255)
     {
         if (npc.life < npc.lifeMax)
         {
             npc.TargetClosest();
         }
         return;
     }
     if (time > 300)
     {
         time = 0;
         ai   = Attack;
     }
     if (time == 240)
     {
         tracking = npcTarget.Center;
     }
     if (ai == Attack)
     {
         npc.velocity += ArchaeaNPC.AngleToSpeed(npc.AngleTo(tracking), rushSpeed);
         ai            = Activated;
         npc.netUpdate = true;
     }
     else
     {
         ArchaeaNPC.SlowDown(ref npc.velocity, 0.2f);
         if (time % 45 == 0 && time != 0)
         {
             npc.velocity = Vector2.Zero;
         }
     }
     if (npc.velocity.X >= npc.oldVelocity.X || npc.velocity.X < npc.oldVelocity.X || npc.velocity.Y >= npc.oldVelocity.Y || npc.velocity.Y < npc.oldVelocity.Y)
     {
         npc.netUpdate = true;
     }
     if (npc.Center.X <= npcTarget.Center.X)
     {
         float angle = (float)Math.Round(Math.PI * 0.2f, 1);
         if (npc.rotation > angle)
         {
             npc.rotation -= rotateSpeed;
         }
         else
         {
             npc.rotation += rotateSpeed;
         }
     }
     else
     {
         float angle = (float)Math.Round((Math.PI * 0.2f) * -1, 1);
         if (npc.rotation > angle)
         {
             npc.rotation -= rotateSpeed;
         }
         else
         {
             npc.rotation += rotateSpeed;
         }
     }
     if (ai == Idle && npc.Distance(npcTarget.Center) < 64f)
     {
         ArchaeaNPC.DustSpread(npc.position, npc.width, npc.height, DustID.Stone, 5, 1.2f);
         npc.TargetClosest();
         ai            = Activated;
         npc.netUpdate = true;
     }
 }