Пример #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 bool Absorb(float range, Action action)
 {
     variance += Main.rand.NextFloat(0.5f, 3f);
     if (time % elapsed * 5 * rotate == 0)
     {
         center                = ArchaeaNPC.AngleBased(npc.Center, rotation + variance, range);
         dust[total]           = Dust.NewDustDirect(center, 1, 1, DustID.Fire, 0f, 0f, 0, color, scale);
         dust[total].noGravity = true;
         total++;
     }
     foreach (Dust d in Main.dust)
     {
         if (d != null)
         {
             if (Vector2.Distance(d.position - npc.position, Vector2.Zero) < range + 32)
             {
                 d.velocity = ArchaeaNPC.AngleToSpeed(ArchaeaNPC.AngleTo(d.position, npc.Center), 3f);
                 Target.VelClamp(ref d.velocity, -3f, 3f, out d.velocity);
             }
         }
     }
     action.Invoke();
     if (range < npc.width || total > elapsed * 12)
     {
         Reset();
         return(true);
     }
     return(false);
 }
Пример #3
0
        public static void TileExplode(int i, int j)
        {
            int     x      = i * 16 + 8;
            int     y      = j * 16 + 8;
            float   range  = 3f * 16;
            Vector2 center = new Vector2(x, y);

            Player[] proximity = Main.player.Where(t => t.Distance(center) < range).ToArray();
            for (float k = 0; k < Math.PI * 2f; k++)
            {
                for (int l = 0; l < range; l++)
                {
                    Vector2 velocity = ArchaeaNPC.AngleToSpeed(k, 3f);
                    int     rand     = Main.rand.Next(20);
                    if (rand == 0)
                    {
                        Dust.NewDustDirect(ArchaeaNPC.AngleBased(center, k, range), 1, 1, DustID.Smoke, velocity.X, velocity.Y, 0, default(Color), 2f);
                    }
                    if (rand == 10)
                    {
                        Dust.NewDustDirect(ArchaeaNPC.AngleBased(center, k, l), 4, 4, DustID.Fire, 0f, 0f, 0, default(Color), 2f);
                    }
                }
            }
            foreach (Player player in proximity)
            {
                player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " struck dead in a mining accident"), 10, player.position.X / 16 < i ? -1 : 1);
                if (Main.netMode == 2)
                {
                    NetMessage.SendData(MessageID.PlayerHurtV2, player.whoAmI, -1, null);
                }
            }
        }
Пример #4
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);
        }
Пример #5
0
        public static void DiggerPartsAI(NPC npc, NPC part, float speed, ref float acc)
        {
            Vector2 connect = ArchaeaNPC.AngleBased(new Vector2(part.position.X, part.position.Y + part.height / 2), part.rotation, part.width);

            npc.rotation = ArchaeaNPC.AngleTo(npc.Center, part.Center);
            if (Vector2.Distance(part.Center, npc.Center) > npc.width * 1.2f)
            {
                if (!npc.Hitbox.Contains(connect.ToPoint()))
                {
                    acc = 0.30f;
                }
                else
                {
                    acc += 0.01f;
                }
                Clamp(acc, 0.3f, 1f, out acc);
                npc.Center += ArchaeaNPC.AngleToSpeed(npc.rotation, speed * acc);
            }
        }
Пример #6
0
 public void Stationary(int j, int radius)
 {
     rotation     += 0.017f;
     proj.timeLeft = 100;
     proj.Center   = ArchaeaNPC.AngleBased(position, (float)Math.PI / 3f * j, radius * 4f * (float)Math.Cos(rotation));
 }
Пример #7
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;
     }
 }