Terraria.Projectile.AI C# (CSharp) Method

AI() public method

public AI ( ) : void
return void
        public void AI()
        {
            Vector2 mountedCenter;
            float num76;
            float num77;
            float num78;
            Vector3 zero;
            int num114;
            int num115;
            int num316;
            Color color5;
            Vector2 vector240;
            if (this.aiStyle == 1)
            {
                this.AI_001();
                return;
            }
            if (this.aiStyle == 2)
            {
                if ((this.type == 0x5d) && (Main.rand.Next(5) == 0))
                {
                    color5 = new Color();
                    int num = Dust.NewDust(base.position, base.width, base.height, 0x39, (this.velocity.X * 0.2f) + (base.direction * 3), this.velocity.Y * 0.2f, 100, color5, 0.3f);
                    Main.dust[num].velocity.X *= 0.3f;
                    Main.dust[num].velocity.Y *= 0.3f;
                }
                if ((this.type == 0x130) && (this.localAI[0] == 0f))
                {
                    this.localAI[0]++;
                    this.alpha = 0;
                }
                if (this.type == 0x14f)
                {
                    this.frame = (int)this.ai[1];
                }
                if (this.type == 510)
                {
                    this.rotation += (Math.Abs(this.velocity.X) * 0.04f) * base.direction;
                }
                else
                {
                    float introduced1570 = Math.Abs(this.velocity.X);
                    this.rotation += ((introduced1570 + Math.Abs(this.velocity.Y)) * 0.03f) * base.direction;
                }
                if (this.type == 0xa2)
                {
                    if (this.ai[1] == 0f)
                    {
                        this.ai[1] = 1f;
                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14);
                    }
                    this.ai[0]++;
                    if (this.ai[0] >= 18f)
                    {
                        this.velocity.Y += 0.28f;
                        this.velocity.X *= 0.99f;
                    }
                    if (this.ai[0] > 2f)
                    {
                        this.alpha = 0;
                        if (this.ai[0] == 3f)
                        {
                            for (int i = 0; i < 10; i++)
                            {
                                color5 = new Color();
                                int num3 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1.5f);
                                Dust dust1 = Main.dust[num3];
                                dust1.velocity = (Vector2)(dust1.velocity * 0.5f);
                                Dust dust33 = Main.dust[num3];
                                dust33.velocity += (Vector2)(base.velocity * 0.1f);
                            }
                            for (int j = 0; j < 5; j++)
                            {
                                color5 = new Color();
                                int num5 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 2f);
                                Main.dust[num5].noGravity = true;
                                Dust dust34 = Main.dust[num5];
                                dust34.velocity = (Vector2)(dust34.velocity * 3f);
                                Dust dust35 = Main.dust[num5];
                                dust35.velocity += (Vector2)(base.velocity * 0.2f);
                                color5 = new Color();
                                num5 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 1f);
                                Dust dust36 = Main.dust[num5];
                                dust36.velocity = (Vector2)(dust36.velocity * 2f);
                                Dust dust37 = Main.dust[num5];
                                dust37.velocity += (Vector2)(base.velocity * 0.3f);
                            }
                            for (int k = 0; k < 1; k++)
                            {
                                vector240 = new Vector2();
                                int num6 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), vector240, Main.rand.Next(0x3d, 0x40), 1f);
                                Gore gore1 = Main.gore[num6];
                                gore1.position += (Vector2)(base.velocity * 1.25f);
                                Main.gore[num6].scale = 1.5f;
                                Gore gore2 = Main.gore[num6];
                                gore2.velocity += (Vector2)(base.velocity * 0.5f);
                                Gore gore3 = Main.gore[num6];
                                gore3.velocity = (Vector2)(gore3.velocity * 0.02f);
                            }
                        }
                    }
                }
                else if (this.type == 0x119)
                {
                    if (this.ai[1] == 0f)
                    {
                        this.ai[1] = 1f;
                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14);
                    }
                    this.ai[0]++;
                    if (this.ai[0] >= 18f)
                    {
                        this.velocity.Y += 0.28f;
                        this.velocity.X *= 0.99f;
                    }
                    if (this.ai[0] > 2f)
                    {
                        this.alpha = 0;
                        if (this.ai[0] == 3f)
                        {
                            for (int m = 0; m < 10; m++)
                            {
                                color5 = new Color();
                                int num9 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1.5f);
                                Dust dust38 = Main.dust[num9];
                                dust38.velocity = (Vector2)(dust38.velocity * 0.5f);
                                Dust dust39 = Main.dust[num9];
                                dust39.velocity += (Vector2)(base.velocity * 0.1f);
                            }
                            for (int n = 0; n < 5; n++)
                            {
                                color5 = new Color();
                                int num11 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 2f);
                                Main.dust[num11].noGravity = true;
                                Dust dust40 = Main.dust[num11];
                                dust40.velocity = (Vector2)(dust40.velocity * 3f);
                                Dust dust41 = Main.dust[num11];
                                dust41.velocity += (Vector2)(base.velocity * 0.2f);
                                color5 = new Color();
                                num11 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 1f);
                                Dust dust42 = Main.dust[num11];
                                dust42.velocity = (Vector2)(dust42.velocity * 2f);
                                Dust dust43 = Main.dust[num11];
                                dust43.velocity += (Vector2)(base.velocity * 0.3f);
                            }
                            for (int num13 = 0; num13 < 1; num13++)
                            {
                                vector240 = new Vector2();
                                int num12 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), vector240, Main.rand.Next(0x3d, 0x40), 1f);
                                Gore gore4 = Main.gore[num12];
                                gore4.position += (Vector2)(base.velocity * 1.25f);
                                Main.gore[num12].scale = 1.5f;
                                Gore gore5 = Main.gore[num12];
                                gore5.velocity += (Vector2)(base.velocity * 0.5f);
                                Gore gore6 = Main.gore[num12];
                                gore6.velocity = (Vector2)(gore6.velocity * 0.02f);
                            }
                        }
                    }
                }
                else if (this.type == 240)
                {
                    if (this.ai[1] == 0f)
                    {
                        this.ai[1] = 1f;
                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14);
                    }
                    this.ai[0]++;
                    if (this.ai[0] >= 16f)
                    {
                        this.velocity.Y += 0.18f;
                        this.velocity.X *= 0.991f;
                    }
                    if (this.ai[0] > 2f)
                    {
                        this.alpha = 0;
                        if (this.ai[0] == 3f)
                        {
                            for (int num14 = 0; num14 < 7; num14++)
                            {
                                color5 = new Color();
                                int num15 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1.5f);
                                Dust dust44 = Main.dust[num15];
                                dust44.velocity = (Vector2)(dust44.velocity * 0.5f);
                                Dust dust45 = Main.dust[num15];
                                dust45.velocity += (Vector2)(base.velocity * 0.1f);
                            }
                            for (int num16 = 0; num16 < 3; num16++)
                            {
                                color5 = new Color();
                                int num17 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 2f);
                                Main.dust[num17].noGravity = true;
                                Dust dust46 = Main.dust[num17];
                                dust46.velocity = (Vector2)(dust46.velocity * 3f);
                                Dust dust47 = Main.dust[num17];
                                dust47.velocity += (Vector2)(base.velocity * 0.2f);
                                color5 = new Color();
                                num17 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 1f);
                                Dust dust48 = Main.dust[num17];
                                dust48.velocity = (Vector2)(dust48.velocity * 2f);
                                Dust dust49 = Main.dust[num17];
                                dust49.velocity += (Vector2)(base.velocity * 0.3f);
                            }
                            for (int num19 = 0; num19 < 1; num19++)
                            {
                                vector240 = new Vector2();
                                int num18 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), vector240, Main.rand.Next(0x3d, 0x40), 1f);
                                Gore gore7 = Main.gore[num18];
                                gore7.position += (Vector2)(base.velocity * 1.25f);
                                Main.gore[num18].scale = 1.25f;
                                Gore gore8 = Main.gore[num18];
                                gore8.velocity += (Vector2)(base.velocity * 0.5f);
                                Gore gore9 = Main.gore[num18];
                                gore9.velocity = (Vector2)(gore9.velocity * 0.02f);
                            }
                        }
                    }
                }
                if (this.type == 0x1f1)
                {
                    color5 = new Color();
                    int num20 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1b, this.velocity.X, this.velocity.Y, 100, color5, 1.2f);
                    Main.dust[num20].position = (Vector2)((Main.dust[num20].position + base.Center) / 2f);
                    Main.dust[num20].noGravity = true;
                    Dust dust50 = Main.dust[num20];
                    dust50.velocity = (Vector2)(dust50.velocity * 0.3f);
                    Dust dust51 = Main.dust[num20];
                    dust51.velocity -= (Vector2)(base.velocity * 0.1f);
                    this.ai[0]++;
                    if (this.ai[0] >= 30f)
                    {
                        this.velocity.X *= 0.99f;
                        this.velocity.Y += 0.5f;
                    }
                    else
                    {
                        this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                    }
                }
                else if (this.type == 0xf9)
                {
                    this.ai[0]++;
                    if (this.ai[0] >= 0f)
                    {
                        this.velocity.Y += 0.25f;
                    }
                }
                else if (this.type == 0x15b)
                {
                    this.ai[0]++;
                    if (this.ai[0] >= 5f)
                    {
                        this.velocity.Y += 0.25f;
                    }
                }
                else if (this.type == 0x1f5)
                {
                    this.ai[0]++;
                    if (this.ai[0] >= 18f)
                    {
                        this.velocity.X *= 0.995f;
                        this.velocity.Y += 0.2f;
                    }
                }
                else if (this.type == 0x1f8)
                {
                    this.alpha = 0xff;
                    this.ai[0]++;
                    if (this.ai[0] > 3f)
                    {
                        int num21 = 100;
                        if (this.ai[0] > 20f)
                        {
                            int num22 = 40;
                            float num23 = this.ai[0] - 20f;
                            num21 = (int)(100f * (1f - (num23 / ((float)num22))));
                            if (num23 >= num22)
                            {
                                this.Kill();
                            }
                        }
                        if (this.ai[0] <= 10f)
                        {
                            num21 = ((int)this.ai[0]) * 10;
                        }
                        if (Main.rand.Next(100) < num21)
                        {
                            color5 = new Color();
                            int num24 = Dust.NewDust(base.position, base.width, base.height, 6, 0f, 0f, 150, color5, 1f);
                            Main.dust[num24].position = (Vector2)((Main.dust[num24].position + base.Center) / 2f);
                            Main.dust[num24].noGravity = true;
                            Dust dust52 = Main.dust[num24];
                            dust52.velocity = (Vector2)(dust52.velocity * 2f);
                            Dust dust53 = Main.dust[num24];
                            dust53.scale *= 1.2f;
                            Dust dust54 = Main.dust[num24];
                            dust54.velocity += base.velocity;
                        }
                    }
                    if (this.ai[0] >= 20f)
                    {
                        this.velocity.X *= 0.99f;
                        this.velocity.Y += 0.1f;
                    }
                }
                else if (((this.type == 0x45) || (this.type == 70)) || (this.type == 0x26d))
                {
                    this.ai[0]++;
                    if (this.ai[0] >= 10f)
                    {
                        this.velocity.Y += 0.25f;
                        this.velocity.X *= 0.99f;
                    }
                }
                else if (this.type == 0xa6)
                {
                    this.ai[0]++;
                    if (this.ai[0] >= 20f)
                    {
                        this.velocity.Y += 0.3f;
                        this.velocity.X *= 0.98f;
                    }
                }
                else if (this.type == 300)
                {
                    if (this.ai[0] == 0f)
                    {
                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 1);
                    }
                    this.ai[0]++;
                    if (this.ai[0] >= 60f)
                    {
                        this.velocity.Y += 0.2f;
                        this.velocity.X *= 0.99f;
                    }
                }
                else if (this.type == 0x132)
                {
                    if (this.alpha <= 200)
                    {
                        for (int num25 = 0; num25 < 4; num25++)
                        {
                            float num26 = (this.velocity.X / 4f) * num25;
                            float num27 = (this.velocity.Y / 4f) * num25;
                            color5 = new Color();
                            int num28 = Dust.NewDust(base.position, base.width, base.height, 0xb8, 0f, 0f, 0, color5, 1f);
                            Main.dust[num28].position.X = base.Center.X - num26;
                            Main.dust[num28].position.Y = base.Center.Y - num27;
                            Dust dust55 = Main.dust[num28];
                            dust55.velocity = (Vector2)(dust55.velocity * 0f);
                            Main.dust[num28].scale = 0.7f;
                        }
                    }
                    this.alpha -= 50;
                    if (this.alpha < 0)
                    {
                        this.alpha = 0;
                    }
                    this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 0.785f;
                }
                else if (this.type == 0x130)
                {
                    this.ai[0]++;
                    if (this.ai[0] >= 30f)
                    {
                        this.alpha += 10;
                        this.damage = (int)(this.damage * 0.9);
                        this.knockBack = (int)(this.knockBack * 0.9);
                        if (this.alpha >= 0xff)
                        {
                            base.active = false;
                        }
                    }
                    if (this.ai[0] < 30f)
                    {
                        this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                    }
                }
                else if ((this.type == 370) || (this.type == 0x173))
                {
                    this.ai[0]++;
                    if (this.ai[0] >= 15f)
                    {
                        this.velocity.Y += 0.3f;
                        this.velocity.X *= 0.98f;
                    }
                }
                else
                {
                    this.ai[0]++;
                    if (this.ai[0] >= 20f)
                    {
                        this.velocity.Y += 0.4f;
                        this.velocity.X *= 0.97f;
                    }
                    else if (((this.type == 0x30) || (this.type == 0x36)) || (((this.type == 0x5d) || (this.type == 520)) || (this.type == 0x257)))
                    {
                        this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                    }
                }
                if (this.velocity.Y > 16f)
                {
                    this.velocity.Y = 16f;
                }
                if ((this.type == 0x36) && (Main.rand.Next(20) == 0))
                {
                    Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 40, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, new Color(), 0.75f);
                    return;
                }
                return;
            }
            if (this.aiStyle != 3)
            {
                if (this.aiStyle == 4)
                {
                    this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                    if (this.ai[0] != 0f)
                    {
                        if ((this.alpha < 170) && ((this.alpha + 5) >= 170))
                        {
                            if ((this.type >= 150) && (this.type <= 0x98))
                            {
                                for (int num60 = 0; num60 < 8; num60++)
                                {
                                    color5 = new Color();
                                    int num61 = Dust.NewDust(base.position, base.width, base.height, 7, this.velocity.X * 0.025f, this.velocity.Y * 0.025f, 200, color5, 1.3f);
                                    Main.dust[num61].noGravity = true;
                                    Dust dust58 = Main.dust[num61];
                                    dust58.velocity = (Vector2)(dust58.velocity * 0.5f);
                                }
                            }
                            else if ((this.type == 0x1ed) || (this.type == 0x1ee))
                            {
                                for (int num62 = 0; num62 < 8; num62++)
                                {
                                    color5 = new Color();
                                    int num63 = Dust.NewDust(base.position, base.width, base.height, Main.rand.Next(0x44, 0x47), this.velocity.X * 0.025f, this.velocity.Y * 0.025f, 200, color5, 1.3f);
                                    Main.dust[num63].noGravity = true;
                                    Dust dust59 = Main.dust[num63];
                                    dust59.velocity = (Vector2)(dust59.velocity * 0.5f);
                                }
                            }
                            else
                            {
                                for (int num64 = 0; num64 < 3; num64++)
                                {
                                    color5 = new Color();
                                    Dust.NewDust(base.position, base.width, base.height, 0x12, this.velocity.X * 0.025f, this.velocity.Y * 0.025f, 170, color5, 1.2f);
                                }
                                Dust.NewDust(base.position, base.width, base.height, 14, 0f, 0f, 170, new Color(), 1.1f);
                            }
                        }
                        if ((this.type >= 150) && (this.type <= 0x98))
                        {
                            this.alpha += 3;
                        }
                        else if ((this.type == 0x1ed) || (this.type == 0x1ee))
                        {
                            this.alpha += 7;
                        }
                        else
                        {
                            this.alpha += 5;
                        }
                        if (this.alpha >= 0xff)
                        {
                            this.Kill();
                            return;
                        }
                    }
                    else
                    {
                        if ((((this.type >= 150) && (this.type <= 0x98)) && ((this.ai[1] == 0f) && (this.alpha == 0xff))) && (Main.rand.Next(2) == 0))
                        {
                            this.type++;
                            this.netUpdate = true;
                        }
                        this.alpha -= 50;
                        if ((this.type >= 150) && (this.type <= 0x98))
                        {
                            this.alpha -= 0x19;
                        }
                        else if ((this.type == 0x1ed) || (this.type == 0x1ee))
                        {
                            this.alpha -= 50;
                        }
                        if (this.alpha <= 0)
                        {
                            this.alpha = 0;
                            this.ai[0] = 1f;
                            if (this.ai[1] == 0f)
                            {
                                this.ai[1]++;
                                base.position += (Vector2)(base.velocity * 1f);
                            }
                            if ((this.type == 7) && (Main.myPlayer == this.owner))
                            {
                                int type = this.type;
                                if (this.ai[1] >= 6f)
                                {
                                    type++;
                                }
                                int num53 = NewProjectile((this.position.X + this.velocity.X) + (base.width / 2), (this.position.Y + this.velocity.Y) + (base.height / 2), this.velocity.X, this.velocity.Y, type, this.damage, this.knockBack, this.owner, 0f, 0f);
                                Main.projectile[num53].damage = this.damage;
                                Main.projectile[num53].ai[1] = this.ai[1] + 1f;
                                NetMessage.SendData(0x1b, -1, -1, "", num53, 0f, 0f, 0f, 0, 0, 0);
                                return;
                            }
                            if ((this.type == 0x1ee) && (Main.myPlayer == this.owner))
                            {
                                int num54 = this.type;
                                if (this.ai[1] >= (7 + Main.rand.Next(2)))
                                {
                                    num54--;
                                }
                                int damage = this.damage;
                                float knockBack = this.knockBack;
                                if (num54 == 0x1ed)
                                {
                                    damage = (int)(this.damage * 1.25);
                                    knockBack = this.knockBack * 1.25f;
                                }
                                int number = NewProjectile((this.position.X + this.velocity.X) + (base.width / 2), (this.position.Y + this.velocity.Y) + (base.height / 2), this.velocity.X, this.velocity.Y, num54, damage, knockBack, this.owner, 0f, this.ai[1] + 1f);
                                NetMessage.SendData(0x1b, -1, -1, "", number, 0f, 0f, 0f, 0, 0, 0);
                                return;
                            }
                            if (((this.type == 150) || (this.type == 0x97)) && (Main.myPlayer == this.owner))
                            {
                                int num58 = this.type;
                                if (this.type == 150)
                                {
                                    num58 = 0x97;
                                }
                                else if (this.type == 0x97)
                                {
                                    num58 = 150;
                                }
                                if ((this.ai[1] >= 10f) && (this.type == 0x97))
                                {
                                    num58 = 0x98;
                                }
                                int num59 = NewProjectile((this.position.X + this.velocity.X) + (base.width / 2), (this.position.Y + this.velocity.Y) + (base.height / 2), this.velocity.X, this.velocity.Y, num58, this.damage, this.knockBack, this.owner, 0f, 0f);
                                Main.projectile[num59].damage = this.damage;
                                Main.projectile[num59].ai[1] = this.ai[1] + 1f;
                                NetMessage.SendData(0x1b, -1, -1, "", num59, 0f, 0f, 0f, 0, 0, 0);
                                return;
                            }
                        }
                    }
                    return;
                }
                if (this.aiStyle == 5)
                {
                    if (this.type == 0x1f7)
                    {
                        if (base.Center.Y > this.ai[1])
                        {
                            this.tileCollide = true;
                        }
                    }
                    else if (this.type == 0x5c)
                    {
                        if (this.position.Y > this.ai[1])
                        {
                            this.tileCollide = true;
                        }
                    }
                    else
                    {
                        if ((this.ai[1] == 0f) && !Collision.SolidCollision(base.position, base.width, base.height))
                        {
                            this.ai[1] = 1f;
                            this.netUpdate = true;
                        }
                        if (this.ai[1] != 0f)
                        {
                            this.tileCollide = true;
                        }
                    }
                    if (this.soundDelay == 0)
                    {
                        this.soundDelay = 20 + Main.rand.Next(40);
                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 9);
                    }
                    if (this.type == 0x1f7)
                    {
                        this.alpha -= 15;
                        int num65 = 150;
                        if (base.Center.Y >= this.ai[1])
                        {
                            num65 = 0;
                        }
                        if (this.alpha < num65)
                        {
                            this.alpha = num65;
                        }
                        float introduced1609 = Math.Abs(this.velocity.X);
                        this.localAI[0] += ((introduced1609 + Math.Abs(this.velocity.Y)) * 0.01f) * base.direction;
                    }
                    else
                    {
                        if (this.localAI[0] == 0f)
                        {
                            this.localAI[0] = 1f;
                        }
                        this.alpha += (int)(25f * this.localAI[0]);
                        if (this.alpha > 200)
                        {
                            this.alpha = 200;
                            this.localAI[0] = -1f;
                        }
                        if (this.alpha < 0)
                        {
                            this.alpha = 0;
                            this.localAI[0] = 1f;
                        }
                    }
                    if (this.type == 0x1f7)
                    {
                        this.rotation = base.velocity.ToRotation() - 1.570796f;
                    }
                    else
                    {
                        float introduced1610 = Math.Abs(this.velocity.X);
                        this.rotation += ((introduced1610 + Math.Abs(this.velocity.Y)) * 0.01f) * base.direction;
                    }
                    if (this.type == 0x1f7)
                    {
                        if (Main.rand.Next(0x10) == 0)
                        {
                            Vector2 vector7 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)base.velocity.ToRotation(), new Vector2());
                            color5 = new Color();
                            int num66 = Dust.NewDust(base.position, base.width, base.height, 0x3a, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, color5, 1.2f);
                            Main.dust[num66].velocity = (Vector2)(vector7 * 0.66f);
                            Main.dust[num66].position = base.Center + ((Vector2)(vector7 * 12f));
                        }
                        if (Main.rand.Next(0x30) == 0)
                        {
                            int num67 = Gore.NewGore(base.Center, new Vector2(this.velocity.X * 0.2f, this.velocity.Y * 0.2f), 0x10, 1f);
                            Gore gore10 = Main.gore[num67];
                            gore10.velocity = (Vector2)(gore10.velocity * 0.66f);
                            Gore gore11 = Main.gore[num67];
                            gore11.velocity += (Vector2)(base.velocity * 0.3f);
                        }
                    }
                    if ((this.ai[1] == 1f) || (this.type == 0x5c))
                    {
                        this.light = 0.9f;
                        if (Main.rand.Next(10) == 0)
                        {
                            Dust.NewDust(base.position, base.width, base.height, 0x3a, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, new Color(), 1.2f);
                        }
                        if (Main.rand.Next(20) == 0)
                        {
                            Gore.NewGore(base.position, new Vector2(this.velocity.X * 0.2f, this.velocity.Y * 0.2f), Main.rand.Next(0x10, 0x12), 1f);
                            return;
                        }
                    }
                    return;
                }
                if (this.aiStyle == 6)
                {
                    base.velocity = (Vector2)(base.velocity * 0.95f);
                    this.ai[0]++;
                    if (this.ai[0] == 180f)
                    {
                        this.Kill();
                    }
                    if (this.ai[1] == 0f)
                    {
                        this.ai[1] = 1f;
                        int num68 = 10 + this.type;
                        if (this.type == 0x1cf)
                        {
                            num68 = 0xe7;
                        }
                        for (int num69 = 0; num69 < 30; num69++)
                        {
                            color5 = new Color();
                            Dust.NewDust(base.position, base.width, base.height, num68, this.velocity.X, this.velocity.Y, 50, color5, 1f);
                        }
                    }
                    if (((this.type == 10) || (this.type == 11)) || (this.type == 0x1cf))
                    {
                        int num70 = ((int)(this.position.X / 16f)) - 1;
                        int maxTilesX = ((int)((this.position.X + base.width) / 16f)) + 2;
                        int num72 = ((int)(this.position.Y / 16f)) - 1;
                        int maxTilesY = ((int)((this.position.Y + base.height) / 16f)) + 2;
                        if (num70 < 0)
                        {
                            num70 = 0;
                        }
                        if (maxTilesX > Main.maxTilesX)
                        {
                            maxTilesX = Main.maxTilesX;
                        }
                        if (num72 < 0)
                        {
                            num72 = 0;
                        }
                        if (maxTilesY > Main.maxTilesY)
                        {
                            maxTilesY = Main.maxTilesY;
                        }
                        for (int num74 = num70; num74 < maxTilesX; num74++)
                        {
                            for (int num75 = num72; num75 < maxTilesY; num75++)
                            {
                                Vector2 vector8;
                                vector8.X = num74 * 0x10;
                                vector8.Y = num75 * 0x10;
                                if (((((this.position.X + base.width) > vector8.X) && (this.position.X < (vector8.X + 16f))) && (((this.position.Y + base.height) > vector8.Y) && (this.position.Y < (vector8.Y + 16f)))) && ((Main.myPlayer == this.owner) && Main.tile[num74, num75].active()))
                                {
                                    if (this.type == 10)
                                    {
                                        if ((Main.tile[num74, num75].type == 0x17) || (Main.tile[num74, num75].type == 0xc7))
                                        {
                                            Main.tile[num74, num75].type = 2;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                        if ((Main.tile[num74, num75].type == 0x19) || (Main.tile[num74, num75].type == 0xcb))
                                        {
                                            Main.tile[num74, num75].type = 1;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                        if ((Main.tile[num74, num75].type == 0x70) || (Main.tile[num74, num75].type == 0xea))
                                        {
                                            Main.tile[num74, num75].type = 0x35;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                        if ((Main.tile[num74, num75].type == 0xa3) || (Main.tile[num74, num75].type == 200))
                                        {
                                            Main.tile[num74, num75].type = 0xa1;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                        if ((Main.tile[num74, num75].type == 400) || (Main.tile[num74, num75].type == 0x191))
                                        {
                                            Main.tile[num74, num75].type = 0x18c;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                        if ((Main.tile[num74, num75].type == 0x18e) || (Main.tile[num74, num75].type == 0x18f))
                                        {
                                            Main.tile[num74, num75].type = 0x18d;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                    }
                                    else if ((this.type == 11) || (this.type == 0x1cf))
                                    {
                                        if (Main.tile[num74, num75].type == 0x6d)
                                        {
                                            Main.tile[num74, num75].type = 2;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                        if (Main.tile[num74, num75].type == 0x74)
                                        {
                                            Main.tile[num74, num75].type = 0x35;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                        if (Main.tile[num74, num75].type == 0x75)
                                        {
                                            Main.tile[num74, num75].type = 1;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                        if (Main.tile[num74, num75].type == 0xa4)
                                        {
                                            Main.tile[num74, num75].type = 0xa1;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                        if (Main.tile[num74, num75].type == 0x193)
                                        {
                                            Main.tile[num74, num75].type = 0x18c;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                        if (Main.tile[num74, num75].type == 0x192)
                                        {
                                            Main.tile[num74, num75].type = 0x18d;
                                            WorldGen.SquareTileFrame(num74, num75, true);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendTileSquare(-1, num74, num75, 1);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        return;
                    }
                    return;
                }
                if (this.aiStyle != 7)
                {
                    if (this.aiStyle == 8)
                    {
                        if ((this.type == 0x102) && (this.localAI[0] == 0f))
                        {
                            this.localAI[0] = 1f;
                            Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 20);
                        }
                        if ((this.type == 0x60) && (this.localAI[0] == 0f))
                        {
                            this.localAI[0] = 1f;
                            Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 20);
                        }
                        if (this.type == 0x1b)
                        {
                            for (int num99 = 0; num99 < 5; num99++)
                            {
                                float num100 = (this.velocity.X / 3f) * num99;
                                float num101 = (this.velocity.Y / 3f) * num99;
                                int num102 = 4;
                                color5 = new Color();
                                int num103 = Dust.NewDust(new Vector2(this.position.X + num102, this.position.Y + num102), base.width - (num102 * 2), base.height - (num102 * 2), 0xac, 0f, 0f, 100, color5, 1.2f);
                                Main.dust[num103].noGravity = true;
                                Dust dust60 = Main.dust[num103];
                                dust60.velocity = (Vector2)(dust60.velocity * 0.1f);
                                Dust dust61 = Main.dust[num103];
                                dust61.velocity += (Vector2)(base.velocity * 0.1f);
                                Main.dust[num103].position.X -= num100;
                                Main.dust[num103].position.Y -= num101;
                            }
                            if (Main.rand.Next(5) == 0)
                            {
                                int num104 = 4;
                                int num105 = Dust.NewDust(new Vector2(this.position.X + num104, this.position.Y + num104), base.width - (num104 * 2), base.height - (num104 * 2), 0xac, 0f, 0f, 100, new Color(), 0.6f);
                                Dust dust62 = Main.dust[num105];
                                dust62.velocity = (Vector2)(dust62.velocity * 0.25f);
                                Dust dust63 = Main.dust[num105];
                                dust63.velocity += (Vector2)(base.velocity * 0.5f);
                            }
                        }
                        else if (this.type == 0x1f6)
                        {
                            float r = ((float)Main.DiscoR) / 255f;
                            float g = ((float)Main.DiscoG) / 255f;
                            float b = ((float)Main.DiscoB) / 255f;
                            r = (0.5f + r) / 2f;
                            g = (0.5f + g) / 2f;
                            b = (0.5f + b) / 2f;
                            Lighting.AddLight(base.Center, r, g, b);
                        }
                        else if ((this.type == 0x5f) || (this.type == 0x60))
                        {
                            int num109 = Dust.NewDust(new Vector2(this.position.X + this.velocity.X, this.position.Y + this.velocity.Y), base.width, base.height, 0x4b, this.velocity.X, this.velocity.Y, 100, new Color(), 3f * this.scale);
                            Main.dust[num109].noGravity = true;
                        }
                        else if (this.type == 0xfd)
                        {
                            for (int num110 = 0; num110 < 2; num110++)
                            {
                                color5 = new Color();
                                int num111 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x87, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 2f);
                                Main.dust[num111].noGravity = true;
                                Main.dust[num111].velocity.X *= 0.3f;
                                Main.dust[num111].velocity.Y *= 0.3f;
                            }
                        }
                        else
                        {
                            for (int num112 = 0; num112 < 2; num112++)
                            {
                                color5 = new Color();
                                int num113 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 2f);
                                Main.dust[num113].noGravity = true;
                                Main.dust[num113].velocity.X *= 0.3f;
                                Main.dust[num113].velocity.Y *= 0.3f;
                            }
                        }
                        if (((this.type != 0x1b) && (this.type != 0x60)) && (this.type != 0x102))
                        {
                            this.ai[1]++;
                        }
                        if (this.ai[1] >= 20f)
                        {
                            this.velocity.Y += 0.2f;
                        }
                        if (this.type == 0x1f6)
                        {
                            this.rotation = base.velocity.ToRotation() + 1.570796f;
                            if (this.velocity.X != 0f)
                            {
                                this.spriteDirection = base.direction = Math.Sign(this.velocity.X);
                            }
                        }
                        else
                        {
                            this.rotation += 0.3f * base.direction;
                        }
                        if (this.velocity.Y > 16f)
                        {
                            this.velocity.Y = 16f;
                            return;
                        }
                        return;
                    }
                    if (this.aiStyle != 9)
                    {
                        if (this.aiStyle == 10)
                        {
                            if ((this.type == 0x1f) && (this.ai[0] != 2f))
                            {
                                if (Main.rand.Next(2) == 0)
                                {
                                    int num136 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x20, 0f, this.velocity.Y / 2f, 0, new Color(), 1f);
                                    Main.dust[num136].velocity.X *= 0.4f;
                                }
                            }
                            else if (this.type == 0x27)
                            {
                                if (Main.rand.Next(2) == 0)
                                {
                                    int num137 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x26, 0f, this.velocity.Y / 2f, 0, new Color(), 1f);
                                    Main.dust[num137].velocity.X *= 0.4f;
                                }
                            }
                            else if ((this.type >= 0x19b) && (this.type <= 0x19e))
                            {
                                if (Main.rand.Next(3) == 0)
                                {
                                    int num138 = 9;
                                    if ((this.type == 0x19c) || (this.type == 0x19e))
                                    {
                                        num138 = 11;
                                    }
                                    if (this.type == 0x19d)
                                    {
                                        num138 = 0x13;
                                    }
                                    int num139 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num138, 0f, this.velocity.Y / 2f, 0, new Color(), 1f);
                                    Main.dust[num139].noGravity = true;
                                    Dust dust69 = Main.dust[num139];
                                    dust69.velocity -= (Vector2)(base.velocity * 0.5f);
                                }
                            }
                            else if (this.type == 40)
                            {
                                if (Main.rand.Next(2) == 0)
                                {
                                    int num140 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x24, 0f, this.velocity.Y / 2f, 0, new Color(), 1f);
                                    Dust dust70 = Main.dust[num140];
                                    dust70.velocity = (Vector2)(dust70.velocity * 0.4f);
                                }
                            }
                            else if ((this.type == 0x2a) || (this.type == 0x1f))
                            {
                                if (Main.rand.Next(2) == 0)
                                {
                                    int num141 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x20, 0f, 0f, 0, new Color(), 1f);
                                    Main.dust[num141].velocity.X *= 0.4f;
                                }
                            }
                            else if ((this.type == 0x38) || (this.type == 0x41))
                            {
                                if (Main.rand.Next(2) == 0)
                                {
                                    int num142 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 14, 0f, 0f, 0, new Color(), 1f);
                                    Main.dust[num142].velocity.X *= 0.4f;
                                }
                            }
                            else if ((this.type == 0x43) || (this.type == 0x44))
                            {
                                if (Main.rand.Next(2) == 0)
                                {
                                    int num143 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x33, 0f, 0f, 0, new Color(), 1f);
                                    Main.dust[num143].velocity.X *= 0.4f;
                                }
                            }
                            else if (this.type == 0x47)
                            {
                                if (Main.rand.Next(2) == 0)
                                {
                                    int num144 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x35, 0f, 0f, 0, new Color(), 1f);
                                    Main.dust[num144].velocity.X *= 0.4f;
                                }
                            }
                            else if (this.type == 0xb3)
                            {
                                if (Main.rand.Next(2) == 0)
                                {
                                    int num145 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x95, 0f, 0f, 0, new Color(), 1f);
                                    Main.dust[num145].velocity.X *= 0.4f;
                                }
                            }
                            else if ((this.type == 0xf1) || (this.type == 0x162))
                            {
                                if (Main.rand.Next(2) == 0)
                                {
                                    int num146 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x24, 0f, 0f, 0, new Color(), 1f);
                                    Main.dust[num146].velocity.X *= 0.4f;
                                }
                            }
                            else if ((this.type != 0x6d) && (Main.rand.Next(20) == 0))
                            {
                                Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0, 0f, 0f, 0, new Color(), 1f);
                            }
                            this.tileCollide = true;
                            this.localAI[1] = 0f;
                            if ((Main.myPlayer == this.owner) && (this.ai[0] == 0f))
                            {
                                this.tileCollide = false;
                                if (Main.player[this.owner].channel)
                                {
                                    this.localAI[1] = -1f;
                                    float num147 = 12f;
                                    Vector2 vector20 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                    float num148 = (Main.mouseX + Main.screenPosition.X) - vector20.X;
                                    float num149 = (Main.mouseY + Main.screenPosition.Y) - vector20.Y;
                                    if (Main.player[this.owner].gravDir == -1f)
                                    {
                                        num149 = ((Main.screenPosition.Y + Main.screenHeight) - Main.mouseY) - vector20.Y;
                                    }
                                    float num150 = (float)Math.Sqrt((double)((num148 * num148) + (num149 * num149)));
                                    num150 = (float)Math.Sqrt((double)((num148 * num148) + (num149 * num149)));
                                    if (num150 > num147)
                                    {
                                        num150 = num147 / num150;
                                        num148 *= num150;
                                        num149 *= num150;
                                        if ((num148 != this.velocity.X) || (num149 != this.velocity.Y))
                                        {
                                            this.netUpdate = true;
                                        }
                                        this.velocity.X = num148;
                                        this.velocity.Y = num149;
                                    }
                                    else
                                    {
                                        if ((num148 != this.velocity.X) || (num149 != this.velocity.Y))
                                        {
                                            this.netUpdate = true;
                                        }
                                        this.velocity.X = num148;
                                        this.velocity.Y = num149;
                                    }
                                }
                                else
                                {
                                    this.ai[0] = 1f;
                                    this.netUpdate = true;
                                }
                            }
                            if ((this.ai[0] == 1f) && (this.type != 0x6d))
                            {
                                if (((this.type == 0x2a) || (this.type == 0x41)) || ((this.type == 0x44) || (this.type == 0x162)))
                                {
                                    this.ai[1]++;
                                    if (this.ai[1] >= 60f)
                                    {
                                        this.ai[1] = 60f;
                                        this.velocity.Y += 0.2f;
                                    }
                                }
                                else
                                {
                                    this.velocity.Y += 0.41f;
                                }
                            }
                            else if ((this.ai[0] == 2f) && (this.type != 0x6d))
                            {
                                this.velocity.Y += 0.2f;
                                if (this.velocity.X < -0.04)
                                {
                                    this.velocity.X += 0.04f;
                                }
                                else if (this.velocity.X > 0.04)
                                {
                                    this.velocity.X -= 0.04f;
                                }
                                else
                                {
                                    this.velocity.X = 0f;
                                }
                            }
                            this.rotation += 0.1f;
                            if (this.velocity.Y > 10f)
                            {
                                this.velocity.Y = 10f;
                                return;
                            }
                            return;
                        }
                        if (this.aiStyle == 11)
                        {
                            if (((this.type == 0x48) || (this.type == 0x56)) || (this.type == 0x57))
                            {
                                if (this.velocity.X > 0f)
                                {
                                    this.spriteDirection = -1;
                                }
                                else if (this.velocity.X < 0f)
                                {
                                    this.spriteDirection = 1;
                                }
                                this.rotation = this.velocity.X * 0.1f;
                                this.frameCounter++;
                                if (this.frameCounter >= 4)
                                {
                                    this.frame++;
                                    this.frameCounter = 0;
                                }
                                if (this.frame >= 4)
                                {
                                    this.frame = 0;
                                }
                                if (Main.rand.Next(6) == 0)
                                {
                                    int num151 = 0x38;
                                    if (this.type == 0x56)
                                    {
                                        num151 = 0x49;
                                    }
                                    else if (this.type == 0x57)
                                    {
                                        num151 = 0x4a;
                                    }
                                    int num152 = Dust.NewDust(base.position, base.width, base.height, num151, 0f, 0f, 200, new Color(), 0.8f);
                                    Dust dust71 = Main.dust[num152];
                                    dust71.velocity = (Vector2)(dust71.velocity * 0.3f);
                                    Main.dust[num152].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cLight, Main.player[this.owner]);
                                }
                            }
                            else
                            {
                                this.rotation += 0.02f;
                            }
                            if (Main.myPlayer == this.owner)
                            {
                                if (this.type == 0x48)
                                {
                                    if (Main.player[Main.myPlayer].blueFairy)
                                    {
                                        this.timeLeft = 2;
                                    }
                                }
                                else if (this.type == 0x56)
                                {
                                    if (Main.player[Main.myPlayer].redFairy)
                                    {
                                        this.timeLeft = 2;
                                    }
                                }
                                else if (this.type == 0x57)
                                {
                                    if (Main.player[Main.myPlayer].greenFairy)
                                    {
                                        this.timeLeft = 2;
                                    }
                                }
                                else if (Main.player[Main.myPlayer].lightOrb)
                                {
                                    this.timeLeft = 2;
                                }
                            }
                            if (!Main.player[this.owner].dead)
                            {
                                float num153 = 3f;
                                if (((this.type == 0x48) || (this.type == 0x56)) || (this.type == 0x57))
                                {
                                    num153 = 3.75f;
                                }
                                Vector2 vector21 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                float num154 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector21.X;
                                float num155 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector21.Y;
                                int num156 = 70;
                                if (this.type == 0x12)
                                {
                                    if (Main.player[this.owner].controlUp)
                                    {
                                        num155 = (Main.player[this.owner].position.Y - 40f) - vector21.Y;
                                        num154 -= 6f;
                                        num156 = 4;
                                    }
                                    else if (Main.player[this.owner].controlDown)
                                    {
                                        num155 = ((Main.player[this.owner].position.Y + Main.player[this.owner].height) + 40f) - vector21.Y;
                                        num154 -= 6f;
                                        num156 = 4;
                                    }
                                }
                                float num157 = (float)Math.Sqrt((double)((num154 * num154) + (num155 * num155)));
                                num157 = (float)Math.Sqrt((double)((num154 * num154) + (num155 * num155)));
                                if (((this.type == 0x48) || (this.type == 0x56)) || (this.type == 0x57))
                                {
                                    num156 = 40;
                                }
                                if (num157 > 800f)
                                {
                                    this.position.X = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - (base.width / 2);
                                    this.position.Y = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - (base.height / 2);
                                    return;
                                }
                                if (num157 > num156)
                                {
                                    num157 = num153 / num157;
                                    num154 *= num157;
                                    num155 *= num157;
                                    this.velocity.X = num154;
                                    this.velocity.Y = num155;
                                    return;
                                }
                                this.velocity.X = 0f;
                                this.velocity.Y = 0f;
                                return;
                            }
                            this.Kill();
                            return;
                        }
                        if (this.aiStyle == 12)
                        {
                            if ((this.type == 0x120) && (this.localAI[0] == 0f))
                            {
                                this.localAI[0] = 1f;
                                Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x11);
                            }
                            if ((this.type != 280) && (this.type != 0x120))
                            {
                                this.scale -= 0.02f;
                                if (this.scale <= 0f)
                                {
                                    this.Kill();
                                }
                                if (this.ai[0] > 3f)
                                {
                                    this.velocity.Y += 0.2f;
                                    for (int num165 = 0; num165 < 1; num165++)
                                    {
                                        for (int num166 = 0; num166 < 3; num166++)
                                        {
                                            float num167 = (this.velocity.X / 3f) * num166;
                                            float num168 = (this.velocity.Y / 3f) * num166;
                                            int num169 = 6;
                                            color5 = new Color();
                                            int num170 = Dust.NewDust(new Vector2(this.position.X + num169, this.position.Y + num169), base.width - (num169 * 2), base.height - (num169 * 2), 0xac, 0f, 0f, 100, color5, 1.2f);
                                            Main.dust[num170].noGravity = true;
                                            Dust dust76 = Main.dust[num170];
                                            dust76.velocity = (Vector2)(dust76.velocity * 0.3f);
                                            Dust dust77 = Main.dust[num170];
                                            dust77.velocity += (Vector2)(base.velocity * 0.5f);
                                            Main.dust[num170].position.X -= num167;
                                            Main.dust[num170].position.Y -= num168;
                                        }
                                        if (Main.rand.Next(8) == 0)
                                        {
                                            int num171 = 6;
                                            color5 = new Color();
                                            int num172 = Dust.NewDust(new Vector2(this.position.X + num171, this.position.Y + num171), base.width - (num171 * 2), base.height - (num171 * 2), 0xac, 0f, 0f, 100, color5, 0.75f);
                                            Dust dust78 = Main.dust[num172];
                                            dust78.velocity = (Vector2)(dust78.velocity * 0.5f);
                                            Dust dust79 = Main.dust[num172];
                                            dust79.velocity += (Vector2)(base.velocity * 0.5f);
                                        }
                                    }
                                    return;
                                }
                                this.ai[0]++;
                                return;
                            }
                            this.scale -= 0.002f;
                            if (this.scale <= 0f)
                            {
                                this.Kill();
                            }
                            if (this.type == 0x120)
                            {
                                this.ai[0] = 4f;
                            }
                            if (this.ai[0] <= 3f)
                            {
                                this.ai[0]++;
                                return;
                            }
                            this.velocity.Y += 0.075f;
                            for (int num158 = 0; num158 < 3; num158++)
                            {
                                float num159 = (this.velocity.X / 3f) * num158;
                                float num160 = (this.velocity.Y / 3f) * num158;
                                int num161 = 14;
                                color5 = new Color();
                                int num162 = Dust.NewDust(new Vector2(this.position.X + num161, this.position.Y + num161), base.width - (num161 * 2), base.height - (num161 * 2), 170, 0f, 0f, 100, color5, 1f);
                                Main.dust[num162].noGravity = true;
                                Dust dust72 = Main.dust[num162];
                                dust72.velocity = (Vector2)(dust72.velocity * 0.1f);
                                Dust dust73 = Main.dust[num162];
                                dust73.velocity += (Vector2)(base.velocity * 0.5f);
                                Main.dust[num162].position.X -= num159;
                                Main.dust[num162].position.Y -= num160;
                            }
                            if (Main.rand.Next(8) == 0)
                            {
                                int num163 = 0x10;
                                int num164 = Dust.NewDust(new Vector2(this.position.X + num163, this.position.Y + num163), base.width - (num163 * 2), base.height - (num163 * 2), 170, 0f, 0f, 100, new Color(), 0.5f);
                                Dust dust74 = Main.dust[num164];
                                dust74.velocity = (Vector2)(dust74.velocity * 0.25f);
                                Dust dust75 = Main.dust[num164];
                                dust75.velocity += (Vector2)(base.velocity * 0.5f);
                                return;
                            }
                            return;
                        }
                        if (this.aiStyle == 13)
                        {
                            if (Main.player[this.owner].dead)
                            {
                                this.Kill();
                                return;
                            }
                            if (this.type != 0x1e1)
                            {
                                Main.player[this.owner].itemAnimation = 5;
                                Main.player[this.owner].itemTime = 5;
                            }
                            if (this.alpha == 0)
                            {
                                if ((this.position.X + (base.width / 2)) > (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)))
                                {
                                    Main.player[this.owner].ChangeDir(1);
                                }
                                else
                                {
                                    Main.player[this.owner].ChangeDir(-1);
                                }
                            }
                            if (this.type == 0x1e1)
                            {
                                if (this.ai[0] == 0f)
                                {
                                    this.extraUpdates = 0;
                                }
                                else
                                {
                                    this.extraUpdates = 1;
                                }
                            }
                            Vector2 vector22 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                            float num173 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector22.X;
                            float num174 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector22.Y;
                            float num175 = (float)Math.Sqrt((double)((num173 * num173) + (num174 * num174)));
                            if (this.ai[0] != 0f)
                            {
                                if (this.ai[0] == 1f)
                                {
                                    this.tileCollide = false;
                                    this.rotation = ((float)Math.Atan2((double)num174, (double)num173)) - 1.57f;
                                    float num176 = 20f;
                                    if (this.type == 0x106)
                                    {
                                        num176 = 30f;
                                    }
                                    if (num175 < 50f)
                                    {
                                        this.Kill();
                                    }
                                    num175 = num176 / num175;
                                    num173 *= num175;
                                    num174 *= num175;
                                    this.velocity.X = num173;
                                    this.velocity.Y = num174;
                                    if ((this.type == 0x106) && (this.velocity.X < 0f))
                                    {
                                        this.spriteDirection = 1;
                                    }
                                    else if (this.type == 0x106)
                                    {
                                        this.spriteDirection = -1;
                                    }
                                    if ((this.type == 0x10f) && (this.velocity.X < 0f))
                                    {
                                        this.spriteDirection = 1;
                                        return;
                                    }
                                    if (this.type == 0x10f)
                                    {
                                        this.spriteDirection = -1;
                                        return;
                                    }
                                }
                            }
                            else
                            {
                                if (num175 > 700f)
                                {
                                    this.ai[0] = 1f;
                                }
                                else if ((this.type == 0x106) && (num175 > 500f))
                                {
                                    this.ai[0] = 1f;
                                }
                                else if ((this.type == 0x10f) && (num175 > 200f))
                                {
                                    this.ai[0] = 1f;
                                }
                                else if ((this.type == 0x111) && (num175 > 150f))
                                {
                                    this.ai[0] = 1f;
                                }
                                else if ((this.type == 0x1e1) && (num175 > 350f))
                                {
                                    this.ai[0] = 1f;
                                }
                                this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                                this.ai[1]++;
                                if (this.ai[1] > 5f)
                                {
                                    this.alpha = 0;
                                }
                                if ((this.type == 0x106) && (this.ai[1] > 8f))
                                {
                                    this.ai[1] = 8f;
                                }
                                if ((this.type == 0x10f) && (this.ai[1] > 8f))
                                {
                                    this.ai[1] = 8f;
                                }
                                if ((this.type == 0x111) && (this.ai[1] > 8f))
                                {
                                    this.ai[1] = 8f;
                                }
                                if ((this.type == 0x1e1) && (this.ai[1] > 8f))
                                {
                                    this.ai[1] = 8f;
                                }
                                if ((this.type == 0x194) && (this.ai[1] > 8f))
                                {
                                    this.ai[1] = 0f;
                                }
                                if (this.ai[1] >= 10f)
                                {
                                    this.ai[1] = 15f;
                                    this.velocity.Y += 0.3f;
                                }
                                if ((this.type == 0x106) && (this.velocity.X < 0f))
                                {
                                    this.spriteDirection = -1;
                                }
                                else if (this.type == 0x106)
                                {
                                    this.spriteDirection = 1;
                                }
                                if ((this.type == 0x10f) && (this.velocity.X < 0f))
                                {
                                    this.spriteDirection = -1;
                                    return;
                                }
                                if (this.type == 0x10f)
                                {
                                    this.spriteDirection = 1;
                                    return;
                                }
                            }
                            return;
                        }
                        if (this.aiStyle == 14)
                        {
                            if ((this.type == 0x1d9) && (Main.netMode != 2))
                            {
                                this.localAI[0]++;
                                if (this.localAI[0] >= 10f)
                                {
                                    this.localAI[0] = 0f;
                                    int num177 = 30;
                                    Vector2 vector23 = base.Center - Main.player[Main.myPlayer].Center;
                                    if (vector23.Length() < (Main.screenWidth + (num177 * 0x10)))
                                    {
                                        int num178 = ((int)base.Center.X) / 0x10;
                                        int num179 = ((int)base.Center.Y) / 0x10;
                                        for (int num180 = num178 - num177; num180 <= (num178 + num177); num180++)
                                        {
                                            for (int num181 = num179 - num177; num181 <= (num179 + num177); num181++)
                                            {
                                                if (Main.rand.Next(4) == 0)
                                                {
                                                    Vector2 vector24 = new Vector2((float)(num178 - num180), (float)(num179 - num181));
                                                    if ((((vector24.Length() < num177) && (num180 > 0)) && ((num180 < (Main.maxTilesX - 1)) && (num181 > 0))) && (((num181 < (Main.maxTilesY - 1)) && (Main.tile[num180, num181] != null)) && Main.tile[num180, num181].active()))
                                                    {
                                                        bool flag3 = false;
                                                        if ((Main.tile[num180, num181].type == 0xb9) && (Main.tile[num180, num181].frameY == 0x12))
                                                        {
                                                            if ((Main.tile[num180, num181].frameX >= 0x240) && (Main.tile[num180, num181].frameX <= 0x372))
                                                            {
                                                                flag3 = true;
                                                            }
                                                        }
                                                        else if (((Main.tile[num180, num181].type == 0xba) && (Main.tile[num180, num181].frameX >= 0x360)) && (Main.tile[num180, num181].frameX <= 0x492))
                                                        {
                                                            flag3 = true;
                                                        }
                                                        if ((flag3 || Main.tileSpelunker[Main.tile[num180, num181].type]) || (Main.tileAlch[Main.tile[num180, num181].type] && (Main.tile[num180, num181].type != 0x52)))
                                                        {
                                                            color5 = new Color();
                                                            int num182 = Dust.NewDust(new Vector2((float)(num180 * 0x10), (float)(num181 * 0x10)), 0x10, 0x10, 0xcc, 0f, 0f, 150, color5, 0.3f);
                                                            Main.dust[num182].fadeIn = 0.75f;
                                                            Dust dust80 = Main.dust[num182];
                                                            dust80.velocity = (Vector2)(dust80.velocity * 0.1f);
                                                            Main.dust[num182].noLight = true;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            if (this.type == 0x160)
                            {
                                if (this.localAI[1] == 0f)
                                {
                                    this.localAI[1] = 1f;
                                }
                                this.alpha += (int)(25f * this.localAI[1]);
                                if (this.alpha <= 0)
                                {
                                    this.alpha = 0;
                                    this.localAI[1] = 1f;
                                }
                                else if (this.alpha >= 0xff)
                                {
                                    this.alpha = 0xff;
                                    this.localAI[1] = -1f;
                                }
                                this.scale += this.localAI[1] * 0.01f;
                            }
                            if (this.type == 0x15a)
                            {
                                if (this.localAI[0] == 0f)
                                {
                                    this.localAI[0] = 1f;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 1);
                                }
                                this.frame = (int)this.ai[1];
                                if ((this.owner == Main.myPlayer) && (this.timeLeft == 1))
                                {
                                    for (int num183 = 0; num183 < 5; num183++)
                                    {
                                        float num184 = 10f;
                                        Vector2 vector25 = new Vector2(base.Center.X, base.Center.Y);
                                        float speedX = Main.rand.Next(-20, 0x15);
                                        float speedY = Main.rand.Next(-20, 0);
                                        float num187 = (float)Math.Sqrt((double)((speedX * speedX) + (speedY * speedY)));
                                        num187 = num184 / num187;
                                        speedX *= num187;
                                        speedY *= num187;
                                        speedX *= 1f + (Main.rand.Next(-30, 0x1f) * 0.01f);
                                        speedY *= 1f + (Main.rand.Next(-30, 0x1f) * 0.01f);
                                        NewProjectile(vector25.X, vector25.Y, speedX, speedY, 0x15b, 40, 0f, Main.myPlayer, 0f, this.ai[1]);
                                    }
                                }
                            }
                            if (this.type == 0xc4)
                            {
                                int num188 = Main.rand.Next(1, 3);
                                for (int num189 = 0; num189 < num188; num189++)
                                {
                                    color5 = new Color();
                                    int num190 = Dust.NewDust(base.position, base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1f);
                                    Dust dust81 = Main.dust[num190];
                                    dust81.alpha += Main.rand.Next(100);
                                    Dust dust82 = Main.dust[num190];
                                    dust82.velocity = (Vector2)(dust82.velocity * 0.3f);
                                    Main.dust[num190].velocity.X += Main.rand.Next(-10, 11) * 0.025f;
                                    Main.dust[num190].velocity.Y -= 0.4f + (Main.rand.Next(-3, 14) * 0.15f);
                                    Main.dust[num190].fadeIn = 1.25f + (Main.rand.Next(20) * 0.15f);
                                }
                            }
                            if (this.type == 0x35)
                            {
                                try
                                {
                                    int num191 = ((int)(this.position.X / 16f)) - 1;
                                    int num192 = ((int)((this.position.X + base.width) / 16f)) + 2;
                                    int num193 = ((int)(this.position.Y / 16f)) - 1;
                                    int num194 = ((int)((this.position.Y + base.height) / 16f)) + 2;
                                    if (num191 < 0)
                                    {
                                        num191 = 0;
                                    }
                                    if (num192 > Main.maxTilesX)
                                    {
                                        num192 = Main.maxTilesX;
                                    }
                                    if (num193 < 0)
                                    {
                                        num193 = 0;
                                    }
                                    if (num194 > Main.maxTilesY)
                                    {
                                        num194 = Main.maxTilesY;
                                    }
                                    for (int num195 = num191; num195 < num192; num195++)
                                    {
                                        for (int num196 = num193; num196 < num194; num196++)
                                        {
                                            if (((Main.tile[num195, num196] != null) && Main.tile[num195, num196].nactive()) && (Main.tileSolid[Main.tile[num195, num196].type] || (Main.tileSolidTop[Main.tile[num195, num196].type] && (Main.tile[num195, num196].frameY == 0))))
                                            {
                                                Vector2 vector26;
                                                vector26.X = num195 * 0x10;
                                                vector26.Y = num196 * 0x10;
                                                if ((((this.position.X + base.width) > vector26.X) && (this.position.X < (vector26.X + 16f))) && (((this.position.Y + base.height) > vector26.Y) && (this.position.Y < (vector26.Y + 16f))))
                                                {
                                                    this.velocity.X = 0f;
                                                    this.velocity.Y = -0.2f;
                                                }
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                            }
                            if (this.type == 0x115)
                            {
                                if (this.alpha > 0)
                                {
                                    this.alpha -= 30;
                                    if (this.alpha < 0)
                                    {
                                        this.alpha = 0;
                                    }
                                }
                                if (Main.expertMode)
                                {
                                    float num197 = 12f;
                                    int num198 = Player.FindClosest(base.Center, 1, 1);
                                    Vector2 vector27 = Main.player[num198].Center - base.Center;
                                    vector27.Normalize();
                                    vector27 = (Vector2)(vector27 * num197);
                                    int num199 = 200;
                                    this.velocity.X = ((this.velocity.X * (num199 - 1)) + vector27.X) / ((float)num199);
                                    if (this.velocity.Length() > 16f)
                                    {
                                        this.velocity.Normalize();
                                        base.velocity = (Vector2)(base.velocity * 16f);
                                    }
                                }
                            }
                            if ((this.type == 0x105) || (this.type == 0x115))
                            {
                                this.ai[0]++;
                                if (this.ai[0] > 15f)
                                {
                                    this.ai[0] = 15f;
                                    if ((this.velocity.Y == 0f) && (this.velocity.X != 0f))
                                    {
                                        this.velocity.X *= 0.97f;
                                        if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01))
                                        {
                                            this.Kill();
                                        }
                                    }
                                    this.velocity.Y += 0.2f;
                                }
                                this.rotation += this.velocity.X * 0.05f;
                            }
                            else if (this.type == 0x17a)
                            {
                                if (this.localAI[0] == 0f)
                                {
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x11);
                                    this.localAI[0]++;
                                }
                                Rectangle rectangle3 = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height);
                                for (int num200 = 0; num200 < 200; num200++)
                                {
                                    if (Main.npc[num200].CanBeChasedBy(this, true))
                                    {
                                        Rectangle rectangle4 = new Rectangle((int)Main.npc[num200].position.X, (int)Main.npc[num200].position.Y, Main.npc[num200].width, Main.npc[num200].height);
                                        if (rectangle3.Intersects(rectangle4))
                                        {
                                            this.Kill();
                                            return;
                                        }
                                    }
                                }
                                this.ai[0]++;
                                if (this.ai[0] > 10f)
                                {
                                    this.ai[0] = 90f;
                                    if ((this.velocity.Y == 0f) && (this.velocity.X != 0f))
                                    {
                                        this.velocity.X *= 0.96f;
                                        if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01))
                                        {
                                            this.Kill();
                                        }
                                    }
                                    this.velocity.Y += 0.2f;
                                }
                                this.rotation += this.velocity.X * 0.1f;
                            }
                            else if (this.type == 0x1e3)
                            {
                                this.ai[0]++;
                                if (this.ai[0] > 5f)
                                {
                                    if ((this.owner == Main.myPlayer) && (this.ai[0] > Main.rand.Next(20, 130)))
                                    {
                                        this.Kill();
                                    }
                                    if ((this.velocity.Y == 0f) && (this.velocity.X != 0f))
                                    {
                                        this.velocity.X *= 0.97f;
                                        if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01))
                                        {
                                            this.velocity.X = 0f;
                                            this.netUpdate = true;
                                        }
                                    }
                                    this.velocity.Y += 0.3f;
                                    this.velocity.X *= 0.99f;
                                }
                                this.rotation += this.velocity.X * 0.05f;
                            }
                            else if (this.type == 0x21a)
                            {
                                this.ai[0]++;
                                if ((this.ai[0] > 60f) || (this.velocity.Y >= 0f))
                                {
                                    this.alpha += 6;
                                    base.velocity = (Vector2)(base.velocity * 0.5f);
                                }
                                else if (this.ai[0] > 5f)
                                {
                                    this.velocity.Y += 0.1f;
                                    this.velocity.X *= 1.025f;
                                    this.alpha -= 0x17;
                                    this.scale = (0.8f * (255f - this.alpha)) / 255f;
                                    if (this.alpha < 0)
                                    {
                                        this.alpha = 0;
                                    }
                                }
                                if ((this.alpha >= 0xff) && (this.ai[0] > 5f))
                                {
                                    this.Kill();
                                    return;
                                }
                            }
                            else
                            {
                                this.ai[0]++;
                                if (this.ai[0] > 5f)
                                {
                                    this.ai[0] = 5f;
                                    if ((this.velocity.Y == 0f) && (this.velocity.X != 0f))
                                    {
                                        this.velocity.X *= 0.97f;
                                        if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01))
                                        {
                                            this.velocity.X = 0f;
                                            this.netUpdate = true;
                                        }
                                    }
                                    this.velocity.Y += 0.2f;
                                }
                                this.rotation += this.velocity.X * 0.1f;
                            }
                            if (this.type == 0x21a)
                            {
                                if (this.localAI[1] == 0f)
                                {
                                    this.localAI[1] = 1f;
                                    Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 7);
                                }
                                if ((this.velocity.Y < 0f) && (this.ai[0] < 60f))
                                {
                                    if (Main.rand.Next(4) == 0)
                                    {
                                        color5 = new Color();
                                        int num201 = Dust.NewDust(base.position, base.width, base.height, 180, 0f, 0f, 100, color5, 1f);
                                        Main.dust[num201].position = base.Center;
                                        Dust dust83 = Main.dust[num201];
                                        dust83.scale += Main.rand.Next(50) * 0.01f;
                                        Main.dust[num201].noGravity = true;
                                        Main.dust[num201].velocity.Y -= 2f;
                                    }
                                    if (Main.rand.Next(6) == 0)
                                    {
                                        color5 = new Color();
                                        int num202 = Dust.NewDust(base.position, base.width, base.height, 0xb0, 0f, 0f, 100, color5, 1f);
                                        Main.dust[num202].position = base.Center;
                                        Dust dust84 = Main.dust[num202];
                                        dust84.scale += 0.3f + (Main.rand.Next(50) * 0.01f);
                                        Main.dust[num202].noGravity = true;
                                        Dust dust85 = Main.dust[num202];
                                        dust85.velocity = (Vector2)(dust85.velocity * 0.1f);
                                    }
                                }
                            }
                            if (this.type == 450)
                            {
                                if (this.ai[1] == 0f)
                                {
                                    this.ai[1] = 1f;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13);
                                }
                                if (Main.rand.Next(2) == 0)
                                {
                                    color5 = new Color();
                                    int num203 = Dust.NewDust(base.position, base.width, base.height, 0xe4, 0f, 0f, 100, color5, 1f);
                                    Main.dust[num203].position.X -= 2f;
                                    Main.dust[num203].position.Y += 2f;
                                    Dust dust86 = Main.dust[num203];
                                    dust86.scale += Main.rand.Next(50) * 0.01f;
                                    Main.dust[num203].noGravity = true;
                                    Main.dust[num203].velocity.Y -= 2f;
                                }
                                if (Main.rand.Next(4) == 0)
                                {
                                    color5 = new Color();
                                    int num204 = Dust.NewDust(base.position, base.width, base.height, 0xe4, 0f, 0f, 100, color5, 1f);
                                    Main.dust[num204].position.X -= 2f;
                                    Main.dust[num204].position.Y += 2f;
                                    Dust dust87 = Main.dust[num204];
                                    dust87.scale += 0.3f + (Main.rand.Next(50) * 0.01f);
                                    Main.dust[num204].noGravity = true;
                                    Dust dust88 = Main.dust[num204];
                                    dust88.velocity = (Vector2)(dust88.velocity * 0.1f);
                                }
                                if (++this.frameCounter >= 3)
                                {
                                    this.frameCounter = 0;
                                    if (++this.frame >= 5)
                                    {
                                        this.frame = 0;
                                    }
                                }
                                if ((this.velocity.Y < 0.25) && (this.velocity.Y > 0.15))
                                {
                                    this.velocity.X *= 0.8f;
                                }
                                this.rotation = -this.velocity.X * 0.05f;
                            }
                            if (this.type == 480)
                            {
                                this.alpha = 0xff;
                                color5 = new Color();
                                int num205 = Dust.NewDust(base.position, base.width, base.height, 0x4b, 0f, 0f, 100, color5, 1f);
                                Main.dust[num205].position.X -= 2f;
                                Main.dust[num205].position.Y += 2f;
                                Dust dust89 = Main.dust[num205];
                                dust89.scale += Main.rand.Next(50) * 0.01f;
                                Main.dust[num205].noGravity = true;
                                Main.dust[num205].velocity.Y -= 2f;
                                if (Main.rand.Next(2) == 0)
                                {
                                    color5 = new Color();
                                    int num206 = Dust.NewDust(base.position, base.width, base.height, 0x4b, 0f, 0f, 100, color5, 1f);
                                    Main.dust[num206].position.X -= 2f;
                                    Main.dust[num206].position.Y += 2f;
                                    Dust dust90 = Main.dust[num206];
                                    dust90.scale += 0.3f + (Main.rand.Next(50) * 0.01f);
                                    Main.dust[num206].noGravity = true;
                                    Dust dust91 = Main.dust[num206];
                                    dust91.velocity = (Vector2)(dust91.velocity * 0.1f);
                                }
                            }
                            if (((this.type >= 0x146) && (this.type <= 0x148)) || ((this.type >= 400) && (this.type <= 0x192)))
                            {
                                if (base.wet)
                                {
                                    this.Kill();
                                }
                                if (((this.ai[1] == 0f) && (this.type >= 0x146)) && (this.type <= 0x148))
                                {
                                    this.ai[1] = 1f;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13);
                                }
                                color5 = new Color();
                                int num207 = Dust.NewDust(base.position, base.width, base.height, 6, 0f, 0f, 100, color5, 1f);
                                Main.dust[num207].position.X -= 2f;
                                Main.dust[num207].position.Y += 2f;
                                Dust dust92 = Main.dust[num207];
                                dust92.scale += Main.rand.Next(50) * 0.01f;
                                Main.dust[num207].noGravity = true;
                                Main.dust[num207].velocity.Y -= 2f;
                                if (Main.rand.Next(2) == 0)
                                {
                                    int num208 = Dust.NewDust(base.position, base.width, base.height, 6, 0f, 0f, 100, new Color(), 1f);
                                    Main.dust[num208].position.X -= 2f;
                                    Main.dust[num208].position.Y += 2f;
                                    Dust dust93 = Main.dust[num208];
                                    dust93.scale += 0.3f + (Main.rand.Next(50) * 0.01f);
                                    Main.dust[num208].noGravity = true;
                                    Dust dust94 = Main.dust[num208];
                                    dust94.velocity = (Vector2)(dust94.velocity * 0.1f);
                                }
                                if ((this.velocity.Y < 0.25) && (this.velocity.Y > 0.15))
                                {
                                    this.velocity.X *= 0.8f;
                                }
                                this.rotation = -this.velocity.X * 0.05f;
                            }
                            if (this.velocity.Y > 16f)
                            {
                                this.velocity.Y = 16f;
                                return;
                            }
                            return;
                        }
                        if (this.aiStyle == 15)
                        {
                            if (this.type == 0x19)
                            {
                                if (Main.rand.Next(15) == 0)
                                {
                                    Dust.NewDust(base.position, base.width, base.height, 14, 0f, 0f, 150, new Color(), 1.3f);
                                }
                            }
                            else if (this.type == 0x1a)
                            {
                                int num209 = Dust.NewDust(base.position, base.width, base.height, 0xac, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, new Color(), 1.5f);
                                Main.dust[num209].noGravity = true;
                                Main.dust[num209].velocity.X /= 2f;
                                Main.dust[num209].velocity.Y /= 2f;
                            }
                            else if (this.type == 0x23)
                            {
                                int num210 = Dust.NewDust(base.position, base.width, base.height, 6, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, new Color(), 3f);
                                Main.dust[num210].noGravity = true;
                                Main.dust[num210].velocity.X *= 2f;
                                Main.dust[num210].velocity.Y *= 2f;
                            }
                            else if (this.type == 0x9a)
                            {
                                int num211 = Dust.NewDust(base.position, base.width, base.height, 0x73, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 140, new Color(), 1.5f);
                                Main.dust[num211].noGravity = true;
                                Dust dust95 = Main.dust[num211];
                                dust95.velocity = (Vector2)(dust95.velocity * 0.25f);
                            }
                            if (Main.player[this.owner].dead)
                            {
                                this.Kill();
                                return;
                            }
                            Main.player[this.owner].itemAnimation = 10;
                            Main.player[this.owner].itemTime = 10;
                            if ((this.position.X + (base.width / 2)) > (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)))
                            {
                                Main.player[this.owner].ChangeDir(1);
                                base.direction = 1;
                            }
                            else
                            {
                                Main.player[this.owner].ChangeDir(-1);
                                base.direction = -1;
                            }
                            Vector2 vector28 = Main.player[this.owner].MountedCenter;
                            Vector2 vector29 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                            float num212 = vector28.X - vector29.X;
                            float num213 = vector28.Y - vector29.Y;
                            float num214 = (float)Math.Sqrt((double)((num212 * num212) + (num213 * num213)));
                            if (this.ai[0] == 0f)
                            {
                                float num215 = 160f;
                                if (this.type == 0x3f)
                                {
                                    num215 *= 1.5f;
                                }
                                if (this.type == 0xf7)
                                {
                                    num215 *= 1.5f;
                                }
                                this.tileCollide = true;
                                if (num214 > num215)
                                {
                                    this.ai[0] = 1f;
                                    this.netUpdate = true;
                                }
                                else if (!Main.player[this.owner].channel)
                                {
                                    if (this.velocity.Y < 0f)
                                    {
                                        this.velocity.Y *= 0.9f;
                                    }
                                    this.velocity.Y++;
                                    this.velocity.X *= 0.9f;
                                }
                            }
                            else if (this.ai[0] == 1f)
                            {
                                float num216 = 14f / Main.player[this.owner].meleeSpeed;
                                float num217 = 0.9f / Main.player[this.owner].meleeSpeed;
                                float num218 = 300f;
                                if (this.type == 0x3f)
                                {
                                    num218 *= 1.5f;
                                    num216 *= 1.5f;
                                    num217 *= 1.5f;
                                }
                                if (this.type == 0xf7)
                                {
                                    num218 *= 1.5f;
                                    num216 = 15.9f;
                                    num217 *= 2f;
                                }
                                Math.Abs(num212);
                                Math.Abs(num213);
                                if (this.ai[1] == 1f)
                                {
                                    this.tileCollide = false;
                                }
                                if ((!Main.player[this.owner].channel || (num214 > num218)) || !this.tileCollide)
                                {
                                    this.ai[1] = 1f;
                                    if (this.tileCollide)
                                    {
                                        this.netUpdate = true;
                                    }
                                    this.tileCollide = false;
                                    if (num214 < 20f)
                                    {
                                        this.Kill();
                                    }
                                }
                                if (!this.tileCollide)
                                {
                                    num217 *= 2f;
                                }
                                int num219 = 60;
                                if (this.type == 0xf7)
                                {
                                    num219 = 100;
                                }
                                if ((num214 > num219) || !this.tileCollide)
                                {
                                    num214 = num216 / num214;
                                    num212 *= num214;
                                    num213 *= num214;
                                    new Vector2(this.velocity.X, this.velocity.Y);
                                    float num220 = num212 - this.velocity.X;
                                    float num221 = num213 - this.velocity.Y;
                                    float num222 = (float)Math.Sqrt((double)((num220 * num220) + (num221 * num221)));
                                    num222 = num217 / num222;
                                    num220 *= num222;
                                    num221 *= num222;
                                    this.velocity.X *= 0.98f;
                                    this.velocity.Y *= 0.98f;
                                    this.velocity.X += num220;
                                    this.velocity.Y += num221;
                                }
                                else
                                {
                                    float introduced1654 = Math.Abs(this.velocity.X);
                                    if ((introduced1654 + Math.Abs(this.velocity.Y)) < 6f)
                                    {
                                        this.velocity.X *= 0.96f;
                                        this.velocity.Y += 0.2f;
                                    }
                                    if (Main.player[this.owner].velocity.X == 0f)
                                    {
                                        this.velocity.X *= 0.96f;
                                    }
                                }
                            }
                            if (this.type != 0xf7)
                            {
                                this.rotation = ((float)Math.Atan2((double)num213, (double)num212)) - (this.velocity.X * 0.1f);
                                return;
                            }
                            if (this.velocity.X < 0f)
                            {
                                float introduced1655 = Math.Abs(this.velocity.X);
                                this.rotation -= (introduced1655 + Math.Abs(this.velocity.Y)) * 0.01f;
                            }
                            else
                            {
                                float introduced1656 = Math.Abs(this.velocity.X);
                                this.rotation += (introduced1656 + Math.Abs(this.velocity.Y)) * 0.01f;
                            }
                            float x = this.position.X;
                            float y = this.position.Y;
                            float num225 = 600f;
                            bool flag4 = false;
                            if (this.owner == Main.myPlayer)
                            {
                                this.localAI[1]++;
                                if (this.localAI[1] > 20f)
                                {
                                    this.localAI[1] = 20f;
                                    for (int num226 = 0; num226 < 200; num226++)
                                    {
                                        if (Main.npc[num226].CanBeChasedBy(this, false))
                                        {
                                            float num227 = Main.npc[num226].position.X + (Main.npc[num226].width / 2);
                                            float num228 = Main.npc[num226].position.Y + (Main.npc[num226].height / 2);
                                            float introduced1657 = Math.Abs((float)((this.position.X + (base.width / 2)) - num227));
                                            float num229 = introduced1657 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num228));
                                            if ((num229 < num225) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num226].position, Main.npc[num226].width, Main.npc[num226].height))
                                            {
                                                num225 = num229;
                                                x = num227;
                                                y = num228;
                                                flag4 = true;
                                            }
                                        }
                                    }
                                }
                            }
                            if (flag4)
                            {
                                this.localAI[1] = 0f;
                                float num230 = 14f;
                                vector29 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                num212 = x - vector29.X;
                                num213 = y - vector29.Y;
                                num214 = (float)Math.Sqrt((double)((num212 * num212) + (num213 * num213)));
                                num214 = num230 / num214;
                                num212 *= num214;
                                num213 *= num214;
                                NewProjectile(vector29.X, vector29.Y, num212, num213, 0xf8, (int)(((double)this.damage) / 1.5), this.knockBack / 2f, Main.myPlayer, 0f, 0f);
                                return;
                            }
                            return;
                        }
                        if (this.aiStyle == 0x10)
                        {
                            if ((this.type == 0x6c) || (this.type == 0xa4))
                            {
                                this.ai[0]++;
                                if (this.ai[0] > 3f)
                                {
                                    this.Kill();
                                }
                            }
                            if (((this.type == 0x25) || (this.type == 0x18d)) || ((this.type == 470) || (this.type == 0x207)))
                            {
                                try
                                {
                                    int num231 = ((int)(this.position.X / 16f)) - 1;
                                    int num232 = ((int)((this.position.X + base.width) / 16f)) + 2;
                                    int num233 = ((int)(this.position.Y / 16f)) - 1;
                                    int num234 = ((int)((this.position.Y + base.height) / 16f)) + 2;
                                    if (num231 < 0)
                                    {
                                        num231 = 0;
                                    }
                                    if (num232 > Main.maxTilesX)
                                    {
                                        num232 = Main.maxTilesX;
                                    }
                                    if (num233 < 0)
                                    {
                                        num233 = 0;
                                    }
                                    if (num234 > Main.maxTilesY)
                                    {
                                        num234 = Main.maxTilesY;
                                    }
                                    for (int num235 = num231; num235 < num232; num235++)
                                    {
                                        for (int num236 = num233; num236 < num234; num236++)
                                        {
                                            if (((Main.tile[num235, num236] != null) && Main.tile[num235, num236].nactive()) && (Main.tileSolid[Main.tile[num235, num236].type] || (Main.tileSolidTop[Main.tile[num235, num236].type] && (Main.tile[num235, num236].frameY == 0))))
                                            {
                                                Vector2 vector30;
                                                vector30.X = num235 * 0x10;
                                                vector30.Y = num236 * 0x10;
                                                if (((((this.position.X + base.width) - 4f) > vector30.X) && ((this.position.X + 4f) < (vector30.X + 16f))) && ((((this.position.Y + base.height) - 4f) > vector30.Y) && ((this.position.Y + 4f) < (vector30.Y + 16f))))
                                                {
                                                    this.velocity.X = 0f;
                                                    this.velocity.Y = -0.2f;
                                                }
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                            }
                            if (this.type == 0x207)
                            {
                                this.localAI[1]++;
                                float num237 = 180f - this.localAI[1];
                                if (num237 < 0f)
                                {
                                    num237 = 0f;
                                }
                                this.frameCounter++;
                                if (num237 < 15f)
                                {
                                    this.frameCounter++;
                                }
                                if (this.frameCounter >= (((num237 / 10f) + 6f) / 2f))
                                {
                                    this.frame++;
                                    this.frameCounter = 0;
                                    if (this.frame >= Main.projFrames[this.type])
                                    {
                                        this.frame = 0;
                                    }
                                }
                            }
                            if (this.type == 0x66)
                            {
                                if (this.velocity.Y > 10f)
                                {
                                    this.velocity.Y = 10f;
                                }
                                if (this.localAI[0] == 0f)
                                {
                                    this.localAI[0] = 1f;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10);
                                }
                                this.frameCounter++;
                                if (this.frameCounter > 3)
                                {
                                    this.frame++;
                                    this.frameCounter = 0;
                                }
                                if (this.frame > 1)
                                {
                                    this.frame = 0;
                                }
                                if (this.velocity.Y == 0f)
                                {
                                    this.position.X += base.width / 2;
                                    this.position.Y += base.height / 2;
                                    base.width = 0x80;
                                    base.height = 0x80;
                                    this.position.X -= base.width / 2;
                                    this.position.Y -= base.height / 2;
                                    this.damage = 40;
                                    this.knockBack = 8f;
                                    this.timeLeft = 3;
                                    this.netUpdate = true;
                                }
                            }
                            if (((this.type == 0x12f) && (this.timeLeft <= 3)) && this.hostile)
                            {
                                this.position.X += base.width / 2;
                                this.position.Y += base.height / 2;
                                base.width = 0x80;
                                base.height = 0x80;
                                this.position.X -= base.width / 2;
                                this.position.Y -= base.height / 2;
                            }
                            if ((this.owner == Main.myPlayer) && (this.timeLeft <= 3))
                            {
                                this.tileCollide = false;
                                this.ai[1] = 0f;
                                this.alpha = 0xff;
                                if (((this.type == 0x1c) || (this.type == 0x25)) || (((this.type == 0x4b) || (this.type == 0x204)) || (this.type == 0x207)))
                                {
                                    this.position.X += base.width / 2;
                                    this.position.Y += base.height / 2;
                                    base.width = 0x80;
                                    base.height = 0x80;
                                    this.position.X -= base.width / 2;
                                    this.position.Y -= base.height / 2;
                                    this.damage = 100;
                                    this.knockBack = 8f;
                                }
                                else if (((this.type == 0x1d) || (this.type == 470)) || (this.type == 0x27d))
                                {
                                    this.position.X += base.width / 2;
                                    this.position.Y += base.height / 2;
                                    base.width = 250;
                                    base.height = 250;
                                    this.position.X -= base.width / 2;
                                    this.position.Y -= base.height / 2;
                                    this.damage = 250;
                                    this.knockBack = 10f;
                                }
                                else if (((this.type == 30) || (this.type == 0x18d)) || ((this.type == 0x205) || (this.type == 0x24c)))
                                {
                                    this.position.X += base.width / 2;
                                    this.position.Y += base.height / 2;
                                    base.width = 0x80;
                                    base.height = 0x80;
                                    this.position.X -= base.width / 2;
                                    this.position.Y -= base.height / 2;
                                    this.knockBack = 8f;
                                }
                                else if ((((this.type == 0x85) || (this.type == 0x86)) || ((this.type == 0x87) || (this.type == 0x88))) || (((this.type == 0x89) || (this.type == 0x8a)) || ((this.type == 0x152) || (this.type == 0x153))))
                                {
                                    this.position.X += base.width / 2;
                                    this.position.Y += base.height / 2;
                                    base.width = 0x80;
                                    base.height = 0x80;
                                    this.position.X -= base.width / 2;
                                    this.position.Y -= base.height / 2;
                                    this.knockBack = 8f;
                                }
                                else if ((((this.type == 0x8b) || (this.type == 140)) || ((this.type == 0x8d) || (this.type == 0x8e))) || (((this.type == 0x8f) || (this.type == 0x90)) || ((this.type == 340) || (this.type == 0x155))))
                                {
                                    this.position.X += base.width / 2;
                                    this.position.Y += base.height / 2;
                                    base.width = 200;
                                    base.height = 200;
                                    this.position.X -= base.width / 2;
                                    this.position.Y -= base.height / 2;
                                    this.knockBack = 10f;
                                }
                            }
                            else
                            {
                                if ((((((this.type != 30) && (this.type != 0x205)) && ((this.type != 0x24c) && (this.type != 0x18d))) && (((this.type != 0x6c) && (this.type != 0x85)) && ((this.type != 0x86) && (this.type != 0x87)))) && ((((this.type != 0x88) && (this.type != 0x89)) && ((this.type != 0x8a) && (this.type != 0x8b))) && (((this.type != 140) && (this.type != 0x8d)) && ((this.type != 0x8e) && (this.type != 0x8f))))) && ((((this.type != 0x90) && (this.type != 0xa4)) && ((this.type != 0x12f) && (this.type < 0x152))) && (this.type < 0x155)))
                                {
                                    this.damage = 0;
                                }
                                if (((this.type == 0x152) || (this.type == 0x153)) || ((this.type == 340) || (this.type == 0x155)))
                                {
                                    this.localAI[1]++;
                                    if (this.localAI[1] > 6f)
                                    {
                                        this.alpha = 0;
                                    }
                                    else
                                    {
                                        this.alpha = ((int)(255f - (42f * this.localAI[1]))) + 100;
                                        if (this.alpha > 0xff)
                                        {
                                            this.alpha = 0xff;
                                        }
                                    }
                                    for (int num238 = 0; num238 < 2; num238++)
                                    {
                                        float num239 = 0f;
                                        float num240 = 0f;
                                        if (num238 == 1)
                                        {
                                            num239 = this.velocity.X * 0.5f;
                                            num240 = this.velocity.Y * 0.5f;
                                        }
                                        if (this.localAI[1] > 9f)
                                        {
                                            if (Main.rand.Next(2) == 0)
                                            {
                                                color5 = new Color();
                                                int num241 = Dust.NewDust(new Vector2((this.position.X + 3f) + num239, (this.position.Y + 3f) + num240) - ((Vector2)(base.velocity * 0.5f)), base.width - 8, base.height - 8, 6, 0f, 0f, 100, color5, 1f);
                                                Dust dust96 = Main.dust[num241];
                                                dust96.scale *= 1.4f + (Main.rand.Next(10) * 0.1f);
                                                Dust dust97 = Main.dust[num241];
                                                dust97.velocity = (Vector2)(dust97.velocity * 0.2f);
                                                Main.dust[num241].noGravity = true;
                                            }
                                            if (Main.rand.Next(2) == 0)
                                            {
                                                color5 = new Color();
                                                int num242 = Dust.NewDust(new Vector2((this.position.X + 3f) + num239, (this.position.Y + 3f) + num240) - ((Vector2)(base.velocity * 0.5f)), base.width - 8, base.height - 8, 0x1f, 0f, 0f, 100, color5, 0.5f);
                                                Main.dust[num242].fadeIn = 0.5f + (Main.rand.Next(5) * 0.1f);
                                                Dust dust98 = Main.dust[num242];
                                                dust98.velocity = (Vector2)(dust98.velocity * 0.05f);
                                            }
                                        }
                                    }
                                    float num243 = this.position.X;
                                    float num244 = this.position.Y;
                                    float num245 = 600f;
                                    bool flag5 = false;
                                    this.ai[0]++;
                                    if (this.ai[0] > 30f)
                                    {
                                        this.ai[0] = 30f;
                                        for (int num246 = 0; num246 < 200; num246++)
                                        {
                                            if (Main.npc[num246].CanBeChasedBy(this, false))
                                            {
                                                float num247 = Main.npc[num246].position.X + (Main.npc[num246].width / 2);
                                                float num248 = Main.npc[num246].position.Y + (Main.npc[num246].height / 2);
                                                float introduced1662 = Math.Abs((float)((this.position.X + (base.width / 2)) - num247));
                                                float num249 = introduced1662 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num248));
                                                if ((num249 < num245) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num246].position, Main.npc[num246].width, Main.npc[num246].height))
                                                {
                                                    num245 = num249;
                                                    num243 = num247;
                                                    num244 = num248;
                                                    flag5 = true;
                                                }
                                            }
                                        }
                                    }
                                    if (!flag5)
                                    {
                                        num243 = (this.position.X + (base.width / 2)) + (this.velocity.X * 100f);
                                        num244 = (this.position.Y + (base.height / 2)) + (this.velocity.Y * 100f);
                                    }
                                    float num250 = 16f;
                                    Vector2 vector31 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                    float num251 = num243 - vector31.X;
                                    float num252 = num244 - vector31.Y;
                                    float num253 = (float)Math.Sqrt((double)((num251 * num251) + (num252 * num252)));
                                    num253 = num250 / num253;
                                    num251 *= num253;
                                    num252 *= num253;
                                    this.velocity.X = ((this.velocity.X * 11f) + num251) / 12f;
                                    this.velocity.Y = ((this.velocity.Y * 11f) + num252) / 12f;
                                }
                                else if (((this.type == 0x86) || (this.type == 0x89)) || (((this.type == 140) || (this.type == 0x8f)) || (this.type == 0x12f)))
                                {
                                    if ((Math.Abs(this.velocity.X) >= 8f) || (Math.Abs(this.velocity.Y) >= 8f))
                                    {
                                        for (int num254 = 0; num254 < 2; num254++)
                                        {
                                            float num255 = 0f;
                                            float num256 = 0f;
                                            if (num254 == 1)
                                            {
                                                num255 = this.velocity.X * 0.5f;
                                                num256 = this.velocity.Y * 0.5f;
                                            }
                                            color5 = new Color();
                                            int num257 = Dust.NewDust(new Vector2((this.position.X + 3f) + num255, (this.position.Y + 3f) + num256) - ((Vector2)(base.velocity * 0.5f)), base.width - 8, base.height - 8, 6, 0f, 0f, 100, color5, 1f);
                                            Dust dust99 = Main.dust[num257];
                                            dust99.scale *= 2f + (Main.rand.Next(10) * 0.1f);
                                            Dust dust100 = Main.dust[num257];
                                            dust100.velocity = (Vector2)(dust100.velocity * 0.2f);
                                            Main.dust[num257].noGravity = true;
                                            color5 = new Color();
                                            num257 = Dust.NewDust(new Vector2((this.position.X + 3f) + num255, (this.position.Y + 3f) + num256) - ((Vector2)(base.velocity * 0.5f)), base.width - 8, base.height - 8, 0x1f, 0f, 0f, 100, color5, 0.5f);
                                            Main.dust[num257].fadeIn = 1f + (Main.rand.Next(5) * 0.1f);
                                            Dust dust101 = Main.dust[num257];
                                            dust101.velocity = (Vector2)(dust101.velocity * 0.05f);
                                        }
                                    }
                                    if ((Math.Abs(this.velocity.X) < 15f) && (Math.Abs(this.velocity.Y) < 15f))
                                    {
                                        base.velocity = (Vector2)(base.velocity * 1.1f);
                                    }
                                }
                                else if (((this.type == 0x85) || (this.type == 0x88)) || ((this.type == 0x8b) || (this.type == 0x8e)))
                                {
                                    int num258 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, new Color(), 1f);
                                    Dust dust102 = Main.dust[num258];
                                    dust102.scale *= 1f + (Main.rand.Next(10) * 0.1f);
                                    Dust dust103 = Main.dust[num258];
                                    dust103.velocity = (Vector2)(dust103.velocity * 0.2f);
                                    Main.dust[num258].noGravity = true;
                                }
                                else if (((this.type == 0x87) || (this.type == 0x8a)) || ((this.type == 0x8d) || (this.type == 0x90)))
                                {
                                    if (((this.velocity.X > -0.2) && (this.velocity.X < 0.2)) && ((this.velocity.Y > -0.2) && (this.velocity.Y < 0.2)))
                                    {
                                        this.alpha += 2;
                                        if (this.alpha > 200)
                                        {
                                            this.alpha = 200;
                                        }
                                    }
                                    else
                                    {
                                        this.alpha = 0;
                                        int num259 = Dust.NewDust(new Vector2(this.position.X + 3f, this.position.Y + 3f) - ((Vector2)(base.velocity * 0.5f)), base.width - 8, base.height - 8, 0x1f, 0f, 0f, 100, new Color(), 1f);
                                        Dust dust104 = Main.dust[num259];
                                        dust104.scale *= 1.6f + (Main.rand.Next(5) * 0.1f);
                                        Dust dust105 = Main.dust[num259];
                                        dust105.velocity = (Vector2)(dust105.velocity * 0.05f);
                                        Main.dust[num259].noGravity = true;
                                    }
                                }
                                else if ((((this.type != 30) && (this.type != 0x205)) && ((this.type != 0x18d) && (this.type != 0x207))) && ((this.type != 0x24c) && (Main.rand.Next(2) == 0)))
                                {
                                    color5 = new Color();
                                    int num260 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1f);
                                    Main.dust[num260].scale = 0.1f + (Main.rand.Next(5) * 0.1f);
                                    Main.dust[num260].fadeIn = 1.5f + (Main.rand.Next(5) * 0.1f);
                                    Main.dust[num260].noGravity = true;
                                    vector240 = new Vector2();
                                    Main.dust[num260].position = base.Center + ((Vector2)(new Vector2(0f, (float)(-base.height / 2)).RotatedBy(((double)this.rotation), vector240) * 1.1f));
                                    Main.rand.Next(2);
                                    num260 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, new Color(), 1f);
                                    Main.dust[num260].scale = 1f + (Main.rand.Next(5) * 0.1f);
                                    Main.dust[num260].noGravity = true;
                                    Main.dust[num260].position = base.Center + ((Vector2)(new Vector2(0f, (float)((-base.height / 2) - 6)).RotatedBy(((double)this.rotation), new Vector2()) * 1.1f));
                                }
                            }
                            this.ai[0]++;
                            if (((this.type == 0x152) || (this.type == 0x153)) || ((this.type == 340) || (this.type == 0x155)))
                            {
                                if (this.velocity.X < 0f)
                                {
                                    this.spriteDirection = -1;
                                    this.rotation = ((float)Math.Atan2((double)-this.velocity.Y, (double)-this.velocity.X)) - 1.57f;
                                }
                                else
                                {
                                    this.spriteDirection = 1;
                                    this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                                }
                            }
                            else if (((this.type == 0x86) || (this.type == 0x89)) || (((this.type == 140) || (this.type == 0x8f)) || (this.type == 0x12f)))
                            {
                                this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                            }
                            else if (((this.type == 0x87) || (this.type == 0x8a)) || ((this.type == 0x8d) || (this.type == 0x90)))
                            {
                                this.velocity.Y += 0.2f;
                                base.velocity = (Vector2)(base.velocity * 0.97f);
                                if ((this.velocity.X > -0.1) && (this.velocity.X < 0.1))
                                {
                                    this.velocity.X = 0f;
                                }
                                if ((this.velocity.Y > -0.1) && (this.velocity.Y < 0.1))
                                {
                                    this.velocity.Y = 0f;
                                }
                            }
                            else if (((this.type == 0x85) || (this.type == 0x88)) || ((this.type == 0x8b) || (this.type == 0x8e)))
                            {
                                if (this.ai[0] > 15f)
                                {
                                    if (this.velocity.Y == 0f)
                                    {
                                        this.velocity.X *= 0.95f;
                                    }
                                    this.velocity.Y += 0.2f;
                                }
                            }
                            else if (((((this.type == 30) || (this.type == 0x18d)) || ((this.type == 0x205) || (this.type == 0x24c))) && (this.ai[0] > 10f)) || ((((this.type != 30) && (this.type != 0x18d)) && ((this.type != 0x205) && (this.type != 0x24c))) && (this.ai[0] > 5f)))
                            {
                                this.ai[0] = 10f;
                                if ((this.velocity.Y == 0f) && (this.velocity.X != 0f))
                                {
                                    this.velocity.X *= 0.97f;
                                    if (((this.type == 0x1d) || (this.type == 470)) || (this.type == 0x27d))
                                    {
                                        this.velocity.X *= 0.99f;
                                    }
                                    if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01))
                                    {
                                        this.velocity.X = 0f;
                                        this.netUpdate = true;
                                    }
                                }
                                this.velocity.Y += 0.2f;
                            }
                            if (this.type == 0x207)
                            {
                                this.rotation += this.velocity.X * 0.06f;
                                return;
                            }
                            if ((((this.type != 0x86) && (this.type != 0x89)) && ((this.type != 140) && (this.type != 0x8f))) && ((this.type != 0x12f) && ((this.type < 0x152) || (this.type > 0x155))))
                            {
                                this.rotation += this.velocity.X * 0.1f;
                                return;
                            }
                            return;
                        }
                        if (this.aiStyle == 0x11)
                        {
                            if (this.velocity.Y == 0f)
                            {
                                this.velocity.X *= 0.98f;
                            }
                            this.rotation += this.velocity.X * 0.1f;
                            this.velocity.Y += 0.2f;
                            if (this.owner == Main.myPlayer)
                            {
                                int num261 = (int)((this.position.X + (base.width / 2)) / 16f);
                                int num262 = (int)(((this.position.Y + base.height) - 4f) / 16f);
                                if ((Main.tile[num261, num262] != null) && !Main.tile[num261, num262].active())
                                {
                                    int style = 0;
                                    if ((this.type >= 0xc9) && (this.type <= 0xcd))
                                    {
                                        style = this.type - 200;
                                    }
                                    if ((this.type >= 0x20f) && (this.type <= 0x213))
                                    {
                                        style = (this.type - 0x20f) + 6;
                                    }
                                    WorldGen.PlaceTile(num261, num262, 0x55, false, false, this.owner, style);
                                    if (Main.tile[num261, num262].active())
                                    {
                                        if (Main.netMode != 0)
                                        {
                                            NetMessage.SendData(0x11, -1, -1, "", 1, (float)num261, (float)num262, 85f, style, 0, 0);
                                        }
                                        int num264 = Sign.ReadSign(num261, num262, true);
                                        if (num264 >= 0)
                                        {
                                            Sign.TextSign(num264, this.miscText);
                                        }
                                        this.Kill();
                                        return;
                                    }
                                }
                            }
                            return;
                        }
                        if (this.aiStyle == 0x12)
                        {
                            if ((this.ai[1] == 0f) && (this.type == 0x2c))
                            {
                                this.ai[1] = 1f;
                                Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
                            }
                            if ((this.type == 0x107) || (this.type == 0x112))
                            {
                                if ((this.type == 0x112) && (this.velocity.X < 0f))
                                {
                                    this.spriteDirection = -1;
                                }
                                this.rotation += base.direction * 0.05f;
                                this.rotation += (base.direction * 0.5f) * (((float)this.timeLeft) / 180f);
                                if (this.type == 0x112)
                                {
                                    base.velocity = (Vector2)(base.velocity * 0.96f);
                                    return;
                                }
                                base.velocity = (Vector2)(base.velocity * 0.95f);
                                return;
                            }
                            this.rotation += base.direction * 0.8f;
                            this.ai[0]++;
                            if (this.ai[0] >= 30f)
                            {
                                if (this.ai[0] < 100f)
                                {
                                    base.velocity = (Vector2)(base.velocity * 1.06f);
                                }
                                else
                                {
                                    this.ai[0] = 200f;
                                }
                            }
                            for (int num265 = 0; num265 < 2; num265++)
                            {
                                color5 = new Color();
                                int num266 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1b, 0f, 0f, 100, color5, 1f);
                                Main.dust[num266].noGravity = true;
                            }
                            return;
                        }
                        if (this.aiStyle == 0x13)
                        {
                            Vector2 vector32 = Main.player[this.owner].RotatedRelativePoint(Main.player[this.owner].MountedCenter, true);
                            base.direction = Main.player[this.owner].direction;
                            Main.player[this.owner].heldProj = base.whoAmI;
                            Main.player[this.owner].itemTime = Main.player[this.owner].itemAnimation;
                            this.position.X = vector32.X - (base.width / 2);
                            this.position.Y = vector32.Y - (base.height / 2);
                            if (!Main.player[this.owner].frozen)
                            {
                                if (this.type == 0x2e)
                                {
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 3f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 1.6f;
                                    }
                                    else
                                    {
                                        this.ai[0] += 1.4f;
                                    }
                                }
                                else if (this.type == 0x69)
                                {
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 3f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 2.4f;
                                    }
                                    else
                                    {
                                        this.ai[0] += 2.1f;
                                    }
                                }
                                else if (this.type == 0x16f)
                                {
                                    this.spriteDirection = -base.direction;
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 3f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 1.6f;
                                    }
                                    else
                                    {
                                        this.ai[0] += 1.5f;
                                    }
                                }
                                else if (this.type == 0x170)
                                {
                                    this.spriteDirection = -base.direction;
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 3f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 1.5f;
                                    }
                                    else
                                    {
                                        this.ai[0] += 1.4f;
                                    }
                                }
                                else if (this.type == 0xde)
                                {
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 3f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 2.4f;
                                        if ((this.localAI[0] == 0f) && (Main.myPlayer == this.owner))
                                        {
                                            this.localAI[0] = 1f;
                                            NewProjectile(base.Center.X + (this.velocity.X * this.ai[0]), base.Center.Y + (this.velocity.Y * this.ai[0]), this.velocity.X, this.velocity.Y, 0xe4, this.damage, this.knockBack, this.owner, 0f, 0f);
                                        }
                                    }
                                    else
                                    {
                                        this.ai[0] += 2.1f;
                                    }
                                }
                                else if (this.type == 0x156)
                                {
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 3f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 2.4f;
                                        if ((this.localAI[0] == 0f) && (Main.myPlayer == this.owner))
                                        {
                                            this.localAI[0] = 1f;
                                            if (Collision.CanHit(Main.player[this.owner].position, Main.player[this.owner].width, Main.player[this.owner].height, new Vector2(base.Center.X + (this.velocity.X * this.ai[0]), base.Center.Y + (this.velocity.Y * this.ai[0])), base.width, base.height))
                                            {
                                                NewProjectile(base.Center.X + (this.velocity.X * this.ai[0]), base.Center.Y + (this.velocity.Y * this.ai[0]), this.velocity.X * 2.4f, this.velocity.Y * 2.4f, 0x157, (int)(this.damage * 0.8), this.knockBack * 0.85f, this.owner, 0f, 0f);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        this.ai[0] += 2.1f;
                                    }
                                }
                                else if (this.type == 0x2f)
                                {
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 4f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 1.2f;
                                    }
                                    else
                                    {
                                        this.ai[0] += 0.9f;
                                    }
                                }
                                else if (this.type == 0x99)
                                {
                                    this.spriteDirection = -base.direction;
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 4f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 1.5f;
                                    }
                                    else
                                    {
                                        this.ai[0] += 1.3f;
                                    }
                                }
                                else if (this.type == 0x31)
                                {
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 4f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 1.1f;
                                    }
                                    else
                                    {
                                        this.ai[0] += 0.85f;
                                    }
                                }
                                else if ((this.type == 0x40) || (this.type == 0xd7))
                                {
                                    this.spriteDirection = -base.direction;
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 3f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 1.9f;
                                    }
                                    else
                                    {
                                        this.ai[0] += 1.7f;
                                    }
                                }
                                else if (((this.type == 0x42) || (this.type == 0x61)) || ((this.type == 0xd4) || (this.type == 0xda)))
                                {
                                    this.spriteDirection = -base.direction;
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 3f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 2.1f;
                                    }
                                    else
                                    {
                                        this.ai[0] += 1.9f;
                                    }
                                }
                                else if (this.type == 130)
                                {
                                    this.spriteDirection = -base.direction;
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = 3f;
                                        this.netUpdate = true;
                                    }
                                    if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3))
                                    {
                                        this.ai[0] -= 1.3f;
                                    }
                                    else
                                    {
                                        this.ai[0]++;
                                    }
                                }
                            }
                            base.position += (Vector2)(base.velocity * this.ai[0]);
                            if (this.type == 130)
                            {
                                if ((((this.ai[1] == 0f) || (this.ai[1] == 4f)) || ((this.ai[1] == 8f) || (this.ai[1] == 12f))) || (((this.ai[1] == 16f) || (this.ai[1] == 20f)) || (this.ai[1] == 24f)))
                                {
                                    NewProjectile(this.position.X + (base.width / 2), this.position.Y + (base.height / 2), this.velocity.X, this.velocity.Y, 0x83, this.damage / 3, 0f, this.owner, 0f, 0f);
                                }
                                this.ai[1]++;
                            }
                            if (Main.player[this.owner].itemAnimation == 0)
                            {
                                this.Kill();
                            }
                            this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 2.355f;
                            if (this.spriteDirection == -1)
                            {
                                this.rotation -= 1.57f;
                            }
                            if (this.type == 0x2e)
                            {
                                if (Main.rand.Next(5) == 0)
                                {
                                    color5 = new Color();
                                    Dust.NewDust(base.position, base.width, base.height, 14, 0f, 0f, 150, color5, 1.4f);
                                }
                                color5 = new Color();
                                int num267 = Dust.NewDust(base.position, base.width, base.height, 0x1b, (this.velocity.X * 0.2f) + (base.direction * 3), this.velocity.Y * 0.2f, 100, color5, 1.2f);
                                Main.dust[num267].noGravity = true;
                                Main.dust[num267].velocity.X /= 2f;
                                Main.dust[num267].velocity.Y /= 2f;
                                num267 = Dust.NewDust(base.position - ((Vector2)(base.velocity * 2f)), base.width, base.height, 0x1b, 0f, 0f, 150, new Color(), 1.4f);
                                Main.dust[num267].velocity.X /= 5f;
                                Main.dust[num267].velocity.Y /= 5f;
                                return;
                            }
                            if (this.type != 0x69)
                            {
                                if (this.type == 0x99)
                                {
                                    int num270 = Dust.NewDust(base.position - ((Vector2)(base.velocity * 3f)), base.width, base.height, 0x73, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 140, new Color(), 1f);
                                    Main.dust[num270].noGravity = true;
                                    Main.dust[num270].fadeIn = 1.25f;
                                    Dust dust110 = Main.dust[num270];
                                    dust110.velocity = (Vector2)(dust110.velocity * 0.25f);
                                    return;
                                }
                            }
                            else
                            {
                                if (Main.rand.Next(3) == 0)
                                {
                                    color5 = new Color();
                                    int num268 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x39, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 200, color5, 1.2f);
                                    Dust dust106 = Main.dust[num268];
                                    dust106.velocity += (Vector2)(base.velocity * 0.3f);
                                    Dust dust107 = Main.dust[num268];
                                    dust107.velocity = (Vector2)(dust107.velocity * 0.2f);
                                }
                                if (Main.rand.Next(4) == 0)
                                {
                                    int num269 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x2b, 0f, 0f, 0xfe, new Color(), 0.3f);
                                    Dust dust108 = Main.dust[num269];
                                    dust108.velocity += (Vector2)(base.velocity * 0.5f);
                                    Dust dust109 = Main.dust[num269];
                                    dust109.velocity = (Vector2)(dust109.velocity * 0.5f);
                                    return;
                                }
                            }
                            return;
                        }
                        if (this.aiStyle == 20)
                        {
                            if (this.type == 0xfc)
                            {
                                this.frameCounter++;
                                if (this.frameCounter >= 4)
                                {
                                    this.frameCounter = 0;
                                    this.frame++;
                                }
                                if (this.frame > 3)
                                {
                                    this.frame = 0;
                                }
                            }
                            if (this.type == 0x1fd)
                            {
                                this.frameCounter++;
                                if (this.frameCounter >= 2)
                                {
                                    this.frameCounter = 0;
                                    this.frame++;
                                }
                                if (this.frame > 1)
                                {
                                    this.frame = 0;
                                }
                            }
                            if (this.soundDelay <= 0)
                            {
                                Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x16);
                                this.soundDelay = 30;
                            }
                            Vector2 vector33 = Main.player[this.owner].RotatedRelativePoint(Main.player[this.owner].MountedCenter, true);
                            if (Main.myPlayer == this.owner)
                            {
                                if (Main.player[this.owner].channel)
                                {
                                    float num271 = Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].shootSpeed * this.scale;
                                    Vector2 vector34 = vector33;
                                    float num272 = (Main.mouseX + Main.screenPosition.X) - vector34.X;
                                    float num273 = (Main.mouseY + Main.screenPosition.Y) - vector34.Y;
                                    if (Main.player[this.owner].gravDir == -1f)
                                    {
                                        num273 = ((Main.screenHeight - Main.mouseY) + Main.screenPosition.Y) - vector34.Y;
                                    }
                                    float num274 = (float)Math.Sqrt((double)((num272 * num272) + (num273 * num273)));
                                    num274 = (float)Math.Sqrt((double)((num272 * num272) + (num273 * num273)));
                                    num274 = num271 / num274;
                                    num272 *= num274;
                                    num273 *= num274;
                                    if ((num272 != this.velocity.X) || (num273 != this.velocity.Y))
                                    {
                                        this.netUpdate = true;
                                    }
                                    this.velocity.X = num272;
                                    this.velocity.Y = num273;
                                }
                                else
                                {
                                    this.Kill();
                                }
                            }
                            if (this.velocity.X > 0f)
                            {
                                Main.player[this.owner].ChangeDir(1);
                            }
                            else if (this.velocity.X < 0f)
                            {
                                Main.player[this.owner].ChangeDir(-1);
                            }
                            this.spriteDirection = base.direction;
                            Main.player[this.owner].ChangeDir(base.direction);
                            Main.player[this.owner].heldProj = base.whoAmI;
                            Main.player[this.owner].itemTime = 2;
                            Main.player[this.owner].itemAnimation = 2;
                            this.position.X = vector33.X - (base.width / 2);
                            this.position.Y = vector33.Y - (base.height / 2);
                            this.rotation = (float)(Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.5700000524520874);
                            if (Main.player[this.owner].direction == 1)
                            {
                                Main.player[this.owner].itemRotation = (float)Math.Atan2((double)(this.velocity.Y * base.direction), (double)(this.velocity.X * base.direction));
                            }
                            else
                            {
                                Main.player[this.owner].itemRotation = (float)Math.Atan2((double)(this.velocity.Y * base.direction), (double)(this.velocity.X * base.direction));
                            }
                            this.velocity.X *= 1f + (Main.rand.Next(-3, 4) * 0.01f);
                            if (Main.rand.Next(6) == 0)
                            {
                                int num275 = Dust.NewDust(base.position + ((Vector2)((base.velocity * Main.rand.Next(6, 10)) * 0.1f)), base.width, base.height, 0x1f, 0f, 0f, 80, new Color(), 1.4f);
                                Main.dust[num275].position.X -= 4f;
                                Main.dust[num275].noGravity = true;
                                Dust dust111 = Main.dust[num275];
                                dust111.velocity = (Vector2)(dust111.velocity * 0.2f);
                                Main.dust[num275].velocity.Y = -Main.rand.Next(7, 13) * 0.15f;
                                return;
                            }
                            return;
                        }
                        if (this.aiStyle == 0x15)
                        {
                            this.rotation = this.velocity.X * 0.1f;
                            this.spriteDirection = -base.direction;
                            if (Main.rand.Next(3) == 0)
                            {
                                int num276 = Dust.NewDust(base.position, base.width, base.height, 0x1b, 0f, 0f, 80, new Color(), 1f);
                                Main.dust[num276].noGravity = true;
                                Dust dust112 = Main.dust[num276];
                                dust112.velocity = (Vector2)(dust112.velocity * 0.2f);
                            }
                            if (this.ai[1] == 1f)
                            {
                                this.ai[1] = 0f;
                                Main.harpNote = this.ai[0];
                                Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x1a);
                                return;
                            }
                            return;
                        }
                        if (this.aiStyle == 0x16)
                        {
                            if ((this.velocity.X == 0f) && (this.velocity.Y == 0f))
                            {
                                this.alpha = 0xff;
                            }
                            if (this.ai[1] < 0f)
                            {
                                if (this.velocity.X > 0f)
                                {
                                    this.rotation += 0.3f;
                                }
                                else
                                {
                                    this.rotation -= 0.3f;
                                }
                                int num277 = ((int)(this.position.X / 16f)) - 1;
                                int num278 = ((int)((this.position.X + base.width) / 16f)) + 2;
                                int num279 = ((int)(this.position.Y / 16f)) - 1;
                                int num280 = ((int)((this.position.Y + base.height) / 16f)) + 2;
                                if (num277 < 0)
                                {
                                    num277 = 0;
                                }
                                if (num278 > Main.maxTilesX)
                                {
                                    num278 = Main.maxTilesX;
                                }
                                if (num279 < 0)
                                {
                                    num279 = 0;
                                }
                                if (num280 > Main.maxTilesY)
                                {
                                    num280 = Main.maxTilesY;
                                }
                                int num281 = ((int)this.position.X) + 4;
                                int num282 = ((int)this.position.Y) + 4;
                                for (int num283 = num277; num283 < num278; num283++)
                                {
                                    for (int num284 = num279; num284 < num280; num284++)
                                    {
                                        if ((((Main.tile[num283, num284] != null) && Main.tile[num283, num284].active()) && ((Main.tile[num283, num284].type != 0x7f) && Main.tileSolid[Main.tile[num283, num284].type])) && !Main.tileSolidTop[Main.tile[num283, num284].type])
                                        {
                                            Vector2 vector35;
                                            vector35.X = num283 * 0x10;
                                            vector35.Y = num284 * 0x10;
                                            if ((((num281 + 8) > vector35.X) && (num281 < (vector35.X + 16f))) && (((num282 + 8) > vector35.Y) && (num282 < (vector35.Y + 16f))))
                                            {
                                                this.Kill();
                                            }
                                        }
                                    }
                                }
                                int num285 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x43, 0f, 0f, 0, new Color(), 1f);
                                Main.dust[num285].noGravity = true;
                                Dust dust113 = Main.dust[num285];
                                dust113.velocity = (Vector2)(dust113.velocity * 0.3f);
                                return;
                            }
                            if (this.ai[0] >= 0f)
                            {
                                int num291 = ((int)(this.position.X / 16f)) - 1;
                                int num292 = ((int)((this.position.X + base.width) / 16f)) + 2;
                                int num293 = ((int)(this.position.Y / 16f)) - 1;
                                int num294 = ((int)((this.position.Y + base.height) / 16f)) + 2;
                                if (num291 < 0)
                                {
                                    num291 = 0;
                                }
                                if (num292 > Main.maxTilesX)
                                {
                                    num292 = Main.maxTilesX;
                                }
                                if (num293 < 0)
                                {
                                    num293 = 0;
                                }
                                if (num294 > Main.maxTilesY)
                                {
                                    num294 = Main.maxTilesY;
                                }
                                int num295 = ((int)this.position.X) + 4;
                                int num296 = ((int)this.position.Y) + 4;
                                for (int num297 = num291; num297 < num292; num297++)
                                {
                                    for (int num298 = num293; num298 < num294; num298++)
                                    {
                                        if ((((Main.tile[num297, num298] != null) && Main.tile[num297, num298].nactive()) && ((Main.tile[num297, num298].type != 0x7f) && Main.tileSolid[Main.tile[num297, num298].type])) && !Main.tileSolidTop[Main.tile[num297, num298].type])
                                        {
                                            Vector2 vector36;
                                            vector36.X = num297 * 0x10;
                                            vector36.Y = num298 * 0x10;
                                            if ((((num295 + 8) > vector36.X) && (num295 < (vector36.X + 16f))) && (((num296 + 8) > vector36.Y) && (num296 < (vector36.Y + 16f))))
                                            {
                                                this.Kill();
                                            }
                                        }
                                    }
                                }
                                if (base.lavaWet)
                                {
                                    this.Kill();
                                }
                                if (base.active)
                                {
                                    int num299 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x43, 0f, 0f, 0, new Color(), 1f);
                                    Main.dust[num299].noGravity = true;
                                    Dust dust116 = Main.dust[num299];
                                    dust116.velocity = (Vector2)(dust116.velocity * 0.3f);
                                    int num300 = (int)this.ai[0];
                                    int num301 = (int)this.ai[1];
                                    if (WorldGen.SolidTile(num300, num301))
                                    {
                                        float introduced1681 = Math.Abs(this.velocity.X);
                                        if (introduced1681 > Math.Abs(this.velocity.Y))
                                        {
                                            if ((base.Center.Y < ((num301 * 0x10) + 8)) && !WorldGen.SolidTile(num300, num301 - 1))
                                            {
                                                num301--;
                                            }
                                            else if (!WorldGen.SolidTile(num300, num301 + 1))
                                            {
                                                num301++;
                                            }
                                            else if (!WorldGen.SolidTile(num300, num301 - 1))
                                            {
                                                num301--;
                                            }
                                            else if ((base.Center.X < ((num300 * 0x10) + 8)) && !WorldGen.SolidTile(num300 - 1, num301))
                                            {
                                                num300--;
                                            }
                                            else if (!WorldGen.SolidTile(num300 + 1, num301))
                                            {
                                                num300++;
                                            }
                                            else if (!WorldGen.SolidTile(num300 - 1, num301))
                                            {
                                                num300--;
                                            }
                                        }
                                        else if ((base.Center.X < ((num300 * 0x10) + 8)) && !WorldGen.SolidTile(num300 - 1, num301))
                                        {
                                            num300--;
                                        }
                                        else if (!WorldGen.SolidTile(num300 + 1, num301))
                                        {
                                            num300++;
                                        }
                                        else if (!WorldGen.SolidTile(num300 - 1, num301))
                                        {
                                            num300--;
                                        }
                                        else if ((base.Center.Y < ((num301 * 0x10) + 8)) && !WorldGen.SolidTile(num300, num301 - 1))
                                        {
                                            num301--;
                                        }
                                        else if (!WorldGen.SolidTile(num300, num301 + 1))
                                        {
                                            num301++;
                                        }
                                        else if (!WorldGen.SolidTile(num300, num301 - 1))
                                        {
                                            num301--;
                                        }
                                    }
                                    if (this.velocity.X > 0f)
                                    {
                                        this.rotation += 0.3f;
                                    }
                                    else
                                    {
                                        this.rotation -= 0.3f;
                                    }
                                    if (Main.myPlayer == this.owner)
                                    {
                                        int num302 = (int)((this.position.X + (base.width / 2)) / 16f);
                                        int num303 = (int)((this.position.Y + (base.height / 2)) / 16f);
                                        bool flag6 = false;
                                        if ((num302 == num300) && (num303 == num301))
                                        {
                                            flag6 = true;
                                        }
                                        if ((((this.velocity.X <= 0f) && (num302 <= num300)) || ((this.velocity.X >= 0f) && (num302 >= num300))) && (((this.velocity.Y <= 0f) && (num303 <= num301)) || ((this.velocity.Y >= 0f) && (num303 >= num301))))
                                        {
                                            flag6 = true;
                                        }
                                        if (flag6)
                                        {
                                            if (WorldGen.PlaceTile(num300, num301, 0x7f, false, false, this.owner, 0))
                                            {
                                                if (Main.netMode == 1)
                                                {
                                                    NetMessage.SendData(0x11, -1, -1, "", 1, (float)((int)this.ai[0]), (float)((int)this.ai[1]), 127f, 0, 0, 0);
                                                }
                                                this.damage = 0;
                                                this.ai[0] = -1f;
                                                base.velocity = (Vector2)(base.velocity * 0f);
                                                this.alpha = 0xff;
                                                this.position.X = num300 * 0x10;
                                                this.position.Y = num301 * 0x10;
                                                this.netUpdate = true;
                                                return;
                                            }
                                            this.ai[1] = -1f;
                                            return;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                if (this.ai[0] == -1f)
                                {
                                    for (int num286 = 0; num286 < 10; num286++)
                                    {
                                        color5 = new Color();
                                        int num287 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x43, 0f, 0f, 0, color5, 1.1f);
                                        Main.dust[num287].noGravity = true;
                                        Dust dust114 = Main.dust[num287];
                                        dust114.velocity = (Vector2)(dust114.velocity * 1.3f);
                                    }
                                }
                                else if (Main.rand.Next(30) == 0)
                                {
                                    int num288 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x43, 0f, 0f, 100, new Color(), 1f);
                                    Dust dust115 = Main.dust[num288];
                                    dust115.velocity = (Vector2)(dust115.velocity * 0.2f);
                                }
                                int num289 = ((int)this.position.X) / 0x10;
                                int num290 = ((int)this.position.Y) / 0x10;
                                if ((Main.tile[num289, num290] == null) || !Main.tile[num289, num290].active())
                                {
                                    this.Kill();
                                }
                                this.ai[0]--;
                                if (((this.ai[0] <= -900f) && ((Main.myPlayer == this.owner) || (Main.netMode == 2))) && (Main.tile[num289, num290].active() && (Main.tile[num289, num290].type == 0x7f)))
                                {
                                    WorldGen.KillTile(num289, num290, false, false, false);
                                    if (Main.netMode == 1)
                                    {
                                        NetMessage.SendData(0x11, -1, -1, "", 0, (float)num289, (float)num290, 0f, 0, 0, 0);
                                    }
                                    this.Kill();
                                    return;
                                }
                            }
                            return;
                        }
                        if (this.aiStyle == 0x17)
                        {
                            if ((this.type == 0xbc) && (this.ai[0] < 8f))
                            {
                                this.ai[0] = 8f;
                            }
                            if (this.timeLeft > 60)
                            {
                                this.timeLeft = 60;
                            }
                            if (this.ai[0] > 7f)
                            {
                                float num304 = 1f;
                                if (this.ai[0] == 8f)
                                {
                                    num304 = 0.25f;
                                }
                                else if (this.ai[0] == 9f)
                                {
                                    num304 = 0.5f;
                                }
                                else if (this.ai[0] == 10f)
                                {
                                    num304 = 0.75f;
                                }
                                this.ai[0]++;
                                int num305 = 6;
                                if (this.type == 0x65)
                                {
                                    num305 = 0x4b;
                                }
                                if ((num305 == 6) || (Main.rand.Next(2) == 0))
                                {
                                    for (int num306 = 0; num306 < 1; num306++)
                                    {
                                        color5 = new Color();
                                        int num307 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num305, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 1f);
                                        if ((Main.rand.Next(3) != 0) || ((num305 == 0x4b) && (Main.rand.Next(3) == 0)))
                                        {
                                            Main.dust[num307].noGravity = true;
                                            Dust dust117 = Main.dust[num307];
                                            dust117.scale *= 3f;
                                            Main.dust[num307].velocity.X *= 2f;
                                            Main.dust[num307].velocity.Y *= 2f;
                                        }
                                        if (this.type == 0xbc)
                                        {
                                            Dust dust118 = Main.dust[num307];
                                            dust118.scale *= 1.25f;
                                        }
                                        else
                                        {
                                            Dust dust119 = Main.dust[num307];
                                            dust119.scale *= 1.5f;
                                        }
                                        Main.dust[num307].velocity.X *= 1.2f;
                                        Main.dust[num307].velocity.Y *= 1.2f;
                                        Dust dust120 = Main.dust[num307];
                                        dust120.scale *= num304;
                                        if (num305 == 0x4b)
                                        {
                                            Dust dust121 = Main.dust[num307];
                                            dust121.velocity += base.velocity;
                                            if (!Main.dust[num307].noGravity)
                                            {
                                                Dust dust122 = Main.dust[num307];
                                                dust122.velocity = (Vector2)(dust122.velocity * 0.5f);
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                this.ai[0]++;
                            }
                            this.rotation += 0.3f * base.direction;
                            return;
                        }
                        if (this.aiStyle == 0x18)
                        {
                            this.light = this.scale * 0.5f;
                            this.rotation += this.velocity.X * 0.2f;
                            this.ai[1]++;
                            if (this.type != 0x5e)
                            {
                                base.velocity = (Vector2)(base.velocity * 0.96f);
                                if (this.ai[1] > 15f)
                                {
                                    this.scale -= 0.05f;
                                    if (this.scale <= 0.2)
                                    {
                                        this.scale = 0.2f;
                                        this.Kill();
                                        return;
                                    }
                                }
                            }
                            else
                            {
                                if (Main.rand.Next(4) == 0)
                                {
                                    int num308 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 70, 0f, 0f, 0, new Color(), 1f);
                                    Main.dust[num308].noGravity = true;
                                    Dust dust123 = Main.dust[num308];
                                    dust123.velocity = (Vector2)(dust123.velocity * 0.5f);
                                    Dust dust124 = Main.dust[num308];
                                    dust124.scale *= 0.9f;
                                }
                                base.velocity = (Vector2)(base.velocity * 0.985f);
                                if (this.ai[1] > 130f)
                                {
                                    this.scale -= 0.05f;
                                    if (this.scale <= 0.2)
                                    {
                                        this.scale = 0.2f;
                                        this.Kill();
                                        return;
                                    }
                                }
                            }
                            return;
                        }
                        if (this.aiStyle == 0x19)
                        {
                            if (((this.ai[0] != 0f) && (this.velocity.Y <= 0f)) && (this.velocity.X == 0f))
                            {
                                float num309 = 0.5f;
                                int num310 = (int)((this.position.X - 8f) / 16f);
                                int num311 = (int)(this.position.Y / 16f);
                                bool flag7 = false;
                                bool flag8 = false;
                                if (WorldGen.SolidTile(num310, num311) || WorldGen.SolidTile(num310, num311 + 1))
                                {
                                    flag7 = true;
                                }
                                num310 = (int)(((this.position.X + base.width) + 8f) / 16f);
                                if (WorldGen.SolidTile(num310, num311) || WorldGen.SolidTile(num310, num311 + 1))
                                {
                                    flag8 = true;
                                }
                                if (flag7)
                                {
                                    this.velocity.X = num309;
                                }
                                else if (flag8)
                                {
                                    this.velocity.X = -num309;
                                }
                                else
                                {
                                    num310 = (int)(((this.position.X - 8f) - 16f) / 16f);
                                    num311 = (int)(this.position.Y / 16f);
                                    flag7 = false;
                                    flag8 = false;
                                    if (WorldGen.SolidTile(num310, num311) || WorldGen.SolidTile(num310, num311 + 1))
                                    {
                                        flag7 = true;
                                    }
                                    num310 = (int)((((this.position.X + base.width) + 8f) + 16f) / 16f);
                                    if (WorldGen.SolidTile(num310, num311) || WorldGen.SolidTile(num310, num311 + 1))
                                    {
                                        flag8 = true;
                                    }
                                    if (flag7)
                                    {
                                        this.velocity.X = num309;
                                    }
                                    else if (flag8)
                                    {
                                        this.velocity.X = -num309;
                                    }
                                    else
                                    {
                                        num310 = (int)((this.position.X + 4f) / 16f);
                                        num311 = (int)(((this.position.Y + base.height) + 8f) / 16f);
                                        if (WorldGen.SolidTile(num310, num311) || WorldGen.SolidTile(num310, num311 + 1))
                                        {
                                            flag7 = true;
                                        }
                                        if (!flag7)
                                        {
                                            this.velocity.X = num309;
                                        }
                                        else
                                        {
                                            this.velocity.X = -num309;
                                        }
                                    }
                                }
                            }
                            this.rotation += this.velocity.X * 0.06f;
                            this.ai[0] = 1f;
                            if (this.velocity.Y > 16f)
                            {
                                this.velocity.Y = 16f;
                            }
                            if (this.velocity.Y <= 6f)
                            {
                                if ((this.velocity.X > 0f) && (this.velocity.X < 7f))
                                {
                                    this.velocity.X += 0.05f;
                                }
                                if ((this.velocity.X < 0f) && (this.velocity.X > -7f))
                                {
                                    this.velocity.X -= 0.05f;
                                }
                            }
                            this.velocity.Y += 0.3f;
                            return;
                        }
                        if (this.aiStyle == 0x1a)
                        {
                            this.AI_026();
                            return;
                        }
                        if (this.aiStyle != 0x1b)
                        {
                            if (this.aiStyle == 0x1c)
                            {
                                if (this.type == 0xb1)
                                {
                                    for (int num321 = 0; num321 < 3; num321++)
                                    {
                                        color5 = new Color();
                                        int num322 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x89, this.velocity.X, this.velocity.Y, Main.rand.Next(0, 0x65), color5, 1f + (Main.rand.Next(-20, 40) * 0.01f));
                                        Main.dust[num322].noGravity = true;
                                        Dust dust133 = Main.dust[num322];
                                        dust133.velocity = (Vector2)(dust133.velocity * 0.3f);
                                    }
                                }
                                if (this.type == 0x76)
                                {
                                    for (int num323 = 0; num323 < 2; num323++)
                                    {
                                        color5 = new Color();
                                        int num324 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x5c, this.velocity.X, this.velocity.Y, 50, color5, 1.2f);
                                        Main.dust[num324].noGravity = true;
                                        Dust dust134 = Main.dust[num324];
                                        dust134.velocity = (Vector2)(dust134.velocity * 0.3f);
                                    }
                                }
                                if (((this.type == 0x77) || (this.type == 0x80)) || (this.type == 0x167))
                                {
                                    for (int num325 = 0; num325 < 3; num325++)
                                    {
                                        color5 = new Color();
                                        int num326 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x5c, this.velocity.X, this.velocity.Y, 50, color5, 1.2f);
                                        Main.dust[num326].noGravity = true;
                                        Dust dust135 = Main.dust[num326];
                                        dust135.velocity = (Vector2)(dust135.velocity * 0.3f);
                                    }
                                }
                                if (this.type == 0x135)
                                {
                                    for (int num327 = 0; num327 < 3; num327++)
                                    {
                                        color5 = new Color();
                                        int num328 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xb9, this.velocity.X, this.velocity.Y, 50, color5, 1.2f);
                                        Main.dust[num328].noGravity = true;
                                        Dust dust136 = Main.dust[num328];
                                        dust136.velocity = (Vector2)(dust136.velocity * 0.3f);
                                    }
                                }
                                if (this.type == 0x81)
                                {
                                    for (int num329 = 0; num329 < 6; num329++)
                                    {
                                        color5 = new Color();
                                        int num330 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x6a, this.velocity.X, this.velocity.Y, 100, color5, 1f);
                                        Main.dust[num330].noGravity = true;
                                        Dust dust137 = Main.dust[num330];
                                        dust137.velocity = (Vector2)(dust137.velocity * (0.1f + (Main.rand.Next(4) * 0.1f)));
                                        Dust dust138 = Main.dust[num330];
                                        dust138.scale *= 1f + (Main.rand.Next(5) * 0.1f);
                                    }
                                }
                                if (this.ai[1] == 0f)
                                {
                                    this.ai[1] = 1f;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x1c);
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x1d)
                            {
                                if (this.type == 0x26b)
                                {
                                    int num332;
                                    int alpha = (int)this.ai[0];
                                    for (int num333 = 0; num333 < 3; num333++)
                                    {
                                        color5 = new Color();
                                        num332 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xfe, this.velocity.X, this.velocity.Y, alpha, color5, 1.2f);
                                        Main.dust[num332].position = (Vector2)((Main.dust[num332].position + base.Center) / 2f);
                                        Main.dust[num332].noGravity = true;
                                        Dust dust139 = Main.dust[num332];
                                        dust139.velocity = (Vector2)(dust139.velocity * 0.5f);
                                    }
                                    for (int num334 = 0; num334 < 2; num334++)
                                    {
                                        color5 = new Color();
                                        num332 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xff, this.velocity.X, this.velocity.Y, alpha, color5, 0.4f);
                                        switch (num334)
                                        {
                                            case 0:
                                                Main.dust[num332].position = (Vector2)((Main.dust[num332].position + (base.Center * 5f)) / 6f);
                                                break;

                                            case 1:
                                                Main.dust[num332].position = (Vector2)((Main.dust[num332].position + ((base.Center + (base.velocity / 2f)) * 5f)) / 6f);
                                                break;
                                        }
                                        Dust dust140 = Main.dust[num332];
                                        dust140.velocity = (Vector2)(dust140.velocity * 0.1f);
                                        Main.dust[num332].noGravity = true;
                                        Main.dust[num332].fadeIn = 1f;
                                    }
                                    return;
                                }
                                if (this.type == 620)
                                {
                                    int num337;
                                    int num335 = (int)this.ai[0];
                                    this.ai[1]++;
                                    float num336 = (60f - this.ai[1]) / 60f;
                                    if (this.ai[1] > 40f)
                                    {
                                        this.Kill();
                                    }
                                    this.velocity.Y += 0.2f;
                                    if (this.velocity.Y > 18f)
                                    {
                                        this.velocity.Y = 18f;
                                    }
                                    this.velocity.X *= 0.98f;
                                    for (int num338 = 0; num338 < 2; num338++)
                                    {
                                        color5 = new Color();
                                        num337 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num335, this.velocity.X, this.velocity.Y, 50, color5, 1.1f);
                                        Main.dust[num337].position = (Vector2)((Main.dust[num337].position + base.Center) / 2f);
                                        Main.dust[num337].noGravity = true;
                                        Dust dust141 = Main.dust[num337];
                                        dust141.velocity = (Vector2)(dust141.velocity * 0.3f);
                                        Dust dust142 = Main.dust[num337];
                                        dust142.scale *= num336;
                                    }
                                    for (int num339 = 0; num339 < 1; num339++)
                                    {
                                        color5 = new Color();
                                        num337 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num335, this.velocity.X, this.velocity.Y, 50, color5, 0.6f);
                                        Main.dust[num337].position = (Vector2)((Main.dust[num337].position + (base.Center * 5f)) / 6f);
                                        Dust dust143 = Main.dust[num337];
                                        dust143.velocity = (Vector2)(dust143.velocity * 0.1f);
                                        Main.dust[num337].noGravity = true;
                                        Main.dust[num337].fadeIn = 0.9f * num336;
                                        Dust dust144 = Main.dust[num337];
                                        dust144.scale *= num336;
                                    }
                                    return;
                                }
                                if (this.type == 0x209)
                                {
                                    int num340;
                                    for (int num341 = 0; num341 < 3; num341++)
                                    {
                                        color5 = new Color();
                                        num340 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xfe, this.velocity.X, this.velocity.Y, 50, color5, 1.2f);
                                        Main.dust[num340].position = (Vector2)((Main.dust[num340].position + base.Center) / 2f);
                                        Main.dust[num340].noGravity = true;
                                        Dust dust145 = Main.dust[num340];
                                        dust145.velocity = (Vector2)(dust145.velocity * 0.5f);
                                    }
                                    for (int num342 = 0; num342 < 2; num342++)
                                    {
                                        color5 = new Color();
                                        num340 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xff, this.velocity.X, this.velocity.Y, 50, color5, 0.4f);
                                        switch (num342)
                                        {
                                            case 0:
                                                Main.dust[num340].position = (Vector2)((Main.dust[num340].position + (base.Center * 5f)) / 6f);
                                                break;

                                            case 1:
                                                Main.dust[num340].position = (Vector2)((Main.dust[num340].position + ((base.Center + (base.velocity / 2f)) * 5f)) / 6f);
                                                break;
                                        }
                                        Dust dust146 = Main.dust[num340];
                                        dust146.velocity = (Vector2)(dust146.velocity * 0.1f);
                                        Main.dust[num340].noGravity = true;
                                        Main.dust[num340].fadeIn = 1f;
                                    }
                                    return;
                                }
                                if (this.type == 0x20a)
                                {
                                    int num344;
                                    this.ai[1]++;
                                    float num343 = (60f - this.ai[1]) / 60f;
                                    if (this.ai[1] > 40f)
                                    {
                                        this.Kill();
                                    }
                                    this.velocity.Y += 0.2f;
                                    if (this.velocity.Y > 18f)
                                    {
                                        this.velocity.Y = 18f;
                                    }
                                    this.velocity.X *= 0.98f;
                                    for (int num345 = 0; num345 < 2; num345++)
                                    {
                                        color5 = new Color();
                                        num344 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xfe, this.velocity.X, this.velocity.Y, 50, color5, 1.1f);
                                        Main.dust[num344].position = (Vector2)((Main.dust[num344].position + base.Center) / 2f);
                                        Main.dust[num344].noGravity = true;
                                        Dust dust147 = Main.dust[num344];
                                        dust147.velocity = (Vector2)(dust147.velocity * 0.3f);
                                        Dust dust148 = Main.dust[num344];
                                        dust148.scale *= num343;
                                    }
                                    for (int num346 = 0; num346 < 1; num346++)
                                    {
                                        color5 = new Color();
                                        num344 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xff, this.velocity.X, this.velocity.Y, 50, color5, 0.6f);
                                        Main.dust[num344].position = (Vector2)((Main.dust[num344].position + (base.Center * 5f)) / 6f);
                                        Dust dust149 = Main.dust[num344];
                                        dust149.velocity = (Vector2)(dust149.velocity * 0.1f);
                                        Main.dust[num344].noGravity = true;
                                        Main.dust[num344].fadeIn = 0.9f * num343;
                                        Dust dust150 = Main.dust[num344];
                                        dust150.scale *= num343;
                                    }
                                    return;
                                }
                                int num347 = (this.type - 0x79) + 0x56;
                                if (this.type == 0x255)
                                {
                                    num347 = 0x106;
                                }
                                for (int num348 = 0; num348 < 2; num348++)
                                {
                                    color5 = new Color();
                                    int num349 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num347, this.velocity.X, this.velocity.Y, 50, color5, 1.2f);
                                    Main.dust[num349].noGravity = true;
                                    Dust dust151 = Main.dust[num349];
                                    dust151.velocity = (Vector2)(dust151.velocity * 0.3f);
                                }
                                if (this.ai[1] == 0f)
                                {
                                    this.ai[1] = 1f;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 30)
                            {
                                base.velocity = (Vector2)(base.velocity * 0.8f);
                                this.rotation += 0.2f;
                                this.alpha += 4;
                                if (this.alpha >= 0xff)
                                {
                                    this.Kill();
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x1f)
                            {
                                int num350 = 110;
                                int conversionType = 0;
                                if (this.type == 0x92)
                                {
                                    num350 = 0x6f;
                                    conversionType = 2;
                                }
                                if (this.type == 0x93)
                                {
                                    num350 = 0x70;
                                    conversionType = 1;
                                }
                                if (this.type == 0x94)
                                {
                                    num350 = 0x71;
                                    conversionType = 3;
                                }
                                if (this.type == 0x95)
                                {
                                    num350 = 0x72;
                                    conversionType = 4;
                                }
                                if (this.owner == Main.myPlayer)
                                {
                                    WorldGen.Convert((((int)this.position.X) + (base.width / 2)) / 0x10, (((int)this.position.Y) + (base.height / 2)) / 0x10, conversionType, 2);
                                }
                                if (this.timeLeft > 0x85)
                                {
                                    this.timeLeft = 0x85;
                                }
                                if (this.ai[0] > 7f)
                                {
                                    float num352 = 1f;
                                    if (this.ai[0] == 8f)
                                    {
                                        num352 = 0.2f;
                                    }
                                    else if (this.ai[0] == 9f)
                                    {
                                        num352 = 0.4f;
                                    }
                                    else if (this.ai[0] == 10f)
                                    {
                                        num352 = 0.6f;
                                    }
                                    else if (this.ai[0] == 11f)
                                    {
                                        num352 = 0.8f;
                                    }
                                    this.ai[0]++;
                                    for (int num353 = 0; num353 < 1; num353++)
                                    {
                                        color5 = new Color();
                                        int num354 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num350, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 1f);
                                        Main.dust[num354].noGravity = true;
                                        Dust dust152 = Main.dust[num354];
                                        dust152.scale *= 1.75f;
                                        Main.dust[num354].velocity.X *= 2f;
                                        Main.dust[num354].velocity.Y *= 2f;
                                        Dust dust153 = Main.dust[num354];
                                        dust153.scale *= num352;
                                    }
                                }
                                else
                                {
                                    this.ai[0]++;
                                }
                                this.rotation += 0.3f * base.direction;
                                return;
                            }
                            if (this.aiStyle == 0x20)
                            {
                                this.timeLeft = 10;
                                this.ai[0]++;
                                if (this.ai[0] >= 20f)
                                {
                                    this.ai[0] = 15f;
                                    for (int num355 = 0; num355 < 0xff; num355++)
                                    {
                                        Rectangle rectangle5 = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height);
                                        if (Main.player[num355].active)
                                        {
                                            Rectangle rectangle6 = new Rectangle((int)Main.player[num355].position.X, (int)Main.player[num355].position.Y, Main.player[num355].width, Main.player[num355].height);
                                            if (rectangle5.Intersects(rectangle6))
                                            {
                                                this.ai[0] = 0f;
                                                this.velocity.Y = -4.5f;
                                                if (this.velocity.X > 2f)
                                                {
                                                    this.velocity.X = 2f;
                                                }
                                                if (this.velocity.X < -2f)
                                                {
                                                    this.velocity.X = -2f;
                                                }
                                                this.velocity.X = (this.velocity.X + (Main.player[num355].direction * 1.75f)) / 2f;
                                                this.velocity.X += Main.player[num355].velocity.X * 3f;
                                                this.velocity.Y += Main.player[num355].velocity.Y;
                                                if (this.velocity.X > 6f)
                                                {
                                                    this.velocity.X = 6f;
                                                }
                                                if (this.velocity.X < -6f)
                                                {
                                                    this.velocity.X = -6f;
                                                }
                                                this.netUpdate = true;
                                                this.ai[1]++;
                                            }
                                        }
                                    }
                                }
                                if ((this.velocity.X == 0f) && (this.velocity.Y == 0f))
                                {
                                    this.Kill();
                                }
                                this.rotation += 0.02f * this.velocity.X;
                                if (this.velocity.Y == 0f)
                                {
                                    this.velocity.X *= 0.98f;
                                }
                                else if (base.wet)
                                {
                                    this.velocity.X *= 0.99f;
                                }
                                else
                                {
                                    this.velocity.X *= 0.995f;
                                }
                                if ((this.velocity.X > -0.03) && (this.velocity.X < 0.03))
                                {
                                    this.velocity.X = 0f;
                                }
                                if (base.wet)
                                {
                                    this.ai[1] = 0f;
                                    if (this.velocity.Y > 0f)
                                    {
                                        this.velocity.Y *= 0.95f;
                                    }
                                    this.velocity.Y -= 0.1f;
                                    if (this.velocity.Y < -4f)
                                    {
                                        this.velocity.Y = -4f;
                                    }
                                    if (this.velocity.X == 0f)
                                    {
                                        this.Kill();
                                    }
                                }
                                else
                                {
                                    this.velocity.Y += 0.1f;
                                }
                                if (this.velocity.Y > 10f)
                                {
                                    this.velocity.Y = 10f;
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x21)
                            {
                                if (this.alpha > 0)
                                {
                                    this.alpha -= 50;
                                    if (this.alpha < 0)
                                    {
                                        this.alpha = 0;
                                    }
                                }
                                float num356 = 4f;
                                float num357 = this.ai[0];
                                float num358 = this.ai[1];
                                if ((num357 == 0f) && (num358 == 0f))
                                {
                                    num357 = 1f;
                                }
                                float num359 = (float)Math.Sqrt((double)((num357 * num357) + (num358 * num358)));
                                num359 = num356 / num359;
                                num357 *= num359;
                                num358 *= num359;
                                if (this.alpha < 70)
                                {
                                    int num360 = 0x7f;
                                    if (this.type == 310)
                                    {
                                        num360 = 0xbb;
                                    }
                                    int num361 = Dust.NewDust(new Vector2(this.position.X, this.position.Y - 2f), 6, 6, num360, this.velocity.X, this.velocity.Y, 100, new Color(), 1.6f);
                                    Main.dust[num361].noGravity = true;
                                    Main.dust[num361].position.X -= num357 * 1f;
                                    Main.dust[num361].position.Y -= num358 * 1f;
                                    Main.dust[num361].velocity.X -= num357;
                                    Main.dust[num361].velocity.Y -= num358;
                                }
                                if (this.localAI[0] == 0f)
                                {
                                    this.ai[0] = this.velocity.X;
                                    this.ai[1] = this.velocity.Y;
                                    this.localAI[1]++;
                                    if (this.localAI[1] >= 30f)
                                    {
                                        this.velocity.Y += 0.09f;
                                        this.localAI[1] = 30f;
                                    }
                                }
                                else
                                {
                                    if (!Collision.SolidCollision(base.position, base.width, base.height))
                                    {
                                        this.localAI[0] = 0f;
                                        this.localAI[1] = 30f;
                                    }
                                    this.damage = 0;
                                }
                                if (this.velocity.Y > 16f)
                                {
                                    this.velocity.Y = 16f;
                                }
                                this.rotation = ((float)Math.Atan2((double)this.ai[1], (double)this.ai[0])) + 1.57f;
                                return;
                            }
                            if (this.aiStyle == 0x22)
                            {
                                this.rotation = base.velocity.ToRotation() + 1.570796f;
                                if (this.ai[1] != 1f)
                                {
                                    if ((this.type < 0x19f) || (this.type > 0x1a2))
                                    {
                                        int num366 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 20f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, new Color(), 1.2f);
                                        Main.dust[num366].noGravity = true;
                                        Dust dust161 = Main.dust[num366];
                                        dust161.velocity = (Vector2)(dust161.velocity * 0.2f);
                                        Main.dust[num366].position = Main.dust[num366].position.RotatedBy((double)this.rotation, base.Center);
                                        return;
                                    }
                                    this.ai[0]++;
                                    if (this.ai[0] > 4f)
                                    {
                                        int num365 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 20f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, new Color(), 1.2f);
                                        Main.dust[num365].noGravity = true;
                                        Dust dust160 = Main.dust[num365];
                                        dust160.velocity = (Vector2)(dust160.velocity * 0.2f);
                                        Main.dust[num365].position = Main.dust[num365].position.RotatedBy((double)this.rotation, base.Center);
                                        return;
                                    }
                                }
                                else
                                {
                                    this.ai[0]++;
                                    if (this.ai[0] == 1f)
                                    {
                                        for (int num362 = 0; num362 < 8; num362++)
                                        {
                                            color5 = new Color();
                                            int num363 = Dust.NewDust(base.position, base.width, base.height, 6, 0f, 0f, 100, color5, 1.8f);
                                            Main.dust[num363].noGravity = true;
                                            Dust dust154 = Main.dust[num363];
                                            dust154.velocity = (Vector2)(dust154.velocity * 3f);
                                            Main.dust[num363].fadeIn = 0.5f;
                                            Dust dust155 = Main.dust[num363];
                                            dust155.position += (Vector2)(base.velocity / 2f);
                                            Dust dust156 = Main.dust[num363];
                                            dust156.velocity += (Vector2)((base.velocity / 4f) + (Main.player[this.owner].velocity * 0.1f));
                                        }
                                    }
                                    if (this.ai[0] > 2f)
                                    {
                                        color5 = new Color();
                                        int num364 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 20f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, color5, 1.2f);
                                        Main.dust[num364].noGravity = true;
                                        Dust dust157 = Main.dust[num364];
                                        dust157.velocity = (Vector2)(dust157.velocity * 0.2f);
                                        Main.dust[num364].position = Main.dust[num364].position.RotatedBy((double)this.rotation, base.Center);
                                        color5 = new Color();
                                        num364 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 15f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, color5, 1.2f);
                                        Main.dust[num364].noGravity = true;
                                        Dust dust158 = Main.dust[num364];
                                        dust158.velocity = (Vector2)(dust158.velocity * 0.2f);
                                        Main.dust[num364].position = Main.dust[num364].position.RotatedBy((double)this.rotation, base.Center);
                                        num364 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 10f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, new Color(), 1.2f);
                                        Main.dust[num364].noGravity = true;
                                        Dust dust159 = Main.dust[num364];
                                        dust159.velocity = (Vector2)(dust159.velocity * 0.2f);
                                        Main.dust[num364].position = Main.dust[num364].position.RotatedBy((double)this.rotation, base.Center);
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x23)
                            {
                                this.ai[0]++;
                                if (this.ai[0] > 30f)
                                {
                                    this.velocity.Y += 0.2f;
                                    this.velocity.X *= 0.985f;
                                    if (this.velocity.Y > 14f)
                                    {
                                        this.velocity.Y = 14f;
                                    }
                                }
                                float introduced1727 = Math.Abs(this.velocity.X);
                                this.rotation += ((introduced1727 + Math.Abs(this.velocity.Y)) * base.direction) * 0.02f;
                                if (this.owner == Main.myPlayer)
                                {
                                    Vector2 vector37 = Collision.TileCollision(base.position, base.velocity, base.width, base.height, true, true, 1);
                                    bool flag9 = false;
                                    if (vector37 != base.velocity)
                                    {
                                        flag9 = true;
                                    }
                                    else
                                    {
                                        int num367 = ((int)(base.Center.X + this.velocity.X)) / 0x10;
                                        int num368 = ((int)(base.Center.Y + this.velocity.Y)) / 0x10;
                                        if (((Main.tile[num367, num368] != null) && Main.tile[num367, num368].active()) && Main.tile[num367, num368].bottomSlope())
                                        {
                                            flag9 = true;
                                            this.position.Y = ((num368 * 0x10) + 0x10) + 8;
                                            this.position.X = (num367 * 0x10) + 8;
                                        }
                                    }
                                    if (!flag9)
                                    {
                                        return;
                                    }
                                    int num369 = 0xd5;
                                    if (this.type == 0x1db)
                                    {
                                        num369 = 0x161;
                                    }
                                    if (this.type == 0x1fa)
                                    {
                                        num369 = 0x16e;
                                    }
                                    if (this.type == 0x1f9)
                                    {
                                        num369 = 0x16d;
                                    }
                                    int num370 = (((int)this.position.X) + (base.width / 2)) / 0x10;
                                    int num371 = (((int)this.position.Y) + (base.height / 2)) / 0x10;
                                    base.position += vector37;
                                    int num372 = 10;
                                    if (Main.tile[num370, num371] == null)
                                    {
                                        return;
                                    }
                                    while (((Main.tile[num370, num371] != null) && Main.tile[num370, num371].active()) && Main.tileRope[Main.tile[num370, num371].type])
                                    {
                                        num371++;
                                    }
                                    while (num372 > 0)
                                    {
                                        num372--;
                                        if (Main.tile[num370, num371] == null)
                                        {
                                            break;
                                        }
                                        if (Main.tile[num370, num371].active() && (Main.tileCut[Main.tile[num370, num371].type] || (Main.tile[num370, num371].type == 0xa5)))
                                        {
                                            WorldGen.KillTile(num370, num371, false, false, false);
                                            NetMessage.SendData(0x11, -1, -1, "", 0, (float)num370, (float)num371, 0f, 0, 0, 0);
                                        }
                                        if (!Main.tile[num370, num371].active())
                                        {
                                            WorldGen.PlaceTile(num370, num371, num369, false, false, -1, 0);
                                            NetMessage.SendData(0x11, -1, -1, "", 1, (float)num370, (float)num371, (float)num369, 0, 0, 0);
                                            this.ai[1]++;
                                        }
                                        else
                                        {
                                            num372 = 0;
                                        }
                                        num371++;
                                    }
                                    this.Kill();
                                }
                                return;
                            }
                            if (this.aiStyle == 0x24)
                            {
                                if (((this.type != 0x133) && base.wet) && !base.honeyWet)
                                {
                                    this.Kill();
                                }
                                if (this.alpha > 0)
                                {
                                    this.alpha -= 50;
                                }
                                else
                                {
                                    this.extraUpdates = 0;
                                }
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                                if (this.type == 0x133)
                                {
                                    this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) - 1.57f;
                                    this.frameCounter++;
                                    if (this.frameCounter >= 6)
                                    {
                                        this.frame++;
                                        this.frameCounter = 0;
                                    }
                                    if (this.frame >= 2)
                                    {
                                        this.frame = 0;
                                    }
                                    for (int num373 = 0; num373 < 3; num373++)
                                    {
                                        float num374 = (this.velocity.X / 3f) * num373;
                                        float num375 = (this.velocity.Y / 3f) * num373;
                                        color5 = new Color();
                                        int num376 = Dust.NewDust(base.position, base.width, base.height, 0xb8, 0f, 0f, 0, color5, 1f);
                                        Main.dust[num376].position.X = base.Center.X - num374;
                                        Main.dust[num376].position.Y = base.Center.Y - num375;
                                        Dust dust162 = Main.dust[num376];
                                        dust162.velocity = (Vector2)(dust162.velocity * 0f);
                                        Main.dust[num376].scale = 0.5f;
                                    }
                                }
                                else
                                {
                                    if (this.type == 0x13c)
                                    {
                                        if (this.velocity.X > 0f)
                                        {
                                            this.spriteDirection = -1;
                                        }
                                        else if (this.velocity.X < 0f)
                                        {
                                            this.spriteDirection = 1;
                                        }
                                    }
                                    else if (this.velocity.X > 0f)
                                    {
                                        this.spriteDirection = 1;
                                    }
                                    else if (this.velocity.X < 0f)
                                    {
                                        this.spriteDirection = -1;
                                    }
                                    this.rotation = this.velocity.X * 0.1f;
                                    this.frameCounter++;
                                    if (this.frameCounter >= 3)
                                    {
                                        this.frame++;
                                        this.frameCounter = 0;
                                    }
                                    if (this.frame >= 3)
                                    {
                                        this.frame = 0;
                                    }
                                }
                                float num377 = this.position.X;
                                float num378 = this.position.Y;
                                float num379 = 100000f;
                                bool flag10 = false;
                                this.ai[0]++;
                                if (this.ai[0] > 30f)
                                {
                                    this.ai[0] = 30f;
                                    for (int num380 = 0; num380 < 200; num380++)
                                    {
                                        if (Main.npc[num380].CanBeChasedBy(this, false) && (!Main.npc[num380].wet || (this.type == 0x133)))
                                        {
                                            float num381 = Main.npc[num380].position.X + (Main.npc[num380].width / 2);
                                            float num382 = Main.npc[num380].position.Y + (Main.npc[num380].height / 2);
                                            float introduced1729 = Math.Abs((float)((this.position.X + (base.width / 2)) - num381));
                                            float num383 = introduced1729 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num382));
                                            if (((num383 < 800f) && (num383 < num379)) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num380].position, Main.npc[num380].width, Main.npc[num380].height))
                                            {
                                                num379 = num383;
                                                num377 = num381;
                                                num378 = num382;
                                                flag10 = true;
                                            }
                                        }
                                    }
                                }
                                if (!flag10)
                                {
                                    num377 = (this.position.X + (base.width / 2)) + (this.velocity.X * 100f);
                                    num378 = (this.position.Y + (base.height / 2)) + (this.velocity.Y * 100f);
                                }
                                else if (this.type == 0x133)
                                {
                                    this.friendly = true;
                                }
                                float num384 = 6f;
                                float num385 = 0.1f;
                                if (this.type == 0xbd)
                                {
                                    num384 = 7f;
                                    num385 = 0.15f;
                                }
                                if (this.type == 0x133)
                                {
                                    num384 = 9f;
                                    num385 = 0.2f;
                                }
                                if (this.type == 0x13c)
                                {
                                    num384 = 10f;
                                    num385 = 0.25f;
                                }
                                if (this.type == 0x236)
                                {
                                    num384 = 6.8f;
                                    num385 = 0.14f;
                                }
                                Vector2 vector38 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                float num386 = num377 - vector38.X;
                                float num387 = num378 - vector38.Y;
                                float num388 = (float)Math.Sqrt((double)((num386 * num386) + (num387 * num387)));
                                num388 = num384 / num388;
                                num386 *= num388;
                                num387 *= num388;
                                if (this.velocity.X < num386)
                                {
                                    this.velocity.X += num385;
                                    if ((this.velocity.X < 0f) && (num386 > 0f))
                                    {
                                        this.velocity.X += num385 * 2f;
                                    }
                                }
                                else if (this.velocity.X > num386)
                                {
                                    this.velocity.X -= num385;
                                    if ((this.velocity.X > 0f) && (num386 < 0f))
                                    {
                                        this.velocity.X -= num385 * 2f;
                                    }
                                }
                                if (this.velocity.Y >= num387)
                                {
                                    if (this.velocity.Y > num387)
                                    {
                                        this.velocity.Y -= num385;
                                        if ((this.velocity.Y > 0f) && (num387 < 0f))
                                        {
                                            this.velocity.Y -= num385 * 2f;
                                            return;
                                        }
                                    }
                                }
                                else
                                {
                                    this.velocity.Y += num385;
                                    if ((this.velocity.Y < 0f) && (num387 > 0f))
                                    {
                                        this.velocity.Y += num385 * 2f;
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x25)
                            {
                                if (this.ai[1] == 0f)
                                {
                                    this.ai[1] = this.position.Y - 5f;
                                }
                                if (this.ai[0] != 0f)
                                {
                                    if (Collision.SolidCollision(base.position, base.width, base.height) || (this.position.Y < this.ai[1]))
                                    {
                                        this.Kill();
                                        return;
                                    }
                                }
                                else
                                {
                                    if (Collision.SolidCollision(base.position, base.width, base.height))
                                    {
                                        this.velocity.Y *= -1f;
                                        this.ai[0]++;
                                        return;
                                    }
                                    float num389 = this.position.Y - this.ai[1];
                                    if (num389 > 300f)
                                    {
                                        this.velocity.Y *= -1f;
                                        this.ai[0]++;
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x26)
                            {
                                this.ai[0]++;
                                if (this.ai[0] >= 6f)
                                {
                                    this.ai[0] = 0f;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x22);
                                    if (Main.myPlayer == this.owner)
                                    {
                                        NewProjectile(this.position.X, this.position.Y, this.velocity.X, this.velocity.Y, 0xbc, this.damage, this.knockBack, this.owner, 0f, 0f);
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x27)
                            {
                                this.alpha -= 50;
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                                if (Main.player[this.owner].dead)
                                {
                                    this.Kill();
                                    return;
                                }
                                if (this.alpha == 0)
                                {
                                    Main.player[this.owner].itemAnimation = 5;
                                    Main.player[this.owner].itemTime = 5;
                                    if ((this.position.X + (base.width / 2)) > (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)))
                                    {
                                        Main.player[this.owner].ChangeDir(1);
                                    }
                                    else
                                    {
                                        Main.player[this.owner].ChangeDir(-1);
                                    }
                                }
                                Vector2 vector39 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                float num390 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector39.X;
                                float num391 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector39.Y;
                                float num392 = (float)Math.Sqrt((double)((num390 * num390) + (num391 * num391)));
                                if (!Main.player[this.owner].channel && (this.alpha == 0))
                                {
                                    this.ai[0] = 1f;
                                    this.ai[1] = -1f;
                                }
                                if ((this.ai[1] > 0f) && (num392 > 1500f))
                                {
                                    this.ai[1] = 0f;
                                    this.ai[0] = 1f;
                                }
                                if (this.ai[1] > 0f)
                                {
                                    this.tileCollide = false;
                                    int num393 = ((int)this.ai[1]) - 1;
                                    if (Main.npc[num393].active && (Main.npc[num393].life > 0))
                                    {
                                        float num394 = 16f;
                                        vector39 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                        num390 = (Main.npc[num393].position.X + (Main.npc[num393].width / 2)) - vector39.X;
                                        num391 = (Main.npc[num393].position.Y + (Main.npc[num393].height / 2)) - vector39.Y;
                                        num392 = (float)Math.Sqrt((double)((num390 * num390) + (num391 * num391)));
                                        if (num392 < num394)
                                        {
                                            this.velocity.X = num390;
                                            this.velocity.Y = num391;
                                            if (num392 > (num394 / 2f))
                                            {
                                                if (this.velocity.X < 0f)
                                                {
                                                    this.spriteDirection = -1;
                                                    this.rotation = (float)Math.Atan2((double)-this.velocity.Y, (double)-this.velocity.X);
                                                }
                                                else
                                                {
                                                    this.spriteDirection = 1;
                                                    this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            num392 = num394 / num392;
                                            num390 *= num392;
                                            num391 *= num392;
                                            this.velocity.X = num390;
                                            this.velocity.Y = num391;
                                            if (this.velocity.X < 0f)
                                            {
                                                this.spriteDirection = -1;
                                                this.rotation = (float)Math.Atan2((double)-this.velocity.Y, (double)-this.velocity.X);
                                            }
                                            else
                                            {
                                                this.spriteDirection = 1;
                                                this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                            }
                                        }
                                        this.ai[0] = 1f;
                                    }
                                    else
                                    {
                                        this.ai[1] = 0f;
                                        float num395 = this.position.X;
                                        float num396 = this.position.Y;
                                        float num397 = 3000f;
                                        int num398 = -1;
                                        for (int num399 = 0; num399 < 200; num399++)
                                        {
                                            if (Main.npc[num399].CanBeChasedBy(this, false))
                                            {
                                                float num400 = Main.npc[num399].position.X + (Main.npc[num399].width / 2);
                                                float num401 = Main.npc[num399].position.Y + (Main.npc[num399].height / 2);
                                                float introduced1730 = Math.Abs((float)((this.position.X + (base.width / 2)) - num400));
                                                float num402 = introduced1730 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num401));
                                                if ((num402 < num397) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height))
                                                {
                                                    num397 = num402;
                                                    num395 = num400;
                                                    num396 = num401;
                                                    num398 = num399;
                                                }
                                            }
                                        }
                                        if (num398 >= 0)
                                        {
                                            float num403 = 16f;
                                            vector39 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                            num390 = num395 - vector39.X;
                                            num391 = num396 - vector39.Y;
                                            num392 = (float)Math.Sqrt((double)((num390 * num390) + (num391 * num391)));
                                            num392 = num403 / num392;
                                            num390 *= num392;
                                            num391 *= num392;
                                            this.velocity.X = num390;
                                            this.velocity.Y = num391;
                                            this.ai[0] = 0f;
                                            this.ai[1] = num398 + 1;
                                        }
                                    }
                                }
                                else if (this.ai[0] == 0f)
                                {
                                    if (num392 > 700f)
                                    {
                                        this.ai[0] = 1f;
                                    }
                                    if (this.velocity.X < 0f)
                                    {
                                        this.spriteDirection = -1;
                                        this.rotation = (float)Math.Atan2((double)-this.velocity.Y, (double)-this.velocity.X);
                                    }
                                    else
                                    {
                                        this.spriteDirection = 1;
                                        this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                    }
                                }
                                else if (this.ai[0] == 1f)
                                {
                                    this.tileCollide = false;
                                    if (this.velocity.X < 0f)
                                    {
                                        this.spriteDirection = 1;
                                        this.rotation = (float)Math.Atan2((double)-this.velocity.Y, (double)-this.velocity.X);
                                    }
                                    else
                                    {
                                        this.spriteDirection = -1;
                                        this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                    }
                                    if (this.velocity.X < 0f)
                                    {
                                        this.spriteDirection = -1;
                                        this.rotation = (float)Math.Atan2((double)-this.velocity.Y, (double)-this.velocity.X);
                                    }
                                    else
                                    {
                                        this.spriteDirection = 1;
                                        this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                    }
                                    float num404 = 20f;
                                    if (num392 < 70f)
                                    {
                                        this.Kill();
                                    }
                                    num392 = num404 / num392;
                                    num390 *= num392;
                                    num391 *= num392;
                                    this.velocity.X = num390;
                                    this.velocity.Y = num391;
                                }
                                this.frameCounter++;
                                if (this.frameCounter >= 4)
                                {
                                    this.frame++;
                                    this.frameCounter = 0;
                                }
                                if (this.frame >= 4)
                                {
                                    this.frame = 0;
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 40)
                            {
                                this.localAI[0]++;
                                if (this.localAI[0] > 3f)
                                {
                                    this.localAI[0] = 100f;
                                    this.alpha -= 50;
                                    if (this.alpha < 0)
                                    {
                                        this.alpha = 0;
                                    }
                                }
                                this.frameCounter++;
                                if (this.frameCounter >= 3)
                                {
                                    this.frame++;
                                    this.frameCounter = 0;
                                }
                                if (this.frame >= 5)
                                {
                                    this.frame = 0;
                                }
                                this.velocity.X += this.ai[0];
                                this.velocity.Y += this.ai[1];
                                this.localAI[1]++;
                                if (this.localAI[1] == 50f)
                                {
                                    this.localAI[1] = 51f;
                                    this.ai[0] = Main.rand.Next(-100, 0x65) * 6E-05f;
                                    this.ai[1] = Main.rand.Next(-100, 0x65) * 6E-05f;
                                }
                                float introduced1731 = Math.Abs(this.velocity.X);
                                if ((introduced1731 + Math.Abs(this.velocity.Y)) > 16f)
                                {
                                    this.velocity.X *= 0.95f;
                                    this.velocity.Y *= 0.95f;
                                }
                                float introduced1732 = Math.Abs(this.velocity.X);
                                if ((introduced1732 + Math.Abs(this.velocity.Y)) < 12f)
                                {
                                    this.velocity.X *= 1.05f;
                                    this.velocity.Y *= 1.05f;
                                }
                                this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 3.14f;
                                return;
                            }
                            if (this.aiStyle == 0x29)
                            {
                                if (this.localAI[0] == 0f)
                                {
                                    this.localAI[0] = 1f;
                                    this.frame = Main.rand.Next(3);
                                }
                                this.rotation += this.velocity.X * 0.01f;
                                return;
                            }
                            if (this.aiStyle == 0x2a)
                            {
                                if (!Main.player[this.owner].crystalLeaf)
                                {
                                    this.Kill();
                                    return;
                                }
                                this.position.X = Main.player[this.owner].Center.X - (base.width / 2);
                                this.position.Y = ((Main.player[this.owner].Center.Y - (base.height / 2)) + Main.player[this.owner].gfxOffY) - 60f;
                                if (Main.player[this.owner].gravDir == -1f)
                                {
                                    this.position.Y += 120f;
                                    this.rotation = 3.14f;
                                }
                                else
                                {
                                    this.rotation = 0f;
                                }
                                this.position.X = (int)this.position.X;
                                this.position.Y = (int)this.position.Y;
                                float num405 = (((float)Main.mouseTextColor) / 200f) - 0.35f;
                                num405 *= 0.2f;
                                this.scale = num405 + 0.95f;
                                if (this.owner == Main.myPlayer)
                                {
                                    if (this.ai[0] != 0f)
                                    {
                                        this.ai[0]--;
                                        return;
                                    }
                                    float num406 = this.position.X;
                                    float num407 = this.position.Y;
                                    float num408 = 700f;
                                    bool flag11 = false;
                                    for (int num409 = 0; num409 < 200; num409++)
                                    {
                                        if (Main.npc[num409].CanBeChasedBy(this, true))
                                        {
                                            float num410 = Main.npc[num409].position.X + (Main.npc[num409].width / 2);
                                            float num411 = Main.npc[num409].position.Y + (Main.npc[num409].height / 2);
                                            float introduced1733 = Math.Abs((float)((this.position.X + (base.width / 2)) - num410));
                                            float num412 = introduced1733 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num411));
                                            if ((num412 < num408) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num409].position, Main.npc[num409].width, Main.npc[num409].height))
                                            {
                                                num408 = num412;
                                                num406 = num410;
                                                num407 = num411;
                                                flag11 = true;
                                            }
                                        }
                                    }
                                    if (flag11)
                                    {
                                        float num413 = 12f;
                                        Vector2 vector40 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                        float num414 = num406 - vector40.X;
                                        float num415 = num407 - vector40.Y;
                                        float num416 = (float)Math.Sqrt((double)((num414 * num414) + (num415 * num415)));
                                        num416 = num413 / num416;
                                        num414 *= num416;
                                        num415 *= num416;
                                        NewProjectile(base.Center.X - 4f, base.Center.Y, num414, num415, 0xe3, Player.crystalLeafDamage, (float)Player.crystalLeafKB, this.owner, 0f, 0f);
                                        this.ai[0] = 50f;
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x2b)
                            {
                                if (this.localAI[1] == 0f)
                                {
                                    Main.PlaySound(6, (int)this.position.X, (int)this.position.Y, 1);
                                    this.localAI[1]++;
                                    for (int num417 = 0; num417 < 5; num417++)
                                    {
                                        color5 = new Color();
                                        int num418 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x9d, 0f, 0f, 0, color5, 1f);
                                        Main.dust[num418].noGravity = true;
                                        Dust dust163 = Main.dust[num418];
                                        dust163.velocity = (Vector2)(dust163.velocity * 3f);
                                        Main.dust[num418].scale = 1.5f;
                                    }
                                }
                                this.ai[0] = Main.rand.Next(-100, 0x65) * 0.0025f;
                                this.ai[1] = Main.rand.Next(-100, 0x65) * 0.0025f;
                                if (this.localAI[0] == 0f)
                                {
                                    this.scale += 0.05f;
                                    if (this.scale > 1.2)
                                    {
                                        this.localAI[0] = 1f;
                                    }
                                }
                                else
                                {
                                    this.scale -= 0.05f;
                                    if (this.scale < 0.8)
                                    {
                                        this.localAI[0] = 0f;
                                    }
                                }
                                this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 3.14f;
                                int num419 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x9d, 0f, 0f, 0, new Color(), 1f);
                                Main.dust[num419].noGravity = true;
                                Dust dust164 = Main.dust[num419];
                                dust164.velocity = (Vector2)(dust164.velocity * 0.1f);
                                Main.dust[num419].scale = 1.5f;
                                return;
                            }
                            if (this.aiStyle == 0x2c)
                            {
                                if (this.type == 0xe4)
                                {
                                    base.velocity = (Vector2)(base.velocity * 0.96f);
                                    this.alpha += 4;
                                    if (this.alpha > 0xff)
                                    {
                                        this.Kill();
                                    }
                                }
                                else if (this.type == 0xe5)
                                {
                                    if (this.ai[0] == 0f)
                                    {
                                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
                                    }
                                    this.ai[0]++;
                                    if (this.ai[0] > 20f)
                                    {
                                        this.velocity.Y += 0.3f;
                                        this.velocity.X *= 0.98f;
                                    }
                                }
                                this.frameCounter++;
                                if (this.frameCounter > 5)
                                {
                                    this.frame++;
                                    this.frameCounter = 0;
                                }
                                if (this.frame >= Main.projFrames[this.type])
                                {
                                    this.frame = 0;
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x2d)
                            {
                                if ((this.type != 0xed) && (this.type != 0xf3))
                                {
                                    if ((this.type != 0xee) && (this.type != 0xf4))
                                    {
                                        if (this.type == 0xef)
                                        {
                                            this.alpha = 50;
                                            return;
                                        }
                                        if (this.type == 0xf5)
                                        {
                                            this.alpha = 100;
                                            return;
                                        }
                                        if (this.type == 0x108)
                                        {
                                            this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        this.frameCounter++;
                                        if (this.frameCounter > 8)
                                        {
                                            this.frameCounter = 0;
                                            this.frame++;
                                            if (this.frame > 5)
                                            {
                                                this.frame = 0;
                                            }
                                        }
                                        this.ai[1]++;
                                        if ((this.type == 0xf4) && (this.ai[1] >= 3600f))
                                        {
                                            this.alpha += 5;
                                            if (this.alpha > 0xff)
                                            {
                                                this.alpha = 0xff;
                                                this.Kill();
                                            }
                                        }
                                        else if ((this.type == 0xee) && (this.ai[1] >= 7200f))
                                        {
                                            this.alpha += 5;
                                            if (this.alpha > 0xff)
                                            {
                                                this.alpha = 0xff;
                                                this.Kill();
                                            }
                                        }
                                        else
                                        {
                                            this.ai[0]++;
                                            if (this.type == 0xf4)
                                            {
                                                if (this.ai[0] > 10f)
                                                {
                                                    this.ai[0] = 0f;
                                                    if (this.owner == Main.myPlayer)
                                                    {
                                                        int num422 = ((int)(this.position.X + 14f)) + Main.rand.Next(base.width - 0x1c);
                                                        int num423 = (int)((this.position.Y + base.height) + 4f);
                                                        NewProjectile((float)num422, (float)num423, 0f, 5f, 0xf5, this.damage, 0f, this.owner, 0f, 0f);
                                                    }
                                                }
                                            }
                                            else if (this.ai[0] > 8f)
                                            {
                                                this.ai[0] = 0f;
                                                if (this.owner == Main.myPlayer)
                                                {
                                                    int num424 = ((int)(this.position.X + 14f)) + Main.rand.Next(base.width - 0x1c);
                                                    int num425 = (int)((this.position.Y + base.height) + 4f);
                                                    NewProjectile((float)num424, (float)num425, 0f, 5f, 0xef, this.damage, 0f, this.owner, 0f, 0f);
                                                }
                                            }
                                        }
                                        this.localAI[0]++;
                                        if (this.localAI[0] >= 10f)
                                        {
                                            this.localAI[0] = 0f;
                                            int num426 = 0;
                                            int num427 = 0;
                                            float num428 = 0f;
                                            int num429 = this.type;
                                            for (int num430 = 0; num430 < 0x3e8; num430++)
                                            {
                                                if ((Main.projectile[num430].active && (Main.projectile[num430].owner == this.owner)) && ((Main.projectile[num430].type == num429) && (Main.projectile[num430].ai[1] < 3600f)))
                                                {
                                                    num426++;
                                                    if (Main.projectile[num430].ai[1] > num428)
                                                    {
                                                        num427 = num430;
                                                        num428 = Main.projectile[num430].ai[1];
                                                    }
                                                }
                                            }
                                            if (this.type != 0xf4)
                                            {
                                                if (num426 > 2)
                                                {
                                                    Main.projectile[num427].netUpdate = true;
                                                    Main.projectile[num427].ai[1] = 36000f;
                                                    return;
                                                }
                                            }
                                            else if (num426 > 1)
                                            {
                                                Main.projectile[num427].netUpdate = true;
                                                Main.projectile[num427].ai[1] = 36000f;
                                                return;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    float num420 = this.ai[0];
                                    float num421 = this.ai[1];
                                    if ((num420 != 0f) && (num421 != 0f))
                                    {
                                        bool flag12 = false;
                                        bool flag13 = false;
                                        if (((this.velocity.X < 0f) && (base.Center.X < num420)) || ((this.velocity.X > 0f) && (base.Center.X > num420)))
                                        {
                                            flag12 = true;
                                        }
                                        if (((this.velocity.Y < 0f) && (base.Center.Y < num421)) || ((this.velocity.Y > 0f) && (base.Center.Y > num421)))
                                        {
                                            flag13 = true;
                                        }
                                        if (flag12 && flag13)
                                        {
                                            this.Kill();
                                        }
                                    }
                                    this.rotation += this.velocity.X * 0.02f;
                                    this.frameCounter++;
                                    if (this.frameCounter > 4)
                                    {
                                        this.frameCounter = 0;
                                        this.frame++;
                                        if (this.frame > 3)
                                        {
                                            this.frame = 0;
                                            return;
                                        }
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x2e)
                            {
                                int num431 = 0x4b0;
                                if (this.type == 250)
                                {
                                    if (this.owner == Main.myPlayer)
                                    {
                                        this.localAI[0]++;
                                        if (this.localAI[0] > 4f)
                                        {
                                            this.localAI[0] = 3f;
                                            NewProjectile(base.Center.X, base.Center.Y, this.velocity.X * 0.001f, this.velocity.Y * 0.001f, 0xfb, this.damage, this.knockBack, this.owner, 0f, 0f);
                                        }
                                        if (this.timeLeft > num431)
                                        {
                                            this.timeLeft = num431;
                                        }
                                    }
                                    float num432 = 1f;
                                    if (this.velocity.Y < 0f)
                                    {
                                        num432 -= this.velocity.Y / 3f;
                                    }
                                    this.ai[0] += num432;
                                    if (this.ai[0] > 30f)
                                    {
                                        this.velocity.Y += 0.5f;
                                        if (this.velocity.Y > 0f)
                                        {
                                            this.velocity.X *= 0.95f;
                                        }
                                        else
                                        {
                                            this.velocity.X *= 1.05f;
                                        }
                                    }
                                    float num433 = this.velocity.X;
                                    float num434 = this.velocity.Y;
                                    float num435 = (float)Math.Sqrt((double)((num433 * num433) + (num434 * num434)));
                                    num435 = (15.95f * this.scale) / num435;
                                    num433 *= num435;
                                    num434 *= num435;
                                    this.velocity.X = num433;
                                    this.velocity.Y = num434;
                                    this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) - 1.57f;
                                    return;
                                }
                                if (this.localAI[0] == 0f)
                                {
                                    if (this.velocity.X > 0f)
                                    {
                                        this.spriteDirection = -1;
                                        this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) - 1.57f;
                                    }
                                    else
                                    {
                                        this.spriteDirection = 1;
                                        this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) - 1.57f;
                                    }
                                    this.localAI[0] = 1f;
                                    this.timeLeft = num431;
                                }
                                this.velocity.X *= 0.98f;
                                this.velocity.Y *= 0.98f;
                                if (this.rotation == 0f)
                                {
                                    this.alpha = 0xff;
                                    return;
                                }
                                if (this.timeLeft < 10)
                                {
                                    this.alpha = 0xff - ((int)((255f * this.timeLeft) / 10f));
                                    return;
                                }
                                if (this.timeLeft > (num431 - 10))
                                {
                                    int num436 = num431 - this.timeLeft;
                                    this.alpha = 0xff - ((int)((255f * num436) / 10f));
                                    return;
                                }
                                this.alpha = 0;
                                return;
                            }
                            if (this.aiStyle == 0x2f)
                            {
                                if (this.ai[0] == 0f)
                                {
                                    this.ai[0] = this.velocity.X;
                                    this.ai[1] = this.velocity.Y;
                                }
                                if (this.velocity.X > 0f)
                                {
                                    float introduced1736 = Math.Abs(this.velocity.Y);
                                    this.rotation += (introduced1736 + Math.Abs(this.velocity.X)) * 0.001f;
                                }
                                else
                                {
                                    float introduced1737 = Math.Abs(this.velocity.Y);
                                    this.rotation -= (introduced1737 + Math.Abs(this.velocity.X)) * 0.001f;
                                }
                                this.frameCounter++;
                                if (this.frameCounter > 6)
                                {
                                    this.frameCounter = 0;
                                    this.frame++;
                                    if (this.frame > 4)
                                    {
                                        this.frame = 0;
                                    }
                                }
                                if (Math.Sqrt((double)((this.velocity.X * this.velocity.X) + (this.velocity.Y * this.velocity.Y))) > 2.0)
                                {
                                    base.velocity = (Vector2)(base.velocity * 0.98f);
                                }
                                for (int num437 = 0; num437 < 0x3e8; num437++)
                                {
                                    if ((((num437 != base.whoAmI) && Main.projectile[num437].active) && ((Main.projectile[num437].owner == this.owner) && (Main.projectile[num437].type == this.type))) && ((this.timeLeft > Main.projectile[num437].timeLeft) && (Main.projectile[num437].timeLeft > 30)))
                                    {
                                        Main.projectile[num437].timeLeft = 30;
                                    }
                                }
                                int[] numArray = new int[20];
                                int num438 = 0;
                                float num439 = 300f;
                                bool flag14 = false;
                                float num440 = 0f;
                                float num441 = 0f;
                                for (int num442 = 0; num442 < 200; num442++)
                                {
                                    if (Main.npc[num442].CanBeChasedBy(this, false))
                                    {
                                        float num443 = Main.npc[num442].position.X + (Main.npc[num442].width / 2);
                                        float num444 = Main.npc[num442].position.Y + (Main.npc[num442].height / 2);
                                        float introduced1738 = Math.Abs((float)((this.position.X + (base.width / 2)) - num443));
                                        float num445 = introduced1738 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num444));
                                        if ((num445 < num439) && Collision.CanHit(base.Center, 1, 1, Main.npc[num442].Center, 1, 1))
                                        {
                                            if (num438 < 20)
                                            {
                                                numArray[num438] = num442;
                                                num438++;
                                                num440 = num443;
                                                num441 = num444;
                                            }
                                            flag14 = true;
                                        }
                                    }
                                }
                                if (this.timeLeft < 30)
                                {
                                    flag14 = false;
                                }
                                if (flag14)
                                {
                                    int num446 = Main.rand.Next(num438);
                                    num446 = numArray[num446];
                                    num440 = Main.npc[num446].position.X + (Main.npc[num446].width / 2);
                                    num441 = Main.npc[num446].position.Y + (Main.npc[num446].height / 2);
                                    this.localAI[0]++;
                                    if (this.localAI[0] > 8f)
                                    {
                                        this.localAI[0] = 0f;
                                        float num447 = 6f;
                                        Vector2 vector41 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                        vector41 += (Vector2)(base.velocity * 4f);
                                        float num448 = num440 - vector41.X;
                                        float num449 = num441 - vector41.Y;
                                        float num450 = (float)Math.Sqrt((double)((num448 * num448) + (num449 * num449)));
                                        num450 = num447 / num450;
                                        num448 *= num450;
                                        num449 *= num450;
                                        NewProjectile(vector41.X, vector41.Y, num448, num449, 0xff, this.damage, this.knockBack, this.owner, 0f, 0f);
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x30)
                            {
                                if (this.type == 0xff)
                                {
                                    for (int num451 = 0; num451 < 4; num451++)
                                    {
                                        Vector2 position = base.position - ((Vector2)(base.velocity * (num451 * 0.25f)));
                                        this.alpha = 0xff;
                                        color5 = new Color();
                                        int num452 = Dust.NewDust(position, 1, 1, 160, 0f, 0f, 0, color5, 1f);
                                        Main.dust[num452].position = position;
                                        Main.dust[num452].position.X += base.width / 2;
                                        Main.dust[num452].position.Y += base.height / 2;
                                        Main.dust[num452].scale = Main.rand.Next(70, 110) * 0.013f;
                                        Dust dust165 = Main.dust[num452];
                                        dust165.velocity = (Vector2)(dust165.velocity * 0.2f);
                                    }
                                    return;
                                }
                                if (this.type == 0x1b1)
                                {
                                    for (int num453 = 0; num453 < 2; num453++)
                                    {
                                        Vector2 vector43 = base.position - ((Vector2)(base.velocity * (num453 * 0.25f)));
                                        this.alpha = 0xff;
                                        color5 = new Color();
                                        int num454 = Dust.NewDust(vector43, 1, 1, 160, 0f, 0f, 0, color5, 1f);
                                        Main.dust[num454].position = vector43;
                                        Main.dust[num454].position.X += base.width / 2;
                                        Main.dust[num454].position.Y += base.height / 2;
                                        if (Main.rand.Next(2) == 0)
                                        {
                                            Main.dust[num454].color = Color.LimeGreen;
                                        }
                                        else
                                        {
                                            Main.dust[num454].color = Color.CornflowerBlue;
                                        }
                                        Main.dust[num454].scale = Main.rand.Next(70, 110) * 0.013f;
                                        Dust dust166 = Main.dust[num454];
                                        dust166.velocity = (Vector2)(dust166.velocity * 0.2f);
                                    }
                                    return;
                                }
                                if (this.type != 290)
                                {
                                    if (this.type != 0x126)
                                    {
                                        this.localAI[0]++;
                                        if (this.localAI[0] > 3f)
                                        {
                                            for (int num459 = 0; num459 < 4; num459++)
                                            {
                                                Vector2 vector46 = base.position - ((Vector2)(base.velocity * (num459 * 0.25f)));
                                                this.alpha = 0xff;
                                                color5 = new Color();
                                                int num460 = Dust.NewDust(vector46, 1, 1, 0xa2, 0f, 0f, 0, color5, 1f);
                                                Main.dust[num460].position = vector46;
                                                Main.dust[num460].position.X += base.width / 2;
                                                Main.dust[num460].position.Y += base.height / 2;
                                                Main.dust[num460].scale = Main.rand.Next(70, 110) * 0.013f;
                                                Dust dust169 = Main.dust[num460];
                                                dust169.velocity = (Vector2)(dust169.velocity * 0.2f);
                                            }
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        this.localAI[0]++;
                                        if (this.localAI[0] > 9f)
                                        {
                                            for (int num457 = 0; num457 < 4; num457++)
                                            {
                                                Vector2 vector45 = base.position - ((Vector2)(base.velocity * (num457 * 0.25f)));
                                                this.alpha = 0xff;
                                                color5 = new Color();
                                                int num458 = Dust.NewDust(vector45, 1, 1, 0xad, 0f, 0f, 0, color5, 1f);
                                                Main.dust[num458].position = vector45;
                                                Main.dust[num458].scale = Main.rand.Next(70, 110) * 0.013f;
                                                Dust dust168 = Main.dust[num458];
                                                dust168.velocity = (Vector2)(dust168.velocity * 0.2f);
                                            }
                                            return;
                                        }
                                    }
                                }
                                else
                                {
                                    if (this.localAI[0] == 0f)
                                    {
                                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
                                    }
                                    this.localAI[0]++;
                                    if (this.localAI[0] > 3f)
                                    {
                                        for (int num455 = 0; num455 < 3; num455++)
                                        {
                                            Vector2 vector44 = base.position - ((Vector2)(base.velocity * (num455 * 0.3334f)));
                                            this.alpha = 0xff;
                                            color5 = new Color();
                                            int num456 = Dust.NewDust(vector44, 1, 1, 0xad, 0f, 0f, 0, color5, 1f);
                                            Main.dust[num456].position = vector44;
                                            Main.dust[num456].scale = Main.rand.Next(70, 110) * 0.013f;
                                            Dust dust167 = Main.dust[num456];
                                            dust167.velocity = (Vector2)(dust167.velocity * 0.2f);
                                        }
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x31)
                            {
                                if (this.ai[1] == 0f)
                                {
                                    this.ai[1] = 1f;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14);
                                }
                                if (this.ai[1] != 1f)
                                {
                                    if (this.ai[1] == 2f)
                                    {
                                        this.rotation = 0f;
                                        this.velocity.X *= 0.95f;
                                        this.velocity.Y += 0.2f;
                                        return;
                                    }
                                }
                                else
                                {
                                    if (this.velocity.X > 0f)
                                    {
                                        base.direction = 1;
                                    }
                                    else if (this.velocity.X < 0f)
                                    {
                                        base.direction = -1;
                                    }
                                    this.spriteDirection = base.direction;
                                    this.ai[0]++;
                                    this.rotation += (this.velocity.X * 0.05f) + (base.direction * 0.05f);
                                    if (this.ai[0] >= 18f)
                                    {
                                        this.velocity.Y += 0.28f;
                                        this.velocity.X *= 0.99f;
                                    }
                                    if (this.velocity.Y > 15.9)
                                    {
                                        this.velocity.Y = 15.9f;
                                    }
                                    if (this.ai[0] > 2f)
                                    {
                                        this.alpha = 0;
                                        if (this.ai[0] == 3f)
                                        {
                                            for (int num461 = 0; num461 < 10; num461++)
                                            {
                                                color5 = new Color();
                                                int num462 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1.5f);
                                                Dust dust170 = Main.dust[num462];
                                                dust170.velocity = (Vector2)(dust170.velocity * 0.5f);
                                                Dust dust171 = Main.dust[num462];
                                                dust171.velocity += (Vector2)(base.velocity * 0.1f);
                                            }
                                            for (int num463 = 0; num463 < 5; num463++)
                                            {
                                                color5 = new Color();
                                                int num464 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 2f);
                                                Main.dust[num464].noGravity = true;
                                                Dust dust172 = Main.dust[num464];
                                                dust172.velocity = (Vector2)(dust172.velocity * 3f);
                                                Dust dust173 = Main.dust[num464];
                                                dust173.velocity += (Vector2)(base.velocity * 0.2f);
                                                color5 = new Color();
                                                num464 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 1f);
                                                Dust dust174 = Main.dust[num464];
                                                dust174.velocity = (Vector2)(dust174.velocity * 2f);
                                                Dust dust175 = Main.dust[num464];
                                                dust175.velocity += (Vector2)(base.velocity * 0.3f);
                                            }
                                            for (int num466 = 0; num466 < 1; num466++)
                                            {
                                                vector240 = new Vector2();
                                                int num465 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), vector240, Main.rand.Next(0x3d, 0x40), 1f);
                                                Gore gore12 = Main.gore[num465];
                                                gore12.position += (Vector2)(base.velocity * 1.25f);
                                                Main.gore[num465].scale = 1.5f;
                                                Gore gore13 = Main.gore[num465];
                                                gore13.velocity += (Vector2)(base.velocity * 0.5f);
                                                Gore gore14 = Main.gore[num465];
                                                gore14.velocity = (Vector2)(gore14.velocity * 0.02f);
                                            }
                                            return;
                                        }
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 50)
                            {
                                if (this.type == 0x123)
                                {
                                    if (this.localAI[0] == 0f)
                                    {
                                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 20);
                                        this.localAI[0]++;
                                    }
                                    bool flag15 = false;
                                    bool flag16 = false;
                                    if ((this.velocity.X < 0f) && (this.position.X < this.ai[0]))
                                    {
                                        flag15 = true;
                                    }
                                    if ((this.velocity.X > 0f) && (this.position.X > this.ai[0]))
                                    {
                                        flag15 = true;
                                    }
                                    if ((this.velocity.Y < 0f) && (this.position.Y < this.ai[1]))
                                    {
                                        flag16 = true;
                                    }
                                    if ((this.velocity.Y > 0f) && (this.position.Y > this.ai[1]))
                                    {
                                        flag16 = true;
                                    }
                                    if (flag15 && flag16)
                                    {
                                        this.Kill();
                                    }
                                    for (int num467 = 0; num467 < 10; num467++)
                                    {
                                        color5 = new Color();
                                        int num468 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xae, 0f, 0f, 100, color5, 1.2f);
                                        Main.dust[num468].noGravity = true;
                                        Dust dust176 = Main.dust[num468];
                                        dust176.velocity = (Vector2)(dust176.velocity * 0.5f);
                                        Dust dust177 = Main.dust[num468];
                                        dust177.velocity += (Vector2)(base.velocity * 0.1f);
                                    }
                                    return;
                                }
                                if (this.type == 0x127)
                                {
                                    for (int num469 = 0; num469 < 8; num469++)
                                    {
                                        color5 = new Color();
                                        int num470 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xae, 0f, 0f, 100, color5, 1.2f);
                                        Main.dust[num470].noGravity = true;
                                        Dust dust178 = Main.dust[num470];
                                        dust178.velocity = (Vector2)(dust178.velocity * 0.5f);
                                        Dust dust179 = Main.dust[num470];
                                        dust179.velocity += (Vector2)(base.velocity * 0.1f);
                                    }
                                    return;
                                }
                                if (this.localAI[0] == 0f)
                                {
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x4a);
                                    this.localAI[0]++;
                                }
                                this.ai[0]++;
                                if (this.type == 0x128)
                                {
                                    this.ai[0] += 3f;
                                }
                                float num471 = 25f;
                                if (this.ai[0] > 180f)
                                {
                                    num471 -= (this.ai[0] - 180f) / 2f;
                                }
                                if (num471 <= 0f)
                                {
                                    num471 = 0f;
                                    this.Kill();
                                }
                                if (this.type == 0x128)
                                {
                                    num471 *= 0.7f;
                                }
                                for (int num472 = 0; num472 < num471; num472++)
                                {
                                    float num473 = Main.rand.Next(-10, 11);
                                    float num474 = Main.rand.Next(-10, 11);
                                    float num475 = Main.rand.Next(3, 9);
                                    float num476 = (float)Math.Sqrt((double)((num473 * num473) + (num474 * num474)));
                                    num476 = num475 / num476;
                                    num473 *= num476;
                                    num474 *= num476;
                                    color5 = new Color();
                                    int num477 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xae, 0f, 0f, 100, color5, 1.5f);
                                    Main.dust[num477].noGravity = true;
                                    Main.dust[num477].position.X = base.Center.X;
                                    Main.dust[num477].position.Y = base.Center.Y;
                                    Main.dust[num477].position.X += Main.rand.Next(-10, 11);
                                    Main.dust[num477].position.Y += Main.rand.Next(-10, 11);
                                    Main.dust[num477].velocity.X = num473;
                                    Main.dust[num477].velocity.Y = num474;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x33)
                            {
                                if (this.type == 0x129)
                                {
                                    this.localAI[0]++;
                                    if (this.localAI[0] > 4f)
                                    {
                                        for (int num478 = 0; num478 < 5; num478++)
                                        {
                                            color5 = new Color();
                                            int num479 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xaf, 0f, 0f, 100, color5, 2f);
                                            Main.dust[num479].noGravity = true;
                                            Dust dust180 = Main.dust[num479];
                                            dust180.velocity = (Vector2)(dust180.velocity * 0f);
                                        }
                                    }
                                }
                                else
                                {
                                    if (this.localAI[0] == 0f)
                                    {
                                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
                                        this.localAI[0]++;
                                    }
                                    for (int num480 = 0; num480 < 9; num480++)
                                    {
                                        color5 = new Color();
                                        int num481 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xaf, 0f, 0f, 100, color5, 1.3f);
                                        Main.dust[num481].noGravity = true;
                                        Dust dust181 = Main.dust[num481];
                                        dust181.velocity = (Vector2)(dust181.velocity * 0f);
                                    }
                                }
                                float num482 = base.Center.X;
                                float num483 = base.Center.Y;
                                float num484 = 400f;
                                bool flag17 = false;
                                if (this.type == 0x129)
                                {
                                    for (int num485 = 0; num485 < 200; num485++)
                                    {
                                        if (Main.npc[num485].CanBeChasedBy(this, false) && Collision.CanHit(base.Center, 1, 1, Main.npc[num485].Center, 1, 1))
                                        {
                                            float num486 = Main.npc[num485].position.X + (Main.npc[num485].width / 2);
                                            float num487 = Main.npc[num485].position.Y + (Main.npc[num485].height / 2);
                                            float introduced1759 = Math.Abs((float)((this.position.X + (base.width / 2)) - num486));
                                            float num488 = introduced1759 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num487));
                                            if (num488 < num484)
                                            {
                                                num484 = num488;
                                                num482 = num486;
                                                num483 = num487;
                                                flag17 = true;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    num484 = 200f;
                                    for (int num489 = 0; num489 < 0xff; num489++)
                                    {
                                        if (Main.player[num489].active && !Main.player[num489].dead)
                                        {
                                            float num490 = Main.player[num489].position.X + (Main.player[num489].width / 2);
                                            float num491 = Main.player[num489].position.Y + (Main.player[num489].height / 2);
                                            float introduced1760 = Math.Abs((float)((this.position.X + (base.width / 2)) - num490));
                                            float num492 = introduced1760 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num491));
                                            if (num492 < num484)
                                            {
                                                num484 = num492;
                                                num482 = num490;
                                                num483 = num491;
                                                flag17 = true;
                                            }
                                        }
                                    }
                                }
                                if (flag17)
                                {
                                    float num493 = 3f;
                                    if (this.type == 0x129)
                                    {
                                        num493 = 6f;
                                    }
                                    Vector2 vector47 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                    float num494 = num482 - vector47.X;
                                    float num495 = num483 - vector47.Y;
                                    float num496 = (float)Math.Sqrt((double)((num494 * num494) + (num495 * num495)));
                                    num496 = num493 / num496;
                                    num494 *= num496;
                                    num495 *= num496;
                                    if (this.type == 0x129)
                                    {
                                        this.velocity.X = ((this.velocity.X * 20f) + num494) / 21f;
                                        this.velocity.Y = ((this.velocity.Y * 20f) + num495) / 21f;
                                        return;
                                    }
                                    this.velocity.X = ((this.velocity.X * 100f) + num494) / 101f;
                                    this.velocity.Y = ((this.velocity.Y * 100f) + num495) / 101f;
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x34)
                            {
                                int num497 = (int)this.ai[0];
                                float num498 = 4f;
                                Vector2 vector48 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                float num499 = Main.player[num497].Center.X - vector48.X;
                                float num500 = Main.player[num497].Center.Y - vector48.Y;
                                float num501 = (float)Math.Sqrt((double)((num499 * num499) + (num500 * num500)));
                                if ((((num501 < 50f) && (this.position.X < (Main.player[num497].position.X + Main.player[num497].width))) && (((this.position.X + base.width) > Main.player[num497].position.X) && (this.position.Y < (Main.player[num497].position.Y + Main.player[num497].height)))) && ((this.position.Y + base.height) > Main.player[num497].position.Y))
                                {
                                    if ((this.owner == Main.myPlayer) && !Main.player[Main.myPlayer].moonLeech)
                                    {
                                        int healAmount = (int)this.ai[1];
                                        Main.player[num497].HealEffect(healAmount, false);
                                        Player player12 = Main.player[num497];
                                        player12.statLife += healAmount;
                                        if (Main.player[num497].statLife > Main.player[num497].statLifeMax2)
                                        {
                                            Main.player[num497].statLife = Main.player[num497].statLifeMax2;
                                        }
                                        NetMessage.SendData(0x42, -1, -1, "", num497, (float)healAmount, 0f, 0f, 0, 0, 0);
                                    }
                                    this.Kill();
                                }
                                num501 = num498 / num501;
                                num499 *= num501;
                                num500 *= num501;
                                this.velocity.X = ((this.velocity.X * 15f) + num499) / 16f;
                                this.velocity.Y = ((this.velocity.Y * 15f) + num500) / 16f;
                                if (this.type == 0x131)
                                {
                                    for (int num503 = 0; num503 < 3; num503++)
                                    {
                                        float num504 = (this.velocity.X * 0.334f) * num503;
                                        float num505 = -(this.velocity.Y * 0.334f) * num503;
                                        color5 = new Color();
                                        int num506 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xb7, 0f, 0f, 100, color5, 1.1f);
                                        Main.dust[num506].noGravity = true;
                                        Dust dust182 = Main.dust[num506];
                                        dust182.velocity = (Vector2)(dust182.velocity * 0f);
                                        Main.dust[num506].position.X -= num504;
                                        Main.dust[num506].position.Y -= num505;
                                    }
                                    return;
                                }
                                for (int num507 = 0; num507 < 5; num507++)
                                {
                                    float num508 = (this.velocity.X * 0.2f) * num507;
                                    float num509 = -(this.velocity.Y * 0.2f) * num507;
                                    color5 = new Color();
                                    int num510 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xaf, 0f, 0f, 100, color5, 1.3f);
                                    Main.dust[num510].noGravity = true;
                                    Dust dust183 = Main.dust[num510];
                                    dust183.velocity = (Vector2)(dust183.velocity * 0f);
                                    Main.dust[num510].position.X -= num508;
                                    Main.dust[num510].position.Y -= num509;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x35)
                            {
                                if (this.localAI[0] == 0f)
                                {
                                    this.localAI[1] = 1f;
                                    this.localAI[0] = 1f;
                                    this.ai[0] = 120f;
                                    int num511 = 80;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x2e);
                                    if (this.type == 0x134)
                                    {
                                        for (int num512 = 0; num512 < num511; num512++)
                                        {
                                            color5 = new Color();
                                            int num513 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 16f), base.width, base.height - 0x10, 0xb9, 0f, 0f, 0, color5, 1f);
                                            Dust dust184 = Main.dust[num513];
                                            dust184.velocity = (Vector2)(dust184.velocity * 2f);
                                            Main.dust[num513].noGravity = true;
                                            Dust dust185 = Main.dust[num513];
                                            dust185.scale *= 1.15f;
                                        }
                                    }
                                    if (this.type == 0x179)
                                    {
                                        this.frame = 4;
                                        num511 = 40;
                                        for (int num514 = 0; num514 < num511; num514++)
                                        {
                                            color5 = new Color();
                                            int num515 = Dust.NewDust(base.position + ((Vector2)(Vector2.UnitY * 16f)), base.width, base.height - 0x10, 0xab, 0f, 0f, 100, color5, 1f);
                                            Main.dust[num515].scale = Main.rand.Next(1, 10) * 0.1f;
                                            Main.dust[num515].noGravity = true;
                                            Main.dust[num515].fadeIn = 1.5f;
                                            Dust dust186 = Main.dust[num515];
                                            dust186.velocity = (Vector2)(dust186.velocity * 0.75f);
                                        }
                                    }
                                }
                                this.velocity.X = 0f;
                                this.velocity.Y += 0.2f;
                                if (this.velocity.Y > 16f)
                                {
                                    this.velocity.Y = 16f;
                                }
                                bool flag18 = false;
                                float num516 = base.Center.X;
                                float num517 = base.Center.Y;
                                float num518 = 1000f;
                                for (int num519 = 0; num519 < 200; num519++)
                                {
                                    if (Main.npc[num519].CanBeChasedBy(this, false))
                                    {
                                        float num520 = Main.npc[num519].position.X + (Main.npc[num519].width / 2);
                                        float num521 = Main.npc[num519].position.Y + (Main.npc[num519].height / 2);
                                        float introduced1767 = Math.Abs((float)((this.position.X + (base.width / 2)) - num520));
                                        float num522 = introduced1767 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num521));
                                        if ((num522 < num518) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num519].position, Main.npc[num519].width, Main.npc[num519].height))
                                        {
                                            num518 = num522;
                                            num516 = num520;
                                            num517 = num521;
                                            flag18 = true;
                                        }
                                    }
                                }
                                if (!flag18)
                                {
                                    if ((this.ai[0] <= 60f) && (((this.frame == 1) || (this.frame == 3)) || (((this.frame == 5) || (this.frame == 7)) || (this.frame == 9))))
                                    {
                                        this.frame--;
                                    }
                                }
                                else
                                {
                                    float num523 = num516;
                                    float num524 = num517;
                                    num516 -= base.Center.X;
                                    num517 -= base.Center.Y;
                                    int num525 = 0;
                                    if (num516 < 0f)
                                    {
                                        this.spriteDirection = -1;
                                    }
                                    else
                                    {
                                        this.spriteDirection = 1;
                                    }
                                    if (num517 > 0f)
                                    {
                                        num525 = 0;
                                    }
                                    else if (Math.Abs(num517) > (Math.Abs(num516) * 3f))
                                    {
                                        num525 = 4;
                                    }
                                    else if (Math.Abs(num517) > (Math.Abs(num516) * 2f))
                                    {
                                        num525 = 3;
                                    }
                                    else if (Math.Abs(num516) > (Math.Abs(num517) * 3f))
                                    {
                                        num525 = 0;
                                    }
                                    else if (Math.Abs(num516) > (Math.Abs(num517) * 2f))
                                    {
                                        num525 = 1;
                                    }
                                    else
                                    {
                                        num525 = 2;
                                    }
                                    if (this.type == 0x134)
                                    {
                                        this.frame = num525 * 2;
                                    }
                                    else if (this.type == 0x179)
                                    {
                                        this.frame = num525;
                                    }
                                    if (((this.ai[0] > 40f) && (this.localAI[1] == 0f)) && (this.type == 0x134))
                                    {
                                        this.frame++;
                                    }
                                    if (this.ai[0] <= 0f)
                                    {
                                        this.localAI[1] = 0f;
                                        this.ai[0] = 60f;
                                        if (Main.myPlayer == this.owner)
                                        {
                                            float num526 = 6f;
                                            int num527 = 0x135;
                                            if (this.type == 0x179)
                                            {
                                                num527 = 0x17a;
                                                num526 = 9f;
                                            }
                                            Vector2 vector49 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                            switch (num525)
                                            {
                                                case 0:
                                                    vector49.Y += 12f;
                                                    vector49.X += 0x18 * this.spriteDirection;
                                                    break;

                                                case 1:
                                                    vector49.Y += 0f;
                                                    vector49.X += 0x18 * this.spriteDirection;
                                                    break;

                                                case 2:
                                                    vector49.Y -= 2f;
                                                    vector49.X += 0x18 * this.spriteDirection;
                                                    break;

                                                case 3:
                                                    vector49.Y -= 6f;
                                                    vector49.X += 14 * this.spriteDirection;
                                                    break;

                                                case 4:
                                                    vector49.Y -= 14f;
                                                    vector49.X += 2 * this.spriteDirection;
                                                    break;
                                            }
                                            if (this.spriteDirection < 0)
                                            {
                                                vector49.X += 10f;
                                            }
                                            float num528 = num523 - vector49.X;
                                            float num529 = num524 - vector49.Y;
                                            float num530 = (float)Math.Sqrt((double)((num528 * num528) + (num529 * num529)));
                                            num530 = num526 / num530;
                                            num528 *= num530;
                                            num529 *= num530;
                                            int num531 = this.damage;
                                            NewProjectile(vector49.X, vector49.Y, num528, num529, num527, num531, this.knockBack, Main.myPlayer, 0f, 0f);
                                        }
                                    }
                                }
                                if (this.ai[0] > 0f)
                                {
                                    this.ai[0]--;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x36)
                            {
                                if (this.type == 0x13d)
                                {
                                    if (Main.player[Main.myPlayer].dead)
                                    {
                                        Main.player[Main.myPlayer].raven = false;
                                    }
                                    if (Main.player[Main.myPlayer].raven)
                                    {
                                        this.timeLeft = 2;
                                    }
                                }
                                for (int num532 = 0; num532 < 0x3e8; num532++)
                                {
                                    if (((num532 != base.whoAmI) && Main.projectile[num532].active) && ((Main.projectile[num532].owner == this.owner) && (Main.projectile[num532].type == this.type)))
                                    {
                                        float introduced1768 = Math.Abs((float)(this.position.X - Main.projectile[num532].position.X));
                                        if ((introduced1768 + Math.Abs((float)(this.position.Y - Main.projectile[num532].position.Y))) < base.width)
                                        {
                                            if (this.position.X < Main.projectile[num532].position.X)
                                            {
                                                this.velocity.X -= 0.05f;
                                            }
                                            else
                                            {
                                                this.velocity.X += 0.05f;
                                            }
                                            if (this.position.Y < Main.projectile[num532].position.Y)
                                            {
                                                this.velocity.Y -= 0.05f;
                                            }
                                            else
                                            {
                                                this.velocity.Y += 0.05f;
                                            }
                                        }
                                    }
                                }
                                float num533 = this.position.X;
                                float num534 = this.position.Y;
                                float num535 = 900f;
                                bool flag19 = false;
                                int num536 = 500;
                                if ((this.ai[1] != 0f) || this.friendly)
                                {
                                    num536 = 0x578;
                                }
                                if ((Math.Abs((float)(base.Center.X - Main.player[this.owner].Center.X)) + Math.Abs((float)(base.Center.Y - Main.player[this.owner].Center.Y))) > num536)
                                {
                                    this.ai[0] = 1f;
                                }
                                if (this.ai[0] == 0f)
                                {
                                    this.tileCollide = true;
                                    for (int num537 = 0; num537 < 200; num537++)
                                    {
                                        if (Main.npc[num537].CanBeChasedBy(this, false))
                                        {
                                            float num538 = Main.npc[num537].position.X + (Main.npc[num537].width / 2);
                                            float num539 = Main.npc[num537].position.Y + (Main.npc[num537].height / 2);
                                            float introduced1769 = Math.Abs((float)((this.position.X + (base.width / 2)) - num538));
                                            float num540 = introduced1769 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num539));
                                            if ((num540 < num535) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num537].position, Main.npc[num537].width, Main.npc[num537].height))
                                            {
                                                num535 = num540;
                                                num533 = num538;
                                                num534 = num539;
                                                flag19 = true;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    this.tileCollide = false;
                                }
                                if (flag19)
                                {
                                    if (this.ai[1] == -1f)
                                    {
                                        this.ai[1] = 17f;
                                    }
                                    if (this.ai[1] > 0f)
                                    {
                                        this.ai[1]--;
                                    }
                                    if (this.ai[1] == 0f)
                                    {
                                        this.friendly = true;
                                        float num545 = 8f;
                                        Vector2 vector51 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                        float num546 = num533 - vector51.X;
                                        float num547 = num534 - vector51.Y;
                                        float num548 = (float)Math.Sqrt((double)((num546 * num546) + (num547 * num547)));
                                        if (num548 < 100f)
                                        {
                                            num545 = 10f;
                                        }
                                        num548 = num545 / num548;
                                        num546 *= num548;
                                        num547 *= num548;
                                        this.velocity.X = ((this.velocity.X * 14f) + num546) / 15f;
                                        this.velocity.Y = ((this.velocity.Y * 14f) + num547) / 15f;
                                    }
                                    else
                                    {
                                        this.friendly = false;
                                        float introduced1770 = Math.Abs(this.velocity.X);
                                        if ((introduced1770 + Math.Abs(this.velocity.Y)) < 10f)
                                        {
                                            base.velocity = (Vector2)(base.velocity * 1.05f);
                                        }
                                    }
                                    this.rotation = this.velocity.X * 0.05f;
                                    this.frameCounter++;
                                    if (this.frameCounter >= 4)
                                    {
                                        this.frameCounter = 0;
                                        this.frame++;
                                    }
                                    if (this.frame < 4)
                                    {
                                        this.frame = 4;
                                    }
                                    if (this.frame > 7)
                                    {
                                        this.frame = 4;
                                    }
                                    if (Math.Abs(this.velocity.X) > 0.2)
                                    {
                                        this.spriteDirection = -base.direction;
                                        return;
                                    }
                                }
                                else
                                {
                                    this.friendly = true;
                                    float num541 = 8f;
                                    if (this.ai[0] == 1f)
                                    {
                                        num541 = 12f;
                                    }
                                    Vector2 vector50 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                    float num542 = Main.player[this.owner].Center.X - vector50.X;
                                    float num543 = (Main.player[this.owner].Center.Y - vector50.Y) - 60f;
                                    float num544 = (float)Math.Sqrt((double)((num542 * num542) + (num543 * num543)));
                                    if (((num544 < 100f) && (this.ai[0] == 1f)) && !Collision.SolidCollision(base.position, base.width, base.height))
                                    {
                                        this.ai[0] = 0f;
                                    }
                                    if (num544 > 2000f)
                                    {
                                        this.position.X = Main.player[this.owner].Center.X - (base.width / 2);
                                        this.position.Y = Main.player[this.owner].Center.Y - (base.width / 2);
                                    }
                                    if (num544 > 70f)
                                    {
                                        num544 = num541 / num544;
                                        num542 *= num544;
                                        num543 *= num544;
                                        this.velocity.X = ((this.velocity.X * 20f) + num542) / 21f;
                                        this.velocity.Y = ((this.velocity.Y * 20f) + num543) / 21f;
                                    }
                                    else
                                    {
                                        if ((this.velocity.X == 0f) && (this.velocity.Y == 0f))
                                        {
                                            this.velocity.X = -0.15f;
                                            this.velocity.Y = -0.05f;
                                        }
                                        base.velocity = (Vector2)(base.velocity * 1.01f);
                                    }
                                    this.friendly = false;
                                    this.rotation = this.velocity.X * 0.05f;
                                    this.frameCounter++;
                                    if (this.frameCounter >= 4)
                                    {
                                        this.frameCounter = 0;
                                        this.frame++;
                                    }
                                    if (this.frame > 3)
                                    {
                                        this.frame = 0;
                                    }
                                    if (Math.Abs(this.velocity.X) > 0.2)
                                    {
                                        this.spriteDirection = -base.direction;
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x37)
                            {
                                this.frameCounter++;
                                if (this.frameCounter > 0)
                                {
                                    this.frame++;
                                    this.frameCounter = 0;
                                    if (this.frame > 2)
                                    {
                                        this.frame = 0;
                                    }
                                }
                                if (this.velocity.X < 0f)
                                {
                                    this.spriteDirection = -1;
                                    this.rotation = (float)Math.Atan2((double)-this.velocity.Y, (double)-this.velocity.X);
                                }
                                else
                                {
                                    this.spriteDirection = 1;
                                    this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                }
                                if ((this.ai[0] >= 0f) && (this.ai[0] < 200f))
                                {
                                    int num549 = (int)this.ai[0];
                                    if (Main.npc[num549].active)
                                    {
                                        float num550 = 8f;
                                        Vector2 vector52 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                        float num551 = Main.npc[num549].position.X - vector52.X;
                                        float num552 = Main.npc[num549].position.Y - vector52.Y;
                                        float num553 = (float)Math.Sqrt((double)((num551 * num551) + (num552 * num552)));
                                        num553 = num550 / num553;
                                        num551 *= num553;
                                        num552 *= num553;
                                        this.velocity.X = ((this.velocity.X * 14f) + num551) / 15f;
                                        this.velocity.Y = ((this.velocity.Y * 14f) + num552) / 15f;
                                    }
                                    else
                                    {
                                        float num554 = 1000f;
                                        for (int num555 = 0; num555 < 200; num555++)
                                        {
                                            if (Main.npc[num555].CanBeChasedBy(this, false))
                                            {
                                                float num556 = Main.npc[num555].position.X + (Main.npc[num555].width / 2);
                                                float num557 = Main.npc[num555].position.Y + (Main.npc[num555].height / 2);
                                                float introduced1771 = Math.Abs((float)((this.position.X + (base.width / 2)) - num556));
                                                float num558 = introduced1771 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num557));
                                                if ((num558 < num554) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num555].position, Main.npc[num555].width, Main.npc[num555].height))
                                                {
                                                    num554 = num558;
                                                    this.ai[0] = num555;
                                                }
                                            }
                                        }
                                    }
                                    int num559 = 8;
                                    int num560 = Dust.NewDust(new Vector2(this.position.X + num559, this.position.Y + num559), base.width - (num559 * 2), base.height - (num559 * 2), 6, 0f, 0f, 0, new Color(), 1f);
                                    Dust dust187 = Main.dust[num560];
                                    dust187.velocity = (Vector2)(dust187.velocity * 0.5f);
                                    Dust dust188 = Main.dust[num560];
                                    dust188.velocity += (Vector2)(base.velocity * 0.5f);
                                    Main.dust[num560].noGravity = true;
                                    Main.dust[num560].noLight = true;
                                    Main.dust[num560].scale = 1.4f;
                                    return;
                                }
                                this.Kill();
                                return;
                            }
                            if (this.aiStyle == 0x38)
                            {
                                if (this.localAI[0] == 0f)
                                {
                                    this.localAI[0] = 1f;
                                    this.rotation = this.ai[0];
                                    this.spriteDirection = -((int)this.ai[1]);
                                }
                                float introduced1774 = Math.Abs(this.velocity.X);
                                if ((introduced1774 + Math.Abs(this.velocity.Y)) < 16f)
                                {
                                    base.velocity = (Vector2)(base.velocity * 1.05f);
                                }
                                if (this.velocity.X < 0f)
                                {
                                    base.direction = -1;
                                }
                                else
                                {
                                    base.direction = 1;
                                }
                                float introduced1775 = Math.Abs(this.velocity.X);
                                this.rotation += ((introduced1775 + Math.Abs(this.velocity.Y)) * 0.025f) * base.direction;
                                return;
                            }
                            if (this.aiStyle == 0x39)
                            {
                                this.ai[0]++;
                                if (this.ai[0] > 30f)
                                {
                                    this.ai[0] = 30f;
                                    this.velocity.Y += 0.25f;
                                    if (this.velocity.Y > 16f)
                                    {
                                        this.velocity.Y = 16f;
                                    }
                                    this.velocity.X *= 0.995f;
                                }
                                this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                                this.alpha -= 50;
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                                if (this.owner == Main.myPlayer)
                                {
                                    this.localAI[0]++;
                                    if (this.localAI[0] >= 4f)
                                    {
                                        this.localAI[0] = 0f;
                                        int num561 = 0;
                                        for (int num562 = 0; num562 < 0x3e8; num562++)
                                        {
                                            if ((Main.projectile[num562].active && (Main.projectile[num562].owner == this.owner)) && (Main.projectile[num562].type == 0x158))
                                            {
                                                num561++;
                                            }
                                        }
                                        float num563 = this.damage * 0.8f;
                                        float num564 = 1f;
                                        if (num561 > 100)
                                        {
                                            num564 = num561 - 100;
                                            num564 = 1f - (num564 / 100f);
                                            num563 *= num564;
                                        }
                                        if (num561 > 100)
                                        {
                                            this.localAI[0]--;
                                        }
                                        if (num561 > 120)
                                        {
                                            this.localAI[0]--;
                                        }
                                        if (num561 > 140)
                                        {
                                            this.localAI[0]--;
                                        }
                                        if (num561 > 150)
                                        {
                                            this.localAI[0]--;
                                        }
                                        if (num561 > 160)
                                        {
                                            this.localAI[0]--;
                                        }
                                        if (num561 > 0xa5)
                                        {
                                            this.localAI[0]--;
                                        }
                                        if (num561 > 170)
                                        {
                                            this.localAI[0] -= 2f;
                                        }
                                        if (num561 > 0xaf)
                                        {
                                            this.localAI[0] -= 3f;
                                        }
                                        if (num561 > 180)
                                        {
                                            this.localAI[0] -= 4f;
                                        }
                                        if (num561 > 0xb9)
                                        {
                                            this.localAI[0] -= 5f;
                                        }
                                        if (num561 > 190)
                                        {
                                            this.localAI[0] -= 6f;
                                        }
                                        if (num561 > 0xc3)
                                        {
                                            this.localAI[0] -= 7f;
                                        }
                                        if (num563 > (this.damage * 0.1f))
                                        {
                                            NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 0x158, (int)num563, this.knockBack * 0.55f, this.owner, 0f, (float)Main.rand.Next(3));
                                            return;
                                        }
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x3a)
                            {
                                this.alpha -= 50;
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                                if (this.ai[0] == 0f)
                                {
                                    this.frame = 0;
                                    this.ai[1]++;
                                    if (this.ai[1] > 30f)
                                    {
                                        this.velocity.Y += 0.1f;
                                    }
                                    if (this.velocity.Y >= 0f)
                                    {
                                        this.ai[0] = 1f;
                                    }
                                }
                                if (this.ai[0] == 1f)
                                {
                                    this.frame = 1;
                                    this.velocity.Y += 0.1f;
                                    if (this.velocity.Y > 3f)
                                    {
                                        this.velocity.Y = 3f;
                                    }
                                    this.velocity.X *= 0.99f;
                                }
                                this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                                return;
                            }
                            if (this.aiStyle == 0x3b)
                            {
                                this.ai[1]++;
                                if (this.ai[1] >= 60f)
                                {
                                    this.friendly = true;
                                    int num565 = (int)this.ai[0];
                                    if (!Main.npc[num565].active)
                                    {
                                        num565 = -1;
                                        int[] numArray2 = new int[200];
                                        int num566 = 0;
                                        for (int num567 = 0; num567 < 200; num567++)
                                        {
                                            if (Main.npc[num567].CanBeChasedBy(this, false))
                                            {
                                                float introduced1776 = Math.Abs((float)(((Main.npc[num567].position.X + (Main.npc[num567].width / 2)) - this.position.X) + (base.width / 2)));
                                                float num568 = introduced1776 + Math.Abs((float)(((Main.npc[num567].position.Y + (Main.npc[num567].height / 2)) - this.position.Y) + (base.height / 2)));
                                                if (num568 < 800f)
                                                {
                                                    numArray2[num566] = num567;
                                                    num566++;
                                                }
                                            }
                                        }
                                        if (num566 == 0)
                                        {
                                            this.Kill();
                                            return;
                                        }
                                        num565 = numArray2[Main.rand.Next(num566)];
                                        this.ai[0] = num565;
                                    }
                                    float num569 = 4f;
                                    Vector2 vector53 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                    float num570 = Main.npc[num565].Center.X - vector53.X;
                                    float num571 = Main.npc[num565].Center.Y - vector53.Y;
                                    float num572 = (float)Math.Sqrt((double)((num570 * num570) + (num571 * num571)));
                                    num572 = num569 / num572;
                                    num570 *= num572;
                                    num571 *= num572;
                                    int num573 = 30;
                                    this.velocity.X = ((this.velocity.X * (num573 - 1)) + num570) / ((float)num573);
                                    this.velocity.Y = ((this.velocity.Y * (num573 - 1)) + num571) / ((float)num573);
                                }
                                for (int num574 = 0; num574 < 5; num574++)
                                {
                                    float num575 = (this.velocity.X * 0.2f) * num574;
                                    float num576 = -(this.velocity.Y * 0.2f) * num574;
                                    color5 = new Color();
                                    int num577 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xaf, 0f, 0f, 100, color5, 1.3f);
                                    Main.dust[num577].noGravity = true;
                                    Dust dust189 = Main.dust[num577];
                                    dust189.velocity = (Vector2)(dust189.velocity * 0f);
                                    Main.dust[num577].position.X -= num575;
                                    Main.dust[num577].position.Y -= num576;
                                }
                                return;
                            }
                            if (this.aiStyle == 60)
                            {
                                this.scale -= 0.015f;
                                if (this.scale <= 0f)
                                {
                                    base.velocity = (Vector2)(base.velocity * 5f);
                                    base.oldVelocity = base.velocity;
                                    this.Kill();
                                }
                                if (this.ai[0] <= 3f)
                                {
                                    this.ai[0]++;
                                    return;
                                }
                                int num578 = 0x67;
                                if (this.type == 0x196)
                                {
                                    num578 = 0x89;
                                }
                                if (this.owner == Main.myPlayer)
                                {
                                    Rectangle rectangle7 = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height);
                                    for (int num579 = 0; num579 < 200; num579++)
                                    {
                                        if ((Main.npc[num579].active && !Main.npc[num579].dontTakeDamage) && (Main.npc[num579].lifeMax > 1))
                                        {
                                            Rectangle rectangle8 = new Rectangle((int)Main.npc[num579].position.X, (int)Main.npc[num579].position.Y, Main.npc[num579].width, Main.npc[num579].height);
                                            if (rectangle7.Intersects(rectangle8))
                                            {
                                                Main.npc[num579].AddBuff(num578, 0x5dc, false);
                                                this.Kill();
                                            }
                                        }
                                    }
                                    for (int num580 = 0; num580 < 0xff; num580++)
                                    {
                                        if (((num580 != this.owner) && Main.player[num580].active) && !Main.player[num580].dead)
                                        {
                                            Rectangle rectangle9 = new Rectangle((int)Main.player[num580].position.X, (int)Main.player[num580].position.Y, Main.player[num580].width, Main.player[num580].height);
                                            if (rectangle7.Intersects(rectangle9))
                                            {
                                                Main.player[num580].AddBuff(num578, 0x5dc, false);
                                                this.Kill();
                                            }
                                        }
                                    }
                                }
                                this.ai[0] += this.ai[1];
                                if (this.ai[0] > 30f)
                                {
                                    this.velocity.Y += 0.1f;
                                }
                                if (this.type == 0x166)
                                {
                                    for (int num581 = 0; num581 < 1; num581++)
                                    {
                                        for (int num582 = 0; num582 < 6; num582++)
                                        {
                                            float num583 = (this.velocity.X / 6f) * num582;
                                            float num584 = (this.velocity.Y / 6f) * num582;
                                            int num585 = 6;
                                            color5 = new Color();
                                            int num586 = Dust.NewDust(new Vector2(this.position.X + num585, this.position.Y + num585), base.width - (num585 * 2), base.height - (num585 * 2), 0xd3, 0f, 0f, 0x4b, color5, 1.2f);
                                            if (Main.rand.Next(2) == 0)
                                            {
                                                Dust dust190 = Main.dust[num586];
                                                dust190.alpha += 0x19;
                                            }
                                            if (Main.rand.Next(2) == 0)
                                            {
                                                Dust dust191 = Main.dust[num586];
                                                dust191.alpha += 0x19;
                                            }
                                            if (Main.rand.Next(2) == 0)
                                            {
                                                Dust dust192 = Main.dust[num586];
                                                dust192.alpha += 0x19;
                                            }
                                            Main.dust[num586].noGravity = true;
                                            Dust dust193 = Main.dust[num586];
                                            dust193.velocity = (Vector2)(dust193.velocity * 0.3f);
                                            Dust dust194 = Main.dust[num586];
                                            dust194.velocity += (Vector2)(base.velocity * 0.5f);
                                            Main.dust[num586].position = base.Center;
                                            Main.dust[num586].position.X -= num583;
                                            Main.dust[num586].position.Y -= num584;
                                            Dust dust195 = Main.dust[num586];
                                            dust195.velocity = (Vector2)(dust195.velocity * 0.2f);
                                        }
                                        if (Main.rand.Next(4) == 0)
                                        {
                                            int num587 = 6;
                                            color5 = new Color();
                                            int num588 = Dust.NewDust(new Vector2(this.position.X + num587, this.position.Y + num587), base.width - (num587 * 2), base.height - (num587 * 2), 0xd3, 0f, 0f, 0x4b, color5, 0.65f);
                                            Dust dust196 = Main.dust[num588];
                                            dust196.velocity = (Vector2)(dust196.velocity * 0.5f);
                                            Dust dust197 = Main.dust[num588];
                                            dust197.velocity += (Vector2)(base.velocity * 0.5f);
                                        }
                                    }
                                }
                                if (this.type == 0x196)
                                {
                                    int num589 = 0xaf;
                                    Color newColor = new Color(0, 80, 0xff, 100);
                                    for (int num590 = 0; num590 < 6; num590++)
                                    {
                                        Vector2 vector54 = (Vector2)((base.velocity * num590) / 6f);
                                        int num591 = 6;
                                        int num592 = Dust.NewDust(base.position + ((Vector2)(Vector2.One * 6f)), base.width - (num591 * 2), base.height - (num591 * 2), 4, 0f, 0f, num589, newColor, 1.2f);
                                        if (Main.rand.Next(2) == 0)
                                        {
                                            Dust dust198 = Main.dust[num592];
                                            dust198.alpha += 0x19;
                                        }
                                        if (Main.rand.Next(2) == 0)
                                        {
                                            Dust dust199 = Main.dust[num592];
                                            dust199.alpha += 0x19;
                                        }
                                        if (Main.rand.Next(2) == 0)
                                        {
                                            Dust dust200 = Main.dust[num592];
                                            dust200.alpha += 0x19;
                                        }
                                        Main.dust[num592].noGravity = true;
                                        Dust dust201 = Main.dust[num592];
                                        dust201.velocity = (Vector2)(dust201.velocity * 0.3f);
                                        Dust dust202 = Main.dust[num592];
                                        dust202.velocity += (Vector2)(base.velocity * 0.5f);
                                        Main.dust[num592].position = base.Center;
                                        Main.dust[num592].position.X -= vector54.X;
                                        Main.dust[num592].position.Y -= vector54.Y;
                                        Dust dust203 = Main.dust[num592];
                                        dust203.velocity = (Vector2)(dust203.velocity * 0.2f);
                                    }
                                    if (Main.rand.Next(4) == 0)
                                    {
                                        int num593 = 6;
                                        int num594 = Dust.NewDust(base.position + ((Vector2)(Vector2.One * 6f)), base.width - (num593 * 2), base.height - (num593 * 2), 4, 0f, 0f, num589, newColor, 1.2f);
                                        Dust dust204 = Main.dust[num594];
                                        dust204.velocity = (Vector2)(dust204.velocity * 0.5f);
                                        Dust dust205 = Main.dust[num594];
                                        dust205.velocity += (Vector2)(base.velocity * 0.5f);
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x3d)
                            {
                                this.timeLeft = 60;
                                if (((Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].fishingPole == 0) || Main.player[this.owner].calmed) || Main.player[this.owner].noItems)
                                {
                                    this.Kill();
                                }
                                else if (Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].shoot != this.type)
                                {
                                    this.Kill();
                                }
                                else if (Main.player[this.owner].pulley)
                                {
                                    this.Kill();
                                }
                                else if (Main.player[this.owner].dead)
                                {
                                    this.Kill();
                                }
                                if ((this.ai[1] > 0f) && (this.localAI[1] >= 0f))
                                {
                                    this.localAI[1] = -1f;
                                    if (!base.lavaWet && !base.honeyWet)
                                    {
                                        for (int num595 = 0; num595 < 100; num595++)
                                        {
                                            color5 = new Color();
                                            int num596 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y - 10f), base.width + 12, 0x18, Dust.dustWater(), 0f, 0f, 0, color5, 1f);
                                            Main.dust[num596].velocity.Y -= 4f;
                                            Main.dust[num596].velocity.X *= 2.5f;
                                            Main.dust[num596].scale = 0.8f;
                                            Main.dust[num596].alpha = 100;
                                            Main.dust[num596].noGravity = true;
                                        }
                                        Main.PlaySound(0x13, (int)this.position.X, (int)this.position.Y, 0);
                                    }
                                }
                                if (this.ai[0] >= 1f)
                                {
                                    if (this.ai[0] == 2f)
                                    {
                                        this.ai[0]++;
                                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x11);
                                        if (!base.lavaWet && !base.honeyWet)
                                        {
                                            for (int num597 = 0; num597 < 100; num597++)
                                            {
                                                color5 = new Color();
                                                int num598 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y - 10f), base.width + 12, 0x18, Dust.dustWater(), 0f, 0f, 0, color5, 1f);
                                                Main.dust[num598].velocity.Y -= 4f;
                                                Main.dust[num598].velocity.X *= 2.5f;
                                                Main.dust[num598].scale = 0.8f;
                                                Main.dust[num598].alpha = 100;
                                                Main.dust[num598].noGravity = true;
                                            }
                                            Main.PlaySound(0x13, (int)this.position.X, (int)this.position.Y, 0);
                                        }
                                    }
                                    if (this.localAI[0] < 100f)
                                    {
                                        this.localAI[0]++;
                                    }
                                    this.tileCollide = false;
                                    float num599 = 15.9f;
                                    int num600 = 10;
                                    Vector2 vector55 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                    float num601 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector55.X;
                                    float num602 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector55.Y;
                                    float num603 = (float)Math.Sqrt((double)((num601 * num601) + (num602 * num602)));
                                    if (num603 > 3000f)
                                    {
                                        this.Kill();
                                    }
                                    num603 = num599 / num603;
                                    num601 *= num603;
                                    num602 *= num603;
                                    this.velocity.X = ((this.velocity.X * (num600 - 1)) + num601) / ((float)num600);
                                    this.velocity.Y = ((this.velocity.Y * (num600 - 1)) + num602) / ((float)num600);
                                    if (Main.myPlayer == this.owner)
                                    {
                                        Rectangle rectangle10 = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height);
                                        Rectangle rectangle11 = new Rectangle((int)Main.player[this.owner].position.X, (int)Main.player[this.owner].position.Y, Main.player[this.owner].width, Main.player[this.owner].height);
                                        if (rectangle10.Intersects(rectangle11))
                                        {
                                            if ((this.ai[1] > 0f) && (this.ai[1] < 3602f))
                                            {
                                                int num604 = (int)this.ai[1];
                                                Item newItem = new Item();
                                                newItem.SetDefaults(num604, false);
                                                switch (num604)
                                                {
                                                    case 0xc7c:
                                                        {
                                                            int num605 = Main.player[this.owner].FishingLevel();
                                                            int minValue = ((num605 / 20) + 3) / 2;
                                                            int num607 = ((num605 / 10) + 6) / 2;
                                                            if (Main.rand.Next(50) < num605)
                                                            {
                                                                num607++;
                                                            }
                                                            if (Main.rand.Next(100) < num605)
                                                            {
                                                                num607++;
                                                            }
                                                            if (Main.rand.Next(150) < num605)
                                                            {
                                                                num607++;
                                                            }
                                                            if (Main.rand.Next(200) < num605)
                                                            {
                                                                num607++;
                                                            }
                                                            int num608 = Main.rand.Next(minValue, num607 + 1);
                                                            newItem.stack = num608;
                                                            break;
                                                        }
                                                    case 0xc7d:
                                                        {
                                                            int num609 = Main.player[this.owner].FishingLevel();
                                                            int num610 = ((num609 / 4) + 15) / 2;
                                                            int num611 = ((num609 / 2) + 30) / 2;
                                                            if (Main.rand.Next(50) < num609)
                                                            {
                                                                num611 += 4;
                                                            }
                                                            if (Main.rand.Next(100) < num609)
                                                            {
                                                                num611 += 4;
                                                            }
                                                            if (Main.rand.Next(150) < num609)
                                                            {
                                                                num611 += 4;
                                                            }
                                                            if (Main.rand.Next(200) < num609)
                                                            {
                                                                num611 += 4;
                                                            }
                                                            int num612 = Main.rand.Next(num610, num611 + 1);
                                                            newItem.stack = num612;
                                                            break;
                                                        }
                                                }
                                                newItem.newAndShiny = true;
                                                if (Main.player[this.owner].GetItem(this.owner, newItem, false, false).stack > 0)
                                                {
                                                    int num613 = Item.NewItem((int)this.position.X, (int)this.position.Y, base.width, base.height, num604, 1, false, 0, true);
                                                    if (Main.netMode == 1)
                                                    {
                                                        NetMessage.SendData(0x15, -1, -1, "", num613, 1f, 0f, 0f, 0, 0, 0);
                                                    }
                                                }
                                                else
                                                {
                                                    newItem.position.X = base.Center.X - (newItem.width / 2);
                                                    newItem.position.Y = base.Center.Y - (newItem.height / 2);
                                                    newItem.active = true;
                                                    ItemText.NewText(newItem, 0, false, false);
                                                }
                                            }
                                            this.Kill();
                                        }
                                    }
                                    this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                                    return;
                                }
                                bool flag20 = false;
                                Vector2 vector56 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                float num614 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector56.X;
                                float num615 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector56.Y;
                                this.rotation = ((float)Math.Atan2((double)num615, (double)num614)) + 1.57f;
                                float num616 = (float)Math.Sqrt((double)((num614 * num614) + (num615 * num615)));
                                if (num616 > 900f)
                                {
                                    this.ai[0] = 1f;
                                }
                                if (base.wet)
                                {
                                    this.rotation = 0f;
                                    this.velocity.X *= 0.9f;
                                    int num617 = (((int)base.Center.X) + (((base.width / 2) + 8) * base.direction)) / 0x10;
                                    int num618 = (int)(base.Center.Y / 16f);
                                    float single1 = this.position.Y / 16f;
                                    int num619 = (int)((this.position.Y + base.height) / 16f);
                                    if (Main.tile[num617, num618] == null)
                                    {
                                        Main.tile[num617, num618] = new Tile();
                                    }
                                    if (Main.tile[num617, num619] == null)
                                    {
                                        Main.tile[num617, num619] = new Tile();
                                    }
                                    if (this.velocity.Y > 0f)
                                    {
                                        this.velocity.Y *= 0.5f;
                                    }
                                    num617 = (int)(base.Center.X / 16f);
                                    num618 = (int)(base.Center.Y / 16f);
                                    float num620 = this.position.Y + base.height;
                                    if (Main.tile[num617, num618 - 1] == null)
                                    {
                                        Main.tile[num617, num618 - 1] = new Tile();
                                    }
                                    if (Main.tile[num617, num618] == null)
                                    {
                                        Main.tile[num617, num618] = new Tile();
                                    }
                                    if (Main.tile[num617, num618 + 1] == null)
                                    {
                                        Main.tile[num617, num618 + 1] = new Tile();
                                    }
                                    if (Main.tile[num617, num618 - 1].liquid > 0)
                                    {
                                        num620 = num618 * 0x10;
                                        num620 -= Main.tile[num617, num618 - 1].liquid / 0x10;
                                    }
                                    else if (Main.tile[num617, num618].liquid > 0)
                                    {
                                        num620 = (num618 + 1) * 0x10;
                                        num620 -= Main.tile[num617, num618].liquid / 0x10;
                                    }
                                    else if (Main.tile[num617, num618 + 1].liquid > 0)
                                    {
                                        num620 = (num618 + 2) * 0x10;
                                        num620 -= Main.tile[num617, num618 + 1].liquid / 0x10;
                                    }
                                    if (base.Center.Y > num620)
                                    {
                                        this.velocity.Y -= 0.1f;
                                        if (this.velocity.Y < -8f)
                                        {
                                            this.velocity.Y = -8f;
                                        }
                                        if ((base.Center.Y + this.velocity.Y) < num620)
                                        {
                                            this.velocity.Y = num620 - base.Center.Y;
                                        }
                                    }
                                    else
                                    {
                                        this.velocity.Y = num620 - base.Center.Y;
                                    }
                                    if ((this.velocity.Y >= -0.01) && (this.velocity.Y <= 0.01))
                                    {
                                        flag20 = true;
                                    }
                                }
                                else
                                {
                                    if (this.velocity.Y == 0f)
                                    {
                                        this.velocity.X *= 0.95f;
                                    }
                                    this.velocity.X *= 0.98f;
                                    this.velocity.Y += 0.2f;
                                    if (this.velocity.Y > 15.9f)
                                    {
                                        this.velocity.Y = 15.9f;
                                    }
                                }
                                if (this.ai[1] != 0f)
                                {
                                    flag20 = true;
                                }
                                if (flag20)
                                {
                                    if ((this.ai[1] != 0f) || (Main.myPlayer != this.owner))
                                    {
                                        if (this.ai[1] < 0f)
                                        {
                                            if ((this.velocity.Y == 0f) || ((base.honeyWet && (this.velocity.Y >= -0.01)) && (this.velocity.Y <= 0.01)))
                                            {
                                                this.velocity.Y = Main.rand.Next(100, 500) * 0.015f;
                                                this.velocity.X = Main.rand.Next(-100, 0x65) * 0.015f;
                                                base.wet = false;
                                                base.lavaWet = false;
                                                base.honeyWet = false;
                                            }
                                            this.ai[1] += Main.rand.Next(1, 5);
                                            if (this.ai[1] >= 0f)
                                            {
                                                this.ai[1] = 0f;
                                                this.localAI[1] = 0f;
                                                this.netUpdate = true;
                                                return;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        int num621 = Main.player[this.owner].FishingLevel();
                                        if (num621 != -9000)
                                        {
                                            if (Main.rand.Next(300) < num621)
                                            {
                                                this.localAI[1] += Main.rand.Next(1, 3);
                                            }
                                            this.localAI[1] += num621 / 30;
                                            this.localAI[1] += Main.rand.Next(1, 3);
                                            if (Main.rand.Next(60) == 0)
                                            {
                                                this.localAI[1] += 60f;
                                            }
                                            if (this.localAI[1] > 660f)
                                            {
                                                this.localAI[1] = 0f;
                                                this.FishingCheck();
                                                return;
                                            }
                                        }
                                        else
                                        {
                                            this.localAI[1] += 5f;
                                            this.localAI[1] += Main.rand.Next(1, 3);
                                            if (this.localAI[1] > 660f)
                                            {
                                                this.localAI[1] = 0f;
                                                this.FishingCheck();
                                                return;
                                            }
                                        }
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x3e)
                            {
                                this.AI_062();
                                return;
                            }
                            if (this.aiStyle == 0x3f)
                            {
                                if (!Main.player[this.owner].active)
                                {
                                    base.active = false;
                                    return;
                                }
                                Vector2 center = base.position;
                                bool flag21 = false;
                                float num622 = 500f;
                                for (int num623 = 0; num623 < 200; num623++)
                                {
                                    NPC npc = Main.npc[num623];
                                    if (npc.CanBeChasedBy(this, false))
                                    {
                                        float num624 = Vector2.Distance(npc.Center, base.Center);
                                        if ((((Vector2.Distance(base.Center, center) > num624) && (num624 < num622)) || !flag21) && Collision.CanHit(base.position, base.width, base.height, npc.position, npc.width, npc.height))
                                        {
                                            num622 = num624;
                                            center = npc.Center;
                                            flag21 = true;
                                        }
                                    }
                                }
                                if (!flag21)
                                {
                                    this.velocity.X *= 0.95f;
                                }
                                else
                                {
                                    float num625 = 5f;
                                    float num626 = 0.08f;
                                    if (this.velocity.Y == 0f)
                                    {
                                        bool flag22 = false;
                                        if ((base.Center.Y - 50f) > center.Y)
                                        {
                                            flag22 = true;
                                        }
                                        if (flag22)
                                        {
                                            this.velocity.Y = -6f;
                                        }
                                    }
                                    else
                                    {
                                        num625 = 8f;
                                        num626 = 0.12f;
                                    }
                                    this.velocity.X += Math.Sign((float)(center.X - base.Center.X)) * num626;
                                    if (this.velocity.X < -num625)
                                    {
                                        this.velocity.X = -num625;
                                    }
                                    if (this.velocity.X > num625)
                                    {
                                        this.velocity.X = num625;
                                    }
                                }
                                float stepSpeed = 0f;
                                Collision.StepUp(ref this.position, ref this.velocity, base.width, base.height, ref stepSpeed, ref this.gfxOffY, 1, false, 0);
                                if (this.velocity.Y != 0f)
                                {
                                    this.frame = 3;
                                }
                                else
                                {
                                    if (Math.Abs(this.velocity.X) > 0.2f)
                                    {
                                        this.frameCounter++;
                                    }
                                    if (this.frameCounter >= 9)
                                    {
                                        this.frameCounter = 0;
                                    }
                                    if (this.frameCounter >= 6)
                                    {
                                        this.frame = 2;
                                    }
                                    else if (this.frameCounter >= 3)
                                    {
                                        this.frame = 1;
                                    }
                                    else
                                    {
                                        this.frame = 0;
                                    }
                                }
                                if (this.velocity.X != 0f)
                                {
                                    base.direction = Math.Sign(this.velocity.X);
                                }
                                this.spriteDirection = -base.direction;
                                this.velocity.Y += 0.2f;
                                if (this.velocity.Y > 16f)
                                {
                                    this.velocity.Y = 16f;
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x40)
                            {
                                int num628 = 10;
                                int num629 = 15;
                                float num630 = 1f;
                                int num631 = 150;
                                int num632 = 0x2a;
                                if (this.type == 0x182)
                                {
                                    num628 = 0x10;
                                    num629 = 0x10;
                                    num630 = 1.5f;
                                }
                                if (this.velocity.X != 0f)
                                {
                                    base.direction = this.spriteDirection = -Math.Sign(this.velocity.X);
                                }
                                this.frameCounter++;
                                if (this.frameCounter > 2)
                                {
                                    this.frame++;
                                    this.frameCounter = 0;
                                }
                                if (this.frame >= 6)
                                {
                                    this.frame = 0;
                                }
                                if ((this.localAI[0] == 0f) && (Main.myPlayer == this.owner))
                                {
                                    this.localAI[0] = 1f;
                                    this.position.X += base.width / 2;
                                    this.position.Y += base.height / 2;
                                    this.scale = (((num628 + num629) - this.ai[1]) * num630) / ((float)(num629 + num628));
                                    base.width = (int)(num631 * this.scale);
                                    base.height = (int)(num632 * this.scale);
                                    this.position.X -= base.width / 2;
                                    this.position.Y -= base.height / 2;
                                    this.netUpdate = true;
                                }
                                if (this.ai[1] != -1f)
                                {
                                    this.scale = (((num628 + num629) - this.ai[1]) * num630) / ((float)(num629 + num628));
                                    base.width = (int)(num631 * this.scale);
                                    base.height = (int)(num632 * this.scale);
                                }
                                if (!Collision.SolidCollision(base.position, base.width, base.height))
                                {
                                    this.alpha -= 30;
                                    if (this.alpha < 60)
                                    {
                                        this.alpha = 60;
                                    }
                                    if ((this.type == 0x182) && (this.alpha < 100))
                                    {
                                        this.alpha = 100;
                                    }
                                }
                                else
                                {
                                    this.alpha += 30;
                                    if (this.alpha > 150)
                                    {
                                        this.alpha = 150;
                                    }
                                }
                                if (this.ai[0] > 0f)
                                {
                                    this.ai[0]--;
                                }
                                if (((this.ai[0] == 1f) && (this.ai[1] > 0f)) && (this.owner == Main.myPlayer))
                                {
                                    this.netUpdate = true;
                                    Vector2 vector58 = base.Center;
                                    vector58.Y -= (num632 * this.scale) / 2f;
                                    float num633 = ((((num628 + num629) - this.ai[1]) + 1f) * num630) / ((float)(num629 + num628));
                                    vector58.Y -= (num632 * num633) / 2f;
                                    vector58.Y += 2f;
                                    NewProjectile(vector58.X, vector58.Y, this.velocity.X, this.velocity.Y, this.type, this.damage, this.knockBack, this.owner, 10f, this.ai[1] - 1f);
                                    int num634 = 4;
                                    if (this.type == 0x182)
                                    {
                                        num634 = 2;
                                    }
                                    if (((((int)this.ai[1]) % num634) == 0) && (this.ai[1] != 0f))
                                    {
                                        int num635 = 0x174;
                                        if (this.type == 0x182)
                                        {
                                            num635 = 0x175;
                                        }
                                        int num636 = NPC.NewNPC((int)vector58.X, (int)vector58.Y, num635, 0, 0f, 0f, 0f, 0f, 0xff);
                                        Main.npc[num636].velocity = base.velocity;
                                        Main.npc[num636].netUpdate = true;
                                        if (this.type == 0x182)
                                        {
                                            Main.npc[num636].ai[2] = base.width;
                                            Main.npc[num636].ai[3] = -1.5f;
                                        }
                                    }
                                }
                                if (this.ai[0] <= 0f)
                                {
                                    float num637 = 0.1047198f;
                                    float num638 = ((float)base.width) / 5f;
                                    if (this.type == 0x182)
                                    {
                                        num638 *= 2f;
                                    }
                                    float num639 = ((float)(Math.Cos((double)(num637 * -this.ai[0])) - 0.5)) * num638;
                                    this.position.X -= num639 * -base.direction;
                                    this.ai[0]--;
                                    num639 = ((float)(Math.Cos((double)(num637 * -this.ai[0])) - 0.5)) * num638;
                                    this.position.X += num639 * -base.direction;
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x41)
                            {
                                if (this.ai[1] > 0f)
                                {
                                    int num640 = ((int)this.ai[1]) - 1;
                                    if (num640 < 0xff)
                                    {
                                        this.localAI[0]++;
                                        if (this.localAI[0] > 10f)
                                        {
                                            int num641 = 6;
                                            for (int num642 = 0; num642 < num641; num642++)
                                            {
                                                Vector2 spinningpoint = (Vector2)((Vector2.Normalize(base.velocity) * new Vector2(((float)base.width) / 2f, (float)base.height)) * 0.75f);
                                                vector240 = new Vector2();
                                                spinningpoint = spinningpoint.RotatedBy((((num642 - ((num641 / 2) - 1)) * 3.1415926535897931) / ((double)num641)), vector240) + base.Center;
                                                Vector2 vector60 = (((float)(Main.rand.NextDouble() * 3.1415927410125732)) - 1.570796f).ToRotationVector2() * Main.rand.Next(3, 8);
                                                color5 = new Color();
                                                int num643 = Dust.NewDust(spinningpoint + vector60, 0, 0, 0xac, vector60.X * 2f, vector60.Y * 2f, 100, color5, 1.4f);
                                                Main.dust[num643].noGravity = true;
                                                Main.dust[num643].noLight = true;
                                                Dust dust206 = Main.dust[num643];
                                                dust206.velocity = (Vector2)(dust206.velocity / 4f);
                                                Dust dust207 = Main.dust[num643];
                                                dust207.velocity -= base.velocity;
                                            }
                                            this.alpha -= 5;
                                            if (this.alpha < 100)
                                            {
                                                this.alpha = 100;
                                            }
                                            this.rotation += this.velocity.X * 0.1f;
                                            this.frame = ((int)(this.localAI[0] / 3f)) % 3;
                                        }
                                        Vector2 vector61 = Main.player[num640].Center - base.Center;
                                        float num644 = 4f;
                                        num644 += this.localAI[0] / 20f;
                                        base.velocity = (Vector2)(Vector2.Normalize(vector61) * num644);
                                        if (vector61.Length() < 50f)
                                        {
                                            this.Kill();
                                        }
                                    }
                                }
                                else
                                {
                                    float num645 = 0.2094395f;
                                    float num646 = 4f;
                                    float num647 = ((float)(Math.Cos((double)(num645 * this.ai[0])) - 0.5)) * num646;
                                    this.velocity.Y -= num647;
                                    this.ai[0]++;
                                    num647 = ((float)(Math.Cos((double)(num645 * this.ai[0])) - 0.5)) * num646;
                                    this.velocity.Y += num647;
                                    this.localAI[0]++;
                                    if (this.localAI[0] > 10f)
                                    {
                                        this.alpha -= 5;
                                        if (this.alpha < 100)
                                        {
                                            this.alpha = 100;
                                        }
                                        this.rotation += this.velocity.X * 0.1f;
                                        this.frame = ((int)(this.localAI[0] / 3f)) % 3;
                                    }
                                }
                                if (base.wet)
                                {
                                    this.position.Y -= 16f;
                                    this.Kill();
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x42)
                            {
                                float num648 = 0f;
                                float num649 = 0f;
                                float num650 = 0f;
                                float num651 = 0f;
                                if ((this.type == 0x183) || (this.type == 0x184))
                                {
                                    num648 = 700f;
                                    num649 = 800f;
                                    num650 = 1200f;
                                    num651 = 150f;
                                    if (Main.player[this.owner].dead)
                                    {
                                        Main.player[this.owner].twinsMinion = false;
                                    }
                                    if (Main.player[this.owner].twinsMinion)
                                    {
                                        this.timeLeft = 2;
                                    }
                                }
                                if (this.type == 0x215)
                                {
                                    num648 = 1500f;
                                    num649 = 900f;
                                    num650 = 1500f;
                                    num651 = 450f;
                                    if (Main.player[this.owner].dead)
                                    {
                                        Main.player[this.owner].DeadlySphereMinion = false;
                                    }
                                    if (Main.player[this.owner].DeadlySphereMinion)
                                    {
                                        this.timeLeft = 2;
                                    }
                                }
                                float num652 = 0.05f;
                                for (int num653 = 0; num653 < 0x3e8; num653++)
                                {
                                    bool flag23 = ((Main.projectile[num653].type == 0x183) || (Main.projectile[num653].type == 0x184)) && ((this.type == 0x183) || (this.type == 0x184));
                                    if (!flag23)
                                    {
                                        flag23 = (this.type == 0x215) && (Main.projectile[num653].type == 0x215);
                                    }
                                    if (((num653 != base.whoAmI) && Main.projectile[num653].active) && ((Main.projectile[num653].owner == this.owner) && flag23))
                                    {
                                        float introduced1797 = Math.Abs((float)(this.position.X - Main.projectile[num653].position.X));
                                        if ((introduced1797 + Math.Abs((float)(this.position.Y - Main.projectile[num653].position.Y))) < base.width)
                                        {
                                            if (this.position.X < Main.projectile[num653].position.X)
                                            {
                                                this.velocity.X -= num652;
                                            }
                                            else
                                            {
                                                this.velocity.X += num652;
                                            }
                                            if (this.position.Y < Main.projectile[num653].position.Y)
                                            {
                                                this.velocity.Y -= num652;
                                            }
                                            else
                                            {
                                                this.velocity.Y += num652;
                                            }
                                        }
                                    }
                                }
                                if (this.type == 0x215)
                                {
                                    if ((((int)this.ai[0]) % 3) != 2)
                                    {
                                        Lighting.AddLight(base.Center, 0.8f, 0.3f, 0.1f);
                                    }
                                    else
                                    {
                                        Lighting.AddLight(base.Center, 0.3f, 0.5f, 0.7f);
                                    }
                                }
                                bool flag24 = false;
                                if ((this.ai[0] == 2f) && (this.type == 0x184))
                                {
                                    this.ai[1]++;
                                    this.extraUpdates = 1;
                                    this.rotation = base.velocity.ToRotation() + 3.141593f;
                                    this.frameCounter++;
                                    if (this.frameCounter > 1)
                                    {
                                        this.frame++;
                                        this.frameCounter = 0;
                                    }
                                    if (this.frame > 2)
                                    {
                                        this.frame = 0;
                                    }
                                    if (this.ai[1] > 40f)
                                    {
                                        this.ai[1] = 1f;
                                        this.ai[0] = 0f;
                                        this.extraUpdates = 0;
                                        this.numUpdates = 0;
                                        this.netUpdate = true;
                                    }
                                    else
                                    {
                                        flag24 = true;
                                    }
                                }
                                if (((this.type == 0x215) && (this.ai[0] >= 3f)) && (this.ai[0] <= 5f))
                                {
                                    int num654 = 2;
                                    flag24 = true;
                                    base.velocity = (Vector2)(base.velocity * 0.9f);
                                    this.ai[1]++;
                                    int num655 = (((int)this.ai[1]) / num654) + (((int)(this.ai[0] - 3f)) * 8);
                                    if (num655 < 4)
                                    {
                                        this.frame = 0x11 + num655;
                                    }
                                    else if (num655 < 5)
                                    {
                                        this.frame = 0;
                                    }
                                    else if (num655 < 8)
                                    {
                                        this.frame = (1 + num655) - 5;
                                    }
                                    else if (num655 < 11)
                                    {
                                        this.frame = 11 - num655;
                                    }
                                    else if (num655 < 12)
                                    {
                                        this.frame = 0;
                                    }
                                    else if (num655 < 0x10)
                                    {
                                        this.frame = num655 - 2;
                                    }
                                    else if (num655 < 20)
                                    {
                                        this.frame = 0x1d - num655;
                                    }
                                    else if (num655 < 0x15)
                                    {
                                        this.frame = 0;
                                    }
                                    else
                                    {
                                        this.frame = num655 - 4;
                                    }
                                    if (this.ai[1] > (num654 * 8))
                                    {
                                        this.ai[0] -= 3f;
                                        this.ai[1] = 0f;
                                    }
                                }
                                if (((this.type == 0x215) && (this.ai[0] >= 6f)) && (this.ai[0] <= 8f))
                                {
                                    this.ai[1]++;
                                    this.MaxUpdates = 2;
                                    if (this.ai[0] == 7f)
                                    {
                                        this.rotation = base.velocity.ToRotation() + 3.141593f;
                                    }
                                    else
                                    {
                                        this.rotation += 0.5235988f;
                                    }
                                    int num656 = 0;
                                    switch (((int)this.ai[0]))
                                    {
                                        case 6:
                                            this.frame = 5;
                                            num656 = 40;
                                            break;

                                        case 7:
                                            this.frame = 13;
                                            num656 = 30;
                                            break;

                                        case 8:
                                            this.frame = 0x11;
                                            num656 = 30;
                                            break;
                                    }
                                    if (this.ai[1] > num656)
                                    {
                                        this.ai[1] = 1f;
                                        this.ai[0] -= 6f;
                                        this.localAI[0]++;
                                        this.extraUpdates = 0;
                                        this.numUpdates = 0;
                                        this.netUpdate = true;
                                    }
                                    else
                                    {
                                        flag24 = true;
                                    }
                                    if (this.ai[0] == 8f)
                                    {
                                        for (int num657 = 0; num657 < 4; num657++)
                                        {
                                            int num658 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe2, 0xe4, 0x4b });
                                            color5 = new Color();
                                            int num659 = Dust.NewDust(base.Center, 0, 0, num658, 0f, 0f, 0, color5, 1f);
                                            Dust dust = Main.dust[num659];
                                            vector240 = new Vector2();
                                            vector240 = new Vector2();
                                            Vector2 vector62 = Vector2.One.RotatedBy(((double)(num657 * 1.570796f)), vector240).RotatedBy((double)this.rotation, vector240);
                                            dust.position = base.Center + ((Vector2)(vector62 * 10f));
                                            dust.velocity = (Vector2)(vector62 * 1f);
                                            dust.scale = 0.6f + (Main.rand.NextFloat() * 0.5f);
                                            dust.noGravity = true;
                                        }
                                    }
                                }
                                if (!flag24)
                                {
                                    Vector2 vector63 = base.position;
                                    bool flag25 = false;
                                    if ((this.ai[0] != 1f) && ((this.type == 0x183) || (this.type == 0x184)))
                                    {
                                        this.tileCollide = true;
                                    }
                                    if ((this.type == 0x215) && (this.ai[0] < 9f))
                                    {
                                        this.tileCollide = true;
                                    }
                                    if (this.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely(((int)base.Center.X) / 0x10, ((int)base.Center.Y) / 0x10)))
                                    {
                                        this.tileCollide = false;
                                    }
                                    for (int num660 = 0; num660 < 200; num660++)
                                    {
                                        NPC npc2 = Main.npc[num660];
                                        if (npc2.CanBeChasedBy(this, false))
                                        {
                                            float num661 = Vector2.Distance(npc2.Center, base.Center);
                                            if ((((Vector2.Distance(base.Center, vector63) > num661) && (num661 < num648)) || !flag25) && Collision.CanHitLine(base.position, base.width, base.height, npc2.position, npc2.width, npc2.height))
                                            {
                                                num648 = num661;
                                                vector63 = npc2.Center;
                                                flag25 = true;
                                            }
                                        }
                                    }
                                    float num662 = num649;
                                    if (flag25)
                                    {
                                        num662 = num650;
                                    }
                                    Player player = Main.player[this.owner];
                                    if (Vector2.Distance(player.Center, base.Center) > num662)
                                    {
                                        if ((this.type == 0x183) || (this.type == 0x184))
                                        {
                                            this.ai[0] = 1f;
                                        }
                                        if ((this.type == 0x215) && (this.ai[0] < 9f))
                                        {
                                            this.ai[0] += 3 * (3 - ((int)(this.ai[0] / 3f)));
                                        }
                                        this.tileCollide = false;
                                        this.netUpdate = true;
                                    }
                                    if (((this.type == 0x184) || (this.type == 0x183)) && (flag25 && (this.ai[0] == 0f)))
                                    {
                                        Vector2 vector64 = vector63 - base.Center;
                                        float num663 = vector64.Length();
                                        vector64.Normalize();
                                        if (num663 > 200f)
                                        {
                                            float num664 = 6f;
                                            if (this.type == 0x184)
                                            {
                                                num664 = 8f;
                                            }
                                            vector64 = (Vector2)(vector64 * num664);
                                            base.velocity = (Vector2)(((base.velocity * 40f) + vector64) / 41f);
                                        }
                                        else
                                        {
                                            float num665 = 4f;
                                            vector64 = (Vector2)(vector64 * -num665);
                                            base.velocity = (Vector2)(((base.velocity * 40f) + vector64) / 41f);
                                        }
                                    }
                                    else
                                    {
                                        bool flag26 = false;
                                        if (!flag26)
                                        {
                                            flag26 = (this.ai[0] == 1f) && ((this.type == 0x183) || (this.type == 0x184));
                                        }
                                        if (!flag26)
                                        {
                                            flag26 = (this.ai[0] >= 9f) && (this.type == 0x215);
                                        }
                                        float num666 = 6f;
                                        if (this.type == 0x215)
                                        {
                                            num666 = 12f;
                                        }
                                        if (flag26)
                                        {
                                            num666 = 15f;
                                        }
                                        Vector2 vector65 = base.Center;
                                        Vector2 vector66 = (player.Center - vector65) + new Vector2(0f, -60f);
                                        float num667 = vector66.Length();
                                        if ((num667 > 200f) && (num666 < 8f))
                                        {
                                            num666 = 8f;
                                        }
                                        if (((num667 < num651) && flag26) && !Collision.SolidCollision(base.position, base.width, base.height))
                                        {
                                            if ((this.type == 0x183) || (this.type == 0x184))
                                            {
                                                this.ai[0] = 0f;
                                            }
                                            if (this.type == 0x215)
                                            {
                                                this.ai[0] -= 9f;
                                            }
                                            this.netUpdate = true;
                                        }
                                        if (num667 > 2000f)
                                        {
                                            this.position.X = Main.player[this.owner].Center.X - (base.width / 2);
                                            this.position.Y = Main.player[this.owner].Center.Y - (base.height / 2);
                                            this.netUpdate = true;
                                        }
                                        if (num667 > 70f)
                                        {
                                            vector66.Normalize();
                                            vector66 = (Vector2)(vector66 * num666);
                                            base.velocity = (Vector2)(((base.velocity * 40f) + vector66) / 41f);
                                        }
                                        else if ((this.velocity.X == 0f) && (this.velocity.Y == 0f))
                                        {
                                            this.velocity.X = -0.15f;
                                            this.velocity.Y = -0.05f;
                                        }
                                    }
                                    if (this.type == 0x184)
                                    {
                                        this.rotation = base.velocity.ToRotation() + 3.141593f;
                                    }
                                    if (this.type == 0x183)
                                    {
                                        if (flag25)
                                        {
                                            this.rotation = (vector63 - base.Center).ToRotation() + 3.141593f;
                                        }
                                        else
                                        {
                                            this.rotation = base.velocity.ToRotation() + 3.141593f;
                                        }
                                    }
                                    if ((this.type == 0x215) && ((this.ai[0] < 3f) || (this.ai[0] >= 9f)))
                                    {
                                        this.rotation += this.velocity.X * 0.04f;
                                    }
                                    if ((this.type == 0x184) || (this.type == 0x183))
                                    {
                                        this.frameCounter++;
                                        if (this.frameCounter > 3)
                                        {
                                            this.frame++;
                                            this.frameCounter = 0;
                                        }
                                        if (this.frame > 2)
                                        {
                                            this.frame = 0;
                                        }
                                    }
                                    else if (this.type == 0x215)
                                    {
                                        if ((this.ai[0] < 3f) || (this.ai[0] >= 9f))
                                        {
                                            this.frameCounter++;
                                            if (this.frameCounter >= 0x18)
                                            {
                                                this.frameCounter = 0;
                                            }
                                            int num668 = this.frameCounter / 4;
                                            this.frame = 4 + num668;
                                            switch (((int)this.ai[0]))
                                            {
                                                case 0:
                                                case 9:
                                                    this.frame = 4 + num668;
                                                    break;

                                                case 1:
                                                case 10:
                                                    num668 = this.frameCounter / 8;
                                                    this.frame = 14 + num668;
                                                    break;

                                                case 2:
                                                case 11:
                                                    num668 = this.frameCounter / 3;
                                                    if (num668 >= 4)
                                                    {
                                                        num668 -= 4;
                                                    }
                                                    this.frame = 0x11 + num668;
                                                    break;
                                            }
                                        }
                                        if ((this.ai[0] == 2f) && (Main.rand.Next(2) == 0))
                                        {
                                            for (int num669 = 0; num669 < 4; num669++)
                                            {
                                                if (Main.rand.Next(2) != 0)
                                                {
                                                    int num670 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe2, 0xe4, 0x4b });
                                                    color5 = new Color();
                                                    int num671 = Dust.NewDust(base.Center, 0, 0, num670, 0f, 0f, 0, color5, 1f);
                                                    Dust dust2 = Main.dust[num671];
                                                    vector240 = new Vector2();
                                                    vector240 = new Vector2();
                                                    Vector2 vector67 = Vector2.One.RotatedBy(((double)(num669 * 1.570796f)), vector240).RotatedBy((double)this.rotation, vector240);
                                                    dust2.position = base.Center + ((Vector2)(vector67 * 10f));
                                                    dust2.velocity = (Vector2)(vector67 * 1f);
                                                    dust2.scale = 0.3f + (Main.rand.NextFloat() * 0.5f);
                                                    dust2.noGravity = true;
                                                    dust2.customData = this;
                                                    dust2.noLight = true;
                                                }
                                            }
                                        }
                                    }
                                    if ((this.ai[1] > 0f) && ((this.type == 0x183) || (this.type == 0x184)))
                                    {
                                        this.ai[1] += Main.rand.Next(1, 4);
                                    }
                                    if ((this.ai[1] > 90f) && (this.type == 0x183))
                                    {
                                        this.ai[1] = 0f;
                                        this.netUpdate = true;
                                    }
                                    if ((this.ai[1] > 40f) && (this.type == 0x184))
                                    {
                                        this.ai[1] = 0f;
                                        this.netUpdate = true;
                                    }
                                    if ((this.ai[1] > 0f) && (this.type == 0x215))
                                    {
                                        this.ai[1]++;
                                        int num672 = 10;
                                        if (this.ai[1] > num672)
                                        {
                                            this.ai[1] = 0f;
                                            this.netUpdate = true;
                                        }
                                    }
                                    if ((this.ai[0] == 0f) && ((this.type == 0x183) || (this.type == 0x184)))
                                    {
                                        if (this.type == 0x183)
                                        {
                                            float num673 = 8f;
                                            int num674 = 0x185;
                                            if (flag25 && (this.ai[1] == 0f))
                                            {
                                                this.ai[1]++;
                                                if ((Main.myPlayer == this.owner) && Collision.CanHitLine(base.position, base.width, base.height, vector63, 0, 0))
                                                {
                                                    Vector2 vector68 = vector63 - base.Center;
                                                    vector68.Normalize();
                                                    vector68 = (Vector2)(vector68 * num673);
                                                    int num675 = NewProjectile(base.Center.X, base.Center.Y, vector68.X, vector68.Y, num674, (int)(this.damage * 0.8f), 0f, Main.myPlayer, 0f, 0f);
                                                    Main.projectile[num675].timeLeft = 300;
                                                    this.netUpdate = true;
                                                }
                                            }
                                        }
                                        if (((this.type == 0x184) && (this.ai[1] == 0f)) && (flag25 && (num648 < 500f)))
                                        {
                                            this.ai[1]++;
                                            if (Main.myPlayer == this.owner)
                                            {
                                                this.ai[0] = 2f;
                                                Vector2 vector69 = vector63 - base.Center;
                                                vector69.Normalize();
                                                base.velocity = (Vector2)(vector69 * 8f);
                                                this.netUpdate = true;
                                                return;
                                            }
                                        }
                                        return;
                                    }
                                    if ((this.type == 0x215) && (this.ai[0] < 3f))
                                    {
                                        int num676 = 0;
                                        switch (((int)this.ai[0]))
                                        {
                                            case 0:
                                            case 3:
                                            case 6:
                                                num676 = 400;
                                                break;

                                            case 1:
                                            case 4:
                                            case 7:
                                                num676 = 400;
                                                break;

                                            case 2:
                                            case 5:
                                            case 8:
                                                num676 = 600;
                                                break;
                                        }
                                        if (((this.ai[1] == 0f) && flag25) && (num648 < num676))
                                        {
                                            this.ai[1]++;
                                            if (Main.myPlayer != this.owner)
                                            {
                                                return;
                                            }
                                            if (this.localAI[0] >= 3f)
                                            {
                                                this.ai[0] += 4f;
                                                if (this.ai[0] == 6f)
                                                {
                                                    this.ai[0] = 3f;
                                                }
                                                this.localAI[0] = 0f;
                                                return;
                                            }
                                            this.ai[0] += 6f;
                                            Vector2 vector70 = vector63 - base.Center;
                                            vector70.Normalize();
                                            float num677 = (this.ai[0] == 8f) ? 12f : 10f;
                                            base.velocity = (Vector2)(vector70 * num677);
                                            this.netUpdate = true;
                                        }
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x43)
                            {
                                Player player2 = Main.player[this.owner];
                                if (!player2.active)
                                {
                                    base.active = false;
                                    return;
                                }
                                bool flag27 = ((this.type == 0x189) || (this.type == 0x18a)) || (this.type == 0x18b);
                                if (flag27)
                                {
                                    if (player2.dead)
                                    {
                                        player2.pirateMinion = false;
                                    }
                                    if (player2.pirateMinion)
                                    {
                                        this.timeLeft = 2;
                                    }
                                }
                                if (this.type == 500)
                                {
                                    if (player2.dead)
                                    {
                                        player2.crimsonHeart = false;
                                    }
                                    if (player2.crimsonHeart)
                                    {
                                        this.timeLeft = 2;
                                    }
                                }
                                Vector2 vector71 = player2.Center;
                                if (flag27)
                                {
                                    vector71.X -= (15 + (player2.width / 2)) * player2.direction;
                                    vector71.X -= (this.minionPos * 40) * player2.direction;
                                }
                                if (this.type == 500)
                                {
                                    vector71.X -= (15 + (player2.width / 2)) * player2.direction;
                                    vector71.X -= 40 * player2.direction;
                                }
                                if (this.type == 500)
                                {
                                    Lighting.AddLight(base.Center, 0.9f, 0.1f, 0.3f);
                                    int num678 = 6;
                                    if ((this.frame == 0) || (this.frame == 2))
                                    {
                                        num678 = 12;
                                    }
                                    if (++this.frameCounter >= num678)
                                    {
                                        this.frameCounter = 0;
                                        if (++this.frame >= Main.projFrames[this.type])
                                        {
                                            this.frame = 0;
                                        }
                                    }
                                    this.rotation += this.velocity.X / 20f;
                                    vector240 = new Vector2();
                                    Vector2 spinninpoint = -Vector2.UnitY.RotatedBy(((double)this.rotation), vector240).RotatedBy((double)(base.direction * 0.2f), new Vector2());
                                    int num679 = Dust.NewDust((base.Center + ((Vector2)(spinninpoint * 10f))) - new Vector2(4f), 0, 0, 5, spinninpoint.X, spinninpoint.Y, 0, Color.Transparent, 1f);
                                    Main.dust[num679].scale = 1f;
                                    Main.dust[num679].velocity = (Vector2)(spinninpoint.RotatedByRandom(0.78539818525314331) * 3.5f);
                                    Main.dust[num679].noGravity = true;
                                    Main.dust[num679].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cLight, Main.player[this.owner]);
                                }
                                bool flag28 = true;
                                if (this.type == 500)
                                {
                                    flag28 = false;
                                }
                                int num680 = -1;
                                float num681 = 450f;
                                if (flag27)
                                {
                                    num681 = 800f;
                                }
                                int num682 = 15;
                                if ((this.ai[0] == 0f) && flag28)
                                {
                                    for (int num683 = 0; num683 < 200; num683++)
                                    {
                                        NPC npc3 = Main.npc[num683];
                                        if (npc3.CanBeChasedBy(this, false))
                                        {
                                            vector240 = npc3.Center - base.Center;
                                            float num684 = vector240.Length();
                                            if (num684 < num681)
                                            {
                                                num680 = num683;
                                                num681 = num684;
                                            }
                                        }
                                    }
                                }
                                if (this.ai[0] == 1f)
                                {
                                    this.tileCollide = false;
                                    float num685 = 0.2f;
                                    float num686 = 10f;
                                    int num687 = 200;
                                    float introduced1798 = Math.Abs(player2.velocity.X);
                                    if (num686 < (introduced1798 + Math.Abs(player2.velocity.Y)))
                                    {
                                        float introduced1799 = Math.Abs(player2.velocity.X);
                                        num686 = introduced1799 + Math.Abs(player2.velocity.Y);
                                    }
                                    Vector2 vector73 = player2.Center - base.Center;
                                    float num688 = vector73.Length();
                                    if (num688 > 2000f)
                                    {
                                        base.position = player2.Center - ((Vector2)(new Vector2((float)base.width, (float)base.height) / 2f));
                                    }
                                    if (((num688 < num687) && (player2.velocity.Y == 0f)) && (((this.position.Y + base.height) <= (player2.position.Y + player2.height)) && !Collision.SolidCollision(base.position, base.width, base.height)))
                                    {
                                        this.ai[0] = 0f;
                                        this.netUpdate = true;
                                        if (this.velocity.Y < -6f)
                                        {
                                            this.velocity.Y = -6f;
                                        }
                                    }
                                    if (num688 >= 60f)
                                    {
                                        vector73.Normalize();
                                        vector73 = (Vector2)(vector73 * num686);
                                        if (this.velocity.X < vector73.X)
                                        {
                                            this.velocity.X += num685;
                                            if (this.velocity.X < 0f)
                                            {
                                                this.velocity.X += num685 * 1.5f;
                                            }
                                        }
                                        if (this.velocity.X > vector73.X)
                                        {
                                            this.velocity.X -= num685;
                                            if (this.velocity.X > 0f)
                                            {
                                                this.velocity.X -= num685 * 1.5f;
                                            }
                                        }
                                        if (this.velocity.Y < vector73.Y)
                                        {
                                            this.velocity.Y += num685;
                                            if (this.velocity.Y < 0f)
                                            {
                                                this.velocity.Y += num685 * 1.5f;
                                            }
                                        }
                                        if (this.velocity.Y > vector73.Y)
                                        {
                                            this.velocity.Y -= num685;
                                            if (this.velocity.Y > 0f)
                                            {
                                                this.velocity.Y -= num685 * 1.5f;
                                            }
                                        }
                                    }
                                    if (this.velocity.X != 0f)
                                    {
                                        this.spriteDirection = Math.Sign(this.velocity.X);
                                    }
                                    if (flag27)
                                    {
                                        this.frameCounter++;
                                        if (this.frameCounter > 3)
                                        {
                                            this.frame++;
                                            this.frameCounter = 0;
                                        }
                                        if ((this.frame < 10) | (this.frame > 13))
                                        {
                                            this.frame = 10;
                                        }
                                        this.rotation = this.velocity.X * 0.1f;
                                    }
                                }
                                if (this.ai[0] == 2f)
                                {
                                    this.friendly = true;
                                    this.spriteDirection = base.direction;
                                    this.rotation = 0f;
                                    this.frame = 4 + ((num682 - ((int)this.ai[1])) / (num682 / 3));
                                    if (this.velocity.Y != 0f)
                                    {
                                        this.frame += 3;
                                    }
                                    this.velocity.Y += 0.4f;
                                    if (this.velocity.Y > 10f)
                                    {
                                        this.velocity.Y = 10f;
                                    }
                                    this.ai[1]--;
                                    if (this.ai[1] <= 0f)
                                    {
                                        this.ai[1] = 0f;
                                        this.ai[0] = 0f;
                                        this.friendly = false;
                                        this.netUpdate = true;
                                        return;
                                    }
                                }
                                if (num680 >= 0)
                                {
                                    float num689 = 400f;
                                    float num690 = 20f;
                                    if (flag27)
                                    {
                                        num689 = 700f;
                                    }
                                    if (this.position.Y > (Main.worldSurface * 16.0))
                                    {
                                        num689 *= 0.7f;
                                    }
                                    NPC npc4 = Main.npc[num680];
                                    Vector2 vector74 = npc4.Center;
                                    vector240 = vector74 - base.Center;
                                    float num691 = vector240.Length();
                                    Collision.CanHit(base.position, base.width, base.height, npc4.position, npc4.width, npc4.height);
                                    if (num691 < num689)
                                    {
                                        vector71 = vector74;
                                        if ((vector74.Y < (base.Center.Y - 30f)) && (this.velocity.Y == 0f))
                                        {
                                            float num692 = Math.Abs((float)(vector74.Y - base.Center.Y));
                                            if (num692 < 120f)
                                            {
                                                this.velocity.Y = -10f;
                                            }
                                            else if (num692 < 210f)
                                            {
                                                this.velocity.Y = -13f;
                                            }
                                            else if (num692 < 270f)
                                            {
                                                this.velocity.Y = -15f;
                                            }
                                            else if (num692 < 310f)
                                            {
                                                this.velocity.Y = -17f;
                                            }
                                            else if (num692 < 380f)
                                            {
                                                this.velocity.Y = -18f;
                                            }
                                        }
                                    }
                                    if (num691 < num690)
                                    {
                                        this.ai[0] = 2f;
                                        this.ai[1] = num682;
                                        this.netUpdate = true;
                                    }
                                }
                                if ((this.ai[0] == 0f) && (num680 < 0))
                                {
                                    float num693 = 500f;
                                    if (this.type == 500)
                                    {
                                        num693 = 200f;
                                    }
                                    if (Main.player[this.owner].rocketDelay2 > 0)
                                    {
                                        this.ai[0] = 1f;
                                        this.netUpdate = true;
                                    }
                                    Vector2 vector75 = player2.Center - base.Center;
                                    if (vector75.Length() > 2000f)
                                    {
                                        base.position = player2.Center - ((Vector2)(new Vector2((float)base.width, (float)base.height) / 2f));
                                    }
                                    else if ((vector75.Length() > num693) || (Math.Abs(vector75.Y) > 300f))
                                    {
                                        this.ai[0] = 1f;
                                        this.netUpdate = true;
                                        if ((this.velocity.Y > 0f) && (vector75.Y < 0f))
                                        {
                                            this.velocity.Y = 0f;
                                        }
                                        if ((this.velocity.Y < 0f) && (vector75.Y > 0f))
                                        {
                                            this.velocity.Y = 0f;
                                        }
                                    }
                                }
                                if (this.ai[0] == 0f)
                                {
                                    this.tileCollide = true;
                                    float num694 = 0.5f;
                                    float num695 = 4f;
                                    float num696 = 4f;
                                    float num697 = 0.1f;
                                    float introduced1800 = Math.Abs(player2.velocity.X);
                                    if (num696 < (introduced1800 + Math.Abs(player2.velocity.Y)))
                                    {
                                        float introduced1801 = Math.Abs(player2.velocity.X);
                                        num696 = introduced1801 + Math.Abs(player2.velocity.Y);
                                        num694 = 0.7f;
                                    }
                                    int num698 = 0;
                                    bool flag29 = false;
                                    float num699 = vector71.X - base.Center.X;
                                    if (Math.Abs(num699) > 5f)
                                    {
                                        if (num699 < 0f)
                                        {
                                            num698 = -1;
                                            if (this.velocity.X > -num695)
                                            {
                                                this.velocity.X -= num694;
                                            }
                                            else
                                            {
                                                this.velocity.X -= num697;
                                            }
                                        }
                                        else
                                        {
                                            num698 = 1;
                                            if (this.velocity.X < num695)
                                            {
                                                this.velocity.X += num694;
                                            }
                                            else
                                            {
                                                this.velocity.X += num697;
                                            }
                                        }
                                        flag29 = true;
                                    }
                                    else
                                    {
                                        this.velocity.X *= 0.9f;
                                        if (Math.Abs(this.velocity.X) < (num694 * 2f))
                                        {
                                            this.velocity.X = 0f;
                                        }
                                    }
                                    if (num698 != 0)
                                    {
                                        int num700 = (((int)this.position.X) + (base.width / 2)) / 0x10;
                                        int num701 = ((int)this.position.Y) / 0x10;
                                        num700 += num698;
                                        num700 += (int)this.velocity.X;
                                        for (int num702 = num701; num702 < ((num701 + (base.height / 0x10)) + 1); num702++)
                                        {
                                            if (WorldGen.SolidTile(num700, num702))
                                            {
                                                flag29 = true;
                                            }
                                        }
                                    }
                                    if ((this.type == 500) && (this.velocity.X != 0f))
                                    {
                                        flag29 = true;
                                    }
                                    Collision.StepUp(ref this.position, ref this.velocity, base.width, base.height, ref this.stepSpeed, ref this.gfxOffY, 1, false, 0);
                                    if ((this.velocity.Y == 0f) && flag29)
                                    {
                                        for (int num703 = 0; num703 < 3; num703++)
                                        {
                                            int num704 = (((int)this.position.X) + (base.width / 2)) / 0x10;
                                            switch (num703)
                                            {
                                                case 0:
                                                    num704 = ((int)this.position.X) / 0x10;
                                                    break;

                                                case 2:
                                                    num704 = (((int)this.position.X) + base.width) / 0x10;
                                                    break;
                                            }
                                            int num705 = ((((int)this.position.Y) + base.height) / 0x10) + 1;
                                            if ((WorldGen.SolidTile(num704, num705) || Main.tile[num704, num705].halfBrick()) || (Main.tile[num704, num705].slope() > 0))
                                            {
                                                try
                                                {
                                                    num704 = (((int)this.position.X) + (base.width / 2)) / 0x10;
                                                    num705 = (((int)this.position.Y) + (base.height / 2)) / 0x10;
                                                    num704 += num698;
                                                    num704 += (int)this.velocity.X;
                                                    if (!WorldGen.SolidTile(num704, num705 - 1) && !WorldGen.SolidTile(num704, num705 - 2))
                                                    {
                                                        this.velocity.Y = -5.1f;
                                                    }
                                                    else if (!WorldGen.SolidTile(num704, num705 - 2))
                                                    {
                                                        this.velocity.Y = -7.1f;
                                                    }
                                                    else if (WorldGen.SolidTile(num704, num705 - 5))
                                                    {
                                                        this.velocity.Y = -11.1f;
                                                    }
                                                    else if (WorldGen.SolidTile(num704, num705 - 4))
                                                    {
                                                        this.velocity.Y = -10.1f;
                                                    }
                                                    else
                                                    {
                                                        this.velocity.Y = -9.1f;
                                                    }
                                                }
                                                catch
                                                {
                                                    this.velocity.Y = -9.1f;
                                                }
                                            }
                                        }
                                    }
                                    if (this.velocity.X > num696)
                                    {
                                        this.velocity.X = num696;
                                    }
                                    if (this.velocity.X < -num696)
                                    {
                                        this.velocity.X = -num696;
                                    }
                                    if (this.velocity.X < 0f)
                                    {
                                        base.direction = -1;
                                    }
                                    if (this.velocity.X > 0f)
                                    {
                                        base.direction = 1;
                                    }
                                    if ((this.velocity.X > num694) && (num698 == 1))
                                    {
                                        base.direction = 1;
                                    }
                                    if ((this.velocity.X < -num694) && (num698 == -1))
                                    {
                                        base.direction = -1;
                                    }
                                    this.spriteDirection = base.direction;
                                    if (flag27)
                                    {
                                        this.rotation = 0f;
                                        if (this.velocity.Y == 0f)
                                        {
                                            if (this.velocity.X == 0f)
                                            {
                                                this.frame = 0;
                                                this.frameCounter = 0;
                                            }
                                            else if (Math.Abs(this.velocity.X) >= 0.5f)
                                            {
                                                this.frameCounter += (int)Math.Abs(this.velocity.X);
                                                this.frameCounter++;
                                                if (this.frameCounter > 10)
                                                {
                                                    this.frame++;
                                                    this.frameCounter = 0;
                                                }
                                                if (this.frame >= 4)
                                                {
                                                    this.frame = 0;
                                                }
                                            }
                                            else
                                            {
                                                this.frame = 0;
                                                this.frameCounter = 0;
                                            }
                                        }
                                        else if (this.velocity.Y != 0f)
                                        {
                                            this.frameCounter = 0;
                                            this.frame = 14;
                                        }
                                    }
                                    this.velocity.Y += 0.4f;
                                    if (this.velocity.Y > 10f)
                                    {
                                        this.velocity.Y = 10f;
                                    }
                                }
                                if (flag27)
                                {
                                    this.localAI[0]++;
                                    if (this.velocity.X == 0f)
                                    {
                                        this.localAI[0]++;
                                    }
                                    if (this.localAI[0] >= Main.rand.Next(900, 0x4b0))
                                    {
                                        this.localAI[0] = 0f;
                                        for (int num706 = 0; num706 < 6; num706++)
                                        {
                                            color5 = new Color();
                                            int num707 = Dust.NewDust((Vector2)(((base.Center + ((Vector2.UnitX * -base.direction) * 8f)) - (Vector2.One * 5f)) + (Vector2.UnitY * 8f)), 3, 6, 0xd8, (float)-base.direction, 1f, 0, color5, 1f);
                                            Dust dust208 = Main.dust[num707];
                                            dust208.velocity = (Vector2)(dust208.velocity / 2f);
                                            Main.dust[num707].scale = 0.8f;
                                        }
                                        int num708 = Gore.NewGore(base.Center + ((Vector2)((Vector2.UnitX * -base.direction) * 8f)), Vector2.Zero, Main.rand.Next(580, 0x247), 1f);
                                        Gore gore15 = Main.gore[num708];
                                        gore15.velocity = (Vector2)(gore15.velocity / 2f);
                                        Main.gore[num708].velocity.Y = Math.Abs(Main.gore[num708].velocity.Y);
                                        Main.gore[num708].velocity.X = -Math.Abs(Main.gore[num708].velocity.X) * base.direction;
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x44)
                            {
                                this.rotation += 0.25f * base.direction;
                                this.ai[0]++;
                                if (this.ai[0] >= 3f)
                                {
                                    this.alpha -= 40;
                                    if (this.alpha < 0)
                                    {
                                        this.alpha = 0;
                                    }
                                }
                                if (this.ai[0] >= 15f)
                                {
                                    this.velocity.Y += 0.2f;
                                    if (this.velocity.Y > 16f)
                                    {
                                        this.velocity.Y = 16f;
                                    }
                                    this.velocity.X *= 0.99f;
                                }
                                if (this.alpha == 0)
                                {
                                    Vector2 vector76 = new Vector2(4f, -8f);
                                    float rotation = this.rotation;
                                    if (base.direction == -1)
                                    {
                                        vector76.X = -4f;
                                    }
                                    vector240 = new Vector2();
                                    vector76 = vector76.RotatedBy((double)rotation, vector240);
                                    for (int num710 = 0; num710 < 1; num710++)
                                    {
                                        color5 = new Color();
                                        int num711 = Dust.NewDust((base.Center + vector76) - ((Vector2)(Vector2.One * 5f)), 4, 4, 6, 0f, 0f, 0, color5, 1f);
                                        Main.dust[num711].scale = 1.5f;
                                        Main.dust[num711].noGravity = true;
                                        Main.dust[num711].velocity = (Vector2)((Main.dust[num711].velocity * 0.25f) + (Vector2.Normalize(vector76) * 1f));
                                        vector240 = new Vector2();
                                        Main.dust[num711].velocity = Main.dust[num711].velocity.RotatedBy((double)(-1.570796f * base.direction), vector240);
                                    }
                                }
                                this.spriteDirection = base.direction;
                                if ((this.owner == Main.myPlayer) && (this.timeLeft <= 3))
                                {
                                    this.tileCollide = false;
                                    this.alpha = 0xff;
                                    this.position.X += base.width / 2;
                                    this.position.Y += base.height / 2;
                                    base.width = 80;
                                    base.height = 80;
                                    this.position.X -= base.width / 2;
                                    this.position.Y -= base.height / 2;
                                    this.knockBack = 8f;
                                }
                                if (base.wet && (this.timeLeft > 3))
                                {
                                    this.timeLeft = 3;
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x45)
                            {
                                Vector2 v = Main.player[this.owner].Center - base.Center;
                                this.rotation = v.ToRotation() - 1.57f;
                                if (Main.player[this.owner].dead)
                                {
                                    this.Kill();
                                    return;
                                }
                                Main.player[this.owner].itemAnimation = 10;
                                Main.player[this.owner].itemTime = 10;
                                if (v.X < 0f)
                                {
                                    Main.player[this.owner].ChangeDir(1);
                                    base.direction = 1;
                                }
                                else
                                {
                                    Main.player[this.owner].ChangeDir(-1);
                                    base.direction = -1;
                                }
                                Main.player[this.owner].itemRotation = ((Vector2)((v * -1f) * base.direction)).ToRotation();
                                this.spriteDirection = (v.X > 0f) ? -1 : 1;
                                if ((this.ai[0] == 0f) && (v.Length() > 400f))
                                {
                                    this.ai[0] = 1f;
                                }
                                if ((this.ai[0] == 1f) || (this.ai[0] == 2f))
                                {
                                    float num712 = v.Length();
                                    if (num712 > 1500f)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    if (num712 > 600f)
                                    {
                                        this.ai[0] = 2f;
                                    }
                                    this.tileCollide = false;
                                    float num713 = 20f;
                                    if (this.ai[0] == 2f)
                                    {
                                        num713 = 40f;
                                    }
                                    base.velocity = (Vector2)(Vector2.Normalize(v) * num713);
                                    if (v.Length() < num713)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                }
                                this.ai[1]++;
                                if (this.ai[1] > 5f)
                                {
                                    this.alpha = 0;
                                }
                                if (((((int)this.ai[1]) % 4) == 0) && (this.owner == Main.myPlayer))
                                {
                                    Vector2 vector78 = (Vector2)(v * -1f);
                                    vector78.Normalize();
                                    vector78 = (Vector2)(vector78 * (Main.rand.Next(0x2d, 0x41) * 0.1f));
                                    vector78 = vector78.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, new Vector2());
                                    NewProjectile(base.Center.X, base.Center.Y, vector78.X, vector78.Y, 0x195, this.damage, this.knockBack, this.owner, -10f, 0f);
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 70)
                            {
                                if (this.ai[0] == 0f)
                                {
                                    float num714 = 500f;
                                    int num715 = -1;
                                    for (int num716 = 0; num716 < 200; num716++)
                                    {
                                        NPC npc5 = Main.npc[num716];
                                        if (npc5.CanBeChasedBy(this, false) && Collision.CanHit(base.position, base.width, base.height, npc5.position, npc5.width, npc5.height))
                                        {
                                            vector240 = npc5.Center - base.Center;
                                            float num717 = vector240.Length();
                                            if (num717 < num714)
                                            {
                                                num715 = num716;
                                                num714 = num717;
                                            }
                                        }
                                    }
                                    this.ai[0] = num715 + 1;
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[0] = -15f;
                                    }
                                    if (this.ai[0] > 0f)
                                    {
                                        float num718 = ((float)Main.rand.Next(0x23, 0x4b)) / 30f;
                                        base.velocity = (Vector2)(((base.velocity * 20f) + (Vector2.Normalize((Main.npc[((int)this.ai[0]) - 1].Center - base.Center) + new Vector2((float)Main.rand.Next(-100, 0x65), (float)Main.rand.Next(-100, 0x65))) * num718)) / 21f);
                                        this.netUpdate = true;
                                    }
                                }
                                else if (this.ai[0] > 0f)
                                {
                                    Vector2 vector79 = Vector2.Normalize(Main.npc[((int)this.ai[0]) - 1].Center - base.Center);
                                    base.velocity = (Vector2)(((base.velocity * 40f) + (vector79 * 12f)) / 41f);
                                }
                                else
                                {
                                    this.ai[0]++;
                                    this.alpha -= 0x19;
                                    if (this.alpha < 50)
                                    {
                                        this.alpha = 50;
                                    }
                                    base.velocity = (Vector2)(base.velocity * 0.95f);
                                }
                                if (this.ai[1] == 0f)
                                {
                                    this.ai[1] = ((float)Main.rand.Next(80, 0x79)) / 100f;
                                    this.netUpdate = true;
                                }
                                this.scale = this.ai[1];
                                return;
                            }
                            if (this.aiStyle == 0x47)
                            {
                                this.localAI[1]++;
                                if ((this.localAI[1] > 10f) && (Main.rand.Next(3) == 0))
                                {
                                    int num719 = 6;
                                    for (int num720 = 0; num720 < num719; num720++)
                                    {
                                        Vector2 vector80 = (Vector2)((Vector2.Normalize(base.velocity) * new Vector2((float)base.width, (float)base.height)) / 2f);
                                        vector240 = new Vector2();
                                        vector80 = vector80.RotatedBy((((num720 - ((num719 / 2) - 1)) * 3.1415926535897931) / ((double)num719)), vector240) + base.Center;
                                        Vector2 vector81 = (((float)(Main.rand.NextDouble() * 3.1415927410125732)) - 1.570796f).ToRotationVector2() * Main.rand.Next(3, 8);
                                        color5 = new Color();
                                        int num721 = Dust.NewDust(vector80 + vector81, 0, 0, 0xd9, vector81.X * 2f, vector81.Y * 2f, 100, color5, 1.4f);
                                        Main.dust[num721].noGravity = true;
                                        Main.dust[num721].noLight = true;
                                        Dust dust209 = Main.dust[num721];
                                        dust209.velocity = (Vector2)(dust209.velocity / 4f);
                                        Dust dust210 = Main.dust[num721];
                                        dust210.velocity -= base.velocity;
                                    }
                                    this.alpha -= 5;
                                    if (this.alpha < 50)
                                    {
                                        this.alpha = 50;
                                    }
                                    this.rotation += this.velocity.X * 0.1f;
                                    this.frame = ((int)(this.localAI[1] / 3f)) % 3;
                                    Lighting.AddLight(((int)base.Center.X) / 0x10, ((int)base.Center.Y) / 0x10, 0.1f, 0.4f, 0.6f);
                                }
                                int num722 = -1;
                                Vector2 vector82 = base.Center;
                                float num723 = 500f;
                                if (this.localAI[0] > 0f)
                                {
                                    this.localAI[0]--;
                                }
                                if ((this.ai[0] == 0f) && (this.localAI[0] == 0f))
                                {
                                    for (int num724 = 0; num724 < 200; num724++)
                                    {
                                        NPC npc6 = Main.npc[num724];
                                        if (npc6.CanBeChasedBy(this, false) && ((this.ai[0] == 0f) || (this.ai[0] == (num724 + 1))))
                                        {
                                            Vector2 vector83 = npc6.Center;
                                            float num725 = Vector2.Distance(vector83, vector82);
                                            if ((num725 < num723) && Collision.CanHit(base.position, base.width, base.height, npc6.position, npc6.width, npc6.height))
                                            {
                                                num723 = num725;
                                                vector82 = vector83;
                                                num722 = num724;
                                            }
                                        }
                                    }
                                    if (num722 >= 0)
                                    {
                                        this.ai[0] = num722 + 1;
                                        this.netUpdate = true;
                                    }
                                    num722 = -1;
                                }
                                if ((this.localAI[0] == 0f) && (this.ai[0] == 0f))
                                {
                                    this.localAI[0] = 30f;
                                }
                                bool flag30 = false;
                                if (this.ai[0] != 0f)
                                {
                                    int num726 = (int)(this.ai[0] - 1f);
                                    if ((Main.npc[num726].active && !Main.npc[num726].dontTakeDamage) && (Main.npc[num726].immune[this.owner] == 0))
                                    {
                                        float num727 = Main.npc[num726].position.X + (Main.npc[num726].width / 2);
                                        float num728 = Main.npc[num726].position.Y + (Main.npc[num726].height / 2);
                                        float introduced1807 = Math.Abs((float)((this.position.X + (base.width / 2)) - num727));
                                        float num729 = introduced1807 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num728));
                                        if (num729 < 1000f)
                                        {
                                            flag30 = true;
                                            vector82 = Main.npc[num726].Center;
                                        }
                                    }
                                    else
                                    {
                                        this.ai[0] = 0f;
                                        flag30 = false;
                                        this.netUpdate = true;
                                    }
                                }
                                if (flag30)
                                {
                                    Vector2 vector84 = vector82 - base.Center;
                                    float num730 = base.velocity.ToRotation();
                                    double num732 = vector84.ToRotation() - num730;
                                    if (num732 > 3.1415926535897931)
                                    {
                                        num732 -= 6.2831853071795862;
                                    }
                                    if (num732 < -3.1415926535897931)
                                    {
                                        num732 += 6.2831853071795862;
                                    }
                                    base.velocity = base.velocity.RotatedBy(num732 * 0.10000000149011612, new Vector2());
                                }
                                float num733 = this.velocity.Length();
                                this.velocity.Normalize();
                                base.velocity = (Vector2)(base.velocity * (num733 + 0.0025f));
                                return;
                            }
                            if (this.aiStyle == 0x48)
                            {
                                this.localAI[0]++;
                                if (this.localAI[0] > 5f)
                                {
                                    this.alpha -= 0x19;
                                    if (this.alpha < 50)
                                    {
                                        this.alpha = 50;
                                    }
                                }
                                base.velocity = (Vector2)(base.velocity * 0.96f);
                                if (this.ai[1] == 0f)
                                {
                                    this.ai[1] = ((float)Main.rand.Next(60, 0x79)) / 100f;
                                    this.netUpdate = true;
                                }
                                this.scale = this.ai[1];
                                base.position = base.Center;
                                int num734 = 14;
                                int num735 = 14;
                                base.width = (int)(num734 * this.ai[1]);
                                base.height = (int)(num735 * this.ai[1]);
                                base.position -= new Vector2((float)(base.width / 2), (float)(base.height / 2));
                                return;
                            }
                            if (this.aiStyle == 0x49)
                            {
                                int num736 = (int)this.ai[0];
                                int num737 = (int)this.ai[1];
                                Tile tile = Main.tile[num736, num737];
                                if (((tile == null) || !tile.active()) || (tile.type != 0x152))
                                {
                                    this.Kill();
                                    return;
                                }
                                float num738 = 2f;
                                float num739 = ((float)this.timeLeft) / 60f;
                                if (num739 < 1f)
                                {
                                    num738 *= num739;
                                }
                                if (this.type == 0x1a3)
                                {
                                    for (int num740 = 0; num740 < 2; num740++)
                                    {
                                        Vector2 vector85 = new Vector2(0f, -num738);
                                        vector85 = (Vector2)(vector85 * (0.85f + (((float)Main.rand.NextDouble()) * 0.2f)));
                                        vector240 = new Vector2();
                                        vector85 = vector85.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, vector240);
                                        color5 = new Color();
                                        int num741 = Dust.NewDust(base.position, base.width, base.height, 0xde, 0f, 0f, 100, color5, 1f);
                                        Dust dust3 = Main.dust[num741];
                                        dust3.scale = 1f + (((float)Main.rand.NextDouble()) * 0.3f);
                                        dust3.velocity = (Vector2)(dust3.velocity * 0.5f);
                                        if (dust3.velocity.Y > 0f)
                                        {
                                            dust3.velocity.Y *= -1f;
                                        }
                                        dust3.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f);
                                        dust3.velocity += vector85;
                                        dust3.scale = 0.6f;
                                        dust3.fadeIn = dust3.scale + 0.2f;
                                        dust3.velocity.Y *= 2f;
                                    }
                                }
                                if (this.type == 420)
                                {
                                    for (int num742 = 0; num742 < 2; num742++)
                                    {
                                        Vector2 vector86 = new Vector2(0f, -num738);
                                        vector86 = (Vector2)(vector86 * (0.85f + (((float)Main.rand.NextDouble()) * 0.2f)));
                                        vector240 = new Vector2();
                                        vector86 = vector86.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, vector240);
                                        int num743 = 0xdb;
                                        if (Main.rand.Next(5) == 0)
                                        {
                                            num743 = 0xde;
                                        }
                                        color5 = new Color();
                                        int num744 = Dust.NewDust(base.position, base.width, base.height, num743, 0f, 0f, 100, color5, 1f);
                                        Dust dust4 = Main.dust[num744];
                                        dust4.scale = 1f + (((float)Main.rand.NextDouble()) * 0.3f);
                                        dust4.velocity = (Vector2)(dust4.velocity * 0.5f);
                                        if (dust4.velocity.Y > 0f)
                                        {
                                            dust4.velocity.Y *= -1f;
                                        }
                                        dust4.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f);
                                        dust4.velocity += vector86;
                                        dust4.velocity.X *= 0.5f;
                                        dust4.scale = 0.6f;
                                        dust4.fadeIn = dust4.scale + 0.2f;
                                        dust4.velocity.Y *= 2f;
                                    }
                                }
                                if (this.type == 0x1a5)
                                {
                                    for (int num745 = 0; num745 < 2; num745++)
                                    {
                                        Vector2 vector87 = new Vector2(0f, -num738);
                                        vector87 = (Vector2)(vector87 * (0.85f + (((float)Main.rand.NextDouble()) * 0.2f)));
                                        vector240 = new Vector2();
                                        vector87 = vector87.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331, vector240);
                                        color5 = new Color();
                                        int num746 = Dust.NewDust(base.position, base.width, base.height, 0xdd, 0f, 0f, 100, color5, 1f);
                                        Dust dust5 = Main.dust[num746];
                                        dust5.scale = 1f + (((float)Main.rand.NextDouble()) * 0.3f);
                                        dust5.velocity = (Vector2)(dust5.velocity * 0.1f);
                                        if (dust5.velocity.Y > 0f)
                                        {
                                            dust5.velocity.Y *= -1f;
                                        }
                                        dust5.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f);
                                        dust5.velocity += vector87;
                                        dust5.scale = 0.6f;
                                        dust5.fadeIn = dust5.scale + 0.2f;
                                        dust5.velocity.Y *= 2.5f;
                                    }
                                    if ((this.timeLeft % 10) == 0)
                                    {
                                        float num747 = 0.85f + (((float)Main.rand.NextDouble()) * 0.2f);
                                        for (int num748 = 0; num748 < 9; num748++)
                                        {
                                            Vector2 vector88 = new Vector2(((float)(num748 - 4)) / 5f, -num738 * num747);
                                            color5 = new Color();
                                            int num749 = Dust.NewDust(base.position, base.width, base.height, 0xde, 0f, 0f, 100, color5, 1f);
                                            Dust dust6 = Main.dust[num749];
                                            dust6.scale = 0.7f + (((float)Main.rand.NextDouble()) * 0.3f);
                                            dust6.velocity = (Vector2)(dust6.velocity * 0f);
                                            if (dust6.velocity.Y > 0f)
                                            {
                                                dust6.velocity.Y *= -1f;
                                            }
                                            dust6.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f);
                                            dust6.velocity += vector88;
                                            dust6.scale = 0.6f;
                                            dust6.fadeIn = dust6.scale + 0.2f;
                                            dust6.velocity.Y *= 2f;
                                        }
                                    }
                                }
                                if (this.type == 0x1a6)
                                {
                                    for (int num750 = 0; num750 < 2; num750++)
                                    {
                                        Vector2 vector89 = new Vector2(0f, -num738);
                                        vector89 = (Vector2)(vector89 * (0.85f + (((float)Main.rand.NextDouble()) * 0.2f)));
                                        vector240 = new Vector2();
                                        vector89 = vector89.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, vector240);
                                        color5 = new Color();
                                        int num751 = Dust.NewDust(base.position, base.width, base.height, 0xdb + Main.rand.Next(5), 0f, 0f, 100, color5, 1f);
                                        Dust dust7 = Main.dust[num751];
                                        dust7.scale = 1f + (((float)Main.rand.NextDouble()) * 0.3f);
                                        dust7.velocity = (Vector2)(dust7.velocity * 0.5f);
                                        if (dust7.velocity.Y > 0f)
                                        {
                                            dust7.velocity.Y *= -1f;
                                        }
                                        dust7.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f);
                                        dust7.velocity += vector89;
                                        dust7.scale = 0.6f;
                                        dust7.fadeIn = dust7.scale + 0.2f;
                                        dust7.velocity.Y *= 2f;
                                    }
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x4a)
                            {
                                if (this.extraUpdates == 1)
                                {
                                    this.localAI[0] *= this.localAI[1];
                                    this.localAI[1] -= 0.001f;
                                    if (this.localAI[0] < 0.01)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x4b)
                            {
                                this.AI_075();
                                return;
                            }
                            if (this.aiStyle == 0x4c)
                            {
                                Player mountedPlayer = Main.player[this.owner];
                                mountedPlayer.heldProj = base.whoAmI;
                                if (this.type == 0x1b9)
                                {
                                    if (mountedPlayer.mount.Type != 9)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                }
                                else if ((this.type == 0x1c5) && (mountedPlayer.mount.Type != 8))
                                {
                                    this.Kill();
                                    return;
                                }
                                if (Main.myPlayer != this.owner)
                                {
                                    this.position.X = mountedPlayer.position.X + this.ai[0];
                                    this.position.Y = mountedPlayer.position.Y + this.ai[1];
                                    if (this.type == 0x1b9)
                                    {
                                        if (!mountedPlayer.mount.AbilityCharging)
                                        {
                                            mountedPlayer.mount.StartAbilityCharge(mountedPlayer);
                                        }
                                    }
                                    else if ((this.type == 0x1c5) && !mountedPlayer.mount.AbilityActive)
                                    {
                                        mountedPlayer.mount.UseAbility(mountedPlayer, base.position, false);
                                    }
                                    mountedPlayer.mount.AimAbility(mountedPlayer, base.position);
                                    return;
                                }
                                this.position.X = Main.screenPosition.X + Main.mouseX;
                                this.position.Y = Main.screenPosition.Y + Main.mouseY;
                                if ((this.ai[0] != (this.position.X - mountedPlayer.position.X)) || (this.ai[1] != (this.position.Y - mountedPlayer.position.Y)))
                                {
                                    this.netUpdate = true;
                                }
                                this.ai[0] = this.position.X - mountedPlayer.position.X;
                                this.ai[1] = this.position.Y - mountedPlayer.position.Y;
                                mountedPlayer.mount.AimAbility(mountedPlayer, base.position);
                                if (!mountedPlayer.channel)
                                {
                                    mountedPlayer.mount.UseAbility(mountedPlayer, base.position, false);
                                    this.Kill();
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x4d)
                            {
                                if (this.ai[1] == 1f)
                                {
                                    this.friendly = false;
                                    if (this.alpha < 0xff)
                                    {
                                        this.alpha += 0x33;
                                    }
                                    if (this.alpha >= 0xff)
                                    {
                                        this.alpha = 0xff;
                                        this.Kill();
                                        return;
                                    }
                                }
                                else
                                {
                                    if (this.alpha > 0)
                                    {
                                        this.alpha -= 50;
                                    }
                                    if (this.alpha < 0)
                                    {
                                        this.alpha = 0;
                                    }
                                }
                                float num752 = 30f;
                                float num753 = num752 * 4f;
                                this.ai[0]++;
                                if (this.ai[0] > num753)
                                {
                                    this.ai[0] = 0f;
                                }
                                Vector2 vector90 = -Vector2.UnitY.RotatedBy(((double)((6.283185f * this.ai[0]) / num752)), new Vector2());
                                float num754 = 0.75f + (vector90.Y * 0.25f);
                                float num755 = 0.8f - (vector90.Y * 0.2f);
                                float num756 = Math.Max(num754, num755);
                                base.position += (Vector2)(new Vector2((float)base.width, (float)base.height) / 2f);
                                base.width = base.height = (int)(80f * num756);
                                base.position -= (Vector2)(new Vector2((float)base.width, (float)base.height) / 2f);
                                this.frameCounter++;
                                if (this.frameCounter >= 3)
                                {
                                    this.frameCounter = 0;
                                    this.frame++;
                                    if (this.frame >= 4)
                                    {
                                        this.frame = 0;
                                    }
                                }
                                for (int num757 = 0; num757 < 1; num757++)
                                {
                                    float num758 = 55f * num756;
                                    float num759 = 11f * num756;
                                    float num760 = 0.5f;
                                    color5 = new Color();
                                    int num761 = Dust.NewDust(base.position, base.width, base.height, 0xe2, 0f, 0f, 100, color5, 0.5f);
                                    Main.dust[num761].noGravity = true;
                                    Dust dust211 = Main.dust[num761];
                                    dust211.velocity = (Vector2)(dust211.velocity * 2f);
                                    Main.dust[num761].position = ((Vector2)((((float)Main.rand.NextDouble()) * 6.283185f).ToRotationVector2() * (num759 + ((num760 * ((float)Main.rand.NextDouble())) * num758)))) + base.Center;
                                    Main.dust[num761].velocity = ((Vector2)(Main.dust[num761].velocity / 2f)) + Vector2.Normalize(Main.dust[num761].position - base.Center);
                                    if (Main.rand.Next(2) == 0)
                                    {
                                        color5 = new Color();
                                        num761 = Dust.NewDust(base.position, base.width, base.height, 0xe2, 0f, 0f, 100, color5, 0.9f);
                                        Main.dust[num761].noGravity = true;
                                        Dust dust212 = Main.dust[num761];
                                        dust212.velocity = (Vector2)(dust212.velocity * 1.2f);
                                        Main.dust[num761].position = ((Vector2)((((float)Main.rand.NextDouble()) * 6.283185f).ToRotationVector2() * (num759 + ((num760 * ((float)Main.rand.NextDouble())) * num758)))) + base.Center;
                                        Main.dust[num761].velocity = ((Vector2)(Main.dust[num761].velocity / 2f)) + Vector2.Normalize(Main.dust[num761].position - base.Center);
                                    }
                                    if (Main.rand.Next(4) == 0)
                                    {
                                        color5 = new Color();
                                        num761 = Dust.NewDust(base.position, base.width, base.height, 0xe2, 0f, 0f, 100, color5, 0.7f);
                                        Main.dust[num761].noGravity = true;
                                        Dust dust213 = Main.dust[num761];
                                        dust213.velocity = (Vector2)(dust213.velocity * 1.2f);
                                        Main.dust[num761].position = ((Vector2)((((float)Main.rand.NextDouble()) * 6.283185f).ToRotationVector2() * (num759 + ((num760 * ((float)Main.rand.NextDouble())) * num758)))) + base.Center;
                                        Main.dust[num761].velocity = ((Vector2)(Main.dust[num761].velocity / 2f)) + Vector2.Normalize(Main.dust[num761].position - base.Center);
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x4e)
                            {
                                if (this.alpha > 0)
                                {
                                    this.alpha -= 30;
                                }
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                                Vector2 vector91 = this.ai[0].ToRotationVector2();
                                float num762 = base.velocity.ToRotation();
                                double num764 = vector91.ToRotation() - num762;
                                if (num764 > 3.1415926535897931)
                                {
                                    num764 -= 6.2831853071795862;
                                }
                                if (num764 < -3.1415926535897931)
                                {
                                    num764 += 6.2831853071795862;
                                }
                                base.velocity = base.velocity.RotatedBy(num764 * 0.05000000074505806, new Vector2());
                                base.velocity = (Vector2)(base.velocity * 0.96f);
                                this.rotation = base.velocity.ToRotation() - 1.570796f;
                                if ((Main.myPlayer == this.owner) && (this.timeLeft > 60))
                                {
                                    this.timeLeft = 60;
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x4f)
                            {
                                bool flag31 = true;
                                int num765 = ((int)this.ai[0]) - 1;
                                if ((this.type == 0x1bf) && ((this.ai[0] == 0f) || ((!Main.npc[num765].active || (Main.npc[num765].type != 0x188)) && ((!Main.npc[num765].active || (Main.npc[num765].type != 0x18b)) || (((Main.npc[num765].ai[3] % 120f) < 60f) || (Main.npc[num765].ai[0] != 2f))))))
                                {
                                    flag31 = false;
                                }
                                if (!flag31)
                                {
                                    this.Kill();
                                    return;
                                }
                                NPC npc7 = Main.npc[num765];
                                float num766 = npc7.Center.Y + 46f;
                                int num767 = ((int)npc7.Center.X) / 0x10;
                                int num768 = ((int)num766) / 0x10;
                                int num769 = 0;
                                if ((!Main.tile[num767, num768].nactive() || !Main.tileSolid[Main.tile[num767, num768].type]) || Main.tileSolidTop[Main.tile[num767, num768].type])
                                {
                                    while ((num769 < 150) && ((num768 + num769) < Main.maxTilesY))
                                    {
                                        int num770 = num768 + num769;
                                        if ((Main.tile[num767, num770].nactive() && Main.tileSolid[Main.tile[num767, num770].type]) && !Main.tileSolidTop[Main.tile[num767, num770].type])
                                        {
                                            num769--;
                                            break;
                                        }
                                        num769++;
                                    }
                                }
                                else
                                {
                                    num769 = 1;
                                }
                                this.position.X = npc7.Center.X - (base.width / 2);
                                this.position.Y = num766;
                                base.height = (num769 + 1) * 0x10;
                                int num771 = ((int)this.position.Y) + base.height;
                                if ((Main.tile[num767, num771 / 0x10].nactive() && Main.tileSolid[Main.tile[num767, num771 / 0x10].type]) && !Main.tileSolidTop[Main.tile[num767, num771 / 0x10].type])
                                {
                                    int num772 = num771 % 0x10;
                                    base.height -= num772 - 2;
                                }
                                if (this.type == 0x1bf)
                                {
                                    for (int num773 = 0; num773 < 2; num773++)
                                    {
                                        color5 = new Color();
                                        int num774 = Dust.NewDust(new Vector2(this.position.X, (this.position.Y + base.height) - 16f), base.width, 0x10, 0xe4, 0f, 0f, 0, color5, 1f);
                                        Main.dust[num774].noGravity = true;
                                        Dust dust214 = Main.dust[num774];
                                        dust214.velocity = (Vector2)(dust214.velocity * 0.5f);
                                        Main.dust[num774].velocity.X -= num773 - ((npc7.velocity.X * 2f) / 3f);
                                        Main.dust[num774].scale = 2.8f;
                                    }
                                    if (Main.rand.Next(5) == 0)
                                    {
                                        int num775 = Dust.NewDust(new Vector2(((this.position.X + (base.width / 2)) - ((base.width / 2) * Math.Sign(npc7.velocity.X))) - 4f, (this.position.Y + base.height) - 16f), 4, 0x10, 0x1f, 0f, 0f, 100, new Color(), 1.5f);
                                        Dust dust215 = Main.dust[num775];
                                        dust215.velocity = (Vector2)(dust215.velocity * 0.5f);
                                        Main.dust[num775].velocity.X -= npc7.velocity.X / 2f;
                                        Main.dust[num775].velocity.Y = -Math.Abs(Main.dust[num775].velocity.Y);
                                    }
                                }
                                if ((this.type == 0x1bf) && (++this.frameCounter >= 5))
                                {
                                    this.frameCounter = 0;
                                    if (++this.frame < 4)
                                    {
                                        return;
                                    }
                                    this.frame = 0;
                                }
                                return;
                            }
                            if (this.aiStyle == 80)
                            {
                                if ((this.ai[0] == 0f) && (this.ai[1] > 0f))
                                {
                                    this.ai[1]--;
                                }
                                else if ((this.ai[0] == 0f) && (this.ai[1] == 0f))
                                {
                                    this.ai[0] = 1f;
                                    this.ai[1] = Player.FindClosest(base.position, base.width, base.height);
                                    this.netUpdate = true;
                                    float num776 = this.velocity.Length();
                                    base.velocity = (Vector2)(Vector2.Normalize(base.velocity) * (num776 + 4f));
                                    for (int num777 = 0; num777 < 8; num777++)
                                    {
                                        Vector2 vector92 = (Vector2)(Vector2.UnitX * -8f);
                                        vector240 = new Vector2();
                                        vector92 += -Vector2.UnitY.RotatedBy(((double)((num777 * 3.141593f) / 4f)), vector240) * new Vector2(2f, 8f);
                                        vector240 = new Vector2();
                                        vector92 = vector92.RotatedBy((double)(this.rotation - 1.570796f), vector240);
                                        color5 = new Color();
                                        int num778 = Dust.NewDust(base.Center, 0, 0, 0xe4, 0f, 0f, 0, color5, 1f);
                                        Main.dust[num778].scale = 1.5f;
                                        Main.dust[num778].noGravity = true;
                                        Main.dust[num778].position = base.Center + vector92;
                                        Main.dust[num778].velocity = (Vector2)(base.velocity * 0f);
                                    }
                                }
                                else if (this.ai[0] == 1f)
                                {
                                    this.tileCollide = true;
                                    this.localAI[1]++;
                                    float num779 = 180f;
                                    float num780 = 0f;
                                    float num781 = 30f;
                                    if (this.localAI[1] == num779)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    if ((this.localAI[1] >= num780) && (this.localAI[1] < (num780 + num781)))
                                    {
                                        Vector2 vector93 = Main.player[(int)this.ai[1]].Center - base.Center;
                                        float num782 = base.velocity.ToRotation();
                                        double num784 = vector93.ToRotation() - num782;
                                        if (num784 > 3.1415926535897931)
                                        {
                                            num784 -= 6.2831853071795862;
                                        }
                                        if (num784 < -3.1415926535897931)
                                        {
                                            num784 += 6.2831853071795862;
                                        }
                                        vector240 = new Vector2();
                                        base.velocity = base.velocity.RotatedBy(num784 * 0.20000000298023224, vector240);
                                    }
                                    if ((this.localAI[1] % 5f) == 0f)
                                    {
                                        for (int num785 = 0; num785 < 4; num785++)
                                        {
                                            Vector2 vector94 = (Vector2)(Vector2.UnitX * -8f);
                                            vector240 = new Vector2();
                                            vector94 += -Vector2.UnitY.RotatedBy(((double)((num785 * 3.141593f) / 4f)), vector240) * new Vector2(2f, 4f);
                                            vector240 = new Vector2();
                                            vector94 = vector94.RotatedBy((double)(this.rotation - 1.570796f), vector240);
                                            color5 = new Color();
                                            int num786 = Dust.NewDust(base.Center, 0, 0, 0xe4, 0f, 0f, 0, color5, 1f);
                                            Main.dust[num786].scale = 1.5f;
                                            Main.dust[num786].noGravity = true;
                                            Main.dust[num786].position = base.Center + vector94;
                                            Main.dust[num786].velocity = (Vector2)(base.velocity * 0f);
                                        }
                                    }
                                }
                                this.rotation = base.velocity.ToRotation() + 1.570796f;
                                if (++this.frameCounter >= 3)
                                {
                                    this.frameCounter = 0;
                                    if (++this.frame >= 3)
                                    {
                                        this.frame = 0;
                                    }
                                }
                                for (int num787 = 0; num787 < (1f + this.ai[0]); num787++)
                                {
                                    vector240 = new Vector2();
                                    Vector2 vector95 = (Vector2)((Vector2.UnitY.RotatedBy(((double)this.rotation), vector240) * 8f) * (num787 + 1));
                                    color5 = new Color();
                                    int num788 = Dust.NewDust(base.Center, 0, 0, 0xe4, 0f, 0f, 0, color5, 1f);
                                    Main.dust[num788].position = base.Center + vector95;
                                    Main.dust[num788].scale = 1f;
                                    Main.dust[num788].noGravity = true;
                                }
                                for (int num789 = 0; num789 < 0xff; num789++)
                                {
                                    Player player4 = Main.player[num789];
                                    if ((player4.active && !player4.dead) && (Vector2.Distance(player4.Center, base.Center) <= 42f))
                                    {
                                        this.Kill();
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x51)
                            {
                                int penetrate = this.penetrate;
                                if (this.ai[0] == 0f)
                                {
                                    this.tileCollide = true;
                                    this.localAI[0]++;
                                    if (this.localAI[0] > 7f)
                                    {
                                        int num791 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe2, 0xe5 });
                                        Vector2 vector96 = base.Center;
                                        Vector2 vector97 = new Vector2(-16f, 16f);
                                        float scale = 1f;
                                        vector97 += new Vector2(-16f, 16f);
                                        vector97 = vector97.RotatedBy((double)this.rotation, new Vector2());
                                        int num793 = 4;
                                        int num794 = Dust.NewDust((vector96 + vector97) + (Vector2.One * -num793), num793 * 2, num793 * 2, num791, 0f, 0f, 100, new Color(), scale);
                                        Dust dust216 = Main.dust[num794];
                                        dust216.velocity = (Vector2)(dust216.velocity * 0.1f);
                                        if (Main.rand.Next(6) != 0)
                                        {
                                            Main.dust[num794].noGravity = true;
                                        }
                                    }
                                    float num795 = 0.01f;
                                    int num796 = 5;
                                    int num797 = num796 * 15;
                                    int num798 = 0;
                                    if (this.localAI[0] > 7f)
                                    {
                                        if (this.localAI[1] == 0f)
                                        {
                                            this.scale -= num795;
                                            this.alpha += num796;
                                            if (this.alpha > num797)
                                            {
                                                this.alpha = num797;
                                                this.localAI[1] = 1f;
                                            }
                                        }
                                        else if (this.localAI[1] == 1f)
                                        {
                                            this.scale += num795;
                                            this.alpha -= num796;
                                            if (this.alpha <= num798)
                                            {
                                                this.alpha = num798;
                                                this.localAI[1] = 0f;
                                            }
                                        }
                                    }
                                    this.rotation = base.velocity.ToRotation() + 0.7853982f;
                                }
                                else if ((this.ai[0] >= 1) && (this.ai[0] < (1 + penetrate)))
                                {
                                    this.tileCollide = false;
                                    this.alpha += 15;
                                    base.velocity = (Vector2)(base.velocity * 0.98f);
                                    this.localAI[0] = 0f;
                                    if (this.alpha >= 0xff)
                                    {
                                        if (this.ai[0] == 1f)
                                        {
                                            this.Kill();
                                            return;
                                        }
                                        int num799 = -1;
                                        Vector2 vector98 = base.Center;
                                        float num800 = 250f;
                                        for (int num801 = 0; num801 < 200; num801++)
                                        {
                                            NPC npc8 = Main.npc[num801];
                                            if (npc8.CanBeChasedBy(this, false))
                                            {
                                                Vector2 vector99 = npc8.Center;
                                                float num802 = Vector2.Distance(vector99, base.Center);
                                                if (num802 < num800)
                                                {
                                                    num800 = num802;
                                                    vector98 = vector99;
                                                    num799 = num801;
                                                }
                                            }
                                        }
                                        if (num799 >= 0)
                                        {
                                            this.netUpdate = true;
                                            this.ai[0] += penetrate;
                                            base.position = (Vector2)((vector98 + ((((float)Main.rand.NextDouble()) * 6.283185f).ToRotationVector2() * 100f)) - (new Vector2((float)base.width, (float)base.height) / 2f));
                                            base.velocity = (Vector2)(Vector2.Normalize(vector98 - base.Center) * 15f);
                                            this.rotation = base.velocity.ToRotation() + 0.7853982f;
                                        }
                                        else
                                        {
                                            this.Kill();
                                        }
                                    }
                                    if (Main.rand.Next(3) == 0)
                                    {
                                        int num803 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe2, 0xe5 });
                                        Vector2 vector100 = base.Center;
                                        Vector2 vector101 = new Vector2(-16f, 16f);
                                        vector101 = vector101 = vector101;
                                        float num804 = 0.6f;
                                        vector101 += new Vector2(-16f, 16f);
                                        vector101 = vector101.RotatedBy((double)this.rotation, new Vector2());
                                        int num805 = 4;
                                        int num806 = Dust.NewDust((vector100 + vector101) + (Vector2.One * -num805), num805 * 2, num805 * 2, num803, 0f, 0f, 100, new Color(), num804);
                                        Dust dust217 = Main.dust[num806];
                                        dust217.velocity = (Vector2)(dust217.velocity * 0.1f);
                                        Main.dust[num806].noGravity = true;
                                    }
                                }
                                else if ((this.ai[0] >= (1 + penetrate)) && (this.ai[0] < (1 + (penetrate * 2))))
                                {
                                    this.scale = 0.9f;
                                    this.tileCollide = false;
                                    this.rotation = base.velocity.ToRotation() + 0.7853982f;
                                    this.ai[1]++;
                                    if (this.ai[1] >= 15f)
                                    {
                                        this.alpha += 0x33;
                                        base.velocity = (Vector2)(base.velocity * 0.8f);
                                        if (this.alpha >= 0xff)
                                        {
                                            this.Kill();
                                        }
                                    }
                                    else
                                    {
                                        this.alpha -= 0x7d;
                                        if (this.alpha < 0)
                                        {
                                            this.alpha = 0;
                                        }
                                        base.velocity = (Vector2)(base.velocity * 0.98f);
                                    }
                                    this.localAI[0]++;
                                    int num807 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe2, 0xe5 });
                                    Vector2 vector102 = base.Center;
                                    Vector2 vector103 = new Vector2(-16f, 16f);
                                    float num808 = 0.6f;
                                    vector103 += new Vector2(-16f, 16f);
                                    vector103 = vector103.RotatedBy((double)this.rotation, new Vector2());
                                    int num809 = 4;
                                    int num810 = Dust.NewDust((vector102 + vector103) + (Vector2.One * -num809), num809 * 2, num809 * 2, num807, 0f, 0f, 100, new Color(), num808);
                                    Dust dust218 = Main.dust[num810];
                                    dust218.velocity = (Vector2)(dust218.velocity * 0.1f);
                                    Main.dust[num810].noGravity = true;
                                }
                                float num811 = ((float)this.alpha) / 255f;
                                Lighting.AddLight(((int)base.Center.X) / 0x10, ((int)base.Center.Y) / 0x10, 0.3f * num811, 0.4f * num811, 1f * num811);
                                return;
                            }
                            if (this.aiStyle == 0x52)
                            {
                                this.alpha -= 40;
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                                if (this.ai[0] == 0f)
                                {
                                    this.localAI[0]++;
                                    if (this.localAI[0] >= 45f)
                                    {
                                        this.localAI[0] = 0f;
                                        this.ai[0] = 1f;
                                        this.ai[1] = -this.ai[1];
                                        this.netUpdate = true;
                                    }
                                    this.velocity.X = base.velocity.RotatedBy(((double)this.ai[1]), new Vector2()).X;
                                    this.velocity.X = MathHelper.Clamp(this.velocity.X, -6f, 6f);
                                    this.velocity.Y -= 0.08f;
                                    if (this.velocity.Y > 0f)
                                    {
                                        this.velocity.Y -= 0.2f;
                                    }
                                    if (this.velocity.Y < -7f)
                                    {
                                        this.velocity.Y = -7f;
                                    }
                                }
                                else if (this.ai[0] == 1f)
                                {
                                    this.localAI[0]++;
                                    if (this.localAI[0] >= 90f)
                                    {
                                        this.localAI[0] = 0f;
                                        this.ai[0] = 2f;
                                        this.ai[1] = Player.FindClosest(base.position, base.width, base.height);
                                        this.netUpdate = true;
                                    }
                                    this.velocity.X = base.velocity.RotatedBy(((double)this.ai[1]), new Vector2()).X;
                                    this.velocity.X = MathHelper.Clamp(this.velocity.X, -6f, 6f);
                                    this.velocity.Y -= 0.08f;
                                    if (this.velocity.Y > 0f)
                                    {
                                        this.velocity.Y -= 0.2f;
                                    }
                                    if (this.velocity.Y < -7f)
                                    {
                                        this.velocity.Y = -7f;
                                    }
                                }
                                else if (this.ai[0] == 2f)
                                {
                                    Vector2 vector104 = Main.player[(int)this.ai[1]].Center - base.Center;
                                    if (vector104.Length() < 30f)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    vector104.Normalize();
                                    vector104 = (Vector2)(vector104 * 14f);
                                    vector104 = Vector2.Lerp(base.velocity, vector104, 0.6f);
                                    if (vector104.Y < 6f)
                                    {
                                        vector104.Y = 6f;
                                    }
                                    float num812 = 0.4f;
                                    if (this.velocity.X < vector104.X)
                                    {
                                        this.velocity.X += num812;
                                        if ((this.velocity.X < 0f) && (vector104.X > 0f))
                                        {
                                            this.velocity.X += num812;
                                        }
                                    }
                                    else if (this.velocity.X > vector104.X)
                                    {
                                        this.velocity.X -= num812;
                                        if ((this.velocity.X > 0f) && (vector104.X < 0f))
                                        {
                                            this.velocity.X -= num812;
                                        }
                                    }
                                    if (this.velocity.Y < vector104.Y)
                                    {
                                        this.velocity.Y += num812;
                                        if ((this.velocity.Y < 0f) && (vector104.Y > 0f))
                                        {
                                            this.velocity.Y += num812;
                                        }
                                    }
                                    else if (this.velocity.Y > vector104.Y)
                                    {
                                        this.velocity.Y -= num812;
                                        if ((this.velocity.Y > 0f) && (vector104.Y < 0f))
                                        {
                                            this.velocity.Y -= num812;
                                        }
                                    }
                                }
                                if (this.alpha < 40)
                                {
                                    int num813 = Dust.NewDust(base.Center - ((Vector2)(Vector2.One * 5f)), 10, 10, 0xe5, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 1.2f);
                                    Main.dust[num813].noGravity = true;
                                }
                                this.rotation = base.velocity.ToRotation() + 1.570796f;
                                return;
                            }
                            if (this.aiStyle == 0x53)
                            {
                                if (this.alpha > 200)
                                {
                                    this.alpha = 200;
                                }
                                this.alpha -= 5;
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                                float num814 = ((float)this.alpha) / 255f;
                                this.scale = 1f - num814;
                                if (this.ai[0] >= 0f)
                                {
                                    this.ai[0]++;
                                }
                                if (this.ai[0] == -1f)
                                {
                                    this.frame = 1;
                                    this.extraUpdates = 1;
                                }
                                else if (this.ai[0] < 30f)
                                {
                                    base.position = (Main.npc[(int)this.ai[1]].Center - ((Vector2)(new Vector2((float)base.width, (float)base.height) / 2f))) - base.velocity;
                                }
                                else
                                {
                                    base.velocity = (Vector2)(base.velocity * 0.96f);
                                    if (++this.frameCounter >= 6)
                                    {
                                        this.frameCounter = 0;
                                        if (++this.frame >= 2)
                                        {
                                            this.frame = 0;
                                        }
                                    }
                                }
                                if (this.alpha < 40)
                                {
                                    for (int num815 = 0; num815 < 2; num815++)
                                    {
                                        float num816 = (((float)Main.rand.NextDouble()) * 1f) - 0.5f;
                                        if (num816 < -0.5f)
                                        {
                                            num816 = -0.5f;
                                        }
                                        if (num816 > 0.5f)
                                        {
                                            num816 = 0.5f;
                                        }
                                        vector240 = new Vector2();
                                        vector240 = new Vector2();
                                        Vector2 vector105 = new Vector2((-base.width * 0.65f) * this.scale, 0f).RotatedBy(((double)(num816 * 6.283185f)), vector240).RotatedBy((double)base.velocity.ToRotation(), vector240);
                                        int num817 = Dust.NewDust(base.Center - ((Vector2)(Vector2.One * 5f)), 10, 10, 0xe5, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 0.7f);
                                        Main.dust[num817].velocity = Vector2.Zero;
                                        Main.dust[num817].position = base.Center + vector105;
                                        Main.dust[num817].noGravity = true;
                                    }
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x54)
                            {
                                Vector2? nullable = null;
                                if (base.velocity.HasNaNs() || (base.velocity == Vector2.Zero))
                                {
                                    base.velocity = -Vector2.UnitY;
                                }
                                if (((this.type == 0x1c7) && Main.npc[(int)this.ai[1]].active) && (Main.npc[(int)this.ai[1]].type == 0x18c))
                                {
                                    Vector2 vector106 = new Vector2(27f, 59f);
                                    Vector2 vector107 = Utils.Vector2FromElipse(Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2(), (Vector2)(vector106 * Main.npc[(int)this.ai[1]].localAI[1]));
                                    base.position = (Main.npc[(int)this.ai[1]].Center + vector107) - ((Vector2)(new Vector2((float)base.width, (float)base.height) / 2f));
                                }
                                else if (((this.type == 0x1c7) && Main.npc[(int)this.ai[1]].active) && (Main.npc[(int)this.ai[1]].type == 400))
                                {
                                    Vector2 vector108 = new Vector2(30f, 30f);
                                    Vector2 vector109 = Utils.Vector2FromElipse(Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2(), (Vector2)(vector108 * Main.npc[(int)this.ai[1]].localAI[1]));
                                    base.position = (Main.npc[(int)this.ai[1]].Center + vector109) - ((Vector2)(new Vector2((float)base.width, (float)base.height) / 2f));
                                }
                                else if (((this.type == 0x219) && Main.npc[(int)this.ai[1]].active) && (Main.npc[(int)this.ai[1]].type == 0x19b))
                                {
                                    Vector2 vector110 = new Vector2((float)(Main.npc[(int)this.ai[1]].direction * 6), -4f);
                                    base.position = ((Main.npc[(int)this.ai[1]].Center + vector110) - ((Vector2)(base.Size / 2f))) + new Vector2(0f, -Main.npc[(int)this.ai[1]].gfxOffY);
                                }
                                else if (((this.type == 0x1cd) && Main.projectile[(int)this.ai[1]].active) && (Main.projectile[(int)this.ai[1]].type == 460))
                                {
                                    Vector2 vector111 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
                                    base.position = ((Vector2)((Main.projectile[(int)this.ai[1]].Center + (vector111 * 16f)) - (new Vector2((float)base.width, (float)base.height) / 2f))) + new Vector2(0f, -Main.projectile[(int)this.ai[1]].gfxOffY);
                                    base.velocity = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
                                }
                                else if (((this.type == 0x282) && Main.projectile[(int)this.ai[1]].active) && (Main.projectile[(int)this.ai[1]].type == 0x281))
                                {
                                    base.Center = Main.projectile[(int)this.ai[1]].Center;
                                    base.velocity = Vector2.Normalize(Main.projectile[(int)this.ai[1]].ai[1].ToRotationVector2());
                                }
                                else if (((this.type == 0x278) && Main.projectile[(int)this.ai[1]].active) && (Main.projectile[(int)this.ai[1]].type == 0x279))
                                {
                                    float num818 = ((int)this.ai[0]) - 2.5f;
                                    Vector2 vector112 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
                                    Projectile projectile = Main.projectile[(int)this.ai[1]];
                                    float num819 = num818 * 0.5235988f;
                                    float num820 = 20f;
                                    Vector2 vector113 = Vector2.Zero;
                                    float num821 = 1f;
                                    float num822 = 15f;
                                    float num823 = -2f;
                                    if (projectile.ai[0] < 180f)
                                    {
                                        num821 = 1f - (projectile.ai[0] / 180f);
                                        num822 = 20f - ((projectile.ai[0] / 180f) * 14f);
                                        if (projectile.ai[0] < 120f)
                                        {
                                            num820 = 20f - (4f * (projectile.ai[0] / 120f));
                                            this.Opacity = (projectile.ai[0] / 120f) * 0.4f;
                                        }
                                        else
                                        {
                                            num820 = 16f - (10f * ((projectile.ai[0] - 120f) / 60f));
                                            this.Opacity = 0.4f + (((projectile.ai[0] - 120f) / 60f) * 0.6f);
                                        }
                                        num823 = -22f + ((projectile.ai[0] / 180f) * 20f);
                                    }
                                    else
                                    {
                                        num821 = 0f;
                                        num820 = 1.75f;
                                        num822 = 6f;
                                        this.Opacity = 1f;
                                        num823 = -2f;
                                    }
                                    float num824 = ((projectile.ai[0] + (num818 * num820)) / (num820 * 6f)) * 6.283185f;
                                    vector240 = new Vector2();
                                    num819 = (Vector2.UnitY.RotatedBy(((double)num824), vector240).Y * 0.5235988f) * num821;
                                    vector240 = new Vector2();
                                    vector240 = new Vector2();
                                    vector113 = (Vector2.UnitY.RotatedBy(((double)num824), vector240) * new Vector2(4f, num822)).RotatedBy((double)projectile.velocity.ToRotation(), vector240);
                                    base.position = ((Vector2)((projectile.Center + (vector112 * 16f)) - (base.Size / 2f))) + new Vector2(0f, -Main.projectile[(int)this.ai[1]].gfxOffY);
                                    base.position += (Vector2)(projectile.velocity.ToRotation().ToRotationVector2() * num823);
                                    base.position += vector113;
                                    vector240 = new Vector2();
                                    base.velocity = Vector2.Normalize(projectile.velocity).RotatedBy((double)num819, vector240);
                                    this.scale = 1.4f * (1f - num821);
                                    this.damage = projectile.damage;
                                    if (projectile.ai[0] >= 180f)
                                    {
                                        this.damage *= 3;
                                        nullable = new Vector2?(projectile.Center);
                                    }
                                    if (!Collision.CanHitLine(Main.player[this.owner].Center, 0, 0, projectile.Center, 0, 0))
                                    {
                                        nullable = new Vector2?(Main.player[this.owner].Center);
                                    }
                                    this.friendly = projectile.ai[0] > 30f;
                                }
                                else
                                {
                                    this.Kill();
                                    return;
                                }
                                if (base.velocity.HasNaNs() || (base.velocity == Vector2.Zero))
                                {
                                    base.velocity = -Vector2.UnitY;
                                }
                                if (this.type == 0x1cd)
                                {
                                    this.ai[0]++;
                                    if (this.ai[0] >= 300f)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    this.scale = ((float)Math.Sin((double)((this.ai[0] * 3.141593f) / 300f))) * 10f;
                                    if (this.scale > 1f)
                                    {
                                        this.scale = 1f;
                                    }
                                }
                                if (this.type == 0x1c7)
                                {
                                    if (this.localAI[0] == 0f)
                                    {
                                        Main.PlaySound(0x1d, (int)this.position.X, (int)this.position.Y, 0x68);
                                    }
                                    float num825 = 1f;
                                    if (Main.npc[(int)this.ai[1]].type == 400)
                                    {
                                        num825 = 0.4f;
                                    }
                                    this.localAI[0]++;
                                    if (this.localAI[0] >= 180f)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    this.scale = (((float)Math.Sin((double)((this.localAI[0] * 3.141593f) / 180f))) * 10f) * num825;
                                    if (this.scale > num825)
                                    {
                                        this.scale = num825;
                                    }
                                }
                                if (this.type == 0x282)
                                {
                                    float num826 = 1f;
                                    this.localAI[0]++;
                                    if (this.localAI[0] >= 50f)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    this.scale = (((float)Math.Sin((double)((this.localAI[0] * 3.141593f) / 50f))) * 10f) * num826;
                                    if (this.scale > num826)
                                    {
                                        this.scale = num826;
                                    }
                                }
                                if (this.type == 0x219)
                                {
                                    float num827 = 0.8f;
                                    this.localAI[0]++;
                                    if (this.localAI[0] >= 60f)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    this.scale = (((float)Math.Sin((double)((this.localAI[0] * 3.141593f) / 60f))) * 10f) * num827;
                                    if (this.scale > num827)
                                    {
                                        this.scale = num827;
                                    }
                                }
                                float f = base.velocity.ToRotation();
                                if (this.type == 0x1c7)
                                {
                                    f += this.ai[0];
                                }
                                this.rotation = f - 1.570796f;
                                base.velocity = f.ToRotationVector2();
                                float num829 = 0f;
                                float width = 0f;
                                Vector2 vector114 = base.Center;
                                if (nullable.HasValue)
                                {
                                    vector114 = nullable.Value;
                                }
                                if (this.type == 0x1c7)
                                {
                                    num829 = 3f;
                                    width = base.width;
                                }
                                else if (this.type == 0x1cd)
                                {
                                    num829 = 2f;
                                    width = 0f;
                                }
                                else if (this.type == 0x282)
                                {
                                    num829 = 2f;
                                    width = 0f;
                                }
                                else if (this.type == 0x278)
                                {
                                    num829 = 2f;
                                    width = 0f;
                                }
                                else if (this.type == 0x219)
                                {
                                    num829 = 2f;
                                    width = 0f;
                                }
                                float[] numArray3 = new float[(int)num829];
                                for (int num831 = 0; num831 < num829; num831++)
                                {
                                    Tuple<int, int> tuple;
                                    float num832 = ((float)num831) / (num829 - 1f);
                                    vector240 = new Vector2();
                                    Vector2 vector115 = vector114 + ((Vector2)(((base.velocity.RotatedBy(1.5707963705062866, vector240) * (num832 - 0.5f)) * width) * this.scale));
                                    int num833 = ((int)vector115.X) / 0x10;
                                    int num834 = ((int)vector115.Y) / 0x10;
                                    Vector2 vector116 = vector115 + ((Vector2)((base.velocity * 16f) * 150f));
                                    int num835 = ((int)vector116.X) / 0x10;
                                    int num836 = ((int)vector116.Y) / 0x10;
                                    float num837 = 0f;
                                    if (!Collision.TupleHitLine(num833, num834, num835, num836, 0, 0, new System.Collections.Generic.List<Tuple<int, int>>(), out tuple))
                                    {
                                        vector240 = new Vector2((float)Math.Abs((int)(num833 - tuple.Item1)), (float)Math.Abs((int)(num834 - tuple.Item2)));
                                        num837 = vector240.Length() * 16f;
                                    }
                                    else if ((tuple.Item1 == num835) && (tuple.Item2 == num836))
                                    {
                                        num837 = 2400f;
                                    }
                                    else
                                    {
                                        vector240 = new Vector2((float)Math.Abs((int)(num833 - tuple.Item1)), (float)Math.Abs((int)(num834 - tuple.Item2)));
                                        num837 = vector240.Length() * 16f;
                                    }
                                    numArray3[num831] = num837;
                                }
                                float num838 = 0f;
                                for (int num839 = 0; num839 < numArray3.Length; num839++)
                                {
                                    num838 += numArray3[num839];
                                }
                                num838 /= num829;
                                float amount = 0.5f;
                                if (this.type == 0x278)
                                {
                                    amount = 0.75f;
                                }
                                this.localAI[1] = MathHelper.Lerp(this.localAI[1], num838, amount);
                                if (this.type == 0x1c7)
                                {
                                    Vector2 vector117 = base.Center + ((Vector2)(base.velocity * (this.localAI[1] - 14f)));
                                    for (int num841 = 0; num841 < 2; num841++)
                                    {
                                        float num842 = base.velocity.ToRotation() + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f);
                                        float num843 = (((float)Main.rand.NextDouble()) * 2f) + 2f;
                                        Vector2 vector118 = new Vector2(((float)Math.Cos((double)num842)) * num843, ((float)Math.Sin((double)num842)) * num843);
                                        color5 = new Color();
                                        int num844 = Dust.NewDust(vector117, 0, 0, 0xe5, vector118.X, vector118.Y, 0, color5, 1f);
                                        Main.dust[num844].noGravity = true;
                                        Main.dust[num844].scale = 1.7f;
                                    }
                                    if (Main.rand.Next(5) == 0)
                                    {
                                        vector240 = new Vector2();
                                        Vector2 vector119 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, vector240) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width);
                                        color5 = new Color();
                                        int num845 = Dust.NewDust((vector117 + vector119) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, color5, 1.5f);
                                        Dust dust219 = Main.dust[num845];
                                        dust219.velocity = (Vector2)(dust219.velocity * 0.5f);
                                        Main.dust[num845].velocity.Y = -Math.Abs(Main.dust[num845].velocity.Y);
                                    }
                                    DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f);
                                    Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * this.localAI[1])), base.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight));
                                }
                                else if (this.type == 0x282)
                                {
                                    Vector2 vector120 = base.Center + ((Vector2)(base.velocity * (this.localAI[1] - 14f)));
                                    for (int num846 = 0; num846 < 2; num846++)
                                    {
                                        float num847 = base.velocity.ToRotation() + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f);
                                        float num848 = (((float)Main.rand.NextDouble()) * 2f) + 2f;
                                        Vector2 vector121 = new Vector2(((float)Math.Cos((double)num847)) * num848, ((float)Math.Sin((double)num847)) * num848);
                                        color5 = new Color();
                                        int num849 = Dust.NewDust(vector120, 0, 0, 0xe5, vector121.X, vector121.Y, 0, color5, 1f);
                                        Main.dust[num849].noGravity = true;
                                        Main.dust[num849].scale = 1.7f;
                                    }
                                    if (Main.rand.Next(5) == 0)
                                    {
                                        vector240 = new Vector2();
                                        Vector2 vector122 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, vector240) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width);
                                        color5 = new Color();
                                        int num850 = Dust.NewDust((vector120 + vector122) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, color5, 1.5f);
                                        Dust dust220 = Main.dust[num850];
                                        dust220.velocity = (Vector2)(dust220.velocity * 0.5f);
                                        Main.dust[num850].velocity.Y = -Math.Abs(Main.dust[num850].velocity.Y);
                                    }
                                    DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f);
                                    Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * this.localAI[1])), base.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight));
                                }
                                if (this.type == 0x1cd)
                                {
                                    Vector2 vector123 = base.Center + ((Vector2)(base.velocity * (this.localAI[1] - 8f)));
                                    for (int num851 = 0; num851 < 2; num851++)
                                    {
                                        float num852 = base.velocity.ToRotation() + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f);
                                        float num853 = (((float)Main.rand.NextDouble()) * 0.8f) + 1f;
                                        Vector2 vector124 = new Vector2(((float)Math.Cos((double)num852)) * num853, ((float)Math.Sin((double)num852)) * num853);
                                        color5 = new Color();
                                        int num854 = Dust.NewDust(vector123, 0, 0, 0xe2, vector124.X, vector124.Y, 0, color5, 1f);
                                        Main.dust[num854].noGravity = true;
                                        Main.dust[num854].scale = 1.2f;
                                    }
                                    if (Main.rand.Next(5) == 0)
                                    {
                                        vector240 = new Vector2();
                                        Vector2 vector125 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, vector240) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width);
                                        color5 = new Color();
                                        int num855 = Dust.NewDust((vector123 + vector125) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, color5, 1.5f);
                                        Dust dust221 = Main.dust[num855];
                                        dust221.velocity = (Vector2)(dust221.velocity * 0.5f);
                                        Main.dust[num855].velocity.Y = -Math.Abs(Main.dust[num855].velocity.Y);
                                    }
                                    DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f);
                                    Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * this.localAI[1])), base.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight));
                                }
                                if (this.type == 0x219)
                                {
                                    Vector2 vector126 = base.Center + ((Vector2)(base.velocity * (this.localAI[1] - 8f)));
                                    for (int num856 = 0; num856 < 2; num856++)
                                    {
                                        float num857 = base.velocity.ToRotation() + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f);
                                        float num858 = (((float)Main.rand.NextDouble()) * 0.8f) + 1f;
                                        Vector2 vector127 = new Vector2(((float)Math.Cos((double)num857)) * num858, ((float)Math.Sin((double)num857)) * num858);
                                        color5 = new Color();
                                        int num859 = Dust.NewDust(vector126, 0, 0, 0xe2, vector127.X, vector127.Y, 0, color5, 1f);
                                        Main.dust[num859].noGravity = true;
                                        Main.dust[num859].scale = 1.2f;
                                    }
                                    if (Main.rand.Next(5) == 0)
                                    {
                                        vector240 = new Vector2();
                                        Vector2 vector128 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, vector240) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width);
                                        color5 = new Color();
                                        int num860 = Dust.NewDust((vector126 + vector128) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, color5, 1.5f);
                                        Dust dust222 = Main.dust[num860];
                                        dust222.velocity = (Vector2)(dust222.velocity * 0.5f);
                                        Main.dust[num860].velocity.Y = -Math.Abs(Main.dust[num860].velocity.Y);
                                    }
                                    DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f);
                                    Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * this.localAI[1])), base.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight));
                                }
                                if (((this.type == 0x278) && (Math.Abs((float)(this.localAI[1] - num838)) < 100f)) && (this.scale > 0.15f))
                                {
                                    Color color2 = Main.hslToRgb(this.GetPrismHue(this.ai[0]), 1f, 0.5f);
                                    color2.A = 0;
                                    Vector2 vector129 = base.Center + ((Vector2)(base.velocity * (this.localAI[1] - (14.5f * this.scale))));
                                    float num862 = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X;
                                    for (int num863 = 0; num863 < 2; num863++)
                                    {
                                        float num864 = base.velocity.ToRotation() + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f);
                                        float num865 = (((float)Main.rand.NextDouble()) * 0.8f) + 1f;
                                        Vector2 vector130 = new Vector2(((float)Math.Cos((double)num864)) * num865, ((float)Math.Sin((double)num864)) * num865);
                                        color5 = new Color();
                                        int num866 = Dust.NewDust(vector129, 0, 0, 0x10b, vector130.X, vector130.Y, 0, color5, 1f);
                                        Main.dust[num866].color = color2;
                                        Main.dust[num866].scale = 1.2f;
                                        if (this.scale > 1f)
                                        {
                                            Dust dust223 = Main.dust[num866];
                                            dust223.velocity = (Vector2)(dust223.velocity * this.scale);
                                            Dust dust224 = Main.dust[num866];
                                            dust224.scale *= this.scale;
                                        }
                                        Main.dust[num866].noGravity = true;
                                        if (this.scale != 1.4f)
                                        {
                                            Dust dust8 = Dust.CloneDust(Main.dust[num866]);
                                            dust8.color = Color.White;
                                            dust8.scale /= 2f;
                                        }
                                        float hue = (num862 + (Main.rand.NextFloat() * 0.4f)) % 1f;
                                        Main.dust[num866].color = Color.Lerp(color2, Main.hslToRgb(hue, 1f, 0.75f), this.scale / 1.4f);
                                    }
                                    if (Main.rand.Next(5) == 0)
                                    {
                                        Vector2 vector131 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, new Vector2()) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width);
                                        int num868 = Dust.NewDust((vector129 + vector131) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, new Color(), 1.5f);
                                        Dust dust225 = Main.dust[num868];
                                        dust225.velocity = (Vector2)(dust225.velocity * 0.5f);
                                        Main.dust[num868].velocity.Y = -Math.Abs(Main.dust[num868].velocity.Y);
                                    }
                                    DelegateMethods.v3_1 = (Vector3)(color2.ToVector3() * 0.3f);
                                    Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * this.localAI[1])), base.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight));
                                    return;
                                }
                                return;
                            }
                            if (this.aiStyle == 0x55)
                            {
                                Vector2 vector132 = new Vector2(0f, 216f);
                                this.alpha -= 15;
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                                int num869 = ((int)Math.Abs(this.ai[0])) - 1;
                                int num870 = (int)this.ai[1];
                                if (!Main.npc[num869].active || (Main.npc[num869].type != 0x18c))
                                {
                                    this.Kill();
                                    return;
                                }
                                this.localAI[0]++;
                                if (((this.localAI[0] >= 330f) && (this.ai[0] > 0f)) && (Main.netMode != 1))
                                {
                                    this.ai[0] *= -1f;
                                    this.netUpdate = true;
                                }
                                if (((Main.netMode != 1) && (this.ai[0] > 0f)) && (!Main.player[(int)this.ai[1]].active || Main.player[(int)this.ai[1]].dead))
                                {
                                    this.ai[0] *= -1f;
                                    this.netUpdate = true;
                                }
                                this.rotation = ((Main.npc[((int)Math.Abs(this.ai[0])) - 1].Center - Main.player[(int)this.ai[1]].Center) + vector132).ToRotation() + 1.570796f;
                                if (this.ai[0] <= 0f)
                                {
                                    Vector2 vector134 = (Main.npc[((int)Math.Abs(this.ai[0])) - 1].Center - base.Center) + vector132;
                                    if ((vector134.X != 0f) || (vector134.Y != 0f))
                                    {
                                        base.velocity = (Vector2)(Vector2.Normalize(vector134) * Math.Min(16f, vector134.Length()));
                                    }
                                    else
                                    {
                                        base.velocity = Vector2.Zero;
                                    }
                                    if (vector134.Length() < 20f)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                }
                                else
                                {
                                    Vector2 vector133 = Main.player[(int)this.ai[1]].Center - base.Center;
                                    if ((vector133.X != 0f) || (vector133.Y != 0f))
                                    {
                                        base.velocity = (Vector2)(Vector2.Normalize(vector133) * Math.Min(16f, vector133.Length()));
                                    }
                                    else
                                    {
                                        base.velocity = Vector2.Zero;
                                    }
                                    if ((vector133.Length() < 20f) && (this.localAI[1] == 0f))
                                    {
                                        this.localAI[1] = 1f;
                                        int num871 = 840;
                                        if (Main.expertMode)
                                        {
                                            num871 = 960;
                                        }
                                        Main.player[num870].AddBuff(0x91, num871, true);
                                        return;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x56)
                            {
                                if (this.localAI[1] == 0f)
                                {
                                    this.localAI[1] = 1f;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 120);
                                }
                                this.ai[0]++;
                                if (this.ai[1] == 1f)
                                {
                                    if (this.ai[0] >= 130f)
                                    {
                                        this.alpha += 10;
                                    }
                                    else
                                    {
                                        this.alpha -= 10;
                                    }
                                    if (this.alpha < 0)
                                    {
                                        this.alpha = 0;
                                    }
                                    if (this.alpha > 0xff)
                                    {
                                        this.alpha = 0xff;
                                    }
                                    if (this.ai[0] >= 150f)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    if (((this.ai[0] % 30f) == 0f) && (Main.netMode != 1))
                                    {
                                        Vector2 vector135 = this.rotation.ToRotationVector2();
                                        NewProjectile(base.Center.X, base.Center.Y, vector135.X, vector135.Y, 0x1d0, this.damage, this.knockBack, this.owner, 0f, 0f);
                                    }
                                    this.rotation += 0.1047198f;
                                    Lighting.AddLight(base.Center, 0.3f, 0.75f, 0.9f);
                                    return;
                                }
                                base.position -= base.velocity;
                                if (this.ai[0] >= 40f)
                                {
                                    this.alpha += 3;
                                }
                                else
                                {
                                    this.alpha -= 40;
                                }
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                                if (this.alpha > 0xff)
                                {
                                    this.alpha = 0xff;
                                }
                                if (this.ai[0] >= 45f)
                                {
                                    this.Kill();
                                    return;
                                }
                                vector240 = new Vector2();
                                Vector2 vector136 = new Vector2(0f, -720f).RotatedBy((double)base.velocity.ToRotation(), vector240);
                                float num872 = (this.ai[0] % 45f) / 45f;
                                Vector2 vector137 = (Vector2)(vector136 * num872);
                                for (int num873 = 0; num873 < 6; num873++)
                                {
                                    vector240 = new Vector2();
                                    Vector2 vector138 = base.Center + vector137.RotatedBy(((double)((num873 * 6.283185f) / 6f)), vector240);
                                    Lighting.AddLight(vector138, 0.3f, 0.75f, 0.9f);
                                    for (int num874 = 0; num874 < 2; num874++)
                                    {
                                        int num875 = Dust.NewDust(vector138 + ((Vector2)(Utils.RandomVector2(Main.rand, -8f, 8f) / 2f)), 8, 8, 0xc5, 0f, 0f, 100, Color.Transparent, 1f);
                                        Main.dust[num875].noGravity = true;
                                    }
                                }
                                return;
                            }
                            if (this.aiStyle == 0x57)
                            {
                                this.position.Y = this.ai[0];
                                base.height = (int)this.ai[1];
                                if (base.Center.X > Main.player[this.owner].Center.X)
                                {
                                    base.direction = 1;
                                }
                                else
                                {
                                    base.direction = -1;
                                }
                                this.velocity.X = base.direction * 1E-06f;
                                if (this.owner == Main.myPlayer)
                                {
                                    for (int num876 = 0; num876 < 0x3e8; num876++)
                                    {
                                        if (((Main.projectile[num876].active && (num876 != base.whoAmI)) && ((Main.projectile[num876].type == this.type) && (Main.projectile[num876].owner == this.owner))) && (Main.projectile[num876].timeLeft > this.timeLeft))
                                        {
                                            this.Kill();
                                            return;
                                        }
                                    }
                                }
                                float num877 = (base.width * base.height) * 0.0045f;
                                for (int num878 = 0; num878 < num877; num878++)
                                {
                                    color5 = new Color();
                                    int num879 = Dust.NewDust(base.position, base.width, base.height, 0x4b, 0f, 0f, 100, color5, 1f);
                                    Main.dust[num879].noGravity = true;
                                    Dust dust226 = Main.dust[num879];
                                    dust226.velocity = (Vector2)(dust226.velocity * 0.5f);
                                    Main.dust[num879].velocity.Y -= 0.5f;
                                    Main.dust[num879].scale = 1.4f;
                                    Main.dust[num879].position.X += 6f;
                                    Main.dust[num879].position.Y -= 2f;
                                }
                                return;
                            }
                            if (this.aiStyle != 0x58)
                            {
                                float num1163;
                                if (this.aiStyle == 0x59)
                                {
                                    if (this.ai[1] == -1f)
                                    {
                                        this.alpha += 12;
                                    }
                                    else if (this.ai[0] < 300f)
                                    {
                                        this.alpha -= 5;
                                    }
                                    else
                                    {
                                        this.alpha += 12;
                                    }
                                    if (this.alpha < 0)
                                    {
                                        this.alpha = 0;
                                    }
                                    if (this.alpha > 0xff)
                                    {
                                        this.alpha = 0xff;
                                    }
                                    this.scale = 1f - (((float)this.alpha) / 255f);
                                    this.scale *= 0.6f;
                                    this.rotation += 0.01495997f;
                                    if (this.localAI[1] == 0f)
                                    {
                                        this.localAI[1] = 1f;
                                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x7b);
                                    }
                                    if (this.alpha == 0)
                                    {
                                        for (int num913 = 0; num913 < 2; num913++)
                                        {
                                            float num914 = Main.rand.Next(2, 4);
                                            float num915 = this.scale;
                                            if (num913 == 1)
                                            {
                                                num915 *= 0.42f;
                                                num914 *= -0.75f;
                                            }
                                            Vector2 vector153 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11));
                                            vector153.Normalize();
                                            color5 = new Color();
                                            int num916 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xe4, 0f, 0f, 100, color5, 2f);
                                            Main.dust[num916].noGravity = true;
                                            Main.dust[num916].noLight = true;
                                            Main.dust[num916].position = base.Center + ((Vector2)((vector153 * 204f) * num915));
                                            if (Main.rand.Next(8) == 0)
                                            {
                                                Main.dust[num916].velocity = (Vector2)((vector153 * -num914) * 2f);
                                                Dust dust229 = Main.dust[num916];
                                                dust229.scale += 0.5f;
                                            }
                                            else
                                            {
                                                Main.dust[num916].velocity = (Vector2)(vector153 * -num914);
                                            }
                                        }
                                    }
                                    this.ai[0]++;
                                    if (this.ai[0] >= 60f)
                                    {
                                        int num1 = ((int)(this.ai[0] - 0f)) / 60;
                                        for (int num917 = 0; num917 < 1; num917++)
                                        {
                                            float num918 = Main.rand.Next(1, 3);
                                            Vector2 vector154 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11));
                                            vector154.Normalize();
                                            color5 = new Color();
                                            int num919 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xe4, 0f, 0f, 100, color5, 2f);
                                            Main.dust[num919].noGravity = true;
                                            Main.dust[num919].noLight = true;
                                            Main.dust[num919].position = base.Center;
                                            if (Main.rand.Next(2) == 0)
                                            {
                                                Main.dust[num919].velocity = (Vector2)((vector154 * num918) * 2f);
                                                Dust dust230 = Main.dust[num919];
                                                dust230.scale += 0.5f;
                                            }
                                            else
                                            {
                                                Main.dust[num919].velocity = (Vector2)(vector154 * num918);
                                            }
                                            Main.dust[num919].fadeIn = 2f;
                                        }
                                    }
                                    if (((this.ai[0] == 300f) && (this.ai[1] != -1f)) && (Main.netMode != 1))
                                    {
                                        if (!NPC.AnyNPCs(0x1c6))
                                        {
                                            this.ai[1] = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 0x1c6, 0, 0f, 0f, 0f, 0f, 0xff);
                                        }
                                        else
                                        {
                                            this.ai[1] = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 0x209, 0, 0f, 0f, 0f, 0f, 0xff);
                                        }
                                    }
                                    else if (this.ai[0] == 320f)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    bool flag38 = false;
                                    if (this.ai[1] == -1f)
                                    {
                                        if (this.alpha == 0xff)
                                        {
                                            flag38 = true;
                                        }
                                    }
                                    else
                                    {
                                        flag38 = (this.ai[1] < 0f) || !Main.npc[(int)this.ai[1]].active;
                                        if (((flag38 || (Main.npc[(int)this.ai[1]].type != 0x1b7)) && (flag38 || (Main.npc[(int)this.ai[1]].type != 0x1c6))) && (flag38 || (Main.npc[(int)this.ai[1]].type != 0x209)))
                                        {
                                            flag38 = true;
                                        }
                                    }
                                    if (flag38)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    Lighting.AddLight(base.Center, 1.1f, 0.9f, 0.4f);
                                    return;
                                }
                                if (this.aiStyle == 90)
                                {
                                    if (Main.player[this.owner].dead)
                                    {
                                        this.Kill();
                                    }
                                    if ((Main.myPlayer == this.owner) && Main.player[this.owner].magicLantern)
                                    {
                                        this.timeLeft = 2;
                                    }
                                    if (this.tileCollide)
                                    {
                                        if (!Collision.CanHit(base.position, base.width, base.height, Main.player[this.owner].Center, 1, 1))
                                        {
                                            this.tileCollide = false;
                                        }
                                        else if (!Collision.SolidCollision(base.position, base.width, base.height) && Collision.CanHitLine(base.position, base.width, base.height, Main.player[this.owner].Center, 1, 1))
                                        {
                                            this.tileCollide = true;
                                        }
                                    }
                                    base.direction = Main.player[this.owner].direction;
                                    this.spriteDirection = base.direction;
                                    Lighting.AddLight(base.position, 0.35f, 0.35f, 0.1f);
                                    this.localAI[0]++;
                                    if (this.localAI[0] >= 10f)
                                    {
                                        this.localAI[0] = 0f;
                                        int num920 = 0x11;
                                        Vector2 vector155 = base.Center - Main.player[Main.myPlayer].Center;
                                        if (vector155.Length() < (Main.screenWidth + (num920 * 0x10)))
                                        {
                                            int num921 = ((int)base.Center.X) / 0x10;
                                            int num922 = ((int)base.Center.Y) / 0x10;
                                            for (int num923 = num921 - num920; num923 <= (num921 + num920); num923++)
                                            {
                                                for (int num924 = num922 - num920; num924 <= (num922 + num920); num924++)
                                                {
                                                    if (Main.rand.Next(4) == 0)
                                                    {
                                                        Vector2 vector156 = new Vector2((float)(num921 - num923), (float)(num922 - num924));
                                                        if ((((vector156.Length() < num920) && (num923 > 0)) && ((num923 < (Main.maxTilesX - 1)) && (num924 > 0))) && (((num924 < (Main.maxTilesY - 1)) && (Main.tile[num923, num924] != null)) && Main.tile[num923, num924].active()))
                                                        {
                                                            bool flag39 = false;
                                                            if ((Main.tile[num923, num924].type == 0xb9) && (Main.tile[num923, num924].frameY == 0x12))
                                                            {
                                                                if ((Main.tile[num923, num924].frameX >= 0x240) && (Main.tile[num923, num924].frameX <= 0x372))
                                                                {
                                                                    flag39 = true;
                                                                }
                                                            }
                                                            else if (((Main.tile[num923, num924].type == 0xba) && (Main.tile[num923, num924].frameX >= 0x360)) && (Main.tile[num923, num924].frameX <= 0x492))
                                                            {
                                                                flag39 = true;
                                                            }
                                                            if ((flag39 || Main.tileSpelunker[Main.tile[num923, num924].type]) || (Main.tileAlch[Main.tile[num923, num924].type] && (Main.tile[num923, num924].type != 0x52)))
                                                            {
                                                                color5 = new Color();
                                                                int num925 = Dust.NewDust(new Vector2((float)(num923 * 0x10), (float)(num924 * 0x10)), 0x10, 0x10, 0xcc, 0f, 0f, 150, color5, 0.3f);
                                                                Main.dust[num925].fadeIn = 0.75f;
                                                                Dust dust231 = Main.dust[num925];
                                                                dust231.velocity = (Vector2)(dust231.velocity * 0.1f);
                                                                Main.dust[num925].noLight = true;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    Vector2 vector157 = Main.player[this.owner].Center - base.Center;
                                    vector157.X += 40 * base.direction;
                                    vector157.Y -= 40f;
                                    float num926 = vector157.Length();
                                    if (num926 > 1000f)
                                    {
                                        base.Center = Main.player[this.owner].Center;
                                    }
                                    float num927 = 3f;
                                    float num928 = 4f;
                                    if (num926 > 200f)
                                    {
                                        num928 += (num926 - 200f) * 0.1f;
                                        this.tileCollide = false;
                                    }
                                    if (num926 < num928)
                                    {
                                        base.velocity = (Vector2)(base.velocity * 0.25f);
                                        num928 = num926;
                                    }
                                    if ((vector157.X != 0f) || (vector157.Y != 0f))
                                    {
                                        vector157.Normalize();
                                        vector157 = (Vector2)(vector157 * num928);
                                    }
                                    base.velocity = (Vector2)(((base.velocity * (num927 - 1f)) + vector157) / num927);
                                    if (this.velocity.Length() <= 6f)
                                    {
                                        if (this.rotation > 3.14)
                                        {
                                            this.rotation -= 6.28f;
                                        }
                                        if ((this.rotation > -0.01) && (this.rotation < 0.01))
                                        {
                                            this.rotation = 0f;
                                        }
                                        else
                                        {
                                            this.rotation *= 0.9f;
                                        }
                                        this.frameCounter++;
                                        if (this.frameCounter > 6)
                                        {
                                            this.frameCounter = 0;
                                            this.frame++;
                                            if (this.frame > 3)
                                            {
                                                this.frame = 0;
                                                return;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        float num929 = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                                        if (Math.Abs((float)(this.rotation - num929)) >= 3.14)
                                        {
                                            if (num929 < this.rotation)
                                            {
                                                this.rotation -= 6.28f;
                                            }
                                            else
                                            {
                                                this.rotation += 6.28f;
                                            }
                                        }
                                        this.rotation = ((this.rotation * 4f) + num929) / 5f;
                                        this.frameCounter++;
                                        if (this.frameCounter > 4)
                                        {
                                            this.frameCounter = 0;
                                            this.frame++;
                                            if (this.frame > 7)
                                            {
                                                this.frame = 4;
                                            }
                                        }
                                        if (this.frame < 4)
                                        {
                                            this.frame = 7;
                                            return;
                                        }
                                    }
                                    return;
                                }
                                if (this.aiStyle == 0x5b)
                                {
                                    Vector2 vector158 = base.Center;
                                    this.scale = 1f - this.localAI[0];
                                    base.width = (int)(20f * this.scale);
                                    base.height = base.width;
                                    this.position.X = vector158.X - (base.width / 2);
                                    this.position.Y = vector158.Y - (base.height / 2);
                                    if (this.localAI[0] < 0.1)
                                    {
                                        this.localAI[0] += 0.01f;
                                    }
                                    else
                                    {
                                        this.localAI[0] += 0.025f;
                                    }
                                    if (this.localAI[0] >= 0.95f)
                                    {
                                        this.Kill();
                                    }
                                    this.velocity.X += this.ai[0] * 1.5f;
                                    this.velocity.Y += this.ai[1] * 1.5f;
                                    if (this.velocity.Length() > 16f)
                                    {
                                        this.velocity.Normalize();
                                        base.velocity = (Vector2)(base.velocity * 16f);
                                    }
                                    this.ai[0] *= 1.05f;
                                    this.ai[1] *= 1.05f;
                                    if (this.scale < 1f)
                                    {
                                        for (int num930 = 0; num930 < (this.scale * 10f); num930++)
                                        {
                                            color5 = new Color();
                                            int num931 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1b, this.velocity.X, this.velocity.Y, 100, color5, 1.1f);
                                            Main.dust[num931].position = (Vector2)((Main.dust[num931].position + base.Center) / 2f);
                                            Main.dust[num931].noGravity = true;
                                            Dust dust232 = Main.dust[num931];
                                            dust232.velocity = (Vector2)(dust232.velocity * 0.1f);
                                            Dust dust233 = Main.dust[num931];
                                            dust233.velocity -= (Vector2)(base.velocity * (1.3f - this.scale));
                                            Main.dust[num931].fadeIn = 100 + this.owner;
                                            Dust dust234 = Main.dust[num931];
                                            dust234.scale += this.scale * 0.75f;
                                        }
                                        return;
                                    }
                                    return;
                                }
                                if (this.aiStyle == 0x5c)
                                {
                                    this.tileCollide = false;
                                    this.ai[1]++;
                                    if (this.ai[1] > 60f)
                                    {
                                        this.ai[0] += 10f;
                                    }
                                    if (this.ai[0] > 255f)
                                    {
                                        this.Kill();
                                        this.ai[0] = 255f;
                                    }
                                    this.alpha = (int)(100.0 + (this.ai[0] * 0.7));
                                    this.rotation += this.velocity.X * 0.1f;
                                    this.rotation += base.direction * 0.003f;
                                    base.velocity = (Vector2)(base.velocity * 0.96f);
                                    Rectangle rectangle12 = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height);
                                    for (int num932 = 0; num932 < 0x3e8; num932++)
                                    {
                                        if (((num932 != base.whoAmI) && Main.projectile[num932].active) && ((Main.projectile[num932].type >= 0x1ff) && (Main.projectile[num932].type <= 0x201)))
                                        {
                                            Rectangle rectangle13 = new Rectangle((int)Main.projectile[num932].position.X, (int)Main.projectile[num932].position.Y, Main.projectile[num932].width, Main.projectile[num932].height);
                                            if (rectangle12.Intersects(rectangle13))
                                            {
                                                Vector2 vector159 = Main.projectile[num932].Center - base.Center;
                                                if ((vector159.X == 0f) && (vector159.Y == 0f))
                                                {
                                                    if (num932 < base.whoAmI)
                                                    {
                                                        vector159.X = -1f;
                                                        vector159.Y = 1f;
                                                    }
                                                    else
                                                    {
                                                        vector159.X = 1f;
                                                        vector159.Y = -1f;
                                                    }
                                                }
                                                vector159.Normalize();
                                                vector159 = (Vector2)(vector159 * 0.005f);
                                                base.velocity -= vector159;
                                                Projectile projectile1 = Main.projectile[num932];
                                                projectile1.velocity += vector159;
                                            }
                                        }
                                    }
                                    return;
                                }
                                if (this.aiStyle == 0x5d)
                                {
                                    if (this.alpha > 0)
                                    {
                                        this.alpha -= 0x19;
                                        if (this.alpha <= 0)
                                        {
                                            this.alpha = 0;
                                        }
                                    }
                                    if (this.velocity.Y > 18f)
                                    {
                                        this.velocity.Y = 18f;
                                    }
                                    if (this.ai[0] == 0f)
                                    {
                                        this.ai[1]++;
                                        if (this.ai[1] > 20f)
                                        {
                                            this.velocity.Y += 0.1f;
                                            this.velocity.X *= 0.992f;
                                        }
                                        this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                                        return;
                                    }
                                    this.tileCollide = false;
                                    if (this.ai[0] == 1f)
                                    {
                                        this.tileCollide = false;
                                        base.velocity = (Vector2)(base.velocity * 0.6f);
                                    }
                                    else
                                    {
                                        this.tileCollide = false;
                                        int num933 = (int)-this.ai[0];
                                        num933--;
                                        base.position = Main.npc[num933].Center - base.velocity;
                                        this.position.X -= base.width / 2;
                                        this.position.Y -= base.height / 2;
                                        if (!Main.npc[num933].active || (Main.npc[num933].life < 0))
                                        {
                                            this.tileCollide = true;
                                            this.ai[0] = 0f;
                                            this.ai[1] = 20f;
                                            base.velocity = new Vector2((float)Main.rand.Next(-100, 0x65), (float)Main.rand.Next(-100, 0x65));
                                            this.velocity.Normalize();
                                            base.velocity = (Vector2)(base.velocity * 6f);
                                            this.netUpdate = true;
                                        }
                                        else if (this.velocity.Length() > ((Main.npc[num933].width + Main.npc[num933].height) / 3))
                                        {
                                            base.velocity = (Vector2)(base.velocity * 0.99f);
                                        }
                                    }
                                    if (this.ai[0] != 0f)
                                    {
                                        this.ai[1]++;
                                        if (this.ai[1] > 90f)
                                        {
                                            this.Kill();
                                            return;
                                        }
                                    }
                                    return;
                                }
                                if (this.aiStyle != 0x5e)
                                {
                                    if (this.aiStyle == 0x5f)
                                    {
                                        if (this.localAI[0] > 2f)
                                        {
                                            this.alpha -= 20;
                                            if (this.alpha < 100)
                                            {
                                                this.alpha = 100;
                                            }
                                        }
                                        else
                                        {
                                            this.localAI[0]++;
                                        }
                                        if (this.ai[0] > 30f)
                                        {
                                            if (this.velocity.Y > -8f)
                                            {
                                                this.velocity.Y -= 0.05f;
                                            }
                                            this.velocity.X *= 0.98f;
                                        }
                                        else
                                        {
                                            this.ai[0]++;
                                        }
                                        this.rotation = this.velocity.X * 0.1f;
                                        if (base.wet)
                                        {
                                            if (this.velocity.Y > 0f)
                                            {
                                                this.velocity.Y *= 0.98f;
                                            }
                                            if (this.velocity.Y > -8f)
                                            {
                                                this.velocity.Y -= 0.2f;
                                            }
                                            this.velocity.X *= 0.94f;
                                            return;
                                        }
                                        return;
                                    }
                                    if (this.aiStyle == 0x60)
                                    {
                                        this.ai[0] += 0.6f;
                                        if (this.ai[0] > 500f)
                                        {
                                            this.Kill();
                                        }
                                        for (int num939 = 0; num939 < 2; num939++)
                                        {
                                            if (Main.rand.Next(3) != 0)
                                            {
                                                color5 = new Color();
                                                int num940 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 170, 0f, 0f, 100, color5, 1f);
                                                Main.dust[num940].position = (Vector2)((Main.dust[num940].position + base.Center) / 2f);
                                                Main.dust[num940].noGravity = true;
                                                Dust dust235 = Main.dust[num940];
                                                dust235.velocity = (Vector2)(dust235.velocity * 0.1f);
                                                if (num939 == 1)
                                                {
                                                    Dust dust236 = Main.dust[num940];
                                                    dust236.position += (Vector2)(base.velocity / 2f);
                                                }
                                                float num941 = (800f - this.ai[0]) / 800f;
                                                Dust dust237 = Main.dust[num940];
                                                dust237.scale *= num941 + 0.1f;
                                            }
                                        }
                                        this.velocity.Y += 0.008f;
                                        return;
                                    }
                                    if (this.aiStyle == 0x61)
                                    {
                                        this.frameCounter++;
                                        float num942 = 4f;
                                        if (this.frameCounter < (num942 * 1f))
                                        {
                                            this.frame = 0;
                                        }
                                        else if (this.frameCounter < (num942 * 2f))
                                        {
                                            this.frame = 1;
                                        }
                                        else if (this.frameCounter < (num942 * 3f))
                                        {
                                            this.frame = 2;
                                        }
                                        else if (this.frameCounter < (num942 * 4f))
                                        {
                                            this.frame = 3;
                                        }
                                        else if (this.frameCounter < (num942 * 5f))
                                        {
                                            this.frame = 4;
                                        }
                                        else if (this.frameCounter < (num942 * 6f))
                                        {
                                            this.frame = 3;
                                        }
                                        else if (this.frameCounter < (num942 * 7f))
                                        {
                                            this.frame = 2;
                                        }
                                        else if (this.frameCounter < (num942 * 8f))
                                        {
                                            this.frame = 1;
                                        }
                                        else
                                        {
                                            this.frameCounter = 0;
                                            this.frame = 0;
                                        }
                                        if (this.owner == Main.myPlayer)
                                        {
                                            for (int num943 = 0; num943 < 0x3e8; num943++)
                                            {
                                                if (((num943 != base.whoAmI) && Main.projectile[num943].active) && ((Main.projectile[num943].owner == this.owner) && (Main.projectile[num943].type == this.type)))
                                                {
                                                    if (this.timeLeft >= Main.projectile[num943].timeLeft)
                                                    {
                                                        Main.projectile[num943].Kill();
                                                    }
                                                    else
                                                    {
                                                        this.Kill();
                                                    }
                                                }
                                            }
                                        }
                                        if (this.ai[0] == 0f)
                                        {
                                            if (this.velocity.Length() < 0.1)
                                            {
                                                this.velocity.X = 0f;
                                                this.velocity.Y = 0f;
                                                this.ai[0] = 1f;
                                                this.ai[1] = 45f;
                                                return;
                                            }
                                            base.velocity = (Vector2)(base.velocity * 0.94f);
                                            if (this.velocity.X < 0f)
                                            {
                                                base.direction = -1;
                                            }
                                            else
                                            {
                                                base.direction = 1;
                                            }
                                            this.spriteDirection = base.direction;
                                            return;
                                        }
                                        if (Main.player[this.owner].Center.X < base.Center.X)
                                        {
                                            base.direction = -1;
                                        }
                                        else
                                        {
                                            base.direction = 1;
                                        }
                                        this.spriteDirection = base.direction;
                                        this.ai[1]++;
                                        float num944 = 0.005f;
                                        if (this.ai[1] > 0f)
                                        {
                                            this.velocity.Y -= num944;
                                        }
                                        else
                                        {
                                            this.velocity.Y += num944;
                                        }
                                        if (this.ai[1] >= 90f)
                                        {
                                            this.ai[1] *= -1f;
                                            return;
                                        }
                                        return;
                                    }
                                    if (this.aiStyle == 0x62)
                                    {
                                        Vector2 vector162 = new Vector2(this.ai[0], this.ai[1]);
                                        Vector2 vector163 = vector162 - base.Center;
                                        if (vector163.Length() < this.velocity.Length())
                                        {
                                            this.Kill();
                                            return;
                                        }
                                        vector163.Normalize();
                                        vector163 = (Vector2)(vector163 * 15f);
                                        base.velocity = Vector2.Lerp(base.velocity, vector163, 0.1f);
                                        for (int num945 = 0; num945 < 2; num945++)
                                        {
                                            color5 = new Color();
                                            int num946 = Dust.NewDust(base.Center, 0, 0, 0xe4, 0f, 0f, 100, color5, 1f);
                                            Main.dust[num946].noGravity = true;
                                            Dust dust238 = Main.dust[num946];
                                            dust238.position += new Vector2(4f);
                                            Dust dust239 = Main.dust[num946];
                                            dust239.scale += Main.rand.NextFloat() * 1f;
                                        }
                                        return;
                                    }
                                    if (((this.aiStyle == 0x63) && (this.type >= 0x22c)) && (this.type <= 0x231))
                                    {
                                        this.AI_099_1();
                                        return;
                                    }
                                    if (this.aiStyle == 0x63)
                                    {
                                        this.AI_099_2();
                                        return;
                                    }
                                    if (this.aiStyle == 100)
                                    {
                                        Player player5 = Main.player[this.owner];
                                        Vector2 vector164 = Vector2.Zero;
                                        if (this.type == 0x217)
                                        {
                                            vector164.X = player5.direction * 6f;
                                            vector164.Y = player5.gravDir * -14f;
                                            this.ai[0]++;
                                            int num947 = 0;
                                            if (this.ai[0] >= 60f)
                                            {
                                                num947++;
                                            }
                                            if (this.ai[0] >= 180f)
                                            {
                                                num947++;
                                            }
                                            if (this.ai[0] >= 240f)
                                            {
                                                this.Kill();
                                                return;
                                            }
                                            bool flag40 = false;
                                            if ((this.ai[0] == 60f) || (this.ai[0] == 180f))
                                            {
                                                flag40 = true;
                                            }
                                            bool flag41 = this.ai[0] >= 180f;
                                            if (flag41)
                                            {
                                                if (this.frame < 8)
                                                {
                                                    this.frame = 8;
                                                }
                                                if (this.frame >= 12)
                                                {
                                                    this.frame = 8;
                                                }
                                                this.frameCounter++;
                                                if (++this.frameCounter >= 5)
                                                {
                                                    this.frameCounter = 0;
                                                    if (++this.frame >= 12)
                                                    {
                                                        this.frame = 8;
                                                    }
                                                }
                                            }
                                            else if (++this.frameCounter >= 5)
                                            {
                                                this.frameCounter = 0;
                                                if (++this.frame >= 8)
                                                {
                                                    this.frame = 0;
                                                }
                                            }
                                            Vector2 vector165 = player5.Center;
                                            Vector2 vector166 = (Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY)) - vector165;
                                            if (player5.gravDir == -1f)
                                            {
                                                vector166.Y = ((Main.screenHeight - Main.mouseY) + Main.screenPosition.Y) - vector165.Y;
                                            }
                                            Vector2 vector167 = new Vector2((float)Math.Sign((vector166.X == 0f) ? ((float)player5.direction) : vector166.X), 0f);
                                            if ((vector167.X != this.velocity.X) || (vector167.Y != this.velocity.Y))
                                            {
                                                this.netUpdate = true;
                                            }
                                            base.velocity = vector167;
                                            if ((this.soundDelay <= 0) && !flag41)
                                            {
                                                this.soundDelay = 10;
                                                this.soundDelay *= 2;
                                                if (this.ai[0] != 1f)
                                                {
                                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 15);
                                                }
                                            }
                                            if (this.ai[0] == 181f)
                                            {
                                                Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 0x11);
                                            }
                                            if ((this.ai[0] > 10f) && !flag41)
                                            {
                                                Vector2 vector168 = base.Center + new Vector2((float)(player5.direction * 2), player5.gravDir * 5f);
                                                float num948 = MathHelper.Lerp(30f, 10f, (this.ai[0] - 10f) / 180f);
                                                float num949 = Main.rand.NextFloat() * 6.283185f;
                                                for (float num950 = 0f; num950 < 1f; num950++)
                                                {
                                                    vector240 = new Vector2();
                                                    Vector2 vector169 = Vector2.UnitY.RotatedBy((double)(((num950 / 1f) * 6.283185f) + num949), vector240);
                                                    color5 = new Color();
                                                    Dust dust9 = Main.dust[Dust.NewDust(vector168, 0, 0, 0xe4, 0f, 0f, 0, color5, 1f)];
                                                    dust9.position = vector168 + ((Vector2)(vector169 * num948));
                                                    dust9.noGravity = true;
                                                    dust9.customData = player5;
                                                    dust9.velocity = (Vector2)(vector169 * -2f);
                                                }
                                            }
                                            if ((this.ai[0] > 180f) && (this.ai[0] <= 182f))
                                            {
                                                Vector2 vector170 = base.Center + new Vector2((float)(player5.direction * 2), player5.gravDir * 5f);
                                                float num951 = MathHelper.Lerp(20f, 30f, (this.ai[0] - 180f) / 182f);
                                                Main.rand.NextFloat();
                                                for (float num952 = 0f; num952 < 10f; num952++)
                                                {
                                                    Vector2 vector171 = (Vector2)(Vector2.UnitY.RotatedByRandom(6.2831854820251465) * ((Main.rand.NextFloat() * 0.5f) + 0.5f));
                                                    color5 = new Color();
                                                    Dust dust10 = Main.dust[Dust.NewDust(vector170, 0, 0, 0xe4, 0f, 0f, 0, color5, 1f)];
                                                    dust10.position = vector170 + ((Vector2)(vector171 * num951));
                                                    dust10.noGravity = true;
                                                    dust10.customData = player5;
                                                    dust10.velocity = (Vector2)(vector171 * 4f);
                                                    dust10.scale = 0.5f + Main.rand.NextFloat();
                                                }
                                            }
                                            if (Main.myPlayer == this.owner)
                                            {
                                                bool flag42 = false;
                                                if (!flag40)
                                                {
                                                    flag42 = true;
                                                }
                                                else
                                                {
                                                    flag42 = player5.CheckMana(player5.inventory[player5.selectedItem].mana, true, false);
                                                }
                                                bool flag43 = player5.channel && flag42;
                                                if ((!flag41 && !flag43) || (this.ai[0] == 180f))
                                                {
                                                    Vector2 vector172 = player5.Center + new Vector2((float)(player5.direction * 4), player5.gravDir * 2f);
                                                    int num953 = this.damage * (1 + num947);
                                                    vector172 = base.Center;
                                                    int num954 = 0;
                                                    float num955 = 0f;
                                                    for (int num956 = 0; num956 < 200; num956++)
                                                    {
                                                        NPC npc9 = Main.npc[num956];
                                                        if ((npc9.active && (base.Distance(npc9.Center) < 500f)) && (npc9.CanBeChasedBy(this, false) && Collision.CanHitLine(npc9.position, npc9.width, npc9.height, vector172, 0, 0)))
                                                        {
                                                            Vector2 vector173 = npc9.Center - vector172;
                                                            num955 += vector173.ToRotation();
                                                            num954++;
                                                            int num957 = NewProjectile(vector172.X, vector172.Y, vector173.X, vector173.Y, 0x218, 0, 0f, this.owner, (float)base.whoAmI, 0f);
                                                            Main.projectile[num957].Center = npc9.Center;
                                                            Main.projectile[num957].damage = num953;
                                                            Main.projectile[num957].Damage();
                                                            Main.projectile[num957].damage = 0;
                                                            Main.projectile[num957].Center = vector172;
                                                            this.ai[0] = 180f;
                                                        }
                                                    }
                                                    if (num954 != 0)
                                                    {
                                                        num955 /= (float)num954;
                                                    }
                                                    else
                                                    {
                                                        num955 = (player5.direction == 1) ? 0f : 3.141593f;
                                                    }
                                                    for (int num958 = 0; num958 < 6; num958++)
                                                    {
                                                        Vector2 vector174 = Vector2.Zero;
                                                        if (Main.rand.Next(4) != 0)
                                                        {
                                                            vector240 = new Vector2();
                                                            vector174 = (Vector2)((Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(((double)num955), vector240) * new Vector2(200f, 50f)) * ((Main.rand.NextFloat() * 0.7f) + 0.3f));
                                                        }
                                                        else
                                                        {
                                                            vector174 = (Vector2)((Vector2.UnitX.RotatedByRandom(6.2831854820251465) * new Vector2(200f, 50f)) * ((Main.rand.NextFloat() * 0.7f) + 0.3f));
                                                        }
                                                        NewProjectile(vector172.X, vector172.Y, vector174.X, vector174.Y, 0x218, 0, 0f, this.owner, (float)base.whoAmI, 0f);
                                                    }
                                                    this.ai[0] = 180f;
                                                    this.netUpdate = true;
                                                }
                                            }
                                            Lighting.AddLight(base.Center, 0.9f, 0.75f, 0.1f);
                                        }
                                        this.rotation = (player5.gravDir == 1f) ? 0f : 3.141593f;
                                        this.spriteDirection = base.direction;
                                        this.timeLeft = 2;
                                        Vector2 vector175 = (Vector2)(Main.OffsetsPlayerOnhand[player5.bodyFrame.Y / 0x38] * 2f);
                                        if (player5.direction != 1)
                                        {
                                            vector175.X = player5.bodyFrame.Width - vector175.X;
                                        }
                                        vector175 -= (Vector2)((player5.bodyFrame.Size() - new Vector2((float)player5.width, 42f)) / 2f);
                                        base.Center = (((player5.position + vector175) + vector164) - base.velocity).Floor();
                                        player5.ChangeDir(base.direction);
                                        player5.heldProj = base.whoAmI;
                                        player5.itemTime = 2;
                                        player5.itemAnimation = 2;
                                        return;
                                    }
                                    if (this.aiStyle != 0x65)
                                    {
                                        if (this.aiStyle != 0x66)
                                        {
                                            if (this.aiStyle == 0x67)
                                            {
                                                this.scale = this.ai[1];
                                                this.ai[0]++;
                                                if (this.ai[0] < 30f)
                                                {
                                                    if (this.ai[0] >= 0f)
                                                    {
                                                        this.alpha -= 0x19;
                                                        if (this.alpha < 0)
                                                        {
                                                            this.alpha = 0;
                                                            if (((this.localAI[1] == 0f) && (Main.netMode != 1)) && (this.localAI[0] != 0f))
                                                            {
                                                                this.localAI[1] = 1f;
                                                                NPC.NewNPC((int)base.Center.X, (int)base.Bottom.Y, (int)this.localAI[0], 0, 0f, 0f, 0f, 0f, 0xff);
                                                                return;
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    this.alpha += 0x19;
                                                    if (this.alpha >= 250)
                                                    {
                                                        this.Kill();
                                                        return;
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (this.aiStyle == 0x68)
                                                {
                                                    if (this.ai[0] == 1f)
                                                    {
                                                        this.scale *= 0.995f;
                                                        this.alpha += 3;
                                                        if (this.alpha >= 250)
                                                        {
                                                            this.Kill();
                                                        }
                                                    }
                                                    else
                                                    {
                                                        this.scale *= 1.01f;
                                                        this.alpha -= 7;
                                                        if (this.alpha < 0)
                                                        {
                                                            this.alpha = 0;
                                                            this.ai[0] = 1f;
                                                        }
                                                    }
                                                    this.frameCounter++;
                                                    if (this.frameCounter > 6)
                                                    {
                                                        this.frameCounter = 0;
                                                        this.frame++;
                                                        if (this.frame > 3)
                                                        {
                                                            this.frame = 0;
                                                        }
                                                    }
                                                    this.velocity.Y -= 0.03f;
                                                    this.velocity.X *= 0.97f;
                                                    return;
                                                }
                                                if (this.aiStyle == 0x69)
                                                {
                                                    float num982 = 1f - (((float)this.alpha) / 255f);
                                                    num982 *= this.scale;
                                                    Lighting.AddLight(base.Center, 0.2f * num982, 0.275f * num982, 0.075f * num982);
                                                    this.localAI[0]++;
                                                    if (this.localAI[0] >= 90f)
                                                    {
                                                        this.localAI[0] *= -1f;
                                                    }
                                                    if (this.localAI[0] >= 0f)
                                                    {
                                                        this.scale += 0.003f;
                                                    }
                                                    else
                                                    {
                                                        this.scale -= 0.003f;
                                                    }
                                                    this.rotation += 0.0025f * this.scale;
                                                    float num983 = 1f;
                                                    float num984 = 1f;
                                                    if ((this.identity % 6) == 0)
                                                    {
                                                        num984 *= -1f;
                                                    }
                                                    if ((this.identity % 6) == 1)
                                                    {
                                                        num983 *= -1f;
                                                    }
                                                    if ((this.identity % 6) == 2)
                                                    {
                                                        num984 *= -1f;
                                                        num983 *= -1f;
                                                    }
                                                    if ((this.identity % 6) == 3)
                                                    {
                                                        num984 = 0f;
                                                    }
                                                    if ((this.identity % 6) == 4)
                                                    {
                                                        num983 = 0f;
                                                    }
                                                    this.localAI[1]++;
                                                    if (this.localAI[1] > 60f)
                                                    {
                                                        this.localAI[1] = -180f;
                                                    }
                                                    if (this.localAI[1] >= -60f)
                                                    {
                                                        this.velocity.X += 0.002f * num984;
                                                        this.velocity.Y += 0.002f * num983;
                                                    }
                                                    else
                                                    {
                                                        this.velocity.X -= 0.002f * num984;
                                                        this.velocity.Y -= 0.002f * num983;
                                                    }
                                                    this.ai[0]++;
                                                    if (this.ai[0] > 5400f)
                                                    {
                                                        this.damage = 0;
                                                        this.ai[1] = 1f;
                                                        if (this.alpha < 0xff)
                                                        {
                                                            this.alpha += 5;
                                                            if (this.alpha > 0xff)
                                                            {
                                                                this.alpha = 0xff;
                                                            }
                                                        }
                                                        else if (this.owner == Main.myPlayer)
                                                        {
                                                            this.Kill();
                                                        }
                                                    }
                                                    else
                                                    {
                                                        Vector2 vector178 = base.Center - Main.player[this.owner].Center;
                                                        float num985 = vector178.Length() / 100f;
                                                        if (num985 > 4f)
                                                        {
                                                            num985 *= 1.1f;
                                                        }
                                                        if (num985 > 5f)
                                                        {
                                                            num985 *= 1.2f;
                                                        }
                                                        if (num985 > 6f)
                                                        {
                                                            num985 *= 1.3f;
                                                        }
                                                        if (num985 > 7f)
                                                        {
                                                            num985 *= 1.4f;
                                                        }
                                                        if (num985 > 8f)
                                                        {
                                                            num985 *= 1.5f;
                                                        }
                                                        if (num985 > 9f)
                                                        {
                                                            num985 *= 1.6f;
                                                        }
                                                        if (num985 > 10f)
                                                        {
                                                            num985 *= 1.7f;
                                                        }
                                                        if (!Main.player[this.owner].sporeSac)
                                                        {
                                                            num985 += 100f;
                                                        }
                                                        this.ai[0] += num985;
                                                        if (this.alpha > 50)
                                                        {
                                                            this.alpha -= 10;
                                                            if (this.alpha < 50)
                                                            {
                                                                this.alpha = 50;
                                                            }
                                                        }
                                                    }
                                                    bool flag49 = false;
                                                    Vector2 vector179 = new Vector2(0f, 0f);
                                                    float num986 = 280f;
                                                    for (int num987 = 0; num987 < 200; num987++)
                                                    {
                                                        if (Main.npc[num987].CanBeChasedBy(this, false))
                                                        {
                                                            float num988 = Main.npc[num987].position.X + (Main.npc[num987].width / 2);
                                                            float num989 = Main.npc[num987].position.Y + (Main.npc[num987].height / 2);
                                                            float introduced1846 = Math.Abs((float)((this.position.X + (base.width / 2)) - num988));
                                                            float num990 = introduced1846 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num989));
                                                            if (num990 < num986)
                                                            {
                                                                num986 = num990;
                                                                vector179 = Main.npc[num987].Center;
                                                                flag49 = true;
                                                            }
                                                        }
                                                    }
                                                    if (flag49)
                                                    {
                                                        Vector2 vector180 = vector179 - base.Center;
                                                        vector180.Normalize();
                                                        vector180 = (Vector2)(vector180 * 0.75f);
                                                        base.velocity = (Vector2)(((base.velocity * 10f) + vector180) / 11f);
                                                        return;
                                                    }
                                                    if (this.velocity.Length() > 0.2)
                                                    {
                                                        base.velocity = (Vector2)(base.velocity * 0.98f);
                                                        return;
                                                    }
                                                }
                                                else if (this.aiStyle == 0x6a)
                                                {
                                                    this.rotation += this.velocity.X * 0.02f;
                                                    if (this.velocity.X < 0f)
                                                    {
                                                        this.rotation -= Math.Abs(this.velocity.Y) * 0.02f;
                                                    }
                                                    else
                                                    {
                                                        this.rotation += Math.Abs(this.velocity.Y) * 0.02f;
                                                    }
                                                    base.velocity = (Vector2)(base.velocity * 0.98f);
                                                    this.ai[0]++;
                                                    if (this.ai[0] < 60f)
                                                    {
                                                        if (this.alpha > 80)
                                                        {
                                                            this.alpha -= 30;
                                                            if (this.alpha < 80)
                                                            {
                                                                this.alpha = 80;
                                                                return;
                                                            }
                                                        }
                                                    }
                                                    else if (this.alpha >= 0xff)
                                                    {
                                                        if (this.owner == Main.myPlayer)
                                                        {
                                                            this.Kill();
                                                            return;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        this.alpha += 5;
                                                        if (this.alpha > 0xff)
                                                        {
                                                            this.alpha = 0xff;
                                                            return;
                                                        }
                                                    }
                                                }
                                                else if (this.aiStyle == 0x6b)
                                                {
                                                    float num991 = 10f;
                                                    float num992 = 5f;
                                                    float num993 = 40f;
                                                    if (this.type == 0x23f)
                                                    {
                                                        if ((this.timeLeft > 30) && (this.alpha > 0))
                                                        {
                                                            this.alpha -= 0x19;
                                                        }
                                                        if (((this.timeLeft > 30) && (this.alpha < 0x80)) && Collision.SolidCollision(base.position, base.width, base.height))
                                                        {
                                                            this.alpha = 0x80;
                                                        }
                                                        if (this.alpha < 0)
                                                        {
                                                            this.alpha = 0;
                                                        }
                                                        if (++this.frameCounter > 4)
                                                        {
                                                            this.frameCounter = 0;
                                                            if (++this.frame >= 4)
                                                            {
                                                                this.frame = 0;
                                                            }
                                                        }
                                                        Lighting.AddLight(base.Center, 0.5f, 0.1f, 0.3f);
                                                    }
                                                    else if (this.type == 0x254)
                                                    {
                                                        Dust dust11;
                                                        num991 = 10f;
                                                        num992 = 7.5f;
                                                        if ((this.timeLeft > 30) && (this.alpha > 0))
                                                        {
                                                            this.alpha -= 0x19;
                                                        }
                                                        if (((this.timeLeft > 30) && (this.alpha < 0x80)) && Collision.SolidCollision(base.position, base.width, base.height))
                                                        {
                                                            this.alpha = 0x80;
                                                        }
                                                        if (this.alpha < 0)
                                                        {
                                                            this.alpha = 0;
                                                        }
                                                        if (++this.frameCounter > 4)
                                                        {
                                                            this.frameCounter = 0;
                                                            if (++this.frame >= 4)
                                                            {
                                                                this.frame = 0;
                                                            }
                                                        }
                                                        float num994 = 0.5f;
                                                        if (this.timeLeft < 120)
                                                        {
                                                            num994 = 1.1f;
                                                        }
                                                        if (this.timeLeft < 60)
                                                        {
                                                            num994 = 1.6f;
                                                        }
                                                        this.ai[1]++;
                                                        float single2 = this.ai[1] / 180f;
                                                        for (float num995 = 0f; num995 < 3f; num995++)
                                                        {
                                                            if (Main.rand.Next(3) != 0)
                                                            {
                                                                return;
                                                            }
                                                            color5 = new Color();
                                                            dust11 = Main.dust[Dust.NewDust(base.Center, 0, 0, 0x1b, 0f, -2f, 0, color5, 1f)];
                                                            vector240 = new Vector2();
                                                            dust11.position = base.Center + ((Vector2)(Vector2.UnitY.RotatedBy(((double)(((num995 * 6.283185f) / 3f) + this.ai[1])), vector240) * 10f));
                                                            dust11.noGravity = true;
                                                            dust11.velocity = base.DirectionFrom(dust11.position);
                                                            dust11.scale = num994;
                                                            dust11.fadeIn = 0.5f;
                                                            dust11.alpha = 200;
                                                        }
                                                        if (this.timeLeft < 4)
                                                        {
                                                            int num996 = 40;
                                                            if (Main.expertMode)
                                                            {
                                                                num996 = 30;
                                                            }
                                                            base.position = base.Center;
                                                            base.width = base.height = 60;
                                                            base.Center = base.position;
                                                            this.damage = num996;
                                                            for (int num997 = 0; num997 < 10; num997++)
                                                            {
                                                                color5 = new Color();
                                                                dust11 = Main.dust[Dust.NewDust(base.position, base.width, base.height, Utils.SelectRandom<int>(Main.rand, new int[] { 0x1b, 6 }), 0f, -2f, 0, color5, 1f)];
                                                                dust11.noGravity = true;
                                                                if (dust11.position != base.Center)
                                                                {
                                                                    dust11.velocity = (Vector2)(base.DirectionTo(dust11.position) * 3f);
                                                                }
                                                            }
                                                        }
                                                    }
                                                    int num998 = (int)this.ai[0];
                                                    if (((num998 < 0) || !Main.player[num998].active) || Main.player[num998].dead)
                                                    {
                                                        if (this.timeLeft > 30)
                                                        {
                                                            this.timeLeft = 30;
                                                        }
                                                        if (this.ai[0] != -1f)
                                                        {
                                                            this.ai[0] = -1f;
                                                            this.netUpdate = true;
                                                            return;
                                                        }
                                                    }
                                                    else if (base.Distance(Main.player[num998].Center) > num993)
                                                    {
                                                        Vector2 vec = base.DirectionTo(Main.player[num998].Center);
                                                        if (vec.HasNaNs())
                                                        {
                                                            vec = Vector2.UnitY;
                                                        }
                                                        base.velocity = (Vector2)(((base.velocity * (num991 - 1f)) + (vec * num992)) / num991);
                                                        return;
                                                    }
                                                }
                                                else if (this.aiStyle == 0x6c)
                                                {
                                                    if ((this.type == 0x242) && (this.localAI[0] == 0f))
                                                    {
                                                        this.localAI[0] = 1f;
                                                        int num999 = Player.FindClosest(base.Center, 0, 0);
                                                        Vector2 unitY = Main.player[num999].Center - base.Center;
                                                        if (unitY == Vector2.Zero)
                                                        {
                                                            unitY = Vector2.UnitY;
                                                        }
                                                        this.ai[1] = unitY.ToRotation();
                                                        this.netUpdate = true;
                                                    }
                                                    this.ai[0]++;
                                                    if (this.ai[0] > 50f)
                                                    {
                                                        if (this.ai[0] > 90f)
                                                        {
                                                            if (this.ai[0] <= 120f)
                                                            {
                                                                this.scale = 1f;
                                                                this.alpha = 0;
                                                                this.rotation -= 0.05235988f;
                                                                if (Main.rand.Next(2) == 0)
                                                                {
                                                                    Vector2 vector195 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                    Dust dust18 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector195 * 30f)), 0, 0, 0xe5, 0f, 0f, 0, new Color(), 1f)];
                                                                    dust18.noGravity = true;
                                                                    dust18.position = base.Center - (vector195 * Main.rand.Next(10, 0x15));
                                                                    dust18.velocity = (Vector2)(vector195.RotatedBy(1.5707963705062866, new Vector2()) * 6f);
                                                                    dust18.scale = 0.5f + Main.rand.NextFloat();
                                                                    dust18.fadeIn = 0.5f;
                                                                    dust18.customData = base.Center;
                                                                    return;
                                                                }
                                                                Vector2 vector196 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                Dust dust19 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector196 * 30f)), 0, 0, 240, 0f, 0f, 0, new Color(), 1f)];
                                                                dust19.noGravity = true;
                                                                dust19.position = base.Center - ((Vector2)(vector196 * 30f));
                                                                dust19.velocity = (Vector2)(vector196.RotatedBy(-1.5707963705062866, new Vector2()) * 3f);
                                                                dust19.scale = 0.5f + Main.rand.NextFloat();
                                                                dust19.fadeIn = 0.5f;
                                                                dust19.customData = base.Center;
                                                                return;
                                                            }
                                                            this.scale = 1f - ((this.ai[0] - 120f) / 60f);
                                                            this.alpha = 0xff - ((int)(255f * this.scale));
                                                            this.rotation -= 0.1047198f;
                                                            if (this.alpha >= 0xff)
                                                            {
                                                                this.Kill();
                                                            }
                                                            for (int num1005 = 0; num1005 < 2; num1005++)
                                                            {
                                                                switch (Main.rand.Next(3))
                                                                {
                                                                    case 0:
                                                                        {
                                                                            Vector2 vector197 = (Vector2)(Vector2.UnitY.RotatedByRandom(6.2831854820251465) * this.scale);
                                                                            color5 = new Color();
                                                                            Dust dust20 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector197 * 30f)), 0, 0, 0xe5, 0f, 0f, 0, color5, 1f)];
                                                                            dust20.noGravity = true;
                                                                            dust20.position = base.Center - (vector197 * Main.rand.Next(10, 0x15));
                                                                            vector240 = new Vector2();
                                                                            dust20.velocity = (Vector2)(vector197.RotatedBy(1.5707963705062866, vector240) * 6f);
                                                                            dust20.scale = 0.5f + Main.rand.NextFloat();
                                                                            dust20.fadeIn = 0.5f;
                                                                            dust20.customData = base.Center;
                                                                            break;
                                                                        }
                                                                    case 1:
                                                                        {
                                                                            Vector2 vector198 = (Vector2)(Vector2.UnitY.RotatedByRandom(6.2831854820251465) * this.scale);
                                                                            color5 = new Color();
                                                                            Dust dust21 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector198 * 30f)), 0, 0, 240, 0f, 0f, 0, color5, 1f)];
                                                                            dust21.noGravity = true;
                                                                            dust21.position = base.Center - ((Vector2)(vector198 * 30f));
                                                                            vector240 = new Vector2();
                                                                            dust21.velocity = (Vector2)(vector198.RotatedBy(-1.5707963705062866, vector240) * 3f);
                                                                            dust21.scale = 0.5f + Main.rand.NextFloat();
                                                                            dust21.fadeIn = 0.5f;
                                                                            dust21.customData = base.Center;
                                                                            break;
                                                                        }
                                                                }
                                                            }
                                                            return;
                                                        }
                                                        this.scale = (this.ai[0] - 50f) / 40f;
                                                        this.alpha = 0xff - ((int)(255f * this.scale));
                                                        this.rotation -= 0.1570796f;
                                                        if (this.type == 0x243)
                                                        {
                                                            if (Main.rand.Next(2) == 0)
                                                            {
                                                                Vector2 vector189 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                color5 = new Color();
                                                                Dust dust15 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector189 * 30f)), 0, 0, 0xe5, 0f, 0f, 0, color5, 1f)];
                                                                dust15.noGravity = true;
                                                                dust15.position = base.Center - (vector189 * Main.rand.Next(10, 0x15));
                                                                vector240 = new Vector2();
                                                                dust15.velocity = (Vector2)(vector189.RotatedBy(1.5707963705062866, vector240) * 6f);
                                                                dust15.scale = 0.5f + Main.rand.NextFloat();
                                                                dust15.fadeIn = 0.5f;
                                                                dust15.customData = base.Center;
                                                            }
                                                            if (Main.rand.Next(2) == 0)
                                                            {
                                                                Vector2 vector190 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                color5 = new Color();
                                                                Dust dust16 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector190 * 30f)), 0, 0, 240, 0f, 0f, 0, color5, 1f)];
                                                                dust16.noGravity = true;
                                                                dust16.position = base.Center - ((Vector2)(vector190 * 30f));
                                                                vector240 = new Vector2();
                                                                dust16.velocity = (Vector2)(vector190.RotatedBy(-1.5707963705062866, vector240) * 3f);
                                                                dust16.scale = 0.5f + Main.rand.NextFloat();
                                                                dust16.fadeIn = 0.5f;
                                                                dust16.customData = base.Center;
                                                            }
                                                        }
                                                        if (this.type != 0x242)
                                                        {
                                                            if (((this.type == 0x243) && (this.ai[0] == 90f)) && (Main.netMode != 1))
                                                            {
                                                                for (int num1003 = 0; num1003 < 2; num1003++)
                                                                {
                                                                    int num1004 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 0x1ab, base.whoAmI, 0f, 0f, 0f, 0f, 0xff);
                                                                    Main.npc[num1004].velocity = (-Vector2.UnitY.RotatedByRandom(6.2831854820251465) * Main.rand.Next(4, 9)) - ((Vector2)(Vector2.UnitY * 2f));
                                                                    Main.npc[num1004].netUpdate = true;
                                                                }
                                                                return;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            Vector2 vector191 = this.ai[1].ToRotationVector2();
                                                            Vector2 vector192 = (vector191.RotatedBy(1.5707963705062866, new Vector2()) * (Main.rand.Next(2) == 0).ToDirectionInt()) * Main.rand.Next(10, 0x15);
                                                            vector191 *= Main.rand.Next(-80, 0x51);
                                                            Vector2 vector193 = vector191 - vector192;
                                                            vector193 = (Vector2)(vector193 / 10f);
                                                            int num1001 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe5, 0xe5 });
                                                            Dust dust17 = Main.dust[Dust.NewDust(base.Center, 0, 0, num1001, 0f, 0f, 0, new Color(), 1f)];
                                                            dust17.noGravity = true;
                                                            dust17.position = base.Center + vector192;
                                                            dust17.velocity = vector193;
                                                            dust17.scale = 0.5f + Main.rand.NextFloat();
                                                            dust17.fadeIn = 0.5f;
                                                            if ((this.ai[0] == 90f) && (Main.netMode != 1))
                                                            {
                                                                Vector2 vector194 = (Vector2)(this.ai[1].ToRotationVector2() * 8f);
                                                                float num1002 = Main.rand.Next(80);
                                                                NewProjectile(base.Center.X - vector194.X, base.Center.Y - vector194.Y, vector194.X, vector194.Y, 580, 15, 1f, Main.myPlayer, this.ai[1], num1002);
                                                                return;
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (this.type == 0x243)
                                                        {
                                                            if (Main.rand.Next(4) == 0)
                                                            {
                                                                Vector2 vector183 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                color5 = new Color();
                                                                Dust dust12 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector183 * 30f)), 0, 0, 0xe5, 0f, 0f, 0, color5, 1f)];
                                                                dust12.noGravity = true;
                                                                dust12.position = base.Center - (vector183 * Main.rand.Next(10, 0x15));
                                                                vector240 = new Vector2();
                                                                dust12.velocity = (Vector2)(vector183.RotatedBy(1.5707963705062866, vector240) * 4f);
                                                                dust12.scale = 0.5f + Main.rand.NextFloat();
                                                                dust12.fadeIn = 0.5f;
                                                            }
                                                            if (Main.rand.Next(4) == 0)
                                                            {
                                                                Vector2 vector184 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                color5 = new Color();
                                                                Dust dust13 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector184 * 30f)), 0, 0, 240, 0f, 0f, 0, color5, 1f)];
                                                                dust13.noGravity = true;
                                                                dust13.position = base.Center - ((Vector2)(vector184 * 30f));
                                                                vector240 = new Vector2();
                                                                dust13.velocity = (Vector2)(vector184.RotatedBy(-1.5707963705062866, vector240) * 2f);
                                                                dust13.scale = 0.5f + Main.rand.NextFloat();
                                                                dust13.fadeIn = 0.5f;
                                                            }
                                                        }
                                                        if ((this.type == 0x242) && (Main.rand.Next(2) == 0))
                                                        {
                                                            Vector2 vector185 = this.ai[1].ToRotationVector2();
                                                            Vector2 vector186 = (vector185.RotatedBy(1.5707963705062866, new Vector2()) * (Main.rand.Next(2) == 0).ToDirectionInt()) * Main.rand.Next(10, 0x15);
                                                            Vector2 vector187 = vector185 * Main.rand.Next(-80, 0x51);
                                                            Vector2 vector188 = vector187 - vector186;
                                                            vector188 = (Vector2)(vector188 / 10f);
                                                            int num1000 = 0xe5;
                                                            color5 = new Color();
                                                            Dust dust14 = Main.dust[Dust.NewDust(base.Center, 0, 0, num1000, 0f, 0f, 0, color5, 1f)];
                                                            dust14.noGravity = true;
                                                            dust14.position = base.Center + vector186;
                                                            dust14.velocity = vector188;
                                                            dust14.scale = 0.5f + Main.rand.NextFloat();
                                                            dust14.fadeIn = 0.5f;
                                                            vector187 = vector185 * Main.rand.Next(40, 0x79);
                                                            vector188 = vector187 - ((Vector2)(vector186 / 2f));
                                                            vector188 = (Vector2)(vector188 / 10f);
                                                            dust14 = Main.dust[Dust.NewDust(base.Center, 0, 0, num1000, 0f, 0f, 0, new Color(), 1f)];
                                                            dust14.noGravity = true;
                                                            dust14.position = base.Center + ((Vector2)(vector186 / 2f));
                                                            dust14.velocity = vector188;
                                                            dust14.scale = 1f + Main.rand.NextFloat();
                                                            return;
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    if (this.aiStyle == 0x6d)
                                                    {
                                                        if (this.localAI[1] == 0f)
                                                        {
                                                            this.localAI[1] = this.velocity.Length();
                                                        }
                                                        if (this.ai[0] == 0f)
                                                        {
                                                            this.localAI[0]++;
                                                            if (this.localAI[0] > 30f)
                                                            {
                                                                this.ai[0] = 1f;
                                                                this.localAI[0] = 0f;
                                                                return;
                                                            }
                                                        }
                                                        else if (this.ai[0] == 1f)
                                                        {
                                                            Vector2 vector199 = Vector2.Zero;
                                                            if (((this.type == 0x246) && Main.npc[(int)this.ai[1]].active) && (Main.npc[(int)this.ai[1]].type == 0x7c))
                                                            {
                                                                vector199 = Main.npc[(int)this.ai[1]].Center;
                                                                this.tileCollide = false;
                                                            }
                                                            else
                                                            {
                                                                this.Kill();
                                                                return;
                                                            }
                                                            float num1007 = this.localAI[1];
                                                            Vector2 vector200 = vector199 - base.Center;
                                                            if (vector200.Length() < num1007)
                                                            {
                                                                this.Kill();
                                                                return;
                                                            }
                                                            vector200.Normalize();
                                                            vector200 = (Vector2)(vector200 * num1007);
                                                            base.velocity = Vector2.Lerp(base.velocity, vector200, 0.04f);
                                                        }
                                                        this.rotation += 0.3141593f;
                                                        return;
                                                    }
                                                    if (this.aiStyle == 110)
                                                    {
                                                        if (this.localAI[1] == 0f)
                                                        {
                                                            this.localAI[1] = this.velocity.Length();
                                                        }
                                                        Vector2 vector201 = Vector2.Zero;
                                                        if (Main.npc[(int)this.ai[0]].active && Main.npc[(int)this.ai[0]].townNPC)
                                                        {
                                                            vector201 = Main.npc[(int)this.ai[0]].Center;
                                                        }
                                                        else
                                                        {
                                                            this.Kill();
                                                            return;
                                                        }
                                                        float num1008 = this.localAI[1];
                                                        Vector2 vector202 = vector201 - base.Center;
                                                        if ((vector202.Length() < num1008) || base.Hitbox.Intersects(Main.npc[(int)this.ai[0]].Hitbox))
                                                        {
                                                            this.Kill();
                                                            int num1009 = Main.npc[(int)this.ai[0]].lifeMax - Main.npc[(int)this.ai[0]].life;
                                                            if (num1009 > 20)
                                                            {
                                                                num1009 = 20;
                                                            }
                                                            if (num1009 > 0)
                                                            {
                                                                NPC npc1 = Main.npc[(int)this.ai[0]];
                                                                npc1.life += num1009;
                                                                Main.npc[(int)this.ai[0]].HealEffect(num1009, true);
                                                            }
                                                            return;
                                                        }
                                                        vector202.Normalize();
                                                        vector202 = (Vector2)(vector202 * num1008);
                                                        if (vector202.Y < this.velocity.Y)
                                                        {
                                                            vector202.Y = this.velocity.Y;
                                                        }
                                                        vector202.Y++;
                                                        base.velocity = Vector2.Lerp(base.velocity, vector202, 0.04f);
                                                        this.rotation += this.velocity.X * 0.05f;
                                                        return;
                                                    }
                                                    if (this.aiStyle == 0x6f)
                                                    {
                                                        if ((!Main.npc[(int)this.ai[1]].active || (Main.npc[(int)this.ai[1]].type != 20)) || (Main.npc[(int)this.ai[1]].ai[0] != 14f))
                                                        {
                                                            this.Kill();
                                                            return;
                                                        }
                                                        this.ai[0]++;
                                                        this.rotation += 0.01047198f;
                                                        this.scale = this.ai[0] / 100f;
                                                        if (this.scale > 1f)
                                                        {
                                                            this.scale = 1f;
                                                        }
                                                        this.alpha = (int)(255f * (1f - this.scale));
                                                        float num1010 = 300f;
                                                        if (this.ai[0] >= 100f)
                                                        {
                                                            num1010 = MathHelper.Lerp(300f, 600f, (this.ai[0] - 100f) / 200f);
                                                        }
                                                        if (num1010 > 600f)
                                                        {
                                                            num1010 = 600f;
                                                        }
                                                        if (this.ai[0] >= 500f)
                                                        {
                                                            this.alpha = (int)MathHelper.Lerp(0f, 255f, (this.ai[0] - 500f) / 100f);
                                                            num1010 = MathHelper.Lerp(600f, 1200f, (this.ai[0] - 500f) / 100f);
                                                            this.rotation += 0.01047198f;
                                                        }
                                                        if (Main.rand.Next(4) == 0)
                                                        {
                                                            float num1011 = num1010;
                                                            Vector2 vector203 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11));
                                                            float num1012 = Main.rand.Next(3, 9);
                                                            vector203.Normalize();
                                                            color5 = new Color();
                                                            int num1013 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xa3, 0f, 0f, 100, color5, 1f);
                                                            Main.dust[num1013].noGravity = true;
                                                            Main.dust[num1013].position = base.Center + ((Vector2)(vector203 * num1011));
                                                            if (Main.rand.Next(8) == 0)
                                                            {
                                                                Main.dust[num1013].velocity = (Vector2)((vector203 * -num1012) * 3f);
                                                                Dust dust246 = Main.dust[num1013];
                                                                dust246.scale += 0.5f;
                                                            }
                                                            else
                                                            {
                                                                Main.dust[num1013].velocity = (Vector2)(vector203 * -num1012);
                                                            }
                                                        }
                                                        if (Main.rand.Next(2) == 0)
                                                        {
                                                            Vector2 vector204 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11));
                                                            float num1014 = Main.rand.Next(3, 9);
                                                            vector204.Normalize();
                                                            int num1015 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xa3, 0f, 0f, 100, new Color(), 1.5f);
                                                            Main.dust[num1015].noGravity = true;
                                                            Main.dust[num1015].position = base.Center + ((Vector2)(vector204 * 30f));
                                                            if (Main.rand.Next(8) == 0)
                                                            {
                                                                Main.dust[num1015].velocity = (Vector2)((vector204 * -num1014) * 3f);
                                                                Dust dust247 = Main.dust[num1015];
                                                                dust247.scale += 0.5f;
                                                            }
                                                            else
                                                            {
                                                                Main.dust[num1015].velocity = (Vector2)(vector204 * -num1014);
                                                            }
                                                        }
                                                        if ((this.ai[0] >= 30f) && (Main.netMode != 2))
                                                        {
                                                            Player player6 = Main.player[Main.myPlayer];
                                                            if ((player6.active && !player6.dead) && ((base.Distance(player6.Center) <= num1010) && (player6.HasBuff(0xa5) == -1)))
                                                            {
                                                                player6.AddBuff(0xa5, 120, true);
                                                            }
                                                        }
                                                        if (((this.ai[0] >= 30f) && ((this.ai[0] % 10f) == 0f)) && (Main.netMode != 1))
                                                        {
                                                            for (int num1016 = 0; num1016 < 200; num1016++)
                                                            {
                                                                NPC npc10 = Main.npc[num1016];
                                                                if (((npc10.type != 0x1e8) && npc10.active) && (base.Distance(npc10.Center) <= num1010))
                                                                {
                                                                    if (npc10.townNPC && ((npc10.HasBuff(0xa5) == -1) || (npc10.buffTime[npc10.HasBuff(0xa5)] <= 20)))
                                                                    {
                                                                        npc10.AddBuff(0xa5, 120, false);
                                                                    }
                                                                    else if (((!npc10.friendly && (npc10.lifeMax > 5)) && !npc10.dontTakeDamage) && (((npc10.HasBuff(0xba) == -1) || (npc10.buffTime[npc10.HasBuff(0xba)] <= 20)) && (npc10.dryadBane || Collision.CanHit(base.Center, 1, 1, npc10.position, npc10.width, npc10.height))))
                                                                    {
                                                                        npc10.AddBuff(0xba, 120, false);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        if (this.ai[0] >= 570f)
                                                        {
                                                            this.Kill();
                                                            return;
                                                        }
                                                    }
                                                    else if (this.aiStyle == 0x70)
                                                    {
                                                        if (this.type == 590)
                                                        {
                                                            if (++this.frameCounter >= 4)
                                                            {
                                                                this.frameCounter = 0;
                                                                if (++this.frame >= 3)
                                                                {
                                                                    this.frame = 0;
                                                                }
                                                            }
                                                            if (this.alpha > 0)
                                                            {
                                                                this.alpha -= 15;
                                                            }
                                                            if (this.alpha < 0)
                                                            {
                                                                this.alpha = 0;
                                                            }
                                                            if (this.alpha == 0)
                                                            {
                                                                float num1017 = Main.rand.Next(0x1c, 0x2a) * 0.005f;
                                                                num1017 += ((float)(270 - Main.mouseTextColor)) / 500f;
                                                                float num1018 = 0.1f;
                                                                float num1019 = 0.3f + (num1017 / 2f);
                                                                float num1020 = 0.6f + num1017;
                                                                float num1021 = 0.35f;
                                                                num1018 *= num1021;
                                                                num1019 *= num1021;
                                                                num1020 *= num1021;
                                                                Lighting.AddLight(base.Center, num1018, num1019, num1020);
                                                            }
                                                            base.velocity = new Vector2(0f, ((float)Math.Sin((double)((6.283185f * this.ai[0]) / 180f))) * 0.15f);
                                                            this.ai[0]++;
                                                            if (this.ai[0] >= 180f)
                                                            {
                                                                this.ai[0] = 0f;
                                                            }
                                                        }
                                                        if (this.type == 0x284)
                                                        {
                                                            Color color3 = Main.hslToRgb(this.ai[0], 1f, 0.5f);
                                                            int num1022 = (int)this.ai[1];
                                                            if (((num1022 < 0) || (num1022 >= 0x3e8)) || (!Main.projectile[num1022].active && (Main.projectile[num1022].type != 0x283)))
                                                            {
                                                                this.ai[1] = -1f;
                                                            }
                                                            else
                                                            {
                                                                DelegateMethods.v3_1 = (Vector3)(color3.ToVector3() * 0.5f);
                                                                Utils.PlotTileLine(base.Center, Main.projectile[num1022].Center, 8f, new Utils.PerLinePoint(DelegateMethods.CastLight));
                                                            }
                                                            if (this.localAI[0] == 0f)
                                                            {
                                                                this.localAI[0] = (Main.rand.NextFloat() * 0.8f) + 0.8f;
                                                                base.direction = (Main.rand.Next(2) > 0) ? 1 : -1;
                                                            }
                                                            this.rotation = ((this.localAI[1] / 40f) * 6.283185f) * base.direction;
                                                            if (this.alpha > 0)
                                                            {
                                                                this.alpha -= 8;
                                                            }
                                                            if (this.alpha < 0)
                                                            {
                                                                this.alpha = 0;
                                                            }
                                                            if (this.alpha == 0)
                                                            {
                                                                Lighting.AddLight(base.Center, (Vector3)(color3.ToVector3() * 0.5f));
                                                            }
                                                            for (int num1023 = 0; num1023 < 2; num1023++)
                                                            {
                                                                if (Main.rand.Next(10) == 0)
                                                                {
                                                                    vector240 = new Vector2();
                                                                    vector240 = new Vector2();
                                                                    Vector2 vector205 = Vector2.UnitY.RotatedBy(((double)(num1023 * 3.141593f)), vector240).RotatedBy((double)this.rotation, vector240);
                                                                    Dust dust22 = Main.dust[Dust.NewDust(base.Center, 0, 0, 0x10b, 0f, 0f, 0xe1, color3, 1.5f)];
                                                                    dust22.noGravity = true;
                                                                    dust22.noLight = true;
                                                                    dust22.scale = this.Opacity * this.localAI[0];
                                                                    dust22.position = base.Center;
                                                                    dust22.velocity = (Vector2)(vector205 * 2.5f);
                                                                }
                                                            }
                                                            for (int num1024 = 0; num1024 < 2; num1024++)
                                                            {
                                                                if (Main.rand.Next(10) == 0)
                                                                {
                                                                    vector240 = new Vector2();
                                                                    Vector2 vector206 = Vector2.UnitY.RotatedBy((double)(num1024 * 3.141593f), vector240);
                                                                    Dust dust23 = Main.dust[Dust.NewDust(base.Center, 0, 0, 0x10b, 0f, 0f, 0xe1, color3, 1.5f)];
                                                                    dust23.noGravity = true;
                                                                    dust23.noLight = true;
                                                                    dust23.scale = this.Opacity * this.localAI[0];
                                                                    dust23.position = base.Center;
                                                                    dust23.velocity = (Vector2)(vector206 * 2.5f);
                                                                }
                                                            }
                                                            if (Main.rand.Next(10) == 0)
                                                            {
                                                                float num1025 = 1f + (Main.rand.NextFloat() * 2f);
                                                                float num1026 = 1f + Main.rand.NextFloat();
                                                                float num1027 = 1f + Main.rand.NextFloat();
                                                                Vector2 vector207 = Utils.RandomVector2(Main.rand, -1f, 1f);
                                                                if (vector207 != Vector2.Zero)
                                                                {
                                                                    vector207.Normalize();
                                                                }
                                                                vector207 = (Vector2)(vector207 * (20f + (Main.rand.NextFloat() * 100f)));
                                                                Vector2 vector208 = base.Center + vector207;
                                                                Point point3 = vector208.ToTileCoordinates();
                                                                bool flag50 = true;
                                                                if (!WorldGen.InWorld(point3.X, point3.Y, 0))
                                                                {
                                                                    flag50 = false;
                                                                }
                                                                if (flag50 && WorldGen.SolidTile(point3.X, point3.Y))
                                                                {
                                                                    flag50 = false;
                                                                }
                                                                if (flag50)
                                                                {
                                                                    Dust rf = Main.dust[Dust.NewDust(vector208, 0, 0, 0x10b, 0f, 0f, 0x7f, color3, 1f)];
                                                                    rf.noGravity = true;
                                                                    rf.position = vector208;
                                                                    rf.velocity = (Vector2)((-Vector2.UnitY * num1025) * ((Main.rand.NextFloat() * 0.9f) + 1.6f));
                                                                    rf.fadeIn = num1026;
                                                                    rf.scale = num1027;
                                                                    rf.noLight = true;
                                                                    Dust dust25 = Dust.CloneDust(rf);
                                                                    dust25.scale *= 0.65f;
                                                                    dust25.fadeIn *= 0.65f;
                                                                    dust25.color = new Color(0xff, 0xff, 0xff, 0xff);
                                                                }
                                                            }
                                                            this.scale = (this.Opacity / 2f) * this.localAI[0];
                                                            base.velocity = Vector2.Zero;
                                                            this.localAI[1]++;
                                                            if (this.localAI[1] >= 60f)
                                                            {
                                                                this.Kill();
                                                                return;
                                                            }
                                                        }
                                                    }
                                                    else if (this.aiStyle == 0x71)
                                                    {
                                                        int num1028 = 0x19;
                                                        if (this.type == 0x266)
                                                        {
                                                            num1028 = 0x3f;
                                                        }
                                                        if (this.alpha > 0)
                                                        {
                                                            this.alpha -= num1028;
                                                        }
                                                        if (this.alpha < 0)
                                                        {
                                                            this.alpha = 0;
                                                        }
                                                        if (this.ai[0] == 0f)
                                                        {
                                                            if (this.type == 0x266)
                                                            {
                                                                int num1029 = (int)this.ai[1];
                                                                if (!Main.npc[num1029].active)
                                                                {
                                                                    this.Kill();
                                                                    return;
                                                                }
                                                                base.velocity.ToRotation();
                                                                Vector2 vector209 = Main.npc[num1029].Center - base.Center;
                                                                if (vector209 != Vector2.Zero)
                                                                {
                                                                    vector209.Normalize();
                                                                    vector209 = (Vector2)(vector209 * 14f);
                                                                }
                                                                float num1030 = 5f;
                                                                base.velocity = (Vector2)(((base.velocity * (num1030 - 1f)) + vector209) / num1030);
                                                            }
                                                            else
                                                            {
                                                                this.ai[1]++;
                                                                if (this.ai[1] >= 45f)
                                                                {
                                                                    float num1031 = 0.98f;
                                                                    float num1032 = 0.35f;
                                                                    if (this.type == 0x27c)
                                                                    {
                                                                        num1031 = 0.995f;
                                                                        num1032 = 0.15f;
                                                                    }
                                                                    this.ai[1] = 45f;
                                                                    this.velocity.X *= num1031;
                                                                    this.velocity.Y += num1032;
                                                                }
                                                                this.rotation = base.velocity.ToRotation() + 1.570796f;
                                                            }
                                                        }
                                                        if (this.ai[0] == 1f)
                                                        {
                                                            this.ignoreWater = true;
                                                            this.tileCollide = false;
                                                            int num1033 = 15;
                                                            if (this.type == 0x27c)
                                                            {
                                                                num1033 = 5 * this.MaxUpdates;
                                                            }
                                                            bool flag52 = false;
                                                            bool flag53 = false;
                                                            this.localAI[0]++;
                                                            if ((this.localAI[0] % 30f) == 0f)
                                                            {
                                                                flag53 = true;
                                                            }
                                                            int num1034 = (int)this.ai[1];
                                                            if (this.localAI[0] >= (60 * num1033))
                                                            {
                                                                flag52 = true;
                                                            }
                                                            else if ((num1034 < 0) || (num1034 >= 200))
                                                            {
                                                                flag52 = true;
                                                            }
                                                            else if (Main.npc[num1034].active && !Main.npc[num1034].dontTakeDamage)
                                                            {
                                                                base.Center = Main.npc[num1034].Center - ((Vector2)(base.velocity * 2f));
                                                                this.gfxOffY = Main.npc[num1034].gfxOffY;
                                                                if (flag53)
                                                                {
                                                                    Main.npc[num1034].HitEffect(0, 1.0);
                                                                }
                                                            }
                                                            else
                                                            {
                                                                flag52 = true;
                                                            }
                                                            if (flag52)
                                                            {
                                                                this.Kill();
                                                            }
                                                        }
                                                        if (this.type == 0x266)
                                                        {
                                                            Lighting.AddLight(base.Center, 0.2f, 0.6f, 0.7f);
                                                        }
                                                        if (this.type == 0x27c)
                                                        {
                                                            Lighting.AddLight(base.Center, 0.8f, 0.7f, 0.4f);
                                                            return;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (this.aiStyle == 0x72)
                                                        {
                                                            if ((Main.netMode == 2) && (this.localAI[0] == 0f))
                                                            {
                                                                PortalHelper.SyncPortalSections(base.Center, 1);
                                                                this.localAI[0] = 1f;
                                                            }
                                                            this.timeLeft = 3;
                                                            bool flag54 = false;
                                                            if ((!Main.player[this.owner].active || Main.player[this.owner].dead) || (base.Distance(Main.player[this.owner].Center) > 12800f))
                                                            {
                                                                flag54 = true;
                                                            }
                                                            if (!flag54 && !WorldGen.InWorld(((int)base.Center.X) / 0x10, ((int)base.Center.Y) / 0x10, Lighting.offScreenTiles))
                                                            {
                                                                flag54 = true;
                                                            }
                                                            if (!flag54 && !PortalHelper.SupportedTilesAreFine(base.Center, this.ai[0]))
                                                            {
                                                                flag54 = true;
                                                            }
                                                            if (flag54)
                                                            {
                                                                this.Kill();
                                                                return;
                                                            }
                                                            Color portalColor = PortalHelper.GetPortalColor(this.owner, (int)this.ai[1]);
                                                            this.alpha -= 0x19;
                                                            if (this.alpha < 0)
                                                            {
                                                                this.alpha = 0;
                                                            }
                                                            if (this.alpha == 0)
                                                            {
                                                                Lighting.AddLight(base.Center + ((Vector2)(base.velocity * 3f)), (Vector3)(portalColor.ToVector3() * 0.5f));
                                                            }
                                                            if (++this.frameCounter >= 6)
                                                            {
                                                                this.frameCounter = 0;
                                                                if (++this.frame >= Main.projFrames[this.type])
                                                                {
                                                                    this.frame = 0;
                                                                }
                                                            }
                                                            this.rotation = this.ai[0] - 1.570796f;
                                                            return;
                                                        }
                                                        if (this.aiStyle == 0x73)
                                                        {
                                                            Lighting.AddLight(base.Center, new Vector3(0.075f, 0.3f, 0.15f));
                                                            base.velocity = (Vector2)(base.velocity * 0.985f);
                                                            this.rotation += this.velocity.X * 0.2f;
                                                            if (this.velocity.X > 0f)
                                                            {
                                                                this.rotation += 0.08f;
                                                            }
                                                            else
                                                            {
                                                                this.rotation -= 0.08f;
                                                            }
                                                            this.ai[1]++;
                                                            if (this.ai[1] > 30f)
                                                            {
                                                                this.alpha += 10;
                                                                if (this.alpha >= 0xff)
                                                                {
                                                                    this.alpha = 0xff;
                                                                    this.Kill();
                                                                    return;
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (this.aiStyle == 0x74)
                                                            {
                                                                if (this.localAI[0] == 0f)
                                                                {
                                                                    this.rotation = this.ai[1];
                                                                    this.localAI[0] = 1f;
                                                                }
                                                                Player player7 = Main.player[this.owner];
                                                                if (player7.setSolar)
                                                                {
                                                                    this.timeLeft = 2;
                                                                }
                                                                float angle = ((((float)player7.miscCounter) / 300f) * 12.56637f) + this.ai[1];
                                                                angle = MathHelper.WrapAngle(angle);
                                                                this.rotation = this.rotation.AngleLerp(angle, 0.05f);
                                                                this.alpha -= 15;
                                                                if (this.alpha < 0)
                                                                {
                                                                    this.alpha = 0;
                                                                }
                                                                base.velocity = ((Vector2)(this.rotation.ToRotationVector2() * 100f)) - player7.velocity;
                                                                base.Center = player7.Center - base.velocity;
                                                                return;
                                                            }
                                                            if (this.aiStyle == 0x75)
                                                            {
                                                                this.ai[1] += 0.01f;
                                                                this.scale = this.ai[1];
                                                                this.ai[0]++;
                                                                if (this.ai[0] >= (3 * Main.projFrames[this.type]))
                                                                {
                                                                    this.Kill();
                                                                    return;
                                                                }
                                                                if (++this.frameCounter >= 3)
                                                                {
                                                                    this.frameCounter = 0;
                                                                    if (++this.frame >= Main.projFrames[this.type])
                                                                    {
                                                                        this.hide = true;
                                                                    }
                                                                }
                                                                this.alpha -= 0x3f;
                                                                if (this.alpha < 0)
                                                                {
                                                                    this.alpha = 0;
                                                                }
                                                                bool flag55 = this.type == 0x264;
                                                                bool flag56 = this.type == 0x270;
                                                                if (flag55)
                                                                {
                                                                    Lighting.AddLight(base.Center, 0.9f, 0.8f, 0.6f);
                                                                }
                                                                if (this.ai[0] == 1f)
                                                                {
                                                                    base.position = base.Center;
                                                                    base.width = base.height = (int)(52f * this.scale);
                                                                    base.Center = base.position;
                                                                    this.Damage();
                                                                    if (flag55)
                                                                    {
                                                                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14);
                                                                        for (int num1036 = 0; num1036 < 4; num1036++)
                                                                        {
                                                                            color5 = new Color();
                                                                            int num1037 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1.5f);
                                                                            Main.dust[num1037].position = base.Center + ((Vector2)(((Vector2.UnitY.RotatedByRandom(3.1415927410125732) * ((float)Main.rand.NextDouble())) * base.width) / 2f));
                                                                        }
                                                                        for (int num1038 = 0; num1038 < 10; num1038++)
                                                                        {
                                                                            color5 = new Color();
                                                                            int num1039 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 200, color5, 2.7f);
                                                                            Main.dust[num1039].position = base.Center + ((Vector2)(((Vector2.UnitY.RotatedByRandom(3.1415927410125732) * ((float)Main.rand.NextDouble())) * base.width) / 2f));
                                                                            Main.dust[num1039].noGravity = true;
                                                                            Dust dust248 = Main.dust[num1039];
                                                                            dust248.velocity = (Vector2)(dust248.velocity * 3f);
                                                                            color5 = new Color();
                                                                            num1039 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 1.5f);
                                                                            Main.dust[num1039].position = base.Center + ((Vector2)(((Vector2.UnitY.RotatedByRandom(3.1415927410125732) * ((float)Main.rand.NextDouble())) * base.width) / 2f));
                                                                            Dust dust249 = Main.dust[num1039];
                                                                            dust249.velocity = (Vector2)(dust249.velocity * 2f);
                                                                            Main.dust[num1039].noGravity = true;
                                                                            Main.dust[num1039].fadeIn = 2.5f;
                                                                        }
                                                                        for (int num1040 = 0; num1040 < 5; num1040++)
                                                                        {
                                                                            color5 = new Color();
                                                                            int num1041 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 0, color5, 2.7f);
                                                                            vector240 = new Vector2();
                                                                            Main.dust[num1041].position = base.Center + ((Vector2)((Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(((double)base.velocity.ToRotation()), vector240) * base.width) / 2f));
                                                                            Main.dust[num1041].noGravity = true;
                                                                            Dust dust250 = Main.dust[num1041];
                                                                            dust250.velocity = (Vector2)(dust250.velocity * 3f);
                                                                        }
                                                                        for (int num1042 = 0; num1042 < 10; num1042++)
                                                                        {
                                                                            color5 = new Color();
                                                                            int num1043 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 0, color5, 1.5f);
                                                                            vector240 = new Vector2();
                                                                            Main.dust[num1043].position = base.Center + ((Vector2)((Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(((double)base.velocity.ToRotation()), vector240) * base.width) / 2f));
                                                                            Main.dust[num1043].noGravity = true;
                                                                            Dust dust251 = Main.dust[num1043];
                                                                            dust251.velocity = (Vector2)(dust251.velocity * 3f);
                                                                        }
                                                                    }
                                                                    if (flag56)
                                                                    {
                                                                        Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14);
                                                                        for (int num1044 = 0; num1044 < 20; num1044++)
                                                                        {
                                                                            color5 = new Color();
                                                                            int num1045 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 100, color5, 1.5f);
                                                                            Main.dust[num1045].position = base.Center + ((Vector2)(((Vector2.UnitY.RotatedByRandom(3.1415927410125732) * ((float)Main.rand.NextDouble())) * base.width) / 2f));
                                                                            Dust dust252 = Main.dust[num1045];
                                                                            dust252.velocity = (Vector2)(dust252.velocity * 2f);
                                                                            Main.dust[num1045].noGravity = true;
                                                                            Main.dust[num1045].fadeIn = 2.5f;
                                                                            Main.dust[num1045].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
                                                                        }
                                                                        for (int num1046 = 0; num1046 < 15; num1046++)
                                                                        {
                                                                            color5 = new Color();
                                                                            int num1047 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 0, color5, 2.7f);
                                                                            vector240 = new Vector2();
                                                                            Main.dust[num1047].position = base.Center + ((Vector2)((Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(((double)base.velocity.ToRotation()), vector240) * base.width) / 2f));
                                                                            Main.dust[num1047].noGravity = true;
                                                                            Dust dust253 = Main.dust[num1047];
                                                                            dust253.velocity = (Vector2)(dust253.velocity * 3f);
                                                                            Main.dust[num1047].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
                                                                        }
                                                                        float num1048 = ((float)Main.rand.NextDouble()) * 6.283185f;
                                                                        float num1049 = ((float)Main.rand.NextDouble()) * 6.283185f;
                                                                        float num1050 = ((float)Main.rand.NextDouble()) * 6.283185f;
                                                                        float num1051 = 7f + (((float)Main.rand.NextDouble()) * 7f);
                                                                        float num1052 = 7f + (((float)Main.rand.NextDouble()) * 7f);
                                                                        float num1053 = 7f + (((float)Main.rand.NextDouble()) * 7f);
                                                                        float num1054 = num1051;
                                                                        if (num1052 > num1054)
                                                                        {
                                                                            num1054 = num1052;
                                                                        }
                                                                        if (num1053 > num1054)
                                                                        {
                                                                            num1054 = num1053;
                                                                        }
                                                                        for (int num1055 = 0; num1055 < 200; num1055++)
                                                                        {
                                                                            int num1056 = 0x87;
                                                                            float num1057 = num1054;
                                                                            if (num1055 > 50)
                                                                            {
                                                                                num1057 = num1052;
                                                                            }
                                                                            if (num1055 > 100)
                                                                            {
                                                                                num1057 = num1051;
                                                                            }
                                                                            if (num1055 > 150)
                                                                            {
                                                                                num1057 = num1053;
                                                                            }
                                                                            color5 = new Color();
                                                                            int num1058 = Dust.NewDust(base.position, 6, 6, num1056, 0f, 0f, 100, color5, 1f);
                                                                            Vector2 velocity = Main.dust[num1058].velocity;
                                                                            Main.dust[num1058].position = base.Center;
                                                                            velocity.Normalize();
                                                                            velocity = (Vector2)(velocity * num1057);
                                                                            if (num1055 > 150)
                                                                            {
                                                                                velocity.Y *= 0.5f;
                                                                                vector240 = new Vector2();
                                                                                velocity = velocity.RotatedBy((double)num1050, vector240);
                                                                            }
                                                                            else if (num1055 > 100)
                                                                            {
                                                                                velocity.X *= 0.5f;
                                                                                vector240 = new Vector2();
                                                                                velocity = velocity.RotatedBy((double)num1048, vector240);
                                                                            }
                                                                            else if (num1055 > 50)
                                                                            {
                                                                                velocity.Y *= 0.5f;
                                                                                vector240 = new Vector2();
                                                                                velocity = velocity.RotatedBy((double)num1049, vector240);
                                                                            }
                                                                            Dust dust254 = Main.dust[num1058];
                                                                            dust254.velocity = (Vector2)(dust254.velocity * 0.2f);
                                                                            Dust dust255 = Main.dust[num1058];
                                                                            dust255.velocity += velocity;
                                                                            Main.dust[num1058].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
                                                                            if (num1055 <= 200)
                                                                            {
                                                                                Main.dust[num1058].scale = 2f;
                                                                                Main.dust[num1058].noGravity = true;
                                                                                Main.dust[num1058].fadeIn = Main.rand.NextFloat() * 2f;
                                                                                if (Main.rand.Next(4) == 0)
                                                                                {
                                                                                    Main.dust[num1058].fadeIn = 2.5f;
                                                                                }
                                                                                Main.dust[num1058].noLight = true;
                                                                                if (num1055 < 100)
                                                                                {
                                                                                    Dust dust256 = Main.dust[num1058];
                                                                                    dust256.position += (Vector2)(Main.dust[num1058].velocity * 20f);
                                                                                    Dust dust257 = Main.dust[num1058];
                                                                                    dust257.velocity = (Vector2)(dust257.velocity * -1f);
                                                                                }
                                                                            }
                                                                        }
                                                                        return;
                                                                    }
                                                                }
                                                            }
                                                            else if (this.aiStyle == 0x76)
                                                            {
                                                                this.ai[0]++;
                                                                int num1059 = 0;
                                                                if (this.velocity.Length() <= 4f)
                                                                {
                                                                    num1059 = 1;
                                                                }
                                                                this.alpha -= 15;
                                                                if (this.alpha < 0)
                                                                {
                                                                    this.alpha = 0;
                                                                }
                                                                switch (num1059)
                                                                {
                                                                    case 0:
                                                                        this.rotation -= 0.1047198f;
                                                                        if (Main.rand.Next(3) == 0)
                                                                        {
                                                                            if (Main.rand.Next(2) == 0)
                                                                            {
                                                                                Vector2 vector211 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                                Dust dust26 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector211 * 30f)), 0, 0, Utils.SelectRandom<int>(Main.rand, new int[] { 0x56, 90 }), 0f, 0f, 0, new Color(), 1f)];
                                                                                dust26.noGravity = true;
                                                                                dust26.position = base.Center - (vector211 * Main.rand.Next(10, 0x15));
                                                                                dust26.velocity = (Vector2)(vector211.RotatedBy(1.5707963705062866, new Vector2()) * 6f);
                                                                                dust26.scale = 0.5f + Main.rand.NextFloat();
                                                                                dust26.fadeIn = 0.5f;
                                                                                dust26.customData = this;
                                                                            }
                                                                            else
                                                                            {
                                                                                Vector2 vector212 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                                Dust dust27 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector212 * 30f)), 0, 0, 240, 0f, 0f, 0, new Color(), 1f)];
                                                                                dust27.noGravity = true;
                                                                                dust27.position = base.Center - ((Vector2)(vector212 * 30f));
                                                                                dust27.velocity = (Vector2)(vector212.RotatedBy(-1.5707963705062866, new Vector2()) * 3f);
                                                                                dust27.scale = 0.5f + Main.rand.NextFloat();
                                                                                dust27.fadeIn = 0.5f;
                                                                                dust27.customData = this;
                                                                            }
                                                                        }
                                                                        if (this.ai[0] >= 30f)
                                                                        {
                                                                            base.velocity = (Vector2)(base.velocity * 0.98f);
                                                                            this.scale += 0.007446808f;
                                                                            if (this.scale > 1.3f)
                                                                            {
                                                                                this.scale = 1.3f;
                                                                            }
                                                                            this.rotation -= 0.01745329f;
                                                                        }
                                                                        if (this.velocity.Length() < 4.1f)
                                                                        {
                                                                            this.velocity.Normalize();
                                                                            base.velocity = (Vector2)(base.velocity * 4f);
                                                                            this.ai[0] = 0f;
                                                                        }
                                                                        break;

                                                                    case 1:
                                                                        {
                                                                            this.rotation -= 0.1047198f;
                                                                            for (int num1060 = 0; num1060 < 1; num1060++)
                                                                            {
                                                                                if (Main.rand.Next(2) == 0)
                                                                                {
                                                                                    Vector2 vector213 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                                    color5 = new Color();
                                                                                    Dust dust28 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector213 * 30f)), 0, 0, 0x56, 0f, 0f, 0, color5, 1f)];
                                                                                    dust28.noGravity = true;
                                                                                    dust28.position = base.Center - (vector213 * Main.rand.Next(10, 0x15));
                                                                                    vector240 = new Vector2();
                                                                                    dust28.velocity = (Vector2)(vector213.RotatedBy(1.5707963705062866, vector240) * 6f);
                                                                                    dust28.scale = 0.9f + Main.rand.NextFloat();
                                                                                    dust28.fadeIn = 0.5f;
                                                                                    dust28.customData = this;
                                                                                    vector213 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                                    color5 = new Color();
                                                                                    dust28 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector213 * 30f)), 0, 0, 90, 0f, 0f, 0, color5, 1f)];
                                                                                    dust28.noGravity = true;
                                                                                    dust28.position = base.Center - (vector213 * Main.rand.Next(10, 0x15));
                                                                                    vector240 = new Vector2();
                                                                                    dust28.velocity = (Vector2)(vector213.RotatedBy(1.5707963705062866, vector240) * 6f);
                                                                                    dust28.scale = 0.9f + Main.rand.NextFloat();
                                                                                    dust28.fadeIn = 0.5f;
                                                                                    dust28.customData = this;
                                                                                    dust28.color = Color.Crimson;
                                                                                }
                                                                                else
                                                                                {
                                                                                    Vector2 vector214 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                                    color5 = new Color();
                                                                                    Dust dust29 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector214 * 30f)), 0, 0, 240, 0f, 0f, 0, color5, 1f)];
                                                                                    dust29.noGravity = true;
                                                                                    dust29.position = base.Center - (vector214 * Main.rand.Next(20, 0x1f));
                                                                                    vector240 = new Vector2();
                                                                                    dust29.velocity = (Vector2)(vector214.RotatedBy(-1.5707963705062866, vector240) * 5f);
                                                                                    dust29.scale = 0.9f + Main.rand.NextFloat();
                                                                                    dust29.fadeIn = 0.5f;
                                                                                    dust29.customData = this;
                                                                                }
                                                                            }
                                                                            if ((((this.ai[0] % 30f) == 0f) && (this.ai[0] < 241f)) && (Main.myPlayer == this.owner))
                                                                            {
                                                                                Vector2 vector215 = (Vector2)(Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 12f);
                                                                                NewProjectile(base.Center.X, base.Center.Y, vector215.X, vector215.Y, 0x26a, this.damage / 2, 0f, this.owner, 0f, (float)base.whoAmI);
                                                                            }
                                                                            Vector2 vector216 = base.Center;
                                                                            float num1061 = 800f;
                                                                            bool flag57 = false;
                                                                            int num1062 = 0;
                                                                            if (this.ai[1] == 0f)
                                                                            {
                                                                                for (int num1063 = 0; num1063 < 200; num1063++)
                                                                                {
                                                                                    if (Main.npc[num1063].CanBeChasedBy(this, false))
                                                                                    {
                                                                                        Vector2 other = Main.npc[num1063].Center;
                                                                                        if ((base.Distance(other) < num1061) && Collision.CanHit(new Vector2(this.position.X + (base.width / 2), this.position.Y + (base.height / 2)), 1, 1, Main.npc[num1063].position, Main.npc[num1063].width, Main.npc[num1063].height))
                                                                                        {
                                                                                            num1061 = base.Distance(other);
                                                                                            vector216 = other;
                                                                                            flag57 = true;
                                                                                            num1062 = num1063;
                                                                                        }
                                                                                    }
                                                                                }
                                                                                if (flag57)
                                                                                {
                                                                                    if (this.ai[1] != (num1062 + 1))
                                                                                    {
                                                                                        this.netUpdate = true;
                                                                                    }
                                                                                    this.ai[1] = num1062 + 1;
                                                                                }
                                                                                flag57 = false;
                                                                            }
                                                                            if (this.ai[1] != 0f)
                                                                            {
                                                                                int num1064 = (int)(this.ai[1] - 1f);
                                                                                if ((Main.npc[num1064].active && Main.npc[num1064].CanBeChasedBy(this, true)) && (base.Distance(Main.npc[num1064].Center) < 1000f))
                                                                                {
                                                                                    flag57 = true;
                                                                                    vector216 = Main.npc[num1064].Center;
                                                                                }
                                                                            }
                                                                            if (!this.friendly)
                                                                            {
                                                                                flag57 = false;
                                                                            }
                                                                            if (flag57)
                                                                            {
                                                                                float num1065 = 4f;
                                                                                int num1066 = 8;
                                                                                Vector2 vector218 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                                                                                float num1067 = vector216.X - vector218.X;
                                                                                float num1068 = vector216.Y - vector218.Y;
                                                                                float num1069 = (float)Math.Sqrt((double)((num1067 * num1067) + (num1068 * num1068)));
                                                                                num1069 = num1065 / num1069;
                                                                                num1067 *= num1069;
                                                                                num1068 *= num1069;
                                                                                this.velocity.X = ((this.velocity.X * (num1066 - 1)) + num1067) / ((float)num1066);
                                                                                this.velocity.Y = ((this.velocity.Y * (num1066 - 1)) + num1068) / ((float)num1066);
                                                                            }
                                                                            break;
                                                                        }
                                                                }
                                                                if (this.alpha < 150)
                                                                {
                                                                    Lighting.AddLight(base.Center, 0.7f, 0.2f, 0.6f);
                                                                }
                                                                if (this.ai[0] >= 600f)
                                                                {
                                                                    this.Kill();
                                                                    return;
                                                                }
                                                            }
                                                            else if (this.aiStyle == 0x77)
                                                            {
                                                                int num1070 = 0;
                                                                float num1071 = 0f;
                                                                float num1072 = 0f;
                                                                float num1073 = 0f;
                                                                bool flag58 = false;
                                                                bool flag59 = false;
                                                                if (this.type == 0x26a)
                                                                {
                                                                    num1070 = 0x269;
                                                                    num1071 = 420f;
                                                                    num1072 = 0.15f;
                                                                    num1073 = 0.15f;
                                                                }
                                                                if (flag59)
                                                                {
                                                                    int num1074 = (int)this.ai[1];
                                                                    if (!Main.projectile[num1074].active || (Main.projectile[num1074].type != num1070))
                                                                    {
                                                                        this.Kill();
                                                                        return;
                                                                    }
                                                                    this.timeLeft = 2;
                                                                }
                                                                this.ai[0]++;
                                                                if (this.ai[0] < num1071)
                                                                {
                                                                    bool flag60 = true;
                                                                    int num1075 = (int)this.ai[1];
                                                                    if (Main.projectile[num1075].active && (Main.projectile[num1075].type == num1070))
                                                                    {
                                                                        if (!flag58 && (Main.projectile[num1075].oldPos[1] != Vector2.Zero))
                                                                        {
                                                                            base.position += Main.projectile[num1075].position - Main.projectile[num1075].oldPos[1];
                                                                        }
                                                                        if (base.Center.HasNaNs())
                                                                        {
                                                                            this.Kill();
                                                                            return;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        this.ai[0] = num1071;
                                                                        flag60 = false;
                                                                        this.Kill();
                                                                    }
                                                                    if (flag60 && !flag58)
                                                                    {
                                                                        base.velocity += new Vector2((float)Math.Sign((float)(Main.projectile[num1075].Center.X - base.Center.X)), (float)Math.Sign((float)(Main.projectile[num1075].Center.Y - base.Center.Y))) * new Vector2(num1072, num1073);
                                                                        if (this.velocity.Length() > 6f)
                                                                        {
                                                                            base.velocity = (Vector2)(base.velocity * (6f / this.velocity.Length()));
                                                                        }
                                                                    }
                                                                    if (this.type == 0x26a)
                                                                    {
                                                                        if (Main.rand.Next(2) == 0)
                                                                        {
                                                                            int num1076 = Dust.NewDust(base.Center, 8, 8, 0x56, 0f, 0f, 0, new Color(), 1f);
                                                                            Main.dust[num1076].position = base.Center;
                                                                            Main.dust[num1076].velocity = base.velocity;
                                                                            Main.dust[num1076].noGravity = true;
                                                                            Main.dust[num1076].scale = 1.5f;
                                                                            if (flag60)
                                                                            {
                                                                                Main.dust[num1076].customData = Main.projectile[(int)this.ai[1]];
                                                                            }
                                                                        }
                                                                        this.alpha = 0xff;
                                                                        return;
                                                                    }
                                                                    this.Kill();
                                                                    return;
                                                                }
                                                            }
                                                            else if (this.aiStyle == 120)
                                                            {
                                                                Player player8 = Main.player[this.owner];
                                                                if (!player8.active)
                                                                {
                                                                    base.active = false;
                                                                    return;
                                                                }
                                                                bool flag61 = this.type == 0x26f;
                                                                Vector2 minionTargetPoint = player8.Center;
                                                                float num1077 = 100f;
                                                                float num1078 = 300f;
                                                                float num1079 = 100f;
                                                                float num1080 = 100f;
                                                                if (flag61)
                                                                {
                                                                    if (player8.dead)
                                                                    {
                                                                        player8.stardustGuardian = false;
                                                                    }
                                                                    if (player8.stardustGuardian)
                                                                    {
                                                                        this.timeLeft = 2;
                                                                    }
                                                                    num1077 = 150f;
                                                                    num1078 = 250f;
                                                                    num1079 = 200f;
                                                                    minionTargetPoint.X -= (5 + (player8.width / 2)) * player8.direction;
                                                                    minionTargetPoint.Y -= 25f;
                                                                    Lighting.AddLight(base.Center, 0.9f, 0.9f, 0.7f);
                                                                    if ((this.ai[0] != 3f) && (this.alpha == 0xff))
                                                                    {
                                                                        this.alpha = 0;
                                                                        for (int num1081 = 0; num1081 < 30; num1081++)
                                                                        {
                                                                            color5 = new Color();
                                                                            int num1082 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 200, color5, 1.7f);
                                                                            Main.dust[num1082].noGravity = true;
                                                                            Dust dust258 = Main.dust[num1082];
                                                                            dust258.velocity = (Vector2)(dust258.velocity * 3f);
                                                                            Main.dust[num1082].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
                                                                            color5 = new Color();
                                                                            num1082 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 100, color5, 1f);
                                                                            Dust dust259 = Main.dust[num1082];
                                                                            dust259.velocity = (Vector2)(dust259.velocity * 2f);
                                                                            Main.dust[num1082].noGravity = true;
                                                                            Main.dust[num1082].fadeIn = 2.5f;
                                                                            Main.dust[num1082].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
                                                                        }
                                                                    }
                                                                    if (this.localAI[0] > 0f)
                                                                    {
                                                                        this.localAI[0]--;
                                                                    }
                                                                }
                                                                if (this.ai[0] != 0f)
                                                                {
                                                                    Main.player[this.owner].tankPet = base.whoAmI;
                                                                    Main.player[this.owner].tankPetReset = false;
                                                                }
                                                                if (this.ai[0] == 0f)
                                                                {
                                                                    if (player8.HasMinionTarget)
                                                                    {
                                                                        this.ai[0] = 3f;
                                                                        this.netUpdate = true;
                                                                    }
                                                                    base.Center = Vector2.Lerp(base.Center, minionTargetPoint, 0.2f);
                                                                    base.velocity = (Vector2)(base.velocity * 0.8f);
                                                                    base.direction = this.spriteDirection = player8.direction;
                                                                    if (flag61 && (++this.frameCounter >= 9))
                                                                    {
                                                                        this.frameCounter = 0;
                                                                        if (++this.frame >= (Main.projFrames[this.type] - 4))
                                                                        {
                                                                            this.frame = 0;
                                                                        }
                                                                    }
                                                                }
                                                                else if (this.ai[0] == 1f)
                                                                {
                                                                    if (player8.HasMinionTarget)
                                                                    {
                                                                        minionTargetPoint = player8.MinionTargetPoint;
                                                                    }
                                                                    else
                                                                    {
                                                                        this.ai[0] = 0f;
                                                                        this.netUpdate = true;
                                                                    }
                                                                    int num1083 = -1;
                                                                    bool flag62 = true;
                                                                    if (flag61 && (Math.Abs((float)(base.Center.X - minionTargetPoint.X)) > (num1077 + 20f)))
                                                                    {
                                                                        flag62 = false;
                                                                    }
                                                                    if (flag62)
                                                                    {
                                                                        for (int num1084 = 0; num1084 < 200; num1084++)
                                                                        {
                                                                            NPC npc11 = Main.npc[num1084];
                                                                            if (npc11.CanBeChasedBy(this, false) && (base.Distance(npc11.Center) < num1078))
                                                                            {
                                                                                num1083 = num1084;
                                                                            }
                                                                        }
                                                                    }
                                                                    if (num1083 != -1)
                                                                    {
                                                                        NPC npc12 = Main.npc[num1083];
                                                                        base.direction = this.spriteDirection = (npc12.Center.X > base.Center.X).ToDirectionInt();
                                                                        float num1086 = Math.Abs((float)(minionTargetPoint.X - base.Center.X));
                                                                        float num1087 = Math.Abs((float)(npc12.Center.X - base.Center.X));
                                                                        float num1088 = Math.Abs((float)(minionTargetPoint.Y - base.Center.Y));
                                                                        float num1089 = Math.Abs((float)(npc12.Center.Y - base.Bottom.Y));
                                                                        float num1090 = (npc12.Center.Y > base.Bottom.Y).ToDirectionInt();
                                                                        if (((num1086 < num1077) || (((minionTargetPoint.X - base.Center.X) * base.direction) < 0f)) && ((num1087 > 20f) && (num1087 < ((num1077 - num1086) + 100f))))
                                                                        {
                                                                            this.velocity.X += 0.1f * base.direction;
                                                                        }
                                                                        else
                                                                        {
                                                                            this.velocity.X *= 0.7f;
                                                                        }
                                                                        if (((num1088 < num1080) || (((minionTargetPoint.Y - base.Bottom.Y) * num1090) < 0f)) && ((num1089 > 10f) && (num1089 < ((num1080 - num1088) + 10f))))
                                                                        {
                                                                            this.velocity.Y += 0.1f * num1090;
                                                                        }
                                                                        else
                                                                        {
                                                                            this.velocity.Y *= 0.7f;
                                                                        }
                                                                        if (((this.localAI[0] == 0f) && (this.owner == Main.myPlayer)) && (num1087 < num1079))
                                                                        {
                                                                            this.ai[1] = 0f;
                                                                            this.ai[0] = 2f;
                                                                            this.netUpdate = true;
                                                                            this.localAI[0] = 90f;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        if (Math.Abs((float)(minionTargetPoint.X - base.Center.X)) > (num1077 + 40f))
                                                                        {
                                                                            this.ai[0] = 3f;
                                                                            this.netUpdate = true;
                                                                        }
                                                                        else if (Math.Abs((float)(minionTargetPoint.X - base.Center.X)) > 20f)
                                                                        {
                                                                            base.direction = this.spriteDirection = (minionTargetPoint.X > base.Center.X).ToDirectionInt();
                                                                            this.velocity.X += 0.06f * base.direction;
                                                                        }
                                                                        else
                                                                        {
                                                                            this.velocity.X *= 0.8f;
                                                                            base.direction = this.spriteDirection = (player8.Center.X < base.Center.X).ToDirectionInt();
                                                                        }
                                                                        if (Math.Abs((float)(minionTargetPoint.Y - base.Center.Y)) > num1080)
                                                                        {
                                                                            this.ai[0] = 3f;
                                                                            this.netUpdate = true;
                                                                        }
                                                                        else if (Math.Abs((float)(minionTargetPoint.Y - base.Center.Y)) > 10f)
                                                                        {
                                                                            this.velocity.Y += 0.06f * Math.Sign((float)(minionTargetPoint.Y - base.Center.Y));
                                                                        }
                                                                        else
                                                                        {
                                                                            this.velocity.Y *= 0.8f;
                                                                        }
                                                                    }
                                                                    if (flag61 && (++this.frameCounter >= 9))
                                                                    {
                                                                        this.frameCounter = 0;
                                                                        if (++this.frame >= (Main.projFrames[this.type] - 4))
                                                                        {
                                                                            this.frame = 0;
                                                                        }
                                                                    }
                                                                }
                                                                else if (this.ai[0] == 2f)
                                                                {
                                                                    this.velocity.X *= 0.9f;
                                                                    this.ai[1]++;
                                                                    float num1091 = 0f;
                                                                    if (flag61)
                                                                    {
                                                                        num1091 = 20f;
                                                                        if ((this.ai[1] == 10f) && (this.owner == Main.myPlayer))
                                                                        {
                                                                            int num1092 = (int)(20f * Main.player[this.owner].minionDamage);
                                                                            NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 0x270, num1092, 6f, this.owner, 0f, 5f);
                                                                        }
                                                                    }
                                                                    if (this.ai[1] >= num1091)
                                                                    {
                                                                        this.ai[1] = 0f;
                                                                        this.ai[0] = 1f;
                                                                        this.netUpdate = true;
                                                                    }
                                                                    if (flag61)
                                                                    {
                                                                        if (this.frame < (Main.projFrames[this.type] - 4))
                                                                        {
                                                                            this.frame = Main.projFrames[this.type] - 1;
                                                                            this.frameCounter = 0;
                                                                        }
                                                                        if (++this.frameCounter >= 5)
                                                                        {
                                                                            this.frameCounter = 0;
                                                                            if (--this.frame < (Main.projFrames[this.type] - 5))
                                                                            {
                                                                                this.frame = Main.projFrames[this.type] - 1;
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                                if (this.ai[0] == 3f)
                                                                {
                                                                    if (player8.HasMinionTarget)
                                                                    {
                                                                        minionTargetPoint = player8.MinionTargetPoint;
                                                                    }
                                                                    else
                                                                    {
                                                                        this.ai[0] = 0f;
                                                                        this.netUpdate = true;
                                                                    }
                                                                    if (this.alpha == 0)
                                                                    {
                                                                        this.alpha = 0xff;
                                                                        for (int num1093 = 0; num1093 < 30; num1093++)
                                                                        {
                                                                            color5 = new Color();
                                                                            int num1094 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 200, color5, 1.7f);
                                                                            Main.dust[num1094].noGravity = true;
                                                                            Dust dust260 = Main.dust[num1094];
                                                                            dust260.velocity = (Vector2)(dust260.velocity * 3f);
                                                                            Main.dust[num1094].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
                                                                            color5 = new Color();
                                                                            num1094 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 100, color5, 1f);
                                                                            Dust dust261 = Main.dust[num1094];
                                                                            dust261.velocity = (Vector2)(dust261.velocity * 2f);
                                                                            Main.dust[num1094].noGravity = true;
                                                                            Main.dust[num1094].fadeIn = 2.5f;
                                                                            Main.dust[num1094].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        for (int num1095 = 0; num1095 < 2; num1095++)
                                                                        {
                                                                            color5 = new Color();
                                                                            int num1096 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 200, color5, 1.7f);
                                                                            Main.dust[num1096].noGravity = true;
                                                                            Dust dust262 = Main.dust[num1096];
                                                                            dust262.velocity = (Vector2)(dust262.velocity * 3f);
                                                                            Main.dust[num1096].noLight = true;
                                                                            Main.dust[num1096].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
                                                                            color5 = new Color();
                                                                            num1096 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 100, color5, 1f);
                                                                            Dust dust263 = Main.dust[num1096];
                                                                            dust263.velocity = (Vector2)(dust263.velocity * 2f);
                                                                            Main.dust[num1096].noGravity = true;
                                                                            Main.dust[num1096].fadeIn = 2.5f;
                                                                            Main.dust[num1096].noLight = true;
                                                                            Main.dust[num1096].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
                                                                        }
                                                                    }
                                                                    base.velocity = (Vector2)(base.velocity * 0.7f);
                                                                    base.Center = Vector2.Lerp(base.Center, minionTargetPoint, 0.2f);
                                                                    if (base.Distance(minionTargetPoint) < 10f)
                                                                    {
                                                                        this.ai[0] = 1f;
                                                                        this.netUpdate = true;
                                                                        return;
                                                                    }
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if (this.aiStyle == 0x79)
                                                                {
                                                                    Player player9 = Main.player[this.owner];
                                                                    if ((((int)Main.time) % 120) == 0)
                                                                    {
                                                                        this.netUpdate = true;
                                                                    }
                                                                    if (!player9.active)
                                                                    {
                                                                        base.active = false;
                                                                        return;
                                                                    }
                                                                    bool flag63 = this.type == 0x271;
                                                                    bool flag64 = (((this.type == 0x271) || (this.type == 0x272)) || (this.type == 0x273)) || (this.type == 0x274);
                                                                    int num1097 = 10;
                                                                    int num1098 = 10;
                                                                    float num1099 = 0.01f;
                                                                    if (flag64)
                                                                    {
                                                                        if (player9.dead)
                                                                        {
                                                                            player9.stardustDragon = false;
                                                                        }
                                                                        if (player9.stardustDragon)
                                                                        {
                                                                            this.timeLeft = 2;
                                                                        }
                                                                        num1097 = 30;
                                                                        num1098 = 50;
                                                                        num1099 = 0.2f;
                                                                        if (Main.rand.Next(30) == 0)
                                                                        {
                                                                            color5 = new Color();
                                                                            int num1100 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 0, color5, 2f);
                                                                            Main.dust[num1100].noGravity = true;
                                                                            Main.dust[num1100].fadeIn = 2f;
                                                                            Point point4 = Main.dust[num1100].position.ToTileCoordinates();
                                                                            if (WorldGen.InWorld(point4.X, point4.Y, 5) && WorldGen.SolidTile(point4.X, point4.Y))
                                                                            {
                                                                                Main.dust[num1100].noLight = true;
                                                                            }
                                                                        }
                                                                    }
                                                                    if (flag63)
                                                                    {
                                                                        Vector2 vector220 = player9.Center;
                                                                        float num1101 = 700f;
                                                                        float num1102 = 1000f;
                                                                        int num1103 = -1;
                                                                        if (base.Distance(vector220) > 2000f)
                                                                        {
                                                                            base.Center = vector220;
                                                                            this.netUpdate = true;
                                                                        }
                                                                        bool flag65 = true;
                                                                        if (flag65)
                                                                        {
                                                                            for (int num1104 = 0; num1104 < 200; num1104++)
                                                                            {
                                                                                NPC npc13 = Main.npc[num1104];
                                                                                if ((npc13.CanBeChasedBy(this, false) && (player9.Distance(npc13.Center) < num1102)) && (base.Distance(npc13.Center) < num1101))
                                                                                {
                                                                                    num1103 = num1104;
                                                                                    bool boss = npc13.boss;
                                                                                }
                                                                            }
                                                                        }
                                                                        if (num1103 != -1)
                                                                        {
                                                                            NPC npc14 = Main.npc[num1103];
                                                                            Vector2 vector221 = npc14.Center - base.Center;
                                                                            (vector221.X > 0f).ToDirectionInt();
                                                                            (vector221.Y > 0f).ToDirectionInt();
                                                                            float num1106 = 0.4f;
                                                                            if (vector221.Length() < 600f)
                                                                            {
                                                                                num1106 = 0.6f;
                                                                            }
                                                                            if (vector221.Length() < 300f)
                                                                            {
                                                                                num1106 = 0.8f;
                                                                            }
                                                                            if (vector221.Length() > (npc14.Size.Length() * 0.75f))
                                                                            {
                                                                                base.velocity += (Vector2)((Vector2.Normalize(vector221) * num1106) * 1.5f);
                                                                                if (Vector2.Dot(base.velocity, vector221) < 0.25f)
                                                                                {
                                                                                    base.velocity = (Vector2)(base.velocity * 0.8f);
                                                                                }
                                                                            }
                                                                            float num1107 = 30f;
                                                                            if (this.velocity.Length() > num1107)
                                                                            {
                                                                                base.velocity = (Vector2)(Vector2.Normalize(base.velocity) * num1107);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            float num1108 = 0.2f;
                                                                            Vector2 vector222 = vector220 - base.Center;
                                                                            if (vector222.Length() < 200f)
                                                                            {
                                                                                num1108 = 0.12f;
                                                                            }
                                                                            if (vector222.Length() < 140f)
                                                                            {
                                                                                num1108 = 0.06f;
                                                                            }
                                                                            if (vector222.Length() > 100f)
                                                                            {
                                                                                if (Math.Abs((float)(vector220.X - base.Center.X)) > 20f)
                                                                                {
                                                                                    this.velocity.X += num1108 * Math.Sign((float)(vector220.X - base.Center.X));
                                                                                }
                                                                                if (Math.Abs((float)(vector220.Y - base.Center.Y)) > 10f)
                                                                                {
                                                                                    this.velocity.Y += num1108 * Math.Sign((float)(vector220.Y - base.Center.Y));
                                                                                }
                                                                            }
                                                                            else if (this.velocity.Length() > 2f)
                                                                            {
                                                                                base.velocity = (Vector2)(base.velocity * 0.96f);
                                                                            }
                                                                            if (Math.Abs(this.velocity.Y) < 1f)
                                                                            {
                                                                                this.velocity.Y -= 0.1f;
                                                                            }
                                                                            float num1109 = 15f;
                                                                            if (this.velocity.Length() > num1109)
                                                                            {
                                                                                base.velocity = (Vector2)(Vector2.Normalize(base.velocity) * num1109);
                                                                            }
                                                                        }
                                                                        this.rotation = base.velocity.ToRotation() + 1.570796f;
                                                                        int direction = base.direction;
                                                                        base.direction = this.spriteDirection = (this.velocity.X > 0f) ? 1 : -1;
                                                                        if (direction != base.direction)
                                                                        {
                                                                            this.netUpdate = true;
                                                                        }
                                                                        float num1111 = MathHelper.Clamp(this.localAI[0], 0f, 4f);
                                                                        base.position = base.Center;
                                                                        this.scale = 1f + (num1111 * 0.01f);
                                                                        base.width = base.height = (int)(num1097 * this.scale);
                                                                        base.Center = base.position;
                                                                        if (this.alpha > 0)
                                                                        {
                                                                            for (int num1112 = 0; num1112 < 2; num1112++)
                                                                            {
                                                                                color5 = new Color();
                                                                                int num1113 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x87, 0f, 0f, 100, color5, 2f);
                                                                                Main.dust[num1113].noGravity = true;
                                                                                Main.dust[num1113].noLight = true;
                                                                            }
                                                                            this.alpha -= 0x2a;
                                                                            if (this.alpha < 0)
                                                                            {
                                                                                this.alpha = 0;
                                                                            }
                                                                        }
                                                                        this.damage = (int)((num1098 * (1f + (this.localAI[0] * num1099))) * player9.minionDamage);
                                                                        return;
                                                                    }
                                                                    bool flag66 = false;
                                                                    Vector2 vector223 = Vector2.Zero;
                                                                    Vector2 vector1 = Vector2.Zero;
                                                                    float num1114 = 0f;
                                                                    float num1115 = 0f;
                                                                    float num1116 = 1f;
                                                                    if (this.ai[1] == 1f)
                                                                    {
                                                                        this.ai[1] = 0f;
                                                                        this.netUpdate = true;
                                                                    }
                                                                    /*int byUUID = GetByUUID(this.owner, (int)this.ai[0]);
                                                                    if (((flag64 && (byUUID >= 0)) && Main.projectile[byUUID].active) && (((Main.projectile[byUUID].type == 0x271) || (Main.projectile[byUUID].type == 0x272)) || (Main.projectile[byUUID].type == 0x273)))
                                                                    {
                                                                        flag66 = true;
                                                                        vector223 = Main.projectile[byUUID].Center;
                                                                        Vector2 vector241 = Main.projectile[byUUID].velocity;
                                                                        num1114 = Main.projectile[byUUID].rotation;
                                                                        num1116 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 4f);
                                                                        num1115 = 16f;
                                                                        int num1164 = Main.projectile[byUUID].alpha;
                                                                        Main.projectile[byUUID].localAI[0] = this.localAI[0] + 1f;
                                                                        if (Main.projectile[byUUID].type != 0x271)
                                                                        {
                                                                            Main.projectile[byUUID].localAI[1] = base.whoAmI;
                                                                        }
                                                                        if (((this.owner == Main.myPlayer) && (Main.projectile[byUUID].type == 0x271)) && (this.type == 0x274))
                                                                        {
                                                                            Main.projectile[byUUID].Kill();
                                                                            this.Kill();
                                                                            return;
                                                                        }
                                                                    }*/
                                                                    if (flag66)
                                                                    {
                                                                        if (this.alpha > 0)
                                                                        {
                                                                            for (int num1119 = 0; num1119 < 2; num1119++)
                                                                            {
                                                                                color5 = new Color();
                                                                                int num1120 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 100, color5, 2f);
                                                                                Main.dust[num1120].noGravity = true;
                                                                                Main.dust[num1120].noLight = true;
                                                                            }
                                                                        }
                                                                        this.alpha -= 0x2a;
                                                                        if (this.alpha < 0)
                                                                        {
                                                                            this.alpha = 0;
                                                                        }
                                                                        base.velocity = Vector2.Zero;
                                                                        Vector2 vector224 = vector223 - base.Center;
                                                                        if (num1114 != this.rotation)
                                                                        {
                                                                            float num1121 = MathHelper.WrapAngle(num1114 - this.rotation);
                                                                            vector224 = vector224.RotatedBy((double)(num1121 * 0.1f), new Vector2());
                                                                        }
                                                                        this.rotation = vector224.ToRotation() + 1.570796f;
                                                                        base.position = base.Center;
                                                                        this.scale = num1116;
                                                                        base.width = base.height = (int)(num1097 * this.scale);
                                                                        base.Center = base.position;
                                                                        if (vector224 != Vector2.Zero)
                                                                        {
                                                                            base.Center = vector223 - ((Vector2)((Vector2.Normalize(vector224) * num1115) * num1116));
                                                                        }
                                                                        this.spriteDirection = (vector224.X > 0f) ? 1 : -1;
                                                                        this.damage = (int)((num1098 * (1f + (this.localAI[0] * num1099))) * player9.minionDamage);
                                                                    }
                                                                    return;
                                                                }
                                                                if (this.aiStyle == 0x7a)
                                                                {
                                                                    int num1122 = (int)this.ai[0];
                                                                    bool flag67 = false;
                                                                    if ((num1122 == -1) || !Main.npc[num1122].active)
                                                                    {
                                                                        flag67 = true;
                                                                    }
                                                                    if (flag67)
                                                                    {
                                                                        if (this.type == 0x275)
                                                                        {
                                                                            this.Kill();
                                                                            return;
                                                                        }
                                                                        if ((this.type == 0x277) && (this.ai[0] != -1f))
                                                                        {
                                                                            this.ai[0] = -1f;
                                                                            this.netUpdate = true;
                                                                        }
                                                                    }
                                                                    if (!flag67 && base.Hitbox.Intersects(Main.npc[num1122].Hitbox))
                                                                    {
                                                                        this.Kill();
                                                                        if (this.type == 0x277)
                                                                        {
                                                                            this.localAI[1] = 1f;
                                                                            this.Damage();
                                                                        }
                                                                        return;
                                                                    }
                                                                    if (this.type == 0x275)
                                                                    {
                                                                        Vector2 vector225 = Main.npc[num1122].Center - base.Center;
                                                                        base.velocity = (Vector2)(Vector2.Normalize(vector225) * 5f);
                                                                        Dust.QuickDust(base.Center, Color.Red);
                                                                    }
                                                                    if (this.type == 0x277)
                                                                    {
                                                                        if (this.ai[1] > 0f)
                                                                        {
                                                                            this.ai[1]--;
                                                                            base.velocity = Vector2.Zero;
                                                                            return;
                                                                        }
                                                                        if (flag67)
                                                                        {
                                                                            if (base.velocity == Vector2.Zero)
                                                                            {
                                                                                this.Kill();
                                                                            }
                                                                            this.tileCollide = true;
                                                                            this.alpha += 10;
                                                                            if (this.alpha > 0xff)
                                                                            {
                                                                                this.Kill();
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            Vector2 vector226 = Main.npc[num1122].Center - base.Center;
                                                                            base.velocity = (Vector2)(Vector2.Normalize(vector226) * 12f);
                                                                            this.alpha -= 15;
                                                                            if (this.alpha < 0)
                                                                            {
                                                                                this.alpha = 0;
                                                                            }
                                                                        }
                                                                        this.rotation = base.velocity.ToRotation() - 1.570796f;
                                                                        return;
                                                                    }
                                                                }
                                                                else if (this.aiStyle == 0x7b)
                                                                {
                                                                    bool flag68 = this.type == 0x281;
                                                                    bool flag69 = this.type == 0x283;
                                                                    float num1123 = 1000f;
                                                                    base.velocity = Vector2.Zero;
                                                                    if (flag68)
                                                                    {
                                                                        this.alpha -= 5;
                                                                        if (this.alpha < 0)
                                                                        {
                                                                            this.alpha = 0;
                                                                        }
                                                                        if (base.direction == 0)
                                                                        {
                                                                            base.direction = Main.player[this.owner].direction;
                                                                        }
                                                                        this.rotation -= (base.direction * 6.283185f) / 120f;
                                                                        this.scale = this.Opacity;
                                                                        Lighting.AddLight(base.Center, (Vector3)(new Vector3(0.3f, 0.9f, 0.7f) * this.Opacity));
                                                                        if (Main.rand.Next(2) == 0)
                                                                        {
                                                                            Vector2 vector227 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                            color5 = new Color();
                                                                            Dust dust30 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector227 * 30f)), 0, 0, 0xe5, 0f, 0f, 0, color5, 1f)];
                                                                            dust30.noGravity = true;
                                                                            dust30.position = base.Center - (vector227 * Main.rand.Next(10, 0x15));
                                                                            vector240 = new Vector2();
                                                                            dust30.velocity = (Vector2)(vector227.RotatedBy(1.5707963705062866, vector240) * 6f);
                                                                            dust30.scale = 0.5f + Main.rand.NextFloat();
                                                                            dust30.fadeIn = 0.5f;
                                                                            dust30.customData = base.Center;
                                                                        }
                                                                        if (Main.rand.Next(2) == 0)
                                                                        {
                                                                            Vector2 vector228 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
                                                                            color5 = new Color();
                                                                            Dust dust31 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector228 * 30f)), 0, 0, 240, 0f, 0f, 0, color5, 1f)];
                                                                            dust31.noGravity = true;
                                                                            dust31.position = base.Center - ((Vector2)(vector228 * 30f));
                                                                            dust31.velocity = (Vector2)(vector228.RotatedBy(-1.5707963705062866, new Vector2()) * 3f);
                                                                            dust31.scale = 0.5f + Main.rand.NextFloat();
                                                                            dust31.fadeIn = 0.5f;
                                                                            dust31.customData = base.Center;
                                                                        }
                                                                        if (this.ai[0] < 0f)
                                                                        {
                                                                            color5 = new Color();
                                                                            int num1124 = Dust.NewDust(base.Center - ((Vector2)(Vector2.One * 8f)), 0x10, 0x10, 0xe5, this.velocity.X / 2f, this.velocity.Y / 2f, 0, color5, 1f);
                                                                            Dust dust264 = Main.dust[num1124];
                                                                            dust264.velocity = (Vector2)(dust264.velocity * 2f);
                                                                            Main.dust[num1124].noGravity = true;
                                                                            Main.dust[num1124].scale = Utils.SelectRandom<float>(Main.rand, new float[] { 0.8f, 1.65f });
                                                                            Main.dust[num1124].customData = this;
                                                                        }
                                                                    }
                                                                    if (flag69)
                                                                    {
                                                                        this.alpha -= 5;
                                                                        if (this.alpha < 0)
                                                                        {
                                                                            this.alpha = 0;
                                                                        }
                                                                        if (base.direction == 0)
                                                                        {
                                                                            base.direction = Main.player[this.owner].direction;
                                                                        }
                                                                        if (++this.frameCounter >= 3)
                                                                        {
                                                                            this.frameCounter = 0;
                                                                            if (++this.frame >= Main.projFrames[this.type])
                                                                            {
                                                                                this.frame = 0;
                                                                            }
                                                                        }
                                                                        if ((this.alpha == 0) && (Main.rand.Next(15) == 0))
                                                                        {
                                                                            Dust dust32 = Main.dust[Dust.NewDust(base.Top, 0, 0, 0x105, 0f, 0f, 100, new Color(), 1f)];
                                                                            dust32.velocity.X = 0f;
                                                                            dust32.noGravity = true;
                                                                            dust32.fadeIn = 1f;
                                                                            dust32.position = base.Center + ((Vector2)(Vector2.UnitY.RotatedByRandom(6.2831854820251465) * ((4f * Main.rand.NextFloat()) + 26f)));
                                                                            dust32.scale = 0.5f;
                                                                        }
                                                                        this.localAI[0]++;
                                                                        if (this.localAI[0] >= 60f)
                                                                        {
                                                                            this.localAI[0] = 0f;
                                                                        }
                                                                    }
                                                                    if (this.ai[0] < 0f)
                                                                    {
                                                                        this.ai[0]++;
                                                                        if (flag68)
                                                                        {
                                                                            this.ai[1] -= (base.direction * 0.3926991f) / 50f;
                                                                        }
                                                                    }
                                                                    if (this.ai[0] == 0f)
                                                                    {
                                                                        int num1125 = -1;
                                                                        float num1126 = num1123;
                                                                        for (int num1127 = 0; num1127 < 200; num1127++)
                                                                        {
                                                                            NPC npc15 = Main.npc[num1127];
                                                                            if (npc15.CanBeChasedBy(this, false))
                                                                            {
                                                                                float num1128 = base.Distance(npc15.Center);
                                                                                if ((num1128 < num1126) && Collision.CanHitLine(base.Center, 0, 0, npc15.Center, 0, 0))
                                                                                {
                                                                                    num1126 = num1128;
                                                                                    num1125 = num1127;
                                                                                }
                                                                            }
                                                                        }
                                                                        if (num1125 != -1)
                                                                        {
                                                                            this.ai[0] = 1f;
                                                                            this.ai[1] = num1125;
                                                                            this.netUpdate = true;
                                                                            return;
                                                                        }
                                                                    }
                                                                    if (this.ai[0] > 0f)
                                                                    {
                                                                        int num1129 = (int)this.ai[1];
                                                                        if (!Main.npc[num1129].CanBeChasedBy(this, false))
                                                                        {
                                                                            this.ai[0] = 0f;
                                                                            this.ai[1] = 0f;
                                                                            this.netUpdate = true;
                                                                            return;
                                                                        }
                                                                        this.ai[0]++;
                                                                        float num1130 = 30f;
                                                                        if (flag69)
                                                                        {
                                                                            num1130 = 5f;
                                                                        }
                                                                        if (this.ai[0] >= num1130)
                                                                        {
                                                                            Vector2 vector230 = base.DirectionTo(Main.npc[num1129].Center);
                                                                            if (vector230.HasNaNs())
                                                                            {
                                                                                vector230 = Vector2.UnitY;
                                                                            }
                                                                            float num1131 = vector230.ToRotation();
                                                                            int num1132 = (vector230.X > 0f) ? 1 : -1;
                                                                            if (flag68)
                                                                            {
                                                                                base.direction = num1132;
                                                                                this.ai[0] = -60f;
                                                                                this.ai[1] = num1131 + ((num1132 * 3.141593f) / 16f);
                                                                                this.netUpdate = true;
                                                                                if (this.owner == Main.myPlayer)
                                                                                {
                                                                                    NewProjectile(base.Center.X, base.Center.Y, vector230.X, vector230.Y, 0x282, this.damage, this.knockBack, this.owner, 0f, (float)base.whoAmI);
                                                                                }
                                                                            }
                                                                            if (flag69)
                                                                            {
                                                                                base.direction = num1132;
                                                                                this.ai[0] = -20f;
                                                                                this.netUpdate = true;
                                                                                if (this.owner == Main.myPlayer)
                                                                                {
                                                                                    Vector2 vector231 = (Main.npc[num1129].position + (Main.npc[num1129].Size * Utils.RandomVector2(Main.rand, 0f, 1f))) - base.Center;
                                                                                    for (int num1133 = 0; num1133 < 3; num1133++)
                                                                                    {
                                                                                        Vector2 vector232 = base.Center + vector231;
                                                                                        if (num1133 > 0)
                                                                                        {
                                                                                            vector232 = base.Center + ((Vector2)(vector231.RotatedByRandom(0.78539818525314331) * ((Main.rand.NextFloat() * 0.5f) + 0.75f)));
                                                                                        }
                                                                                        float num1134 = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X;
                                                                                        NewProjectile(vector232.X, vector232.Y, 0f, 0f, 0x284, this.damage, this.knockBack, this.owner, num1134, (float)base.whoAmI);
                                                                                    }
                                                                                    return;
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                                else if (this.aiStyle == 0x7c)
                                                                {
                                                                    Player player10 = Main.player[this.owner];
                                                                    if (player10.dead)
                                                                    {
                                                                        this.Kill();
                                                                        return;
                                                                    }
                                                                    if ((Main.myPlayer == this.owner) && player10.suspiciouslookingTentacle)
                                                                    {
                                                                        this.timeLeft = 2;
                                                                    }
                                                                    base.direction = this.spriteDirection = player10.direction;
                                                                    Vector3 vector233 = (Vector3)(new Vector3(0.5f, 0.9f, 1f) * 1.5f);
                                                                    DelegateMethods.v3_1 = vector233;
                                                                    Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * 6f)), 20f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
                                                                    Utils.PlotTileLine(base.Left, base.Right, 20f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
                                                                    Utils.PlotTileLine(player10.Center, player10.Center + ((Vector2)(player10.velocity * 6f)), 40f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
                                                                    Utils.PlotTileLine(player10.Left, player10.Right, 40f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
                                                                    Vector2 vector234 = new Vector2((float)(player10.direction * 30), -20f);
                                                                    Vector2 vector235 = player10.MountedCenter + vector234;
                                                                    float num1135 = Vector2.Distance(base.Center, vector235);
                                                                    if (num1135 > 1000f)
                                                                    {
                                                                        base.Center = player10.Center + vector234;
                                                                    }
                                                                    Vector2 vector236 = vector235 - base.Center;
                                                                    float num1136 = 4f;
                                                                    if (num1135 < num1136)
                                                                    {
                                                                        base.velocity = (Vector2)(base.velocity * 0.25f);
                                                                    }
                                                                    if (vector236 != Vector2.Zero)
                                                                    {
                                                                        if (vector236.Length() < num1136)
                                                                        {
                                                                            base.velocity = vector236;
                                                                        }
                                                                        else
                                                                        {
                                                                            base.velocity = (Vector2)(vector236 * 0.1f);
                                                                        }
                                                                    }
                                                                    if (this.velocity.Length() > 6f)
                                                                    {
                                                                        float num1137 = base.velocity.ToRotation() + 1.570796f;
                                                                        if (Math.Abs((float)(this.rotation - num1137)) >= 3.141593f)
                                                                        {
                                                                            if (num1137 < this.rotation)
                                                                            {
                                                                                this.rotation -= 6.283185f;
                                                                            }
                                                                            else
                                                                            {
                                                                                this.rotation += 6.283185f;
                                                                            }
                                                                        }
                                                                        float num1138 = 12f;
                                                                        this.rotation = ((this.rotation * (num1138 - 1f)) + num1137) / num1138;
                                                                        if (++this.frameCounter >= 4)
                                                                        {
                                                                            this.frameCounter = 0;
                                                                            if (++this.frame >= Main.projFrames[this.type])
                                                                            {
                                                                                this.frame = 0;
                                                                            }
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        if (this.rotation > 3.141593f)
                                                                        {
                                                                            this.rotation -= 6.283185f;
                                                                        }
                                                                        if ((this.rotation > -0.005f) && (this.rotation < 0.005f))
                                                                        {
                                                                            this.rotation = 0f;
                                                                        }
                                                                        else
                                                                        {
                                                                            this.rotation *= 0.96f;
                                                                        }
                                                                        if (++this.frameCounter >= 6)
                                                                        {
                                                                            this.frameCounter = 0;
                                                                            if (++this.frame >= Main.projFrames[this.type])
                                                                            {
                                                                                this.frame = 0;
                                                                            }
                                                                        }
                                                                    }
                                                                    if (this.ai[0] > 0f)
                                                                    {
                                                                        this.ai[0] = num1163 = this.ai[0] + 1f;
                                                                        if (num1163 >= 60f)
                                                                        {
                                                                            this.ai[0] = 0f;
                                                                            this.ai[1] = 0f;
                                                                        }
                                                                    }
                                                                    if (Main.rand.Next(15) == 0)
                                                                    {
                                                                        float num1139 = -1f;
                                                                        int num1140 = 0x11;
                                                                        Vector2 vector237 = base.Center - player10.Center;
                                                                        if (vector237.Length() < Main.screenWidth)
                                                                        {
                                                                            int num1141 = ((int)base.Center.X) / 0x10;
                                                                            int num1142 = ((int)base.Center.Y) / 0x10;
                                                                            num1141 = (int)MathHelper.Clamp((float)num1141, (float)(num1140 + 1), (float)((Main.maxTilesX - num1140) - 1));
                                                                            num1142 = (int)MathHelper.Clamp((float)num1142, (float)(num1140 + 1), (float)((Main.maxTilesY - num1140) - 1));
                                                                            for (int num1143 = num1141 - num1140; num1143 <= (num1141 + num1140); num1143++)
                                                                            {
                                                                                for (int num1144 = num1142 - num1140; num1144 <= (num1142 + num1140); num1144++)
                                                                                {
                                                                                    int num1145 = Main.rand.Next(8);
                                                                                    if (num1145 < 4)
                                                                                    {
                                                                                        Vector2 vector238 = new Vector2((float)(num1141 - num1143), (float)(num1142 - num1144));
                                                                                        if (((vector238.Length() < num1140) && (Main.tile[num1143, num1144] != null)) && Main.tile[num1143, num1144].active())
                                                                                        {
                                                                                            bool flag70 = false;
                                                                                            if ((Main.tile[num1143, num1144].type == 0xb9) && (Main.tile[num1143, num1144].frameY == 0x12))
                                                                                            {
                                                                                                if ((Main.tile[num1143, num1144].frameX >= 0x240) && (Main.tile[num1143, num1144].frameX <= 0x372))
                                                                                                {
                                                                                                    flag70 = true;
                                                                                                }
                                                                                            }
                                                                                            else if (((Main.tile[num1143, num1144].type == 0xba) && (Main.tile[num1143, num1144].frameX >= 0x360)) && (Main.tile[num1143, num1144].frameX <= 0x492))
                                                                                            {
                                                                                                flag70 = true;
                                                                                            }
                                                                                            if ((flag70 || Main.tileSpelunker[Main.tile[num1143, num1144].type]) || (Main.tileAlch[Main.tile[num1143, num1144].type] && (Main.tile[num1143, num1144].type != 0x52)))
                                                                                            {
                                                                                                float num1146 = base.Distance(new Vector2((float)((num1143 * 0x10) + 8), (float)((num1144 * 0x10) + 8)));
                                                                                                if ((num1146 < num1139) || (num1139 == -1f))
                                                                                                {
                                                                                                    num1139 = num1146;
                                                                                                    this.ai[0] = 1f;
                                                                                                    this.ai[1] = base.AngleTo(new Vector2((float)((num1143 * 0x10) + 8), (float)((num1144 * 0x10) + 8)));
                                                                                                }
                                                                                                if (num1145 < 2)
                                                                                                {
                                                                                                    color5 = new Color();
                                                                                                    int num1147 = Dust.NewDust(new Vector2((float)(num1143 * 0x10), (float)(num1144 * 0x10)), 0x10, 0x10, 0xcc, 0f, 0f, 150, color5, 0.3f);
                                                                                                    Main.dust[num1147].fadeIn = 0.75f;
                                                                                                    Dust dust265 = Main.dust[num1147];
                                                                                                    dust265.velocity = (Vector2)(dust265.velocity * 0.1f);
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                    float num1148 = (this.localAI[0] % 6.283185f) - 3.141593f;
                                                                    float num1149 = (float)Math.IEEERemainder((double)this.localAI[1], 1.0);
                                                                    if (num1149 < 0f)
                                                                    {
                                                                        num1149++;
                                                                    }
                                                                    float num1150 = (float)Math.Floor((double)this.localAI[1]);
                                                                    float max = 0.999f;
                                                                    float num1152 = 0f;
                                                                    int num1153 = 0;
                                                                    float num1154 = 0.1f;
                                                                    bool flag71 = player10.velocity.Length() > 3f;
                                                                    int num1155 = -1;
                                                                    int num1156 = -1;
                                                                    float num1157 = 300f;
                                                                    float num1158 = 500f;
                                                                    for (int num1159 = 0; num1159 < 200; num1159++)
                                                                    {
                                                                        NPC npc16 = Main.npc[num1159];
                                                                        if ((npc16.active && npc16.chaseable) && (!npc16.dontTakeDamage && !npc16.immortal))
                                                                        {
                                                                            float num1160 = base.Distance(npc16.Center);
                                                                            if (npc16.friendly || (npc16.lifeMax <= 5))
                                                                            {
                                                                                if ((num1160 < num1157) && !flag71)
                                                                                {
                                                                                    num1157 = num1160;
                                                                                    num1156 = num1159;
                                                                                }
                                                                            }
                                                                            else if (num1160 < num1158)
                                                                            {
                                                                                num1158 = num1160;
                                                                                num1155 = num1159;
                                                                            }
                                                                        }
                                                                    }
                                                                    if (flag71)
                                                                    {
                                                                        num1152 = base.AngleTo(base.Center + player10.velocity);
                                                                        num1153 = 1;
                                                                        num1149 = MathHelper.Clamp(num1149 + 0.05f, 0f, max);
                                                                        num1150 += Math.Sign((float)(-10f - num1150));
                                                                    }
                                                                    else if (num1155 != -1)
                                                                    {
                                                                        num1152 = base.AngleTo(Main.npc[num1155].Center);
                                                                        num1153 = 2;
                                                                        num1149 = MathHelper.Clamp(num1149 + 0.05f, 0f, max);
                                                                        num1150 += Math.Sign((float)(-12f - num1150));
                                                                    }
                                                                    else if (num1156 != -1)
                                                                    {
                                                                        num1152 = base.AngleTo(Main.npc[num1156].Center);
                                                                        num1153 = 3;
                                                                        num1149 = MathHelper.Clamp(num1149 + 0.05f, 0f, max);
                                                                        num1150 += Math.Sign((float)(6f - num1150));
                                                                    }
                                                                    else if (this.ai[0] > 0f)
                                                                    {
                                                                        num1152 = this.ai[1];
                                                                        num1149 = MathHelper.Clamp(num1149 + (Math.Sign((float)(0.75f - num1149)) * 0.05f), 0f, max);
                                                                        num1153 = 4;
                                                                        num1150 += Math.Sign((float)(10f - num1150));
                                                                        if (Main.rand.Next(10) == 0)
                                                                        {
                                                                            int num1161 = Dust.NewDust((Vector2)((base.Center + ((num1148.ToRotationVector2() * 6f) * num1149)) - (Vector2.One * 4f)), 8, 8, 0xcc, 0f, 0f, 150, new Color(), 0.3f);
                                                                            Main.dust[num1161].fadeIn = 0.75f;
                                                                            Dust dust266 = Main.dust[num1161];
                                                                            dust266.velocity = (Vector2)(dust266.velocity * 0.1f);
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        num1152 = (player10.direction == 1) ? 0f : 3.141603f;
                                                                        num1149 = MathHelper.Clamp(num1149 + (Math.Sign((float)(0.75f - num1149)) * 0.05f), 0f, max);
                                                                        num1150 += Math.Sign((float)(0f - num1150));
                                                                        num1154 = 0.12f;
                                                                    }
                                                                    Vector2 vector239 = num1152.ToRotationVector2();
                                                                    num1152 = Vector2.Lerp(num1148.ToRotationVector2(), vector239, num1154).ToRotation();
                                                                    this.localAI[0] = (num1152 + (num1153 * 6.283185f)) + 3.141593f;
                                                                    this.localAI[1] = num1150 + num1149;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            return;
                                        }
                                        int num963 = 0;
                                        float num964 = 0f;
                                        float num965 = 0f;
                                        float num966 = 0f;
                                        int num967 = -1;
                                        int num968 = 0;
                                        float num969 = 0f;
                                        bool flag44 = true;
                                        bool flag45 = false;
                                        bool flag46 = false;
                                        switch (this.type)
                                        {
                                            case 0x23d:
                                                num963 = 0x1a8;
                                                num964 = 90f;
                                                num969 = 20f;
                                                flag44 = false;
                                                flag45 = true;
                                                break;

                                            case 0x23e:
                                                num963 = 420;
                                                num964 = 180f;
                                                num965 = 0.15f;
                                                num966 = 0.075f;
                                                num969 = 8f;
                                                flag44 = false;
                                                num967 = 0x240;
                                                num968 = 0x41;
                                                if (Main.expertMode)
                                                {
                                                    num968 = 50;
                                                }
                                                flag46 = true;
                                                break;

                                            case 0x21b:
                                                num963 = 0x197;
                                                num964 = 210f;
                                                num965 = 0.15f;
                                                num966 = 0.075f;
                                                num969 = 16f;
                                                break;
                                        }
                                        if (flag46)
                                        {
                                            int num970 = (int)this.ai[1];
                                            if (!Main.npc[num970].active || (Main.npc[num970].type != num963))
                                            {
                                                this.Kill();
                                                return;
                                            }
                                            this.timeLeft = 2;
                                        }
                                        this.ai[0]++;
                                        if (this.ai[0] < num964)
                                        {
                                            bool flag47 = true;
                                            int num971 = (int)this.ai[1];
                                            if (Main.npc[num971].active && (Main.npc[num971].type == num963))
                                            {
                                                if (!flag45 && (Main.npc[num971].oldPos[1] != Vector2.Zero))
                                                {
                                                    base.position += Main.npc[num971].position - Main.npc[num971].oldPos[1];
                                                }
                                            }
                                            else
                                            {
                                                this.ai[0] = num964;
                                                flag47 = false;
                                            }
                                            if (flag47 && !flag45)
                                            {
                                                base.velocity += new Vector2((float)Math.Sign((float)(Main.npc[num971].Center.X - base.Center.X)), (float)Math.Sign((float)(Main.npc[num971].Center.Y - base.Center.Y))) * new Vector2(num965, num966);
                                                if (this.velocity.Length() > 6f)
                                                {
                                                    base.velocity = (Vector2)(base.velocity * (6f / this.velocity.Length()));
                                                }
                                            }
                                            if (this.type == 0x21b)
                                            {
                                                if (Main.rand.Next(12) == 0)
                                                {
                                                    color5 = new Color();
                                                    int num972 = Dust.NewDust(base.Center, 8, 8, 180, 0f, 0f, 0, color5, 1f);
                                                    Main.dust[num972].position = base.Center;
                                                    Dust dust240 = Main.dust[num972];
                                                    dust240.velocity = (Vector2)(dust240.velocity * 0.2f);
                                                    Main.dust[num972].noGravity = true;
                                                }
                                                if (++this.frameCounter >= 4)
                                                {
                                                    this.frameCounter = 0;
                                                    if (++this.frame >= Main.projFrames[this.type])
                                                    {
                                                        this.frame = 0;
                                                    }
                                                }
                                                this.rotation = this.velocity.X * 0.1f;
                                            }
                                            if (this.type == 0x23d)
                                            {
                                                if (Main.rand.Next(2) == 0)
                                                {
                                                    color5 = new Color();
                                                    int num973 = Dust.NewDust(base.Center, 8, 8, 0xf2, 0f, 0f, 0, color5, 1f);
                                                    Main.dust[num973].position = base.Center;
                                                    Main.dust[num973].velocity = base.velocity;
                                                    Main.dust[num973].noGravity = true;
                                                    Main.dust[num973].scale = 1.5f;
                                                }
                                                this.alpha = 0xff;
                                            }
                                            if (this.type == 0x23e)
                                            {
                                                if (Main.rand.Next(10) == 0)
                                                {
                                                    color5 = new Color();
                                                    int num974 = Dust.NewDust(base.Center, 8, 8, 0xf2, 0f, 0f, 0, color5, 1f);
                                                    Main.dust[num974].position = base.Center;
                                                    Main.dust[num974].velocity = base.velocity;
                                                    Main.dust[num974].noGravity = true;
                                                    Main.dust[num974].scale = 1.5f;
                                                }
                                                if (flag47)
                                                {
                                                    int target = Main.npc[num971].target;
                                                    float num976 = base.velocity.ToRotation();
                                                    if (Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0))
                                                    {
                                                        num976 = base.DirectionTo(Main.player[target].Center).ToRotation();
                                                    }
                                                    this.rotation = this.rotation.AngleLerp(num976 + 1.570796f, 0.2f);
                                                }
                                                this.frame = 1;
                                            }
                                        }
                                        if (this.ai[0] == num964)
                                        {
                                            bool flag48 = true;
                                            int num977 = -1;
                                            if (!flag44)
                                            {
                                                int num978 = (int)this.ai[1];
                                                if (Main.npc[num978].active && (Main.npc[num978].type == num963))
                                                {
                                                    num977 = Main.npc[num978].target;
                                                }
                                                else
                                                {
                                                    flag48 = false;
                                                }
                                            }
                                            else
                                            {
                                                flag48 = false;
                                            }
                                            if (!flag48)
                                            {
                                                num977 = Player.FindClosest(base.position, base.width, base.height);
                                            }
                                            Vector2 vector176 = Main.player[num977].Center - base.Center;
                                            vector176.X += Main.rand.Next(-50, 0x33);
                                            vector176.Y += Main.rand.Next(-50, 0x33);
                                            vector176.X *= Main.rand.Next(80, 0x79) * 0.01f;
                                            vector176.Y *= Main.rand.Next(80, 0x79) * 0.01f;
                                            Vector2 vector177 = Vector2.Normalize(vector176);
                                            if (vector177.HasNaNs())
                                            {
                                                vector177 = Vector2.UnitY;
                                            }
                                            if (num967 == -1)
                                            {
                                                base.velocity = (Vector2)(vector177 * num969);
                                                this.netUpdate = true;
                                            }
                                            else
                                            {
                                                if ((Main.netMode != 1) && Collision.CanHitLine(base.Center, 0, 0, Main.player[num977].Center, 0, 0))
                                                {
                                                    NewProjectile(base.Center.X, base.Center.Y, vector177.X * num969, vector177.Y * num969, num967, num968, 1f, Main.myPlayer, 0f, 0f);
                                                }
                                                this.ai[0] = 0f;
                                            }
                                        }
                                        if (this.ai[0] >= num964)
                                        {
                                            this.rotation = this.rotation.AngleLerp(base.velocity.ToRotation() + 1.570796f, 0.4f);
                                            if (this.type == 0x21b)
                                            {
                                                if (++this.frameCounter >= 2)
                                                {
                                                    this.frameCounter = 0;
                                                    if (++this.frame >= Main.projFrames[this.type])
                                                    {
                                                        this.frame = 0;
                                                    }
                                                }
                                                if (Main.rand.Next(2) == 0)
                                                {
                                                    color5 = new Color();
                                                    int num979 = Dust.NewDust(base.position, base.width, base.height, 180, 0f, 0f, 100, color5, 1f);
                                                    Dust dust241 = Main.dust[num979];
                                                    dust241.scale += Main.rand.Next(50) * 0.01f;
                                                    Main.dust[num979].noGravity = true;
                                                    Dust dust242 = Main.dust[num979];
                                                    dust242.velocity = (Vector2)(dust242.velocity * 0.1f);
                                                    Main.dust[num979].fadeIn = Main.rand.NextFloat() * 1.5f;
                                                }
                                                if (Main.rand.Next(3) == 0)
                                                {
                                                    color5 = new Color();
                                                    int num980 = Dust.NewDust(base.position, base.width, base.height, 0xb0, 0f, 0f, 100, color5, 1f);
                                                    Dust dust243 = Main.dust[num980];
                                                    dust243.scale += 0.3f + (Main.rand.Next(50) * 0.01f);
                                                    Main.dust[num980].noGravity = true;
                                                    Dust dust244 = Main.dust[num980];
                                                    dust244.velocity = (Vector2)(dust244.velocity * 0.1f);
                                                    Main.dust[num980].fadeIn = Main.rand.NextFloat() * 1.5f;
                                                }
                                            }
                                            if (this.type == 0x23d)
                                            {
                                                if (Main.rand.Next(4) == 0)
                                                {
                                                    int num981 = Dust.NewDust(base.Center, 8, 8, 0xf2, 0f, 0f, 0, new Color(), 1f);
                                                    Main.dust[num981].position = base.Center;
                                                    Dust dust245 = Main.dust[num981];
                                                    dust245.velocity = (Vector2)(dust245.velocity * 0.2f);
                                                    Main.dust[num981].noGravity = true;
                                                    Main.dust[num981].scale = 1.5f;
                                                }
                                                this.alpha = 0;
                                            }
                                        }
                                        return;
                                    }
                                    float num959 = 20f;
                                    this.localAI[0]++;
                                    this.alpha = (int)MathHelper.Lerp(0f, 255f, this.localAI[0] / num959);
                                    int num960 = (int)this.ai[0];
                                    int num961 = -1;
                                    int num962 = -1;
                                    switch (this.type)
                                    {
                                        case 0x218:
                                            num961 = 0x217;
                                            num962 = 0;
                                            break;

                                        case 0x24f:
                                            num962 = 1;
                                            break;
                                    }
                                    if (num962 == 1)
                                    {
                                        if (((this.localAI[0] >= num959) || (num960 < 0)) || (((num960 > 0xff) || !Main.player[num960].active) || Main.player[num960].dead))
                                        {
                                            this.Kill();
                                            return;
                                        }
                                        if (this.type == 0x24f)
                                        {
                                            base.Center = Mount.GetMinecartMechPoint(Main.player[num960], 20, -19) - base.velocity;
                                            this.rotation = base.velocity.ToRotation() + 1.570796f;
                                            int introduced1839 = Math.Sign(this.velocity.X);
                                            if ((introduced1839 != Math.Sign(Main.player[num960].velocity.X)) && (Main.player[num960].velocity.X != 0f))
                                            {
                                                this.Kill();
                                                return;
                                            }
                                        }
                                        else
                                        {
                                            base.Center = Main.player[num960].Center - base.velocity;
                                        }
                                    }
                                    else if (num962 == 0)
                                    {
                                        if (((this.localAI[0] >= num959) || (num960 < 0)) || (((num960 > 0x3e8) || !Main.projectile[num960].active) || (Main.projectile[num960].type != num961)))
                                        {
                                            this.Kill();
                                            return;
                                        }
                                        base.Center = Main.projectile[num960].Center - base.velocity;
                                    }
                                    this.rotation = base.velocity.ToRotation() + 1.570796f;
                                    return;
                                }
                                if (++this.frameCounter >= 4)
                                {
                                    this.frameCounter = 0;
                                    if (++this.frame >= Main.projFrames[this.type])
                                    {
                                        this.frame = 0;
                                    }
                                }
                                this.ai[0]++;
                                if (this.ai[0] <= 40f)
                                {
                                    this.alpha -= 5;
                                    if (this.alpha < 0)
                                    {
                                        this.alpha = 0;
                                    }
                                    base.velocity = (Vector2)(base.velocity * 0.85f);
                                    if (this.ai[0] == 40f)
                                    {
                                        this.netUpdate = true;
                                        switch (Main.rand.Next(3))
                                        {
                                            case 0:
                                                this.ai[1] = 10f;
                                                break;

                                            case 1:
                                                this.ai[1] = 15f;
                                                break;

                                            case 2:
                                                this.ai[1] = 30f;
                                                break;
                                        }
                                    }
                                }
                                else if (this.ai[0] <= 60f)
                                {
                                    base.velocity = Vector2.Zero;
                                    if (this.ai[0] == 60f)
                                    {
                                        this.netUpdate = true;
                                    }
                                }
                                else if (this.ai[0] <= 210f)
                                {
                                    if (Main.netMode != 1)
                                    {
                                        this.localAI[0] = num1163 = this.localAI[0] + 1f;
                                        if (num1163 >= this.ai[1])
                                        {
                                            this.localAI[0] = 0f;
                                            int num934 = Item.NewItem((int)base.Center.X, (int)base.Center.Y, 0, 0, 0x49, 1, false, 0, false);
                                            Main.item[num934].velocity = (Vector2)(((Vector2.UnitY.RotatedByRandom(6.2831854820251465) * new Vector2(3f, 2f)) * ((Main.rand.NextFloat() * 0.5f) + 0.5f)) - (Vector2.UnitY * 1f));
                                        }
                                    }
                                    if (this.ai[0] == 210f)
                                    {
                                        this.netUpdate = true;
                                    }
                                }
                                else
                                {
                                    this.scale -= 0.03333334f;
                                    this.alpha += 15;
                                    if (this.ai[0] == 239f)
                                    {
                                        this.netUpdate = true;
                                    }
                                    if (this.ai[0] == 240f)
                                    {
                                        this.Kill();
                                    }
                                }
                                if ((this.alpha < 90) && (Main.rand.Next(3) == 0))
                                {
                                    Vector2 vector160 = (Vector2)((new Vector2((float)base.width, (float)base.height) * this.scale) * 0.85f);
                                    vector160 = (Vector2)(vector160 / 2f);
                                    Vector2 vector161 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * vector160;
                                    int num935 = Dust.NewDust(base.Center + vector161, 0, 0, 0xf6, 0f, 0f, 0, new Color(), 1f);
                                    Main.dust[num935].position = base.Center + vector161;
                                    Main.dust[num935].velocity = Vector2.Zero;
                                }
                                float num936 = 0.8f;
                                float num937 = 0.7098039f;
                                float num938 = 0.282353f;
                                Lighting.AddLight(base.Center, num936 * 0.3f, num937 * 0.3f, num938 * 0.3f);
                                return;
                            }
                            if (this.type != 0x1d1)
                            {
                                int num900;
                                if (this.type != 0x1d2)
                                {
                                    int num910;
                                    if (this.type != 580)
                                    {
                                        return;
                                    }
                                    if ((this.localAI[1] == 0f) && (this.ai[0] >= 900f))
                                    {
                                        this.ai[0] -= 1000f;
                                        this.localAI[1] = -1f;
                                    }
                                    this.frameCounter++;
                                    Lighting.AddLight(base.Center, 0.3f, 0.45f, 0.5f);
                                    if (base.velocity == Vector2.Zero)
                                    {
                                        if (this.frameCounter >= (this.extraUpdates * 2))
                                        {
                                            this.frameCounter = 0;
                                            bool flag36 = true;
                                            for (int num902 = 1; num902 < this.oldPos.Length; num902++)
                                            {
                                                if (this.oldPos[num902] != this.oldPos[0])
                                                {
                                                    flag36 = false;
                                                }
                                            }
                                            if (flag36)
                                            {
                                                this.Kill();
                                                return;
                                            }
                                        }
                                        if ((Main.rand.Next(this.extraUpdates) == 0) && ((base.velocity != Vector2.Zero) || (Main.rand.Next((this.localAI[1] == 2f) ? 2 : 6) == 0)))
                                        {
                                            for (int num903 = 0; num903 < 2; num903++)
                                            {
                                                float num904 = this.rotation + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f);
                                                float num905 = (((float)Main.rand.NextDouble()) * 0.8f) + 1f;
                                                Vector2 vector148 = new Vector2(((float)Math.Cos((double)num904)) * num905, ((float)Math.Sin((double)num904)) * num905);
                                                color5 = new Color();
                                                int num906 = Dust.NewDust(base.Center, 0, 0, 0xe2, vector148.X, vector148.Y, 0, color5, 1f);
                                                Main.dust[num906].noGravity = true;
                                                Main.dust[num906].scale = 1.2f;
                                            }
                                            if (Main.rand.Next(5) == 0)
                                            {
                                                Vector2 vector149 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, new Vector2()) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width);
                                                int num907 = Dust.NewDust((base.Center + vector149) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, new Color(), 1.5f);
                                                Dust dust228 = Main.dust[num907];
                                                dust228.velocity = (Vector2)(dust228.velocity * 0.5f);
                                                Main.dust[num907].velocity.Y = -Math.Abs(Main.dust[num907].velocity.Y);
                                                return;
                                            }
                                        }
                                        return;
                                    }
                                    if (this.frameCounter < (this.extraUpdates * 2))
                                    {
                                        return;
                                    }
                                    this.frameCounter = 0;
                                    float num908 = this.velocity.Length();
                                    Random random2 = new Random((int)this.ai[1]);
                                    int num909 = 0;
                                    Vector2 vector150 = -Vector2.UnitY;
                                Label_23A47:
                                    num910 = random2.Next();
                                    this.ai[1] = num910;
                                    num910 = num910 % 100;
                                    Vector2 vector151 = ((((float)num910) / 100f) * 6.283185f).ToRotationVector2();
                                    if (vector151.Y > 0f)
                                    {
                                        vector151.Y *= -1f;
                                    }
                                    bool flag37 = false;
                                    if (vector151.Y > -0.02f)
                                    {
                                        flag37 = true;
                                    }
                                    if (((((vector151.X * (this.extraUpdates + 1)) * 2f) * num908) + this.localAI[0]) > 40f)
                                    {
                                        flag37 = true;
                                    }
                                    if (((((vector151.X * (this.extraUpdates + 1)) * 2f) * num908) + this.localAI[0]) < -40f)
                                    {
                                        flag37 = true;
                                    }
                                    if (flag37)
                                    {
                                        if (num909++ < 100)
                                        {
                                            goto Label_23A47;
                                        }
                                        base.velocity = Vector2.Zero;
                                        if (this.localAI[1] < 1f)
                                        {
                                            this.localAI[1] += 2f;
                                        }
                                    }
                                    else
                                    {
                                        vector150 = vector151;
                                    }
                                    if (base.velocity != Vector2.Zero)
                                    {
                                        this.localAI[0] += ((vector150.X * (this.extraUpdates + 1)) * 2f) * num908;
                                        vector240 = new Vector2();
                                        base.velocity = (Vector2)(vector150.RotatedBy(((double)(this.ai[0] + 1.570796f)), vector240) * num908);
                                        this.rotation = base.velocity.ToRotation() + 1.570796f;
                                        if (((Main.rand.Next(4) != 0) || (Main.netMode == 1)) || (this.localAI[1] != 0f))
                                        {
                                            return;
                                        }
                                        float num912 = (Main.rand.Next(-3, 4) * 1.047198f) / 3f;
                                        Vector2 vector152 = (Vector2)(this.ai[0].ToRotationVector2().RotatedBy(((double)num912), new Vector2()) * this.velocity.Length());
                                        if (Collision.CanHitLine(base.Center, 0, 0, base.Center + ((Vector2)(vector152 * 50f)), 0, 0))
                                        {
                                            return;
                                        }
                                        NewProjectile(base.Center.X - vector152.X, base.Center.Y - vector152.Y, vector152.X, vector152.Y, this.type, this.damage, this.knockBack, this.owner, vector152.ToRotation() + 1000f, this.ai[1]);
                                    }
                                    return;
                                }
                                this.frameCounter++;
                                Lighting.AddLight(base.Center, 0.3f, 0.45f, 0.5f);
                                if (base.velocity == Vector2.Zero)
                                {
                                    if (this.frameCounter >= (this.extraUpdates * 2))
                                    {
                                        this.frameCounter = 0;
                                        bool flag34 = true;
                                        for (int num892 = 1; num892 < this.oldPos.Length; num892++)
                                        {
                                            if (this.oldPos[num892] != this.oldPos[0])
                                            {
                                                flag34 = false;
                                            }
                                        }
                                        if (flag34)
                                        {
                                            this.Kill();
                                            return;
                                        }
                                    }
                                    if (Main.rand.Next(this.extraUpdates) == 0)
                                    {
                                        for (int num893 = 0; num893 < 2; num893++)
                                        {
                                            float num894 = this.rotation + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f);
                                            float num895 = (((float)Main.rand.NextDouble()) * 0.8f) + 1f;
                                            Vector2 vector144 = new Vector2(((float)Math.Cos((double)num894)) * num895, ((float)Math.Sin((double)num894)) * num895);
                                            color5 = new Color();
                                            int num896 = Dust.NewDust(base.Center, 0, 0, 0xe2, vector144.X, vector144.Y, 0, color5, 1f);
                                            Main.dust[num896].noGravity = true;
                                            Main.dust[num896].scale = 1.2f;
                                        }
                                        if (Main.rand.Next(5) == 0)
                                        {
                                            Vector2 vector145 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, new Vector2()) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width);
                                            int num897 = Dust.NewDust((base.Center + vector145) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, new Color(), 1.5f);
                                            Dust dust227 = Main.dust[num897];
                                            dust227.velocity = (Vector2)(dust227.velocity * 0.5f);
                                            Main.dust[num897].velocity.Y = -Math.Abs(Main.dust[num897].velocity.Y);
                                            return;
                                        }
                                    }
                                    return;
                                }
                                if (this.frameCounter < (this.extraUpdates * 2))
                                {
                                    return;
                                }
                                this.frameCounter = 0;
                                float num898 = this.velocity.Length();
                                Random random = new Random((int)this.ai[1]);
                                int num899 = 0;
                                Vector2 vector146 = -Vector2.UnitY;
                            Label_23502:
                                num900 = random.Next();
                                this.ai[1] = num900;
                                num900 = num900 % 100;
                                Vector2 vector147 = ((((float)num900) / 100f) * 6.283185f).ToRotationVector2();
                                if (vector147.Y > 0f)
                                {
                                    vector147.Y *= -1f;
                                }
                                bool flag35 = false;
                                if (vector147.Y > -0.02f)
                                {
                                    flag35 = true;
                                }
                                if (((((vector147.X * (this.extraUpdates + 1)) * 2f) * num898) + this.localAI[0]) > 40f)
                                {
                                    flag35 = true;
                                }
                                if (((((vector147.X * (this.extraUpdates + 1)) * 2f) * num898) + this.localAI[0]) < -40f)
                                {
                                    flag35 = true;
                                }
                                if (flag35)
                                {
                                    if (num899++ < 100)
                                    {
                                        goto Label_23502;
                                    }
                                    base.velocity = Vector2.Zero;
                                    this.localAI[1] = 1f;
                                }
                                else
                                {
                                    vector146 = vector147;
                                }
                                if (base.velocity != Vector2.Zero)
                                {
                                    this.localAI[0] += ((vector146.X * (this.extraUpdates + 1)) * 2f) * num898;
                                    base.velocity = (Vector2)(vector146.RotatedBy(((double)(this.ai[0] + 1.570796f)), new Vector2()) * num898);
                                    this.rotation = base.velocity.ToRotation() + 1.570796f;
                                }
                                return;
                            }
                            if (this.localAI[1] == 0f)
                            {
                                Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x79);
                                this.localAI[1] = 1f;
                            }
                            if (this.ai[0] < 180f)
                            {
                                this.alpha -= 5;
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                            }
                            else
                            {
                                this.alpha += 5;
                                if (this.alpha > 0xff)
                                {
                                    this.alpha = 0xff;
                                    this.Kill();
                                    return;
                                }
                            }
                            this.ai[0]++;
                            if ((((this.ai[0] % 30f) == 0f) && (this.ai[0] < 180f)) && (Main.netMode != 1))
                            {
                                int[] numArray4 = new int[5];
                                Vector2[] vectorArray = new Vector2[5];
                                int num880 = 0;
                                float num881 = 2000f;
                                for (int num882 = 0; num882 < 0xff; num882++)
                                {
                                    if (Main.player[num882].active && !Main.player[num882].dead)
                                    {
                                        Vector2 vector139 = Main.player[num882].Center;
                                        if ((Vector2.Distance(vector139, base.Center) < num881) && Collision.CanHit(base.Center, 1, 1, vector139, 1, 1))
                                        {
                                            numArray4[num880] = num882;
                                            vectorArray[num880] = vector139;
                                            if (++num880 >= vectorArray.Length)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                }
                                for (int num884 = 0; num884 < num880; num884++)
                                {
                                    Vector2 vector140 = vectorArray[num884] - base.Center;
                                    float num885 = Main.rand.Next(100);
                                    Vector2 vector141 = (Vector2)(Vector2.Normalize(vector140.RotatedByRandom(0.78539818525314331)) * 7f);
                                    NewProjectile(base.Center.X, base.Center.Y, vector141.X, vector141.Y, 0x1d2, this.damage, 0f, Main.myPlayer, vector140.ToRotation(), num885);
                                }
                            }
                            Lighting.AddLight(base.Center, 0.4f, 0.85f, 0.9f);
                            if (++this.frameCounter >= 4)
                            {
                                this.frameCounter = 0;
                                if (++this.frame >= Main.projFrames[this.type])
                                {
                                    this.frame = 0;
                                }
                            }
                            if ((this.alpha < 150) && (this.ai[0] < 180f))
                            {
                                for (int num886 = 0; num886 < 1; num886++)
                                {
                                    float num887 = (((float)Main.rand.NextDouble()) * 1f) - 0.5f;
                                    if (num887 < -0.5f)
                                    {
                                        num887 = -0.5f;
                                    }
                                    if (num887 > 0.5f)
                                    {
                                        num887 = 0.5f;
                                    }
                                    vector240 = new Vector2();
                                    vector240 = new Vector2();
                                    Vector2 vector142 = new Vector2((-base.width * 0.2f) * this.scale, 0f).RotatedBy(((double)(num887 * 6.283185f)), vector240).RotatedBy((double)base.velocity.ToRotation(), vector240);
                                    int num888 = Dust.NewDust(base.Center - ((Vector2)(Vector2.One * 5f)), 10, 10, 0xe2, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 0.7f);
                                    Main.dust[num888].position = base.Center + vector142;
                                    Main.dust[num888].velocity = (Vector2)(Vector2.Normalize(Main.dust[num888].position - base.Center) * 2f);
                                    Main.dust[num888].noGravity = true;
                                }
                                for (int num889 = 0; num889 < 1; num889++)
                                {
                                    float num890 = (((float)Main.rand.NextDouble()) * 1f) - 0.5f;
                                    if (num890 < -0.5f)
                                    {
                                        num890 = -0.5f;
                                    }
                                    if (num890 > 0.5f)
                                    {
                                        num890 = 0.5f;
                                    }
                                    vector240 = new Vector2();
                                    vector240 = new Vector2();
                                    Vector2 vector143 = new Vector2((-base.width * 0.6f) * this.scale, 0f).RotatedBy(((double)(num890 * 6.283185f)), vector240).RotatedBy((double)base.velocity.ToRotation(), vector240);
                                    int num891 = Dust.NewDust(base.Center - ((Vector2)(Vector2.One * 5f)), 10, 10, 0xe2, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 0.7f);
                                    Main.dust[num891].velocity = Vector2.Zero;
                                    Main.dust[num891].position = base.Center + vector143;
                                    Main.dust[num891].noGravity = true;
                                }
                            }
                            return;
                        }
                        if (this.type == 0x73)
                        {
                            this.ai[0]++;
                            if (this.ai[0] < 30f)
                            {
                                base.velocity = (Vector2)(base.velocity * 1.125f);
                            }
                        }
                        if ((this.type == 0x73) && (this.localAI[1] < 5f))
                        {
                            this.localAI[1] = 5f;
                            for (int num312 = 5; num312 < 0x19; num312++)
                            {
                                float num313 = this.velocity.X * (30f / ((float)num312));
                                float num314 = this.velocity.Y * (30f / ((float)num312));
                                num313 *= 80f;
                                num314 *= 80f;
                                color5 = new Color();
                                int num315 = Dust.NewDust(new Vector2(this.position.X - num313, this.position.Y - num314), 8, 8, 0x1b, this.oldVelocity.X, this.oldVelocity.Y, 100, color5, 0.9f);
                                Dust dust125 = Main.dust[num315];
                                dust125.velocity = (Vector2)(dust125.velocity * 0.25f);
                                Dust dust126 = Main.dust[num315];
                                dust126.velocity -= (Vector2)(base.velocity * 5f);
                            }
                        }
                        if ((this.localAI[1] <= 7f) || (this.type != 0xad))
                        {
                            goto Label_E566;
                        }
                        num316 = Main.rand.Next(3);
                        switch (num316)
                        {
                            case 0:
                                num316 = 15;
                                goto Label_E4CE;

                            case 1:
                                num316 = 0x39;
                                goto Label_E4CE;
                        }
                        num316 = 0x3a;
                        goto Label_E4CE;
                    }
                    if (this.type != 0x1eb)
                    {
                        if (this.type == 0x22)
                        {
                            color5 = new Color();
                            int num116 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 3.5f);
                            Main.dust[num116].noGravity = true;
                            Dust dust65 = Main.dust[num116];
                            dust65.velocity = (Vector2)(dust65.velocity * 1.4f);
                            num116 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, new Color(), 1.5f);
                        }
                        else if (this.type == 0x4f)
                        {
                            if (this.soundDelay == 0)
                            {
                                float introduced1621 = Math.Abs(this.velocity.X);
                                if ((introduced1621 + Math.Abs(this.velocity.Y)) > 2f)
                                {
                                    this.soundDelay = 10;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 9);
                                }
                            }
                            for (int num117 = 0; num117 < 1; num117++)
                            {
                                int num118 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x42, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f);
                                Dust dust66 = Main.dust[num118];
                                dust66.velocity = (Vector2)(dust66.velocity * 0.1f);
                                Dust dust67 = Main.dust[num118];
                                dust67.velocity += (Vector2)(base.velocity * 0.2f);
                                Main.dust[num118].position.X = ((this.position.X + (base.width / 2)) + 4f) + Main.rand.Next(-2, 3);
                                Main.dust[num118].position.Y = (this.position.Y + (base.height / 2)) + Main.rand.Next(-2, 3);
                                Main.dust[num118].noGravity = true;
                            }
                        }
                        else
                        {
                            if (this.soundDelay == 0)
                            {
                                float introduced1624 = Math.Abs(this.velocity.X);
                                if ((introduced1624 + Math.Abs(this.velocity.Y)) > 2f)
                                {
                                    this.soundDelay = 10;
                                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 9);
                                }
                            }
                            int num119 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 15, 0f, 0f, 100, new Color(), 2f);
                            Dust dust68 = Main.dust[num119];
                            dust68.velocity = (Vector2)(dust68.velocity * 0.3f);
                            Main.dust[num119].position.X = ((this.position.X + (base.width / 2)) + 4f) + Main.rand.Next(-4, 5);
                            Main.dust[num119].position.Y = (this.position.Y + (base.height / 2)) + Main.rand.Next(-4, 5);
                            Main.dust[num119].noGravity = true;
                        }
                        goto Label_5199;
                    }
                    if (Main.rand.Next(2) != 0)
                    {
                        goto Label_5199;
                    }
                    num114 = Main.rand.Next(3);
                    switch (num114)
                    {
                        case 0:
                            num114 = 15;
                            goto Label_4D0C;

                        case 1:
                            num114 = 0x39;
                            goto Label_4D0C;
                    }
                    num114 = 0x3a;
                    goto Label_4D0C;
                }
                if ((Main.player[this.owner].dead || Main.player[this.owner].stoned) || (Main.player[this.owner].webbed || Main.player[this.owner].frozen))
                {
                    this.Kill();
                    return;
                }
                mountedCenter = Main.player[this.owner].MountedCenter;
                Vector2 vector10 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                num76 = mountedCenter.X - vector10.X;
                num77 = mountedCenter.Y - vector10.Y;
                num78 = (float)Math.Sqrt((double)((num76 * num76) + (num77 * num77)));
                this.rotation = ((float)Math.Atan2((double)num77, (double)num76)) - 1.57f;
                if (this.type == 0x100)
                {
                    this.rotation = ((float)Math.Atan2((double)num77, (double)num76)) + 3.925f;
                }
                if (this.type == 0x1be)
                {
                    Lighting.AddLight(mountedCenter, 0f, 0.4f, 0.3f);
                    this.localAI[0]++;
                    if (this.localAI[0] >= 28f)
                    {
                        this.localAI[0] = 0f;
                    }
                    DelegateMethods.v3_1 = new Vector3(0f, 0.4f, 0.3f);
                    Utils.PlotTileLine(base.Center, mountedCenter, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
                }
                if ((this.type < 0x286) || (this.type > 0x289))
                {
                    goto Label_3C0D;
                }
                zero = Vector3.Zero;
                switch (this.type)
                {
                    case 0x286:
                        zero = new Vector3(0.7f, 0.5f, 0.1f);
                        break;

                    case 0x287:
                        zero = new Vector3(0f, 0.6f, 0.7f);
                        break;

                    case 0x288:
                        zero = new Vector3(0.6f, 0.2f, 0.6f);
                        break;

                    case 0x289:
                        zero = new Vector3(0.6f, 0.6f, 0.9f);
                        break;
                }
            }
            else
            {
                if ((this.soundDelay == 0) && (this.type != 0x17f))
                {
                    this.soundDelay = 8;
                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 7);
                }
                if (this.type == 0x13)
                {
                    for (int num29 = 0; num29 < 2; num29++)
                    {
                        color5 = new Color();
                        int num30 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 2f);
                        Main.dust[num30].noGravity = true;
                        Main.dust[num30].velocity.X *= 0.3f;
                        Main.dust[num30].velocity.Y *= 0.3f;
                    }
                }
                else if (this.type == 0x21)
                {
                    if (Main.rand.Next(1) == 0)
                    {
                        color5 = new Color();
                        int num31 = Dust.NewDust(base.position, base.width, base.height, 40, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 0, color5, 1.4f);
                        Main.dust[num31].noGravity = true;
                    }
                }
                else if (this.type == 320)
                {
                    if (Main.rand.Next(3) == 0)
                    {
                        color5 = new Color();
                        int num32 = Dust.NewDust(base.position, base.width, base.height, 5, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 0, color5, 1.1f);
                        if (Main.rand.Next(2) == 0)
                        {
                            Main.dust[num32].scale = 0.9f;
                            Dust dust56 = Main.dust[num32];
                            dust56.velocity = (Vector2)(dust56.velocity * 0.2f);
                        }
                        else
                        {
                            Main.dust[num32].noGravity = true;
                        }
                    }
                }
                else if (this.type != 6)
                {
                    if ((this.type == 0x71) && (Main.rand.Next(1) == 0))
                    {
                        color5 = new Color();
                        int num34 = Dust.NewDust(base.position, base.width, base.height, 0x4c, this.velocity.X * 0.15f, this.velocity.Y * 0.15f, 0, color5, 1.1f);
                        Main.dust[num34].noGravity = true;
                        color5 = new Color();
                        Dust.NewDust(base.position, base.width, base.height, 15, this.velocity.X * 0.05f, this.velocity.Y * 0.05f, 150, color5, 0.6f);
                    }
                }
                else if (Main.rand.Next(5) == 0)
                {
                    int num33 = Main.rand.Next(3);
                    switch (num33)
                    {
                        case 0:
                            num33 = 15;
                            break;

                        case 1:
                            num33 = 0x39;
                            break;

                        default:
                            num33 = 0x3a;
                            break;
                    }
                    color5 = new Color();
                    Dust.NewDust(base.position, base.width, base.height, num33, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 150, color5, 0.7f);
                }
                if (this.ai[0] == 0f)
                {
                    this.ai[1]++;
                    if ((this.type == 0x6a) && (this.ai[1] >= 45f))
                    {
                        this.ai[0] = 1f;
                        this.ai[1] = 0f;
                        this.netUpdate = true;
                    }
                    if ((this.type == 320) || (this.type == 0x17f))
                    {
                        if (this.ai[1] >= 10f)
                        {
                            this.velocity.Y += 0.5f;
                            if ((this.type == 0x17f) && (this.velocity.Y < 0f))
                            {
                                this.velocity.Y += 0.35f;
                            }
                            this.velocity.X *= 0.95f;
                            if (this.velocity.Y > 16f)
                            {
                                this.velocity.Y = 16f;
                            }
                            if ((this.type == 0x17f) && (Vector2.Distance(base.Center, Main.player[this.owner].Center) > 800f))
                            {
                                this.ai[0] = 1f;
                            }
                        }
                    }
                    else if (this.type == 0xb6)
                    {
                        if (Main.rand.Next(2) == 0)
                        {
                            int num35 = Dust.NewDust(base.position, base.width, base.height, 0x39, 0f, 0f, 0xff, new Color(), 0.75f);
                            Dust dust57 = Main.dust[num35];
                            dust57.velocity = (Vector2)(dust57.velocity * 0.1f);
                            Main.dust[num35].noGravity = true;
                        }
                        if (this.velocity.X > 0f)
                        {
                            this.spriteDirection = 1;
                        }
                        else if (this.velocity.X < 0f)
                        {
                            this.spriteDirection = -1;
                        }
                        float num36 = this.position.X;
                        float num37 = this.position.Y;
                        bool flag = false;
                        if (this.ai[1] > 10f)
                        {
                            for (int num38 = 0; num38 < 200; num38++)
                            {
                                if (Main.npc[num38].CanBeChasedBy(this, false))
                                {
                                    float num39 = Main.npc[num38].position.X + (Main.npc[num38].width / 2);
                                    float num40 = Main.npc[num38].position.Y + (Main.npc[num38].height / 2);
                                    float introduced1606 = Math.Abs((float)((this.position.X + (base.width / 2)) - num39));
                                    float num41 = introduced1606 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num40));
                                    if ((num41 < 800f) && Collision.CanHit(new Vector2(this.position.X + (base.width / 2), this.position.Y + (base.height / 2)), 1, 1, Main.npc[num38].position, Main.npc[num38].width, Main.npc[num38].height))
                                    {
                                        num36 = num39;
                                        num37 = num40;
                                        flag = true;
                                    }
                                }
                            }
                        }
                        if (!flag)
                        {
                            num36 = (this.position.X + (base.width / 2)) + (this.velocity.X * 100f);
                            num37 = (this.position.Y + (base.height / 2)) + (this.velocity.Y * 100f);
                            if (this.ai[1] >= 30f)
                            {
                                this.ai[0] = 1f;
                                this.ai[1] = 0f;
                                this.netUpdate = true;
                            }
                        }
                        float num42 = 12f;
                        float num43 = 0.25f;
                        Vector2 vector = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                        float num44 = num36 - vector.X;
                        float num45 = num37 - vector.Y;
                        float num46 = (float)Math.Sqrt((double)((num44 * num44) + (num45 * num45)));
                        num46 = num42 / num46;
                        num44 *= num46;
                        num45 *= num46;
                        if (this.velocity.X < num44)
                        {
                            this.velocity.X += num43;
                            if ((this.velocity.X < 0f) && (num44 > 0f))
                            {
                                this.velocity.X += num43 * 2f;
                            }
                        }
                        else if (this.velocity.X > num44)
                        {
                            this.velocity.X -= num43;
                            if ((this.velocity.X > 0f) && (num44 < 0f))
                            {
                                this.velocity.X -= num43 * 2f;
                            }
                        }
                        if (this.velocity.Y < num45)
                        {
                            this.velocity.Y += num43;
                            if ((this.velocity.Y < 0f) && (num45 > 0f))
                            {
                                this.velocity.Y += num43 * 2f;
                            }
                        }
                        else if (this.velocity.Y > num45)
                        {
                            this.velocity.Y -= num43;
                            if ((this.velocity.Y > 0f) && (num45 < 0f))
                            {
                                this.velocity.Y -= num43 * 2f;
                            }
                        }
                    }
                    else if (this.type == 0x12d)
                    {
                        if (this.ai[1] >= 20f)
                        {
                            this.ai[0] = 1f;
                            this.ai[1] = 0f;
                            this.netUpdate = true;
                        }
                    }
                    else if (this.ai[1] >= 30f)
                    {
                        this.ai[0] = 1f;
                        this.ai[1] = 0f;
                        this.netUpdate = true;
                    }
                }
                else
                {
                    this.tileCollide = false;
                    float num47 = 9f;
                    float num48 = 0.4f;
                    if (this.type == 0x13)
                    {
                        num47 = 13f;
                        num48 = 0.6f;
                    }
                    else if (this.type == 0x21)
                    {
                        num47 = 15f;
                        num48 = 0.8f;
                    }
                    else if (this.type == 0xb6)
                    {
                        num47 = 16f;
                        num48 = 1.2f;
                    }
                    else if (this.type == 0x6a)
                    {
                        num47 = 16f;
                        num48 = 1.2f;
                    }
                    else if (this.type == 0x110)
                    {
                        num47 = 15f;
                        num48 = 1f;
                    }
                    else if (this.type == 0x14d)
                    {
                        num47 = 12f;
                        num48 = 0.6f;
                    }
                    else if (this.type == 0x12d)
                    {
                        num47 = 15f;
                        num48 = 3f;
                    }
                    else if (this.type == 320)
                    {
                        num47 = 15f;
                        num48 = 3f;
                    }
                    else if (this.type == 0x17f)
                    {
                        num47 = 16f;
                        num48 = 4f;
                    }
                    Vector2 vector2 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                    float num49 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector2.X;
                    float num50 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector2.Y;
                    float num51 = (float)Math.Sqrt((double)((num49 * num49) + (num50 * num50)));
                    if (num51 > 3000f)
                    {
                        this.Kill();
                    }
                    num51 = num47 / num51;
                    num49 *= num51;
                    num50 *= num51;
                    if (this.type == 0x17f)
                    {
                        Vector2 vector3 = new Vector2(num49, num50) - base.velocity;
                        if (vector3 != Vector2.Zero)
                        {
                            Vector2 vector4 = vector3;
                            vector4.Normalize();
                            base.velocity += (Vector2)(vector4 * Math.Min(num48, vector3.Length()));
                        }
                    }
                    else
                    {
                        if (this.velocity.X < num49)
                        {
                            this.velocity.X += num48;
                            if ((this.velocity.X < 0f) && (num49 > 0f))
                            {
                                this.velocity.X += num48;
                            }
                        }
                        else if (this.velocity.X > num49)
                        {
                            this.velocity.X -= num48;
                            if ((this.velocity.X > 0f) && (num49 < 0f))
                            {
                                this.velocity.X -= num48;
                            }
                        }
                        if (this.velocity.Y < num50)
                        {
                            this.velocity.Y += num48;
                            if ((this.velocity.Y < 0f) && (num50 > 0f))
                            {
                                this.velocity.Y += num48;
                            }
                        }
                        else if (this.velocity.Y > num50)
                        {
                            this.velocity.Y -= num48;
                            if ((this.velocity.Y > 0f) && (num50 < 0f))
                            {
                                this.velocity.Y -= num48;
                            }
                        }
                    }
                    if (Main.myPlayer == this.owner)
                    {
                        Rectangle rectangle = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height);
                        Rectangle rectangle2 = new Rectangle((int)Main.player[this.owner].position.X, (int)Main.player[this.owner].position.Y, Main.player[this.owner].width, Main.player[this.owner].height);
                        if (rectangle.Intersects(rectangle2))
                        {
                            this.Kill();
                        }
                    }
                }
                if (this.type == 0x6a)
                {
                    this.rotation += 0.3f * base.direction;
                    return;
                }
                if (this.type == 0x17f)
                {
                    if (this.ai[0] == 0f)
                    {
                        Vector2 vector5 = base.velocity;
                        vector5.Normalize();
                        this.rotation = ((float)Math.Atan2((double)vector5.Y, (double)vector5.X)) + 1.57f;
                        return;
                    }
                    Vector2 vector6 = base.Center - Main.player[this.owner].Center;
                    vector6.Normalize();
                    this.rotation = ((float)Math.Atan2((double)vector6.Y, (double)vector6.X)) + 1.57f;
                    return;
                }
                this.rotation += 0.4f * base.direction;
                return;
            }
            Lighting.AddLight(mountedCenter, zero);
            Lighting.AddLight(base.Center, zero);
            DelegateMethods.v3_1 = zero;
            Utils.PlotTileLine(base.Center, mountedCenter, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
        Label_3C0D:
            if (this.ai[0] == 0f)
            {
                if ((((((num78 > 300f) && (this.type == 13)) || ((num78 > 400f) && (this.type == 0x20))) || (((num78 > 440f) && (this.type == 0x49)) || ((num78 > 440f) && (this.type == 0x4a)))) || ((((num78 > 250f) && (this.type == 0xa5)) || ((num78 > 350f) && (this.type == 0x100))) || (((num78 > 500f) && (this.type == 0x13b)) || ((num78 > 550f) && (this.type == 0x142))))) || (((((num78 > 400f) && (this.type == 0x14b)) || ((num78 > 550f) && (this.type == 0x14c))) || (((num78 > 400f) && (this.type == 0x174)) || ((num78 > 300f) && (this.type == 0x18c)))) || (((((num78 > 550f) && (this.type >= 0x286)) && (this.type <= 0x289)) || (((num78 > 480f) && (this.type >= 0x1e6)) && (this.type <= 0x1e9))) || ((num78 > 500f) && (this.type == 0x1be)))))
                {
                    this.ai[0] = 1f;
                }
                else if ((this.type >= 230) && (this.type <= 0xeb))
                {
                    int num79 = 300 + ((this.type - 230) * 30);
                    if (num78 > num79)
                    {
                        this.ai[0] = 1f;
                    }
                }
                Vector2 vector12 = base.Center - new Vector2(5f);
                Vector2 vector13 = base.Center + new Vector2(5f);
                Point point = (vector12 - new Vector2(16f)).ToTileCoordinates();
                Point point2 = (vector13 + new Vector2(32f)).ToTileCoordinates();
                int num80 = point.X;
                int num81 = point2.X;
                int num82 = point.Y;
                int num83 = point2.Y;
                if (num80 < 0)
                {
                    num80 = 0;
                }
                if (num81 > Main.maxTilesX)
                {
                    num81 = Main.maxTilesX;
                }
                if (num82 < 0)
                {
                    num82 = 0;
                }
                if (num83 > Main.maxTilesY)
                {
                    num83 = Main.maxTilesY;
                }
                for (int num84 = num80; num84 < num81; num84++)
                {
                    for (int num85 = num82; num85 < num83; num85++)
                    {
                        Vector2 vector14;
                        if (Main.tile[num84, num85] == null)
                        {
                            Main.tile[num84, num85] = new Tile();
                        }
                        vector14.X = num84 * 0x10;
                        vector14.Y = num85 * 0x10;
                        if ((((((vector12.X + 10f) > vector14.X) && (vector12.X < (vector14.X + 16f))) && (((vector12.Y + 10f) > vector14.Y) && (vector12.Y < (vector14.Y + 16f)))) && (Main.tile[num84, num85].nactive() && (Main.tileSolid[Main.tile[num84, num85].type] || (Main.tile[num84, num85].type == 0x13a)))) && ((this.type != 0x193) || (Main.tile[num84, num85].type == 0x13a)))
                        {
                            if (Main.player[this.owner].grapCount < 10)
                            {
                                Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = base.whoAmI;
                                Player player1 = Main.player[this.owner];
                                player1.grapCount++;
                            }
                            if (Main.myPlayer == this.owner)
                            {
                                int num86 = 0;
                                int num87 = -1;
                                int timeLeft = 0x186a0;
                                if ((this.type == 0x49) || (this.type == 0x4a))
                                {
                                    for (int num89 = 0; num89 < 0x3e8; num89++)
                                    {
                                        if ((((num89 != base.whoAmI) && Main.projectile[num89].active) && ((Main.projectile[num89].owner == this.owner) && (Main.projectile[num89].aiStyle == 7))) && (Main.projectile[num89].ai[0] == 2f))
                                        {
                                            Main.projectile[num89].Kill();
                                        }
                                    }
                                }
                                else
                                {
                                    int num90 = 3;
                                    if (this.type == 0xa5)
                                    {
                                        num90 = 8;
                                    }
                                    if (this.type == 0x100)
                                    {
                                        num90 = 2;
                                    }
                                    if (this.type == 0x174)
                                    {
                                        num90 = 2;
                                    }
                                    if ((this.type >= 0x286) && (this.type <= 0x289))
                                    {
                                        num90 = 4;
                                    }
                                    for (int num91 = 0; num91 < 0x3e8; num91++)
                                    {
                                        if ((Main.projectile[num91].active && (Main.projectile[num91].owner == this.owner)) && (Main.projectile[num91].aiStyle == 7))
                                        {
                                            if (Main.projectile[num91].timeLeft < timeLeft)
                                            {
                                                num87 = num91;
                                                timeLeft = Main.projectile[num91].timeLeft;
                                            }
                                            num86++;
                                        }
                                    }
                                    if (num86 > num90)
                                    {
                                        Main.projectile[num87].Kill();
                                    }
                                }
                            }
                            WorldGen.KillTile(num84, num85, true, true, false);
                            Main.PlaySound(0, num84 * 0x10, num85 * 0x10, 1);
                            this.velocity.X = 0f;
                            this.velocity.Y = 0f;
                            this.ai[0] = 2f;
                            this.position.X = ((num84 * 0x10) + 8) - (base.width / 2);
                            this.position.Y = ((num85 * 0x10) + 8) - (base.height / 2);
                            this.damage = 0;
                            this.netUpdate = true;
                            if (Main.myPlayer == this.owner)
                            {
                                NetMessage.SendData(13, -1, -1, "", this.owner, 0f, 0f, 0f, 0, 0, 0);
                            }
                            break;
                        }
                    }
                    if (this.ai[0] == 2f)
                    {
                        return;
                    }
                }
                return;
            }
            if (this.ai[0] == 1f)
            {
                float num92 = 11f;
                if (this.type == 0x20)
                {
                    num92 = 15f;
                }
                if ((this.type == 0x49) || (this.type == 0x4a))
                {
                    num92 = 17f;
                }
                if (this.type == 0x13b)
                {
                    num92 = 20f;
                }
                if (this.type == 0x142)
                {
                    num92 = 22f;
                }
                if ((this.type >= 230) && (this.type <= 0xeb))
                {
                    num92 = 11f + ((this.type - 230) * 0.75f);
                }
                if (this.type == 0x1be)
                {
                    num92 = 20f;
                }
                if ((this.type >= 0x1e6) && (this.type <= 0x1e9))
                {
                    num92 = 18f;
                }
                if ((this.type >= 0x286) && (this.type <= 0x289))
                {
                    num92 = 24f;
                }
                if (this.type == 0x14c)
                {
                    num92 = 17f;
                }
                if (num78 < 24f)
                {
                    this.Kill();
                }
                num78 = num92 / num78;
                num76 *= num78;
                num77 *= num78;
                this.velocity.X = num76;
                this.velocity.Y = num77;
                return;
            }
            if (this.ai[0] == 2f)
            {
                int num93 = ((int)(this.position.X / 16f)) - 1;
                int num94 = ((int)((this.position.X + base.width) / 16f)) + 2;
                int num95 = ((int)(this.position.Y / 16f)) - 1;
                int num96 = ((int)((this.position.Y + base.height) / 16f)) + 2;
                if (num93 < 0)
                {
                    num93 = 0;
                }
                if (num94 > Main.maxTilesX)
                {
                    num94 = Main.maxTilesX;
                }
                if (num95 < 0)
                {
                    num95 = 0;
                }
                if (num96 > Main.maxTilesY)
                {
                    num96 = Main.maxTilesY;
                }
                bool flag2 = true;
                for (int num97 = num93; num97 < num94; num97++)
                {
                    for (int num98 = num95; num98 < num96; num98++)
                    {
                        Vector2 vector15;
                        if (Main.tile[num97, num98] == null)
                        {
                            Main.tile[num97, num98] = new Tile();
                        }
                        vector15.X = num97 * 0x10;
                        vector15.Y = num98 * 0x10;
                        if (((((this.position.X + (base.width / 2)) > vector15.X) && ((this.position.X + (base.width / 2)) < (vector15.X + 16f))) && (((this.position.Y + (base.height / 2)) > vector15.Y) && ((this.position.Y + (base.height / 2)) < (vector15.Y + 16f)))) && (Main.tile[num97, num98].nactive() && ((Main.tileSolid[Main.tile[num97, num98].type] || (Main.tile[num97, num98].type == 0x13a)) || (Main.tile[num97, num98].type == 5))))
                        {
                            flag2 = false;
                        }
                    }
                }
                if (flag2)
                {
                    this.ai[0] = 1f;
                    return;
                }
                if (Main.player[this.owner].grapCount >= 10)
                {
                    return;
                }
                Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = base.whoAmI;
                Player player11 = Main.player[this.owner];
                player11.grapCount++;
            }
            return;
        Label_4D0C:
            num115 = Dust.NewDust(base.position, base.width, base.height, num114, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 0xff, new Color(), 0.7f);
            Dust dust64 = Main.dust[num115];
            dust64.velocity = (Vector2)(dust64.velocity * 0.25f);
            Main.dust[num115].position = (Vector2)((Main.dust[num115].position + base.position) / 2f);
        Label_5199:
            if ((Main.myPlayer == this.owner) && (this.ai[0] <= 0f))
            {
                if (Main.player[this.owner].channel)
                {
                    float num120 = 12f;
                    if (this.type == 0x10)
                    {
                        num120 = 15f;
                    }
                    if (this.type == 0x1eb)
                    {
                        num120 = 20f;
                    }
                    Vector2 vector16 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                    float num121 = (Main.mouseX + Main.screenPosition.X) - vector16.X;
                    float num122 = (Main.mouseY + Main.screenPosition.Y) - vector16.Y;
                    if (Main.player[this.owner].gravDir == -1f)
                    {
                        num122 = ((Main.screenPosition.Y + Main.screenHeight) - Main.mouseY) - vector16.Y;
                    }
                    float num123 = (float)Math.Sqrt((double)((num121 * num121) + (num122 * num122)));
                    num123 = (float)Math.Sqrt((double)((num121 * num121) + (num122 * num122)));
                    if (this.ai[0] < 0f)
                    {
                        this.ai[0]++;
                    }
                    if ((this.type == 0x1eb) && (num123 < 100f))
                    {
                        if (this.velocity.Length() < num120)
                        {
                            base.velocity = (Vector2)(base.velocity * 1.1f);
                            if (this.velocity.Length() > num120)
                            {
                                this.velocity.Normalize();
                                base.velocity = (Vector2)(base.velocity * num120);
                            }
                        }
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = -10f;
                        }
                    }
                    else if (num123 > num120)
                    {
                        num123 = num120 / num123;
                        num121 *= num123;
                        num122 *= num123;
                        int num124 = (int)(num121 * 1000f);
                        int num125 = (int)(this.velocity.X * 1000f);
                        int num126 = (int)(num122 * 1000f);
                        int num127 = (int)(this.velocity.Y * 1000f);
                        if ((num124 != num125) || (num126 != num127))
                        {
                            this.netUpdate = true;
                        }
                        if (this.type == 0x1eb)
                        {
                            Vector2 vector17 = new Vector2(num121, num122);
                            base.velocity = (Vector2)(((base.velocity * 4f) + vector17) / 5f);
                        }
                        else
                        {
                            this.velocity.X = num121;
                            this.velocity.Y = num122;
                        }
                    }
                    else
                    {
                        int num128 = (int)(num121 * 1000f);
                        int num129 = (int)(this.velocity.X * 1000f);
                        int num130 = (int)(num122 * 1000f);
                        int num131 = (int)(this.velocity.Y * 1000f);
                        if ((num128 != num129) || (num130 != num131))
                        {
                            this.netUpdate = true;
                        }
                        this.velocity.X = num121;
                        this.velocity.Y = num122;
                    }
                }
                else if (this.ai[0] <= 0f)
                {
                    this.netUpdate = true;
                    if (this.type != 0x1eb)
                    {
                        float num132 = 12f;
                        Vector2 vector18 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f));
                        float num133 = (Main.mouseX + Main.screenPosition.X) - vector18.X;
                        float num134 = (Main.mouseY + Main.screenPosition.Y) - vector18.Y;
                        if (Main.player[this.owner].gravDir == -1f)
                        {
                            num134 = ((Main.screenPosition.Y + Main.screenHeight) - Main.mouseY) - vector18.Y;
                        }
                        float num135 = (float)Math.Sqrt((double)((num133 * num133) + (num134 * num134)));
                        if ((num135 == 0f) || (this.ai[0] < 0f))
                        {
                            vector18 = new Vector2(Main.player[this.owner].position.X + (Main.player[this.owner].width / 2), Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2));
                            num133 = (this.position.X + (base.width * 0.5f)) - vector18.X;
                            num134 = (this.position.Y + (base.height * 0.5f)) - vector18.Y;
                            num135 = (float)Math.Sqrt((double)((num133 * num133) + (num134 * num134)));
                        }
                        num135 = num132 / num135;
                        num133 *= num135;
                        num134 *= num135;
                        this.velocity.X = num133;
                        this.velocity.Y = num134;
                        if ((this.velocity.X == 0f) && (this.velocity.Y == 0f))
                        {
                            this.Kill();
                        }
                    }
                    this.ai[0] = 1f;
                }
            }
            if (this.type == 0x1eb)
            {
                this.localAI[0]++;
                if ((this.ai[0] > 0f) && (this.localAI[0] > 15f))
                {
                    this.tileCollide = false;
                    Vector2 vector19 = Main.player[this.owner].Center - base.Center;
                    if (vector19.Length() < 20f)
                    {
                        this.Kill();
                    }
                    vector19.Normalize();
                    vector19 = (Vector2)(vector19 * 25f);
                    base.velocity = (Vector2)(((base.velocity * 5f) + vector19) / 6f);
                }
                if ((this.ai[0] < 0f) || ((this.velocity.X == 0f) && (this.velocity.Y == 0f)))
                {
                    this.rotation += 0.3f;
                }
                else if (this.ai[0] > 0f)
                {
                    this.rotation += 0.3f * base.direction;
                }
                else
                {
                    this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f;
                }
            }
            else if (this.type == 0x22)
            {
                this.rotation += 0.3f * base.direction;
            }
            else if ((this.velocity.X != 0f) || (this.velocity.Y != 0f))
            {
                this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) - 2.355f;
            }
            if (this.velocity.Y > 16f)
            {
                this.velocity.Y = 16f;
            }
            return;
        Label_E4CE:
            color5 = new Color();
            int index = Dust.NewDust(new Vector2((this.position.X - (this.velocity.X * 4f)) + 2f, (this.position.Y + 2f) - (this.velocity.Y * 4f)), 8, 8, num316, 0f, 0f, 100, color5, 1.25f);
            Dust dust127 = Main.dust[index];
            dust127.velocity = (Vector2)(dust127.velocity * 0.1f);
        Label_E566:
            if ((this.localAI[1] > 7f) && (this.type == 0x84))
            {
                color5 = new Color();
                int num318 = Dust.NewDust(new Vector2((this.position.X - (this.velocity.X * 4f)) + 2f, (this.position.Y + 2f) - (this.velocity.Y * 4f)), 8, 8, 0x6b, this.oldVelocity.X, this.oldVelocity.Y, 100, color5, 1.25f);
                Dust dust128 = Main.dust[num318];
                dust128.velocity = (Vector2)(dust128.velocity * -0.25f);
                color5 = new Color();
                num318 = Dust.NewDust(new Vector2((this.position.X - (this.velocity.X * 4f)) + 2f, (this.position.Y + 2f) - (this.velocity.Y * 4f)), 8, 8, 0x6b, this.oldVelocity.X, this.oldVelocity.Y, 100, color5, 1.25f);
                Dust dust129 = Main.dust[num318];
                dust129.velocity = (Vector2)(dust129.velocity * -0.25f);
                Dust dust130 = Main.dust[num318];
                dust130.position -= (Vector2)(base.velocity * 0.5f);
            }
            if (this.localAI[1] < 15f)
            {
                this.localAI[1]++;
            }
            else
            {
                if ((this.type == 0x72) || (this.type == 0x73))
                {
                    int num319 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 4f), 8, 8, 0x1b, this.oldVelocity.X, this.oldVelocity.Y, 100, new Color(), 0.6f);
                    Dust dust131 = Main.dust[num319];
                    dust131.velocity = (Vector2)(dust131.velocity * -0.25f);
                }
                else if (this.type == 0x74)
                {
                    int num320 = Dust.NewDust(new Vector2((this.position.X - (this.velocity.X * 5f)) + 2f, (this.position.Y + 2f) - (this.velocity.Y * 5f)), 8, 8, 0x40, this.oldVelocity.X, this.oldVelocity.Y, 100, new Color(), 1.5f);
                    Dust dust132 = Main.dust[num320];
                    dust132.velocity = (Vector2)(dust132.velocity * -0.25f);
                    Main.dust[num320].noGravity = true;
                }
                if (this.localAI[0] == 0f)
                {
                    this.scale -= 0.02f;
                    this.alpha += 30;
                    if (this.alpha >= 250)
                    {
                        this.alpha = 0xff;
                        this.localAI[0] = 1f;
                    }
                }
                else if (this.localAI[0] == 1f)
                {
                    this.scale += 0.02f;
                    this.alpha -= 30;
                    if (this.alpha <= 0)
                    {
                        this.alpha = 0;
                        this.localAI[0] = 0f;
                    }
                }
            }
            if (this.ai[1] == 0f)
            {
                this.ai[1] = 1f;
                if (this.type == 0x84)
                {
                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 60);
                }
                else
                {
                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
                }
            }
            if (this.type == 0x9d)
            {
                this.rotation += base.direction * 0.4f;
                this.spriteDirection = base.direction;
            }
            else
            {
                this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 0.785f;
            }
            if (this.velocity.Y > 16f)
            {
                this.velocity.Y = 16f;
            }
        }