Пример #1
0
 public override bool StartDigging()
 {
     attack = new Attack(Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ProjectileID.Fireball, 20, 4f));
     attack.proj.tileCollide = false;
     attack.proj.ignoreWater = true;
     projCenter = new Vector2[max];
     projs      = new Attack[max][];
     for (int i = 0; i < projs.GetLength(0); i++)
     {
         projs[i] = new Attack[6];
         index    = 0;
         for (double r = 0d; r < Math.PI * 2d; r += Math.PI / 3d)
         {
             if (index < 6)
             {
                 projs[i][index] = new Attack(Projectile.NewProjectileDirect(ArchaeaNPC.AngleBased(npc.Center, (float)r, npc.width * 4f), Vector2.Zero, ProjectileID.Fireball, 20, 4f), (float)r);
                 projs[i][index].proj.timeLeft    = 600;
                 projs[i][index].proj.rotation    = (float)r;
                 projs[i][index].proj.tileCollide = false;
                 projs[i][index].proj.ignoreWater = true;
                 Vector2 v = Vector2.Zero;
                 do
                 {
                     v = ArchaeaNPC.FindEmptyRegion(target(), ArchaeaNPC.defaultBounds(target()));
                     projs[i][index].position = v;
                 } while (v == Vector2.Zero);
                 index++;
             }
         }
     }
     start = false;
     index = 0;
     return(true);
 }
Пример #2
0
        public override void PostMovement()
        {
            if (npc.Distance(target().position) > range / 2)
            {
                ai = ChasePlayer;
            }

            if (projs == null || projCenter == null || attack == null)
            {
                return;
            }
            attack.Update(npc, target());
            for (int j = 0; j < projs[1].Length; j++)
            {
                for (int i = 0; i < max; i++)
                {
                    projs[i][j].Stationary(j, npc.width);
                    if (time % interval == 0 && time != 0)
                    {
                        Vector2 v = ArchaeaNPC.FindEmptyRegion(target(), ArchaeaNPC.defaultBounds(target()));
                        if (v != Vector2.Zero)
                        {
                            projs[i][j].position = v;
                        }
                    }
                }
            }
        }
Пример #3
0
        public override bool JustSpawned()
        {
            proximity = false;
            if (timer % elapsed / 24 == 0 && timer != 0)
            {
                flip = !flip;
            }
            if (ai < SpawnParts)
            {
                npc.velocity.Y = flip ? 0.5f : -0.5f;
            }
            else
            {
                npc.velocity.Y = 0f;
            }
            switch (ai)
            {
            case Begin:
                move = ArchaeaNPC.FindEmptyRegion(target(), ArchaeaNPC.defaultBounds(target()));
                if (move != Vector2.Zero)
                {
                    npc.position = move;
                    npc.alpha    = 250;
                    goto case FadeIn;
                }
                break;

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

            case SpawnParts:
                ai = SpawnParts;
                if (timer % elapsed / 4 == 0 && timer != 0)
                {
                    f += (float)Math.PI * 2f / 4f;
                    Vector2 around = ArchaeaNPC.AngleBased(npc.Center, f, npc.width * 8f);
                    NPC.ReleaseNPC((int)around.X, (int)around.Y, ModNPCID.MonolithOrb, 0, 255);
                }
                if (f == (float)Math.PI * 2f)
                {
                    goto case End;
                }
                break;

            case End:
                return(true);
            }
            return(false);
        }
Пример #4
0
 public override void Attacking()
 {
     if (timer % maxTime == 0 && timer != 0)
     {
         if (projs != null)
         {
             for (int j = 0; j < projs.GetLength(0); j++)
             {
                 foreach (Attack sets in projs[j])
                 {
                     sets.proj.active = false;
                 }
             }
         }
         attack = new Attack(Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ProjectileID.Fireball, 20, 4f));
         attack.proj.tileCollide = false;
         attack.proj.ignoreWater = true;
         max        = Math.Max(8 / npc.life, 3);
         projCenter = new Vector2[max];
         projs      = new Attack[max][];
         for (int i = 0; i < projs.GetLength(0); i++)
         {
             projs[i] = new Attack[6];
             index    = 0;
             for (double r = 0d; r < Math.PI * 2d; r += Math.PI / 3d)
             {
                 if (index < 6)
                 {
                     projs[i][index] = new Attack(Projectile.NewProjectileDirect(ArchaeaNPC.AngleBased(npc.Center, (float)r, npc.width * 4f), Vector2.Zero, ProjectileID.Fireball, 20, 4f), (float)r);
                     projs[i][index].proj.timeLeft    = maxTime;
                     projs[i][index].proj.rotation    = (float)r;
                     projs[i][index].proj.tileCollide = false;
                     projs[i][index].proj.ignoreWater = true;
                     Vector2 v = Vector2.Zero;
                     do
                     {
                         v = ArchaeaNPC.FindEmptyRegion(target(), ArchaeaNPC.defaultBounds(target()));
                         projs[i][index].position = v;
                     } while (v == Vector2.Zero);
                     index++;
                 }
             }
         }
         start = false;
         index = 0;
     }
 }
Пример #5
0
 public override void Digging()
 {
     if (projs == null || projCenter == null || attack == null)
     {
         return;
     }
     attack.Update(npc, target());
     for (int j = 0; j < projs[1].Length; j++)
     {
         for (int i = 0; i < max; i++)
         {
             projs[i][j].Stationary(j, npc.width);
             if (timer % maxTime / 2 == 0 && timer != 0)
             {
                 Vector2 v = ArchaeaNPC.FindEmptyRegion(target(), ArchaeaNPC.defaultBounds(target()));
                 if (v != Vector2.Zero)
                 {
                     projs[i][j].position = v;
                 }
             }
         }
     }
 }
Пример #6
0
        public override void AI()
        {
            npc.spriteDirection = 1;
            if (timer++ > 900)
            {
                npcCounter++;
                timer = 0;
            }
            if (timer % 600 == 0 && timer != 0)
            {
                move = Vector2.Zero;
                do
                {
                    move = ArchaeaNPC.FindEmptyRegion(target(), ArchaeaNPC.defaultBounds(target()));
                } while (move == Vector2.Zero);
                SyncNPC(move.X, move.Y);
                fade = true;
            }
            if (timer % 300 == 0 && timer != 0)
            {
                if (timer != 600)
                {
                    move = target().Center;
                    SyncNPC(true, true);
                }
            }
            if (npcCounter > 1)
            {
                Vector2 newPosition = ArchaeaNPC.FindAny(npc, target(), false, 300);
                int     n           = NPC.NewNPC((int)newPosition.X, (int)newPosition.Y, mod.NPCType <Sky_1>(), 0, 0f, 0f, 0f, 0f, npc.target);
                if (Main.netMode == 2)
                {
                    NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                }
                npcCounter = 0;
                SyncNPC();
            }
            if (fade)
            {
                npc.velocity = Vector2.Zero;
                if (npc.alpha < 255)
                {
                    npc.scale -= 1f / 90f;
                    npc.alpha += 255 / 15;
                }
                else
                {
                    npc.position = move;
                    if (FlameBurst())
                    {
                        npc.scale = 1f;
                        fade      = false;
                    }
                }
            }
            else
            {
                if (npc.alpha > 0)
                {
                    npc.alpha -= 255 / 60;
                }
                if (timer < 600)
                {
                    if (timer % 150 == 0)
                    {
                        move = ArchaeaNPC.FindAny(npc, target(), false);
                    }
                    float angle = npc.AngleTo(move);
                    float cos   = (float)(0.2f * Math.Cos(angle));
                    float sine  = (float)(0.2f * Math.Sin(angle));
                    npc.velocity += new Vector2(cos, sine);
                    ArchaeaNPC.VelocityClamp(ref npc.velocity, -4f, 4f);
                }
            }
            if (attack)
            {
                if (counter++ % 90 == 0)
                {
                    angle += (float)Math.PI / 3f;
                    float cos  = (float)(npc.Center.X + npc.width * 3f * Math.Cos(angle));
                    float sine = (float)(npc.Center.Y + npc.height * 3f * Math.Sin(angle));
                    int   t    = Projectile.NewProjectile(new Vector2(cos, sine), Vector2.Zero, mod.ProjectileType <Orb>(), 12, 2f, 255, 0f, target().whoAmI);
                    Main.projectile[t].whoAmI = t;
                    if (Main.netMode == 2)
                    {
                        NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, t);
                    }
                    index++;
                }
                if (index == 6)
                {
                    attack = false;
                }
            }
            else
            {
                index = 0;
                angle = ArchaeaNPC.RandAngle();
                SyncNPC(false, false);
            }

            if (fade && npc.position != npc.oldPosition || npc.velocity.X < 0f && npc.oldVelocity.X >= 0f || npc.velocity.X > 0f && npc.oldVelocity.X <= 0f || npc.velocity.Y < 0f && npc.oldVelocity.Y >= 0f || npc.velocity.Y > 0f && npc.oldVelocity.Y <= 0f)
            {
                SyncNPC();
            }
        }