Terraria.Projectile.Kill C# (CSharp) Method

Kill() public method

public Kill ( ) : void
return void
        public void Kill()
        {
            if (!active)
                return;
            int num1 = timeLeft;
            timeLeft = 0;
            if (type == 634 || type == 635)
            {
                int num2 = Utils.SelectRandom<int>(Main.rand, 242, 73, 72, 71, 255);
                int Type1 = 255;
                int Type2 = 255;
                int num3 = 50;
                float Scale1 = 1.7f;
                float Scale2 = 0.8f;
                float Scale3 = 2f;
                Vector2 vector2 = Utils.ToRotationVector2(rotation - 1.570796f) * velocity.Length() * (float)MaxUpdates;
                if (type == 635)
                {
                    Type1 = 88;
                    Type2 = 88;
                    num2 = Utils.SelectRandom<int>(Main.rand, 242, 59, 88);
                    Scale1 = 3.7f;
                    Scale2 = 1.5f;
                    Scale3 = 2.2f;
                    vector2 *= 0.5f;
                }
                Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                position = Center;
                width = height = num3;
                Center = position;
                maxPenetrate = -1;
                penetrate = -1;
                Damage();
                for (int index1 = 0; index1 < 40; ++index1)
                {
                    int Type3 = Utils.SelectRandom<int>(Main.rand, 242, 73, 72, 71, 255);
                    if (type == 635)
                        Type3 = Utils.SelectRandom<int>(Main.rand, 242, 59, 88);
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, Type3, 0.0f, 0.0f, 200, new Color(), Scale1);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                    Main.dust[index2].velocity += vector2 * Utils.NextFloat(Main.rand);
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, Type1, 0.0f, 0.0f, 100, new Color(), Scale2);
                    Main.dust[index3].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index3].velocity *= 2f;
                    Main.dust[index3].noGravity = true;
                    Main.dust[index3].fadeIn = 1f;
                    Main.dust[index3].color = Color.Crimson * 0.5f;
                    Main.dust[index3].velocity += vector2 * Utils.NextFloat(Main.rand);
                }
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, Type2, 0.0f, 0.0f, 0, new Color(), Scale3);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 3f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 0.5f;
                    Main.dust[index2].velocity += vector2 * (float)(0.600000023841858 + 0.600000023841858 * (double)Utils.NextFloat(Main.rand));
                }
            }
            else if (type == 641)
            {
                if (owner == Main.myPlayer)
                {
                    for (int index = 0; index < 1000; ++index)
                    {
                        if (Main.projectile[index].active && Main.projectile[index].owner == owner && Main.projectile[index].type == 642)
                            Main.projectile[index].Kill();
                    }
                }
            }
            else if (type == 643)
            {
                if (owner == Main.myPlayer)
                {
                    for (int index = 0; index < 1000; ++index)
                    {
                        if (Main.projectile[index].active && Main.projectile[index].owner == owner && Main.projectile[index].type == 644)
                            Main.projectile[index].Kill();
                    }
                }
            }
            else if (type == 645)
            {
                bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)position.X / 16, (int)position.Y / 16));
                for (int index = 0; index < 4; ++index)
                    Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                for (int index1 = 0; index1 < 4; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0.0f, 0.0f, 0, new Color(), 2.5f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                    if (flag)
                        Main.dust[index2].noLight = true;
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index3].velocity *= 2f;
                    Main.dust[index3].noGravity = true;
                    if (flag)
                        Main.dust[index3].noLight = true;
                }
                for (int index1 = 0; index1 < 1; ++index1)
                {
                    int index2 = Gore.NewGore(position + new Vector2((width * Main.rand.Next(100)) / 100f, (height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index2].velocity *= 0.3f;
                    Main.gore[index2].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                }
            }
            else if (type == 636)
            {
                Rectangle hitbox = Hitbox;
                int index1 = 0;
                while (index1 < 6)
                {
                    hitbox.X = (int)oldPos[index1].X;
                    hitbox.Y = (int)oldPos[index1].Y;
                    for (int index2 = 0; index2 < 5; ++index2)
                    {
                        int Type = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
                        int index3 = Dust.NewDust(Utils.TopLeft(hitbox), width, height, Type, 2.5f * direction, -2.5f, 0, new Color(), 1f);
                        Main.dust[index3].alpha = 200;
                        Main.dust[index3].velocity *= 2.4f;
                        Main.dust[index3].scale += Utils.NextFloat(Main.rand);
                    }
                    index1 += 3;
                }
            }
            else if (type == 614)
            {
                for (int index = 0; index < 10; ++index)
                {
                    Dust dust = Main.dust[Dust.NewDust(position, width, height, 229, 0.0f, 0.0f, 0, new Color(), 1f)];
                    dust.noGravity = true;
                    dust.velocity *= 3f;
                }
            }
            if (type == 644)
            {
                Vector2 spinningpoint = Utils.RotatedByRandom(new Vector2(0.0f, -3f), 3.14159274101257);
                float num2 = Main.rand.Next(7, 13);
                Vector2 vector2 = new Vector2(2.1f, 2f);
                Color newColor = Main.hslToRgb(ai[0], 1f, 0.5f);
                newColor.A = byte.MaxValue;
                for (float num3 = 0.0f; num3 < num2; ++num3)
                {
                    int dustIndex = Dust.NewDust(Center, 0, 0, 267, 0.0f, 0.0f, 0, newColor, 1f);
                    Main.dust[dustIndex].position = Center;
                    Main.dust[dustIndex].velocity = Utils.RotatedBy(spinningpoint, 6.28318548202515 * num3 / num2, new Vector2()) * vector2 * (float)(0.800000011920929 + (double)Utils.NextFloat(Main.rand) * 0.400000005960464);
                    Main.dust[dustIndex].noGravity = true;
                    Main.dust[dustIndex].scale = 2f;
                    Main.dust[dustIndex].fadeIn = Utils.NextFloat(Main.rand) * 2f;
                    Dust dust = Dust.CloneDust(dustIndex);
                    dust.scale /= 2f;
                    dust.fadeIn /= 2f;
                    dust.color = new Color(255, 255, 255, 255);
                }
                for (float num3 = 0.0f; num3 < num2; ++num3)
                {
                    int dustIndex = Dust.NewDust(Center, 0, 0, 267, 0.0f, 0.0f, 0, newColor, 1f);
                    Main.dust[dustIndex].position = Center;
                    Main.dust[dustIndex].velocity = Utils.RotatedBy(spinningpoint, 6.28318548202515 * num3 / num2, new Vector2()) * vector2 * (float)(0.800000011920929 + (double)Utils.NextFloat(Main.rand) * 0.400000005960464);
                    Main.dust[dustIndex].velocity *= Utils.NextFloat(Main.rand) * 0.8f;
                    Main.dust[dustIndex].noGravity = true;
                    Main.dust[dustIndex].scale = Utils.NextFloat(Main.rand) * 1f;
                    Main.dust[dustIndex].fadeIn = Utils.NextFloat(Main.rand) * 2f;
                    Dust dust = Dust.CloneDust(dustIndex);
                    dust.scale /= 2f;
                    dust.fadeIn /= 2f;
                    dust.color = new Color(255, 255, 255, 255);
                }
                if (Main.myPlayer == owner)
                {
                    friendly = true;
                    int num3 = width;
                    int num4 = height;
                    int num5 = penetrate;
                    position = Center;
                    width = height = 60;
                    Center = position;
                    penetrate = -1;
                    maxPenetrate = -1;
                    Damage();
                    penetrate = num5;
                    position = Center;
                    width = num3;
                    height = num4;
                    Center = position;
                }
            }
            if (type == 608)
            {
                maxPenetrate = -1;
                penetrate = -1;
                Damage();
                Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                for (int index1 = 0; index1 < 4; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                }
                for (int index1 = 0; index1 < 30; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 200, new Color(), 3.7f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                    Main.dust[index2].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].ArmorSetDye(), Main.player[owner]);
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index3].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index3].velocity *= 2f;
                    Main.dust[index3].noGravity = true;
                    Main.dust[index3].fadeIn = 2.5f;
                    Main.dust[index3].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].ArmorSetDye(), Main.player[owner]);
                }
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 0, new Color(), 2.7f);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                    Main.dust[index2].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].ArmorSetDye(), Main.player[owner]);
                }
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 0, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                }
                for (int index1 = 0; index1 < 2; ++index1)
                {
                    int index2 = Gore.NewGore(position + new Vector2((width * Main.rand.Next(100)) / 100f, (height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.gore[index2].velocity *= 0.3f;
                    Main.gore[index2].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                }
            }
            else if (type == 617)
            {
                position = Center;
                width = height = 176;
                Center = position;
                maxPenetrate = -1;
                penetrate = -1;
                Damage();
                Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                for (int index1 = 0; index1 < 4; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 240, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                }
                for (int index1 = 0; index1 < 30; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 62, 0.0f, 0.0f, 200, new Color(), 3.7f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 90, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index3].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index3].velocity *= 2f;
                    Main.dust[index3].noGravity = true;
                    Main.dust[index3].fadeIn = 1f;
                    Main.dust[index3].color = Color.Crimson * 0.5f;
                }
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 62, 0.0f, 0.0f, 0, new Color(), 2.7f);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                }
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 240, 0.0f, 0.0f, 0, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                }
                for (int index1 = 0; index1 < 2; ++index1)
                {
                    int index2 = Gore.NewGore(position + new Vector2((width * Main.rand.Next(100)) / 100f, (height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.gore[index2].velocity *= 0.3f;
                    Main.gore[index2].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                }
                if (Main.myPlayer == owner)
                {
                    for (int index = 0; index < 1000; ++index)
                    {
                        if (Main.projectile[index].active && Main.projectile[index].type == 618 && Main.projectile[index].ai[1] == (double)whoAmI)
                            Main.projectile[index].Kill();
                    }
                    int num2 = Main.rand.Next(5, 9);
                    int num3 = Main.rand.Next(5, 9);
                    int num4 = Utils.SelectRandom<int>(Main.rand, 86, 90);
                    int num5 = num4 == 86 ? 90 : 86;
                    for (int index = 0; index < num2; ++index)
                    {
                        Vector2 vector2_1 = Center + Utils.RandomVector2(Main.rand, -30f, 30f);
                        Vector2 vector2_2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                        while (vector2_2.X == 0.0 && vector2_2.Y == 0.0)
                            vector2_2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                        vector2_2.Normalize();
                        if (vector2_2.Y > 0.200000002980232)
                            vector2_2.Y *= -1f;
                        vector2_2 *= Main.rand.Next(70, 101) * 0.1f;
                        NewProjectile(vector2_1.X, vector2_1.Y, vector2_2.X, vector2_2.Y, 620, (int)(damage * 0.8), knockBack * 0.8f, owner, num4, 0.0f);
                    }
                    for (int index = 0; index < num3; ++index)
                    {
                        Vector2 vector2_1 = Center + Utils.RandomVector2(Main.rand, -30f, 30f);
                        Vector2 vector2_2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                        while (vector2_2.X == 0.0 && vector2_2.Y == 0.0)
                            vector2_2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                        vector2_2.Normalize();
                        if (vector2_2.Y > 0.400000005960464)
                            vector2_2.Y *= -1f;
                        vector2_2 *= Main.rand.Next(40, 81) * 0.1f;
                        NewProjectile(vector2_1.X, vector2_1.Y, vector2_2.X, vector2_2.Y, 620, (int)(damage * 0.8), knockBack * 0.8f, owner, num5, 0.0f);
                    }
                }
            }
            else if (type == 620 || type == 618)
            {
                if (type == 618)
                    ai[0] = 86f;
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, (int)ai[0], velocity.X * 0.1f, velocity.Y * 0.1f, 0, new Color(), 0.5f);
                    if (Main.rand.Next(3) == 0)
                    {
                        Main.dust[index2].fadeIn = (float)(0.75 + Main.rand.Next(-10, 11) * 0.00999999977648258);
                        Main.dust[index2].scale = (float)(0.25 + Main.rand.Next(-10, 11) * 0.00499999988824129);
                        ++Main.dust[index2].type;
                    }
                    else
                        Main.dust[index2].scale = (float)(1.0 + Main.rand.Next(-10, 11) * 0.00999999977648258);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 1.25f;
                    Main.dust[index2].velocity -= oldVelocity / 10f;
                }
            }
            else if (type == 619)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 50);
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, (int)ai[0], velocity.X * 0.1f, velocity.Y * 0.1f, 0, new Color(), 0.5f);
                    if (Main.rand.Next(3) == 0)
                    {
                        Main.dust[index2].fadeIn = (float)(1.10000002384186 + Main.rand.Next(-10, 11) * 0.00999999977648258);
                        Main.dust[index2].scale = (float)(0.349999994039536 + Main.rand.Next(-10, 11) * 0.00999999977648258);
                        ++Main.dust[index2].type;
                    }
                    else
                        Main.dust[index2].scale = (float)(1.20000004768372 + Main.rand.Next(-10, 11) * 0.00999999977648258);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 2.5f;
                    Main.dust[index2].velocity -= oldVelocity / 10f;
                }
                if (Main.myPlayer == owner)
                {
                    int num2 = Main.rand.Next(3, 6);
                    for (int index = 0; index < num2; ++index)
                    {
                        Vector2 vector2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                        while (vector2.X == 0.0 && vector2.Y == 0.0)
                            vector2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                        vector2.Normalize();
                        vector2 *= Main.rand.Next(70, 101) * 0.1f;
                        NewProjectile(oldPosition.X + (width / 2), oldPosition.Y + (height / 2), vector2.X, vector2.Y, 620, (int)(damage * 0.8), knockBack * 0.8f, owner, ai[0], 0.0f);
                    }
                }
            }
            if (type == 601)
            {
                Color portalColor = PortalHelper.GetPortalColor(owner, (int)ai[0]);
                portalColor.A = byte.MaxValue;
                for (int index = 0; index < 6; ++index)
                {
                    Vector2 vector2 = Utils.RotatedByRandom(Vector2.UnitY, 6.28318548202515) * (3f * Utils.NextFloat(Main.rand));
                    Dust dust = Main.dust[Dust.NewDust(Center, 0, 0, 263, 0.0f, 0.0f, 0, new Color(), 1f)];
                    dust.position = Center;
                    dust.velocity = vector2 + velocity / 5f;
                    dust.color = portalColor;
                    dust.scale = 2f;
                    dust.noLight = true;
                    dust.noGravity = true;
                }
            }
            if (type == 596)
            {
                position = Center;
                width = height = 60;
                Center = position;
                int num2 = 40;
                if (Main.expertMode)
                    num2 = 30;
                damage = num2;
                Damage();
                Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                for (int index1 = 0; index1 < 4; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                }
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0.0f, 0.0f, 0, new Color(), 2.5f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 2f;
                }
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 0, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 2f;
                }
            }
            else if (type >= 625 && type <= 628)
            {
                for (int index1 = 0; index1 < 6; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 135, 0.0f, 0.0f, 100, new Color(), 2f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].noLight = true;
                }
            }
            if (type == 631)
            {
                int num2 = Main.rand.Next(5, 10);
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int index2 = Dust.NewDust(Center, 0, 0, 229, 0.0f, 0.0f, 100, new Color(), 1f);
                    Main.dust[index2].velocity *= 1.6f;
                    --Main.dust[index2].velocity.Y;
                    Main.dust[index2].position -= Vector2.One * 4f;
                    Main.dust[index2].position = Vector2.Lerp(Main.dust[index2].position, Center, 0.5f);
                    Main.dust[index2].noGravity = true;
                }
            }
            if (type == 539)
            {
                position = Center;
                width = height = 80;
                Center = position;
                Damage();
                Main.PlaySound(4, (int)position.X, (int)position.Y, 7);
                for (int index1 = 0; index1 < 4; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                }
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 176, 0.0f, 0.0f, 200, new Color(), 3.7f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                }
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 180, 0.0f, 0.0f, 0, new Color(), 2.7f);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                }
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 0, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                }
            }
            else if (type == 585)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 27);
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 26, 0.0f, 0.0f, 100, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 1.2f;
                    Main.dust[index2].scale = 1.3f;
                    Main.dust[index2].velocity -= oldVelocity * 0.3f;
                    int index3 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 27, 0.0f, 0.0f, 100, new Color(), 2f);
                    Main.dust[index3].noGravity = true;
                    Main.dust[index3].velocity *= 3f;
                }
            }
            else if (type == 590)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 27);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 165, 0.0f, 0.0f, 50, new Color(), 1.5f);
                    Main.dust[index2].velocity *= 2f;
                    Main.dust[index2].noGravity = true;
                }
                float Scale = (float)(0.600000023841858 + (double)Utils.NextFloat(Main.rand) * 0.400000005960464);
                int index3 = Gore.NewGore(position, Vector2.Zero, 375, Scale);
                Main.gore[index3].velocity *= 0.3f;
                int index4 = Gore.NewGore(position, Vector2.Zero, 376, Scale);
                Main.gore[index4].velocity *= 0.3f;
                int index5 = Gore.NewGore(position, Vector2.Zero, 377, Scale);
                Main.gore[index5].velocity *= 0.3f;
            }
            else if (type == 587)
            {
                Color newColor = Main.hslToRgb(ai[1], 1f, 0.5f);
                newColor.A = (byte)200;
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 76, 0.0f, 0.0f, 0, newColor, 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 1.2f;
                    Main.dust[index2].scale = 0.9f;
                    Main.dust[index2].velocity -= oldVelocity * 0.3f;
                    int index3 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 76, 0.0f, 0.0f, 0, newColor, 1.1f);
                    Main.dust[index3].noGravity = true;
                    Main.dust[index3].velocity *= 2f;
                }
            }
            else if (type == 572)
            {
                for (int index1 = 0; index1 < 15; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 40, velocity.X * 0.1f, velocity.Y * 0.1f, 100, new Color(), 1f);
                    Main.dust[index2].velocity *= 3f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].scale = 1.25f;
                    Main.dust[index2].position = (Center + position) / 2f;
                }
            }
            else if (type == 581)
            {
                for (int index = 0; index < 30; ++index)
                {
                    int Type = Utils.SelectRandom<int>(Main.rand, 229, 229, 161);
                    Dust dust = Main.dust[Dust.NewDust(position, width, height, Type, 0.0f, 0.0f, 0, new Color(), 1f)];
                    dust.noGravity = true;
                    dust.scale = 1.25f + Utils.NextFloat(Main.rand);
                    dust.fadeIn = 0.25f;
                    dust.velocity *= 2f;
                    dust.noLight = true;
                }
            }
            if (type == 405)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 54);
                Vector2 center = Center;
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int num2 = 10;
                    Vector2 vector2_1 = Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.283185f) * Main.rand.Next(24, 41) / 8f;
                    int index2 = Dust.NewDust(Center - Vector2.One * num2, num2 * 2, num2 * 2, 212, 0.0f, 0.0f, 0, new Color(), 1f);
                    Dust dust = Main.dust[index2];
                    Vector2 vector2_2 = Vector2.Normalize(dust.position - Center);
                    dust.position = Center + vector2_2 * num2 * scale;
                    dust.velocity = index1 >= 30 ? vector2_2 * Main.rand.Next(45, 91) / 10f : vector2_2 * dust.velocity.Length();
                    dust.color = Main.hslToRgb((float)(0.400000005960464 + Main.rand.NextDouble() * 0.200000002980232), 0.9f, 0.5f);
                    dust.color = Color.Lerp(dust.color, Color.White, 0.3f);
                    dust.noGravity = true;
                    dust.scale = 0.7f;
                }
            }
            if (type == 501)
            {
                Main.PlaySound(13, (int)position.X, (int)position.Y, 1);
                int num2 = 20;
                position.X -= num2;
                position.Y -= num2;
                width += num2 * 2;
                height += num2 * 2;
                int num3 = num2 + 20;
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 188, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index2].velocity *= 0.5f;
                }
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    int index2 = Gore.NewGore(new Vector2(position.X + Main.rand.Next(width), position.Y + Main.rand.Next(height)), new Vector2(), Main.rand.Next(435, 438), 1f);
                    Main.gore[index2].velocity *= 0.5f;
                    if (index1 == 0)
                    {
                        ++Main.gore[index2].velocity.X;
                        ++Main.gore[index2].velocity.Y;
                    }
                    else if (index1 == 1)
                    {
                        --Main.gore[index2].velocity.X;
                        ++Main.gore[index2].velocity.Y;
                    }
                    else if (index1 == 2)
                    {
                        ++Main.gore[index2].velocity.X;
                        --Main.gore[index2].velocity.Y;
                    }
                    else
                    {
                        --Main.gore[index2].velocity.X;
                        --Main.gore[index2].velocity.Y;
                    }
                    Main.gore[index2].velocity *= 0.5f;
                }
                position.X -= num3;
                position.Y -= num3;
                width += num3 * 2;
                height += num3 * 2;
                Damage();
            }
            if (type == 410)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 54);
                Vector2 center = Center;
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int num2 = (int)(10.0 * ai[1]);
                    Vector2 vector2_1 = Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.283185f) * Main.rand.Next(24, 41) / 8f;
                    int index2 = Dust.NewDust(Center - Vector2.One * num2, num2 * 2, num2 * 2, 212, 0.0f, 0.0f, 0, new Color(), 1f);
                    Dust dust = Main.dust[index2];
                    Vector2 vector2_2 = Vector2.Normalize(dust.position - Center);
                    dust.position = Center + vector2_2 * num2 * scale;
                    dust.velocity = index1 >= 30 ? vector2_2 * Main.rand.Next(45, 91) / 10f : vector2_2 * dust.velocity.Length();
                    dust.color = Main.hslToRgb((float)(0.400000005960464 + Main.rand.NextDouble() * 0.200000002980232), 0.9f, 0.5f);
                    dust.color = Color.Lerp(dust.color, Color.White, 0.3f);
                    dust.noGravity = true;
                    dust.scale = 0.7f;
                }
            }
            if (type == 629 && Main.netMode != 1)
            {
                switch (Main.npc[(int)ai[0]].type)
                {
                    case 507:
                        if (NPC.ShieldStrengthTowerNebula != 0)
                            Main.npc[(int)ai[0]].ai[3] = 1f;
                        NPC.ShieldStrengthTowerNebula = (int)MathHelper.Clamp((float)(NPC.ShieldStrengthTowerNebula - 1), 0.0f, (float)NPC.ShieldStrengthTowerMax);
                        break;
                    case 517:
                        if (NPC.ShieldStrengthTowerSolar != 0)
                            Main.npc[(int)ai[0]].ai[3] = 1f;
                        NPC.ShieldStrengthTowerSolar = (int)MathHelper.Clamp((float)(NPC.ShieldStrengthTowerSolar - 1), 0.0f, (float)NPC.ShieldStrengthTowerMax);
                        break;
                    case 422:
                        if (NPC.ShieldStrengthTowerVortex != 0)
                            Main.npc[(int)ai[0]].ai[3] = 1f;
                        NPC.ShieldStrengthTowerVortex = (int)MathHelper.Clamp((float)(NPC.ShieldStrengthTowerVortex - 1), 0.0f, (float)NPC.ShieldStrengthTowerMax);
                        break;
                    case 493:
                        if (NPC.ShieldStrengthTowerStardust != 0)
                            Main.npc[(int)ai[0]].ai[3] = 1f;
                        NPC.ShieldStrengthTowerStardust = (int)MathHelper.Clamp((float)(NPC.ShieldStrengthTowerStardust - 1), 0.0f, (float)NPC.ShieldStrengthTowerMax);
                        break;
                }
                Main.npc[(int)ai[0]].netUpdate = true;
                NetMessage.SendData(101, -1, -1, "", 0, 0.0f, 0.0f, 0.0f, 0, 0, 0);
            }
            if (aiStyle == 105 && owner == Main.myPlayer && ai[1] == 0.0)
            {
                Vector2 vector2_1 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                vector2_1.Normalize();
                Vector2 vector2_2 = vector2_1 * 0.3f;
                NewProjectile(Center.X, Center.Y, vector2_2.X, vector2_2.Y, Main.rand.Next(569, 572), damage, 0.0f, owner, 0.0f, 0.0f);
            }
            if (type == 452)
            {
                Main.PlaySound(29, (int)position.X, (int)position.Y, 103);
                position = Center;
                width = height = 144;
                position.X -= (width / 2);
                position.Y -= (height / 2);
                for (int index = 0; index < 4; ++index)
                    Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                for (int index1 = 0; index1 < 40; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0.0f, 0.0f, 0, new Color(), 2.5f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index3].velocity *= 2f;
                    Main.dust[index3].noGravity = true;
                }
                for (int index1 = 0; index1 < 1; ++index1)
                {
                    int index2 = Gore.NewGore(position + new Vector2((width * Main.rand.Next(100)) / 100f, (height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index2].velocity *= 0.3f;
                    Main.gore[index2].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                }
                Damage();
            }
            if (type == 454)
            {
                Main.PlaySound(4, (int)position.X, (int)position.Y, 6);
                position = Center;
                width = height = 208;
                position.X -= (width / 2);
                position.Y -= (height / 2);
                for (int index1 = 0; index1 < 7; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index2].position = Utils.RotatedBy(new Vector2((width / 2), 0.0f), 6.28318548202515 * (float)Main.rand.NextDouble(), new Vector2()) * (float)Main.rand.NextDouble() + Center;
                }
                for (int index1 = 0; index1 < 60; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0.0f, 0.0f, 0, new Color(), 2.5f);
                    Main.dust[index2].position = Utils.RotatedBy(new Vector2((width / 2), 0.0f), 6.28318548202515 * (float)Main.rand.NextDouble(), new Vector2()) * (float)Main.rand.NextDouble() + Center;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 1f;
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index3].position = Utils.RotatedBy(new Vector2((width / 2), 0.0f), 6.28318548202515 * (float)Main.rand.NextDouble(), new Vector2()) * (float)Main.rand.NextDouble() + Center;
                    Main.dust[index3].velocity *= 1f;
                    Main.dust[index3].noGravity = true;
                }
                for (int index1 = 0; index1 < 3; ++index1)
                {
                    int index2 = Gore.NewGore(position + new Vector2((width * Main.rand.Next(100)) / 100f, (height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index2].velocity *= 0.3f;
                    Main.gore[index2].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                }
                Damage();
            }
            if (type == 467)
            {
                position = Center;
                width = height = 176;
                Center = position;
                Damage();
                Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                for (int index1 = 0; index1 < 4; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                }
                for (int index1 = 0; index1 < 30; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 200, new Color(), 3.7f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index3].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index3].velocity *= 2f;
                    Main.dust[index3].noGravity = true;
                    Main.dust[index3].fadeIn = 2.5f;
                }
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 0, new Color(), 2.7f);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                }
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 0, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                }
                for (int index1 = 0; index1 < 2; ++index1)
                {
                    int index2 = Gore.NewGore(position + new Vector2((width * Main.rand.Next(100)) / 100f, (height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.gore[index2].velocity *= 0.3f;
                    Main.gore[index2].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                }
            }
            if (type == 468)
            {
                position = Center;
                width = height = 176;
                Center = position;
                Damage();
                Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                for (int index1 = 0; index1 < 4; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                }
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0.0f, 0.0f, 200, new Color(), 3.7f);
                    Main.dust[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index3].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.dust[index3].velocity *= 2f;
                    Main.dust[index3].noGravity = true;
                    Main.dust[index3].fadeIn = 2.5f;
                }
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0.0f, 0.0f, 0, new Color(), 2.7f);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                }
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 0, new Color(), 1.5f);
                    Main.dust[index2].position = Center + Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 3.14159274101257), Utils.ToRotation(velocity), new Vector2()) * width / 2f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                }
                for (int index1 = 0; index1 < 2; ++index1)
                {
                    int index2 = Gore.NewGore(position + new Vector2((width * Main.rand.Next(100)) / 100f, (height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index2].position = Center + Utils.RotatedByRandom(Vector2.UnitY, 3.14159274101257) * (float)Main.rand.NextDouble() * width / 2f;
                    Main.gore[index2].velocity *= 0.3f;
                    Main.gore[index2].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                }
            }
            if (type == 485)
            {
                for (int index1 = 0; index1 < 15; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 6, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity -= oldVelocity * Main.rand.Next(20, 60) * 0.01f;
                }
            }
            else if (type == 484)
            {
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 78, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity -= oldVelocity / 5f;
                    Main.dust[index2].scale = 0.85f;
                }
            }
            else if (type == 483)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                if (owner == Main.myPlayer)
                {
                    int length = Main.rand.Next(4, 8);
                    int[] numArray = new int[length];
                    int maxValue = 0;
                    for (int index = 0; index < 200; ++index)
                    {
                        if (Main.npc[index].CanBeChasedBy(this, true) && Collision.CanHitLine(position, width, height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
                        {
                            numArray[maxValue] = index;
                            ++maxValue;
                            if (maxValue == length)
                                break;
                        }
                    }
                    if (maxValue > 1)
                    {
                        for (int index1 = 0; index1 < 100; ++index1)
                        {
                            int index2 = Main.rand.Next(maxValue);
                            int index3 = index2;
                            while (index3 == index2)
                                index3 = Main.rand.Next(maxValue);
                            int num2 = numArray[index2];
                            numArray[index2] = numArray[index3];
                            numArray[index3] = num2;
                        }
                    }
                    Vector2 vector2_1 = new Vector2(-1f, -1f);
                    for (int index = 0; index < maxValue; ++index)
                    {
                        Vector2 vector2_2 = Main.npc[numArray[index]].Center - Center;
                        vector2_2.Normalize();
                        vector2_1 += vector2_2;
                    }
                    vector2_1.Normalize();
                    for (int index = 0; index < length; ++index)
                    {
                        float num2 = Main.rand.Next(8, 15);
                        Vector2 vector2_2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                        vector2_2.Normalize();
                        if (maxValue > 0)
                        {
                            vector2_2 += vector2_1;
                            vector2_2.Normalize();
                        }
                        vector2_2 *= num2;
                        if (maxValue > 0)
                        {
                            --maxValue;
                            vector2_2 = Main.npc[numArray[maxValue]].Center - Center;
                            vector2_2.Normalize();
                            vector2_2 *= num2;
                        }
                        NewProjectile(Center.X, Center.Y, vector2_2.X, vector2_2.Y, 484, (int)(damage * 0.7), knockBack * 0.7f, owner, 0.0f, 0.0f);
                    }
                }
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 78, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 4f;
                }
                for (int index1 = 0; index1 < 7; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index2].velocity *= 0.9f;
                    Main.dust[index2].scale = 0.9f;
                }
                for (int index1 = 0; index1 < 3; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index3].velocity *= 2f;
                }
                int index4 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                Main.gore[index4].velocity *= 0.3f;
                Main.gore[index4].velocity.X += Main.rand.Next(-1, 2);
                Main.gore[index4].velocity.Y += Main.rand.Next(-1, 2);
                if (owner == Main.myPlayer)
                {
                    int num2 = 100;
                    position.X -= (float)(num2 / 2);
                    position.Y -= (float)(num2 / 2);
                    width += num2;
                    ++height;
                    penetrate = -1;
                    Damage();
                }
            }
            if (type == 523)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 54);
                for (int index1 = 0; index1 < 25; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 256, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].position = (Main.dust[index2].position + position) / 2f;
                    Main.dust[index2].velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                    Main.dust[index2].velocity.Normalize();
                    Main.dust[index2].velocity *= Main.rand.Next(1, 30) * 0.1f;
                    Main.dust[index2].alpha = alpha;
                }
            }
            else if (type == 522)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 118);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 254, velocity.X * 0.1f, velocity.Y * 0.1f, 0, new Color(), 0.5f);
                    if (Main.rand.Next(3) == 0)
                    {
                        Main.dust[index2].fadeIn = (float)(0.75 + Main.rand.Next(-10, 11) * 0.00999999977648258);
                        Main.dust[index2].scale = (float)(0.25 + Main.rand.Next(-10, 11) * 0.00499999988824129);
                        ++Main.dust[index2].type;
                    }
                    else
                        Main.dust[index2].scale = (float)(1.0 + Main.rand.Next(-10, 11) * 0.00999999977648258);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 1.25f;
                    Main.dust[index2].velocity -= oldVelocity / 10f;
                }
            }
            else if (type == 521)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 110);
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 254, velocity.X * 0.1f, velocity.Y * 0.1f, 0, new Color(), 0.5f);
                    if (Main.rand.Next(3) == 0)
                    {
                        Main.dust[index2].fadeIn = (float)(1.10000002384186 + Main.rand.Next(-10, 11) * 0.00999999977648258);
                        Main.dust[index2].scale = (float)(0.349999994039536 + Main.rand.Next(-10, 11) * 0.00999999977648258);
                        ++Main.dust[index2].type;
                    }
                    else
                        Main.dust[index2].scale = (float)(1.20000004768372 + Main.rand.Next(-10, 11) * 0.00999999977648258);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 2.5f;
                    Main.dust[index2].velocity -= oldVelocity / 10f;
                }
                if (Main.myPlayer == owner)
                {
                    int num2 = Main.rand.Next(3, 6);
                    for (int index = 0; index < num2; ++index)
                    {
                        Vector2 vector2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                        while (vector2.X == 0.0 && vector2.Y == 0.0)
                            vector2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                        vector2.Normalize();
                        vector2 *= Main.rand.Next(70, 101) * 0.1f;
                        NewProjectile(oldPosition.X + (width / 2), oldPosition.Y + (height / 2), vector2.X, vector2.Y, 522, (int)(damage * 0.8), knockBack * 0.8f, owner, 0.0f, 0.0f);
                    }
                }
            }
            if (type == 520)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 50);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 252, velocity.X * 0.1f, velocity.Y * 0.1f, 0, new Color(), 0.75f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity -= oldVelocity / 3f;
                }
            }
            if (type == 459)
            {
                int num2 = 3;
                int num3 = 10;
                int num4 = 0;
                if (scale >= 1.0)
                {
                    position = Center;
                    width = height = 144;
                    Center = position;
                    num2 = 7;
                    num3 = 30;
                    num4 = 2;
                    Damage();
                }
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index2].position = Utils.RotatedBy(new Vector2((width / 2), 0.0f), 6.28318548202515 * (float)Main.rand.NextDouble(), new Vector2()) * (float)Main.rand.NextDouble() + Center;
                }
                for (int index1 = 0; index1 < num3; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 226, 0.0f, 0.0f, 0, new Color(), 1.5f);
                    Main.dust[index2].position = Utils.RotatedBy(new Vector2((width / 2), 0.0f), 6.28318548202515 * (float)Main.rand.NextDouble(), new Vector2()) * (float)Main.rand.NextDouble() + Center;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 1f;
                }
                for (int index1 = 0; index1 < num4; ++index1)
                {
                    int index2 = Gore.NewGore(position + new Vector2((width * Main.rand.Next(100)) / 100f, (height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index2].velocity *= 0.3f;
                    Main.gore[index2].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                }
            }
            if (owner != Main.myPlayer && type == 453 && Main.player[owner].mount.AbilityActive)
                Main.player[owner].mount.UseAbility(Main.player[owner], position, false);
            if (type == 441)
                Main.player[owner].mount.StopAbilityCharge();
            if (type == 444)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 96);
                int num2 = Main.rand.Next(5, 9);
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int index2 = Dust.NewDust(Center, 0, 0, 171, 0.0f, 0.0f, 100, new Color(), 1.4f);
                    Main.dust[index2].velocity *= 0.8f;
                    Main.dust[index2].position = Vector2.Lerp(Main.dust[index2].position, Center, 0.5f);
                    Main.dust[index2].noGravity = true;
                }
                if (owner == Main.myPlayer)
                {
                    Vector2 vector2_1 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY);
                    if (Main.player[owner].gravDir == -1.0)
                        vector2_1.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y;
                    Vector2 vector2_2 = Vector2.Normalize(vector2_1 - Center) * localAI[1];
                    NewProjectile(Center.X, Center.Y, vector2_2.X, vector2_2.Y, (int)localAI[0], damage, knockBack, owner, 0.0f, 0.0f);
                }
            }
            if (type == 472)
            {
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 30, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 0.45f;
                    Main.dust[index2].velocity += velocity * 0.9f;
                }
            }
            if (type == 639 || type == 640)
            {
                int num2 = Main.rand.Next(5, 10);
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int index2 = Dust.NewDust(Center, 0, 0, 220, 0.0f, 0.0f, 100, new Color(), 0.5f);
                    Main.dust[index2].velocity *= 1.6f;
                    --Main.dust[index2].velocity.Y;
                    Main.dust[index2].position = Vector2.Lerp(Main.dust[index2].position, Center, 0.5f);
                    Main.dust[index2].noGravity = true;
                }
                if (owner == Main.myPlayer && type == 639)
                {
                    int num3 = num1 + 1;
                    int nextSlot = Projectile.GetNextSlot();
                    if (Main.ProjectileUpdateLoopIndex < nextSlot && Main.ProjectileUpdateLoopIndex != -1)
                        ++num3;
                    Vector2 vector2 = new Vector2(ai[0], ai[1]);
                    NewProjectile(localAI[0], localAI[1], vector2.X, vector2.Y, 640, damage, knockBack, owner, 0.0f, num3);
                }
            }
            if (type == 435)
            {
                int num2 = Main.rand.Next(5, 10);
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int index2 = Dust.NewDust(Center, 0, 0, 226, 0.0f, 0.0f, 100, new Color(), 0.5f);
                    Main.dust[index2].velocity *= 1.6f;
                    --Main.dust[index2].velocity.Y;
                    Main.dust[index2].position = Vector2.Lerp(Main.dust[index2].position, Center, 0.5f);
                    Main.dust[index2].noGravity = true;
                }
            }
            if (type == 436)
            {
                int num2 = Main.rand.Next(5, 10);
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int index2 = Dust.NewDust(Center, 0, 0, 220, 0.0f, 0.0f, 100, new Color(), 0.5f);
                    Main.dust[index2].velocity *= 1.6f;
                    --Main.dust[index2].velocity.Y;
                    Main.dust[index2].position = Vector2.Lerp(Main.dust[index2].position, Center, 0.5f);
                    Main.dust[index2].noGravity = true;
                }
            }
            if (type == 462)
            {
                int num2 = Main.rand.Next(5, 10);
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int index2 = Dust.NewDust(Center, 0, 0, 229, 0.0f, 0.0f, 100, new Color(), 0.5f);
                    Main.dust[index2].velocity *= 1.6f;
                    --Main.dust[index2].velocity.Y;
                    Main.dust[index2].position -= Vector2.One * 4f;
                    Main.dust[index2].position = Vector2.Lerp(Main.dust[index2].position, Center, 0.5f);
                    Main.dust[index2].noGravity = true;
                }
            }
            if (type == 442)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 94);
                int num2 = Main.rand.Next(3, 7);
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 135, 0.0f, 0.0f, 100, new Color(), 2.1f);
                    Main.dust[index2].velocity *= 2f;
                    Main.dust[index2].noGravity = true;
                }
                if (Main.myPlayer == owner)
                {
                    Rectangle rectangle = new Rectangle((int)Center.X - 40, (int)Center.Y - 40, 80, 80);
                    for (int index = 0; index < 1000; ++index)
                    {
                        if (index != whoAmI && Main.projectile[index].active && (Main.projectile[index].owner == owner && Main.projectile[index].type == 443) && Main.projectile[index].getRect().Intersects(rectangle))
                        {
                            Main.projectile[index].ai[1] = 1f;
                            Main.projectile[index].velocity = (Center - Main.projectile[index].Center) / 5f;
                            Main.projectile[index].netUpdate = true;
                        }
                    }
                    NewProjectile(Center.X, Center.Y, 0.0f, 0.0f, 443, damage, 0.0f, owner, 0.0f, 0.0f);
                }
            }
            if (type == 440)
            {
                int num2 = Main.rand.Next(3, 7);
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int index2 = Dust.NewDust(Center - velocity / 2f, 0, 0, 135, 0.0f, 0.0f, 100, new Color(), 2.1f);
                    Main.dust[index2].velocity *= 2f;
                    Main.dust[index2].noGravity = true;
                }
            }
            if (type == 606)
            {
                int num2 = Main.rand.Next(3, 7);
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int index2 = Dust.NewDust(Center - velocity / 2f, 0, 0, 182, 0.0f, 0.0f, 100, new Color(), 1.6f);
                    Main.dust[index2].velocity *= 1.5f;
                    Main.dust[index2].noGravity = true;
                }
            }
            if (type == 449)
            {
                int num2 = Main.rand.Next(3, 7);
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int index2 = Dust.NewDust(Center - velocity / 2f, 0, 0, 228, 0.0f, 0.0f, 100, new Color(), 2.1f);
                    Main.dust[index2].velocity *= 2f;
                    Main.dust[index2].noGravity = true;
                }
            }
            if (type == 495)
            {
                for (int index1 = 0; index1 < 15; ++index1)
                {
                    int index2 = Dust.NewDust(Center, 10, 10, 27, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity -= oldVelocity * 0.3f;
                }
            }
            if (type == 497)
            {
                for (int index1 = 0; index1 < 15; ++index1)
                {
                    int index2 = Dust.NewDust(Center, 10, 10, 27, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 2f;
                    Main.dust[index2].velocity -= oldVelocity * 0.3f;
                    Main.dust[index2].scale += Main.rand.Next(150) * (1.0f / 1000.0f);
                }
            }
            if (type == 448)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                position = Center;
                width = height = 112;
                position.X -= (width / 2);
                position.Y -= (height / 2);
                for (int index = 0; index < 4; ++index)
                    Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                for (int index1 = 0; index1 < 40; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0.0f, 0.0f, 0, new Color(), 2.5f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index3].velocity *= 2f;
                    Main.dust[index3].noGravity = true;
                }
                for (int index1 = 0; index1 < 1; ++index1)
                {
                    int index2 = Gore.NewGore(position + new Vector2((width * Main.rand.Next(100)) / 100f, (height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index2].velocity *= 0.3f;
                    Main.gore[index2].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                }
                Damage();
            }
            if (type == 616)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                position = Center;
                width = height = 80;
                position.X -= (width / 2);
                position.Y -= (height / 2);
                for (int index = 0; index < 4; ++index)
                    Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                for (int index1 = 0; index1 < 40; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0.0f, 0.0f, 200, new Color(), 2.5f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 2f;
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0.0f, 0.0f, 200, new Color(), 1.5f);
                    Main.dust[index3].velocity *= 1.2f;
                    Main.dust[index3].noGravity = true;
                }
                for (int index1 = 0; index1 < 1; ++index1)
                {
                    int index2 = Gore.NewGore(position + new Vector2((width * Main.rand.Next(100)) / 100f, (height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index2].velocity *= 0.3f;
                    Main.gore[index2].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                }
                Damage();
            }
            if (type == 502)
            {
                Vector2 vector2 = new Vector2(width, height) / 2f;
                for (int index1 = 0; index1 < oldPos.Length; ++index1)
                {
                    if (!(oldPos[index1] == Vector2.Zero))
                    {
                        int index2 = Dust.NewDust(oldPos[index1] + vector2, 0, 0, 66, 0.0f, 0.0f, 150, Color.Transparent, 0.7f);
                        Main.dust[index2].color = Main.hslToRgb(Utils.NextFloat(Main.rand), 1f, 0.5f);
                        Main.dust[index2].noGravity = true;
                    }
                }
            }
            if (type == 510)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 107);
                Gore.NewGore(Center, -oldVelocity * 0.2f, 704, 1f);
                Gore.NewGore(Center, -oldVelocity * 0.2f, 705, 1f);
                if (owner == Main.myPlayer)
                {
                    int num2 = Main.rand.Next(20, 31);
                    for (int index = 0; index < num2; ++index)
                    {
                        Vector2 vector2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                        vector2.Normalize();
                        vector2 *= Main.rand.Next(10, 201) * 0.01f;
                        NewProjectile(Center.X, Center.Y, vector2.X, vector2.Y, 511 + Main.rand.Next(3), damage, 1f, owner, 0.0f, Main.rand.Next(-45, 1));
                    }
                }
            }
            if (type == 408)
            {
                for (int index1 = 0; index1 < 15; ++index1)
                {
                    int index2 = Dust.NewDust(Center - Vector2.One * 10f, 50, 50, 5, 0.0f, -2f, 0, new Color(), 1f);
                    Main.dust[index2].velocity /= 2f;
                }
                int num2 = 10;
                int index3 = Gore.NewGore(Center, velocity * 0.8f, 584, 1f);
                Main.gore[index3].timeLeft /= num2;
                int index4 = Gore.NewGore(Center, velocity * 0.9f, 585, 1f);
                Main.gore[index4].timeLeft /= num2;
                int index5 = Gore.NewGore(Center, velocity * 1f, 586, 1f);
                Main.gore[index5].timeLeft /= num2;
            }
            if (type == 385)
            {
                Main.PlaySound(4, (int)Center.X, (int)Center.Y, 19);
                int num2 = 36;
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    Vector2 vector2_1 = Utils.RotatedBy(Vector2.Normalize(velocity) * new Vector2(width / 2f, height) * 0.75f, (double)(index1 - (num2 / 2 - 1)) * 6.28318548202515 / num2, new Vector2()) + Center;
                    Vector2 vector2_2 = vector2_1 - Center;
                    int index2 = Dust.NewDust(vector2_1 + vector2_2, 0, 0, 172, vector2_2.X * 2f, vector2_2.Y * 2f, 100, new Color(), 1.4f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].noLight = true;
                    Main.dust[index2].velocity = vector2_2;
                }
                if (owner == Main.myPlayer)
                {
                    if (ai[1] < 1.0)
                    {
                        int index = NewProjectile(Center.X - (direction * 30), Center.Y - 4f, (float)-direction * 0.01f, 0.0f, 384, Main.expertMode ? 25 : 40, 4f, owner, 16f, 15f);
                        Main.projectile[index].netUpdate = true;
                    }
                    else
                    {
                        int num3 = (int)(Center.Y / 16.0);
                        int index1 = (int)(Center.X / 16.0);
                        int num4 = 100;
                        if (index1 < 10)
                            index1 = 10;
                        if (index1 > Main.maxTilesX - 10)
                            index1 = Main.maxTilesX - 10;
                        if (num3 < 10)
                            num3 = 10;
                        if (num3 > Main.maxTilesY - num4 - 10)
                            num3 = Main.maxTilesY - num4 - 10;
                        for (int index2 = num3; index2 < num3 + num4; ++index2)
                        {
                            Tile tile = Main.tile[index1, index2];
                            if (tile.active() && (Main.tileSolid[(int)tile.type] || (int)tile.liquid != 0))
                            {
                                num3 = index2;
                                break;
                            }
                        }
                        int Damage = Main.expertMode ? 50 : 80;
                        int index3 = NewProjectile((float)(index1 * 16 + 8), (float)(num3 * 16 - 24), 0.0f, 0.0f, 386, Damage, 4f, Main.myPlayer, 16f, 24f);
                        Main.projectile[index3].netUpdate = true;
                    }
                }
            }
            else if (type >= 424 && type <= 426)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 89);
                position.X += (width / 2);
                position.Y += (height / 2);
                width = (int)(128.0 * scale);
                height = (int)(128.0 * scale);
                position.X -= (width / 2);
                position.Y -= (height / 2);
                for (int index = 0; index < 8; ++index)
                    Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                for (int index1 = 0; index1 < 32; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 3f;
                    int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index3].velocity *= 2f;
                    Main.dust[index3].noGravity = true;
                }
                for (int index1 = 0; index1 < 2; ++index1)
                {
                    int index2 = Gore.NewGore(position + new Vector2((width * Main.rand.Next(100)) / 100f, (height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index2].velocity *= 0.3f;
                    Main.gore[index2].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                }
                if (owner == Main.myPlayer)
                {
                    localAI[1] = -1f;
                    maxPenetrate = 0;
                    Damage();
                }
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, Utils.SelectRandom<int>(Main.rand, 6, 259, 158), 2.5f * direction, -2.5f, 0, new Color(), 1f);
                    Main.dust[index2].alpha = 200;
                    Main.dust[index2].velocity *= 2.4f;
                    Main.dust[index2].scale += Utils.NextFloat(Main.rand);
                }
            }
            if (type == 399)
            {
                Main.PlaySound(13, (int)position.X, (int)position.Y, 1);
                Vector2 vector2 = new Vector2(20f, 20f);
                for (int index = 0; index < 5; ++index)
                    Dust.NewDust(Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, 12, 0.0f, 0.0f, 0, Color.Red, 1f);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index2].velocity *= 1.4f;
                }
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, 6, 0.0f, 0.0f, 100, new Color(), 2.5f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 5f;
                    int index3 = Dust.NewDust(Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[index3].velocity *= 3f;
                }
                if (Main.myPlayer == owner)
                {
                    for (int index = 0; index < 6; ++index)
                    {
                        float SpeedX = (float)(-velocity.X * Main.rand.Next(20, 50) * 0.00999999977648258 + Main.rand.Next(-20, 21) * 0.400000005960464);
                        float SpeedY = (float)(-Math.Abs(velocity.Y) * Main.rand.Next(30, 50) * 0.00999999977648258 + Main.rand.Next(-20, 5) * 0.400000005960464);
                        NewProjectile(Center.X + SpeedX, Center.Y + SpeedY, SpeedX, SpeedY, 400 + Main.rand.Next(3), (int)(damage * 0.5), 0.0f, owner, 0.0f, 0.0f);
                    }
                }
            }
            if (type == 384 || type == 386)
            {
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 212, (direction * 2), 0.0f, 100, new Color(), 1.4f);
                    Dust dust = Main.dust[index2];
                    dust.color = Color.CornflowerBlue;
                    dust.color = Color.Lerp(dust.color, Color.White, 0.3f);
                    dust.noGravity = true;
                }
            }
            if (type == 507 || type == 508)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                Vector2 vector2_1 = position;
                Vector2 vector2_2 = oldVelocity;
                vector2_2.Normalize();
                Vector2 Position = vector2_1 + vector2_2 * 16f;
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(Position, width, height, 81, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].position = (Main.dust[index2].position + Center) / 2f;
                    Main.dust[index2].velocity += oldVelocity * 0.4f;
                    Main.dust[index2].velocity *= 0.5f;
                    Main.dust[index2].noGravity = true;
                    Position -= vector2_2 * 8f;
                }
            }
            if (type == 598)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                Vector2 vector2_1 = position;
                Vector2 vector2_2 = Utils.ToRotationVector2(rotation - 1.570796f);
                Vector2 Position = vector2_1 + vector2_2 * 16f;
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(Position, width, height, 81, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].position = (Main.dust[index2].position + Center) / 2f;
                    Main.dust[index2].velocity += vector2_2 * 2f;
                    Main.dust[index2].velocity *= 0.5f;
                    Main.dust[index2].noGravity = true;
                    Position -= vector2_2 * 8f;
                }
            }
            if (type == 1 || type == 81 || type == 98)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index = 0; index < 10; ++index)
                    Dust.NewDust(new Vector2(position.X, position.Y), width, height, 7, 0.0f, 0.0f, 0, new Color(), 1f);
            }
            if (type == 336 || type == 345)
            {
                for (int index1 = 0; index1 < 6; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 196, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].scale = scale;
                }
            }
            if (type == 358)
            {
                velocity = oldVelocity * 0.2f;
                for (int index1 = 0; index1 < 100; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 211, 0.0f, 0.0f, 75, new Color(), 1.2f);
                    if (Main.rand.Next(2) == 0)
                        Main.dust[index2].alpha += 25;
                    if (Main.rand.Next(2) == 0)
                        Main.dust[index2].alpha += 25;
                    if (Main.rand.Next(2) == 0)
                        Main.dust[index2].alpha += 25;
                    if (Main.rand.Next(2) == 0)
                        Main.dust[index2].scale = 0.6f;
                    else
                        Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 0.3f;
                    Main.dust[index2].velocity += velocity;
                    Main.dust[index2].velocity *= (float)(1.0 + Main.rand.Next(-100, 101) * 0.00999999977648258);
                    Main.dust[index2].velocity.X += Main.rand.Next(-50, 51) * 0.015f;
                    Main.dust[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.015f;
                    Main.dust[index2].position = Center;
                }
            }
            if (type == 406)
            {
                int Alpha = 175;
                Color newColor = new Color(0, 80, 255, 100);
                velocity = oldVelocity * 0.2f;
                for (int index1 = 0; index1 < 40; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 4, 0.0f, 0.0f, Alpha, newColor, 1.6f);
                    if (Main.rand.Next(2) == 0)
                        Main.dust[index2].alpha += 25;
                    if (Main.rand.Next(2) == 0)
                        Main.dust[index2].alpha += 25;
                    if (Main.rand.Next(2) == 0)
                        Main.dust[index2].alpha += 25;
                    if (Main.rand.Next(2) == 0)
                        Main.dust[index2].scale = 0.6f;
                    else
                        Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 0.3f;
                    Main.dust[index2].velocity += velocity;
                    Main.dust[index2].velocity *= (float)(1.0 + Main.rand.Next(-100, 101) * 0.00999999977648258);
                    Main.dust[index2].velocity.X += Main.rand.Next(-50, 51) * 0.015f;
                    Main.dust[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.015f;
                    Main.dust[index2].position = Center;
                }
            }
            if (type == 344)
            {
                for (int index1 = 0; index1 < 3; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 197, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].scale = scale;
                }
            }
            else if (type == 343)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 27);
                for (int index1 = 4; index1 < 31; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(oldPosition.X - oldVelocity.X * (30f / index1), oldPosition.Y - oldVelocity.Y * (30f / index1)), 8, 8, 197, oldVelocity.X, oldVelocity.Y, 100, new Color(), 1.2f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 0.5f;
                }
            }
            else if (type == 349)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 27);
                for (int index1 = 0; index1 < 3; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 76, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].noLight = true;
                    Main.dust[index2].scale = 0.7f;
                }
            }
            if (type == 323)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index1 = 0; index1 < 20; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 7, 0.0f, 0.0f, 0, new Color(), 1f);
                    if (Main.rand.Next(2) == 0)
                    {
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].scale = 1.3f;
                        Main.dust[index2].velocity *= 1.5f;
                        Main.dust[index2].velocity -= oldVelocity * 0.5f;
                        Main.dust[index2].velocity *= 1.5f;
                    }
                    else
                    {
                        Main.dust[index2].velocity *= 0.75f;
                        Main.dust[index2].velocity -= oldVelocity * 0.25f;
                        Main.dust[index2].scale = 0.8f;
                    }
                }
            }
            if (type == 589)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 27);
                Color newColor = Color.Red;
                if (ai[1] == 1.0)
                    newColor = Color.Green;
                if (ai[1] == 2.0)
                    newColor = Color.Purple;
                if (ai[1] == 3.0)
                    newColor = Color.Gold;
                if (ai[1] == 4.0)
                    newColor = Color.White;
                newColor.A = (byte)100;
                for (int index1 = 0; index1 < 30; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 11, 0.0f, 0.0f, 0, newColor, 1f);
                    Main.dust[index2].velocity *= (float)(1.0 + (double)Utils.NextFloat(Main.rand) * 1.0);
                    if (index1 < 10)
                    {
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 0.5f;
                    }
                }
            }
            if (type == 346)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 27);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int Type = 10;
                    if (ai[1] == 1.0)
                        Type = 4;
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, Type, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                }
            }
            if (type == 335)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 27);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 90 - (int)ai[1], 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noLight = true;
                    Main.dust[index2].scale = 0.8f;
                }
            }
            if (type == 318)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 30, 0.0f, 0.0f, 0, new Color(), 1f);
                    if (Main.rand.Next(2) == 0)
                        Main.dust[index2].noGravity = true;
                }
            }
            if (type == 378)
            {
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 30, 0.0f, 0.0f, 0, new Color(), 1f);
                    if (Main.rand.Next(2) == 0)
                        Main.dust[index2].noGravity = true;
                }
            }
            else if (type == 311)
            {
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 189, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].scale = 0.85f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity += velocity * 0.5f;
                }
            }
            else if (type == 316)
            {
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 195, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].scale = 0.85f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity += velocity * 0.5f;
                }
            }
            else if (type == 184 || type == 195)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index = 0; index < 5; ++index)
                    Dust.NewDust(new Vector2(position.X, position.Y), width, height, 7, 0.0f, 0.0f, 0, new Color(), 1f);
            }
            else if (type == 275 || type == 276)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index = 0; index < 5; ++index)
                    Dust.NewDust(new Vector2(position.X, position.Y), width, height, 7, 0.0f, 0.0f, 0, new Color(), 1f);
            }
            else if (type == 291)
            {
                if (owner == Main.myPlayer)
                    NewProjectile(Center.X, Center.Y, 0.0f, 0.0f, 292, damage, knockBack, owner, 0.0f, 0.0f);
            }
            else if (type == 295)
            {
                if (owner == Main.myPlayer)
                    NewProjectile(Center.X, Center.Y, 0.0f, 0.0f, 296, (int)(damage * 0.65), knockBack, owner, 0.0f, 0.0f);
            }
            else if (type == 270)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 27);
                if (ai[0] < 0.0)
                {
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(position, width, height, 26, 0.0f, 0.0f, 100, new Color(), 1f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 1.2f;
                        Main.dust[index2].scale = 1.3f;
                        Main.dust[index2].velocity -= oldVelocity * 0.3f;
                        int index3 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 5, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index3].noGravity = true;
                        Main.dust[index3].velocity *= 3f;
                    }
                }
                else
                {
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(position, width, height, 26, 0.0f, 0.0f, 100, new Color(), 1f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 1.2f;
                        Main.dust[index2].scale = 1.3f;
                        Main.dust[index2].velocity -= oldVelocity * 0.3f;
                        int index3 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 6, 0.0f, 0.0f, 100, new Color(), 2f);
                        Main.dust[index3].noGravity = true;
                        Main.dust[index3].velocity *= 3f;
                    }
                }
            }
            else if (type == 265)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 27);
                for (int index1 = 0; index1 < 15; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 163, 0.0f, 0.0f, 100, new Color(), 1.2f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 1.2f;
                    Main.dust[index2].velocity -= oldVelocity * 0.3f;
                }
            }
            else if (type == 355)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 27);
                for (int index1 = 0; index1 < 15; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 205, 0.0f, 0.0f, 100, new Color(), 1.2f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 1.2f;
                    Main.dust[index2].velocity -= oldVelocity * 0.3f;
                }
            }
            else if (type == 304)
            {
                for (int index1 = 0; index1 < 3; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 182, 0.0f, 0.0f, 100, new Color(), 0.8f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 1.2f;
                    Main.dust[index2].velocity -= oldVelocity * 0.3f;
                }
            }
            else if (type == 263)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 27);
                for (int index1 = 0; index1 < 15; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 92, velocity.X, velocity.Y, Main.rand.Next(0, 101), new Color(), (float)(1.0 + Main.rand.Next(40) * 0.00999999977648258));
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 2f;
                }
            }
            else if (type == 261)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index = 0; index < 5; ++index)
                    Dust.NewDust(new Vector2(position.X, position.Y), width, height, 148, 0.0f, 0.0f, 0, new Color(), 1f);
            }
            else if (type == 229)
            {
                for (int index1 = 0; index1 < 25; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 157, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 1.5f;
                    Main.dust[index2].scale = 1.5f;
                }
            }
            else if (type == 239)
            {
                int index = Dust.NewDust(new Vector2(position.X, (float)(position.Y + (double)height - 2.0)), 2, 2, 154, 0.0f, 0.0f, 0, new Color(), 1f);
                Main.dust[index].position.X -= 2f;
                Main.dust[index].alpha = 38;
                Main.dust[index].velocity *= 0.1f;
                Main.dust[index].velocity += -oldVelocity * 0.25f;
                Main.dust[index].scale = 0.95f;
            }
            else if (type == 245)
            {
                int index = Dust.NewDust(new Vector2(position.X, (float)(position.Y + (double)height - 2.0)), 2, 2, 114, 0.0f, 0.0f, 0, new Color(), 1f);
                Main.dust[index].noGravity = true;
                Main.dust[index].position.X -= 2f;
                Main.dust[index].alpha = 38;
                Main.dust[index].velocity *= 0.1f;
                Main.dust[index].velocity += -oldVelocity * 0.25f;
                Main.dust[index].scale = 0.95f;
            }
            else if (type == 264)
            {
                int index = Dust.NewDust(new Vector2(position.X, (float)(position.Y + (double)height - 2.0)), 2, 2, 54, 0.0f, 0.0f, 0, new Color(), 1f);
                Main.dust[index].noGravity = true;
                Main.dust[index].position.X -= 2f;
                Main.dust[index].alpha = 38;
                Main.dust[index].velocity *= 0.1f;
                Main.dust[index].velocity += -oldVelocity * 0.25f;
                Main.dust[index].scale = 0.95f;
            }
            else if (type == 206 || type == 225)
            {
                Main.PlaySound(6, (int)position.X, (int)position.Y, 1);
                for (int index = 0; index < 5; ++index)
                    Dust.NewDust(new Vector2(position.X, position.Y), width, height, 40, 0.0f, 0.0f, 0, new Color(), 1f);
            }
            else if (type == 227)
            {
                Main.PlaySound(6, (int)position.X, (int)position.Y, 1);
                for (int index1 = 0; index1 < 15; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 157, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity += oldVelocity;
                    Main.dust[index2].scale = 1.5f;
                }
            }
            else if (type == 237 && owner == Main.myPlayer)
                NewProjectile(Center.X, Center.Y, 0.0f, 0.0f, 238, damage, knockBack, owner, 0.0f, 0.0f);
            else if (type == 243 && owner == Main.myPlayer)
                NewProjectile(Center.X, Center.Y, 0.0f, 0.0f, 244, damage, knockBack, owner, 0.0f, 0.0f);
            else if (type == 120)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X - velocity.X, position.Y - velocity.Y), width, height, 67, velocity.X, velocity.Y, 100, new Color(), 1f);
                    if (index1 < 5)
                        Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 0.2f;
                }
            }
            else if (type == 181 || type == 189 || type == 566)
            {
                for (int index1 = 0; index1 < 6; ++index1)
                {
                    int index2 = Dust.NewDust(position, width, height, 150, velocity.X, velocity.Y, 50, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].scale = 1f;
                }
            }
            else if (type == 178)
            {
                for (int index1 = 0; index1 < 85; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, Main.rand.Next(139, 143), velocity.X, velocity.Y, 0, new Color(), 1.2f);
                    Main.dust[index2].velocity.X += Main.rand.Next(-50, 51) * 0.01f;
                    Main.dust[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.01f;
                    Main.dust[index2].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                    Main.dust[index2].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                    Main.dust[index2].velocity.X += Main.rand.Next(-50, 51) * 0.05f;
                    Main.dust[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.05f;
                    Main.dust[index2].scale *= (float)(1.0 + Main.rand.Next(-30, 31) * 0.00999999977648258);
                }
                for (int index1 = 0; index1 < 40; ++index1)
                {
                    int index2 = Gore.NewGore(position, velocity, Main.rand.Next(276, 283), 1f);
                    Main.gore[index2].velocity.X += Main.rand.Next(-50, 51) * 0.01f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.01f;
                    Main.gore[index2].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                    Main.gore[index2].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                    Main.gore[index2].scale *= (float)(1.0 + Main.rand.Next(-20, 21) * 0.00999999977648258);
                    Main.gore[index2].velocity.X += Main.rand.Next(-50, 51) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.05f;
                }
            }
            else if (type == 289)
            {
                for (int index1 = 0; index1 < 30; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, Main.rand.Next(139, 143), velocity.X, velocity.Y, 0, new Color(), 1.2f);
                    Main.dust[index2].velocity.X += Main.rand.Next(-50, 51) * 0.01f;
                    Main.dust[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.01f;
                    Main.dust[index2].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                    Main.dust[index2].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                    Main.dust[index2].velocity.X += Main.rand.Next(-50, 51) * 0.05f;
                    Main.dust[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.05f;
                    Main.dust[index2].scale *= (float)(1.0 + Main.rand.Next(-30, 31) * 0.00999999977648258);
                }
                for (int index1 = 0; index1 < 15; ++index1)
                {
                    int index2 = Gore.NewGore(position, velocity, Main.rand.Next(276, 283), 1f);
                    Main.gore[index2].velocity.X += Main.rand.Next(-50, 51) * 0.01f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.01f;
                    Main.gore[index2].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                    Main.gore[index2].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                    Main.gore[index2].scale *= (float)(1.0 + Main.rand.Next(-20, 21) * 0.00999999977648258);
                    Main.gore[index2].velocity.X += Main.rand.Next(-50, 51) * 0.05f;
                    Main.gore[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.05f;
                }
            }
            else if (type == 475 || type == 505 || type == 506)
            {
                if (ai[1] == 0.0)
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                if (ai[1] < 10.0)
                {
                    Vector2 Position = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
                    float num2 = -velocity.X;
                    float num3 = -velocity.Y;
                    float num4 = 1f;
                    if (ai[0] <= 17.0)
                        num4 = ai[0] / 17f;
                    int num5 = (int)(30.0 * num4);
                    float num6 = 1f;
                    if (ai[0] <= 30.0)
                        num6 = ai[0] / 30f;
                    float num7 = 0.4f * num6;
                    float num8 = num7;
                    float num9 = num3 + num8;
                    for (int index1 = 0; index1 < num5; ++index1)
                    {
                        float num10 = (float)Math.Sqrt(num2 * num2 + num9 * num9);
                        float num11 = 5.6f;
                        if (Math.Abs(num2) + Math.Abs(num9) < 1.0)
                            num11 *= Math.Abs(num2) + Math.Abs(num9) / 1f;
                        float num12 = num11 / num10;
                        float num13 = num2 * num12;
                        float num14 = num9 * num12;
                        Math.Atan2(num14, num13);
                        int Type = 3;
                        if (type == 506)
                            Type = 30;
                        if (type == 505)
                            Type = 239;
                        if ((double)index1 > ai[1])
                        {
                            for (int index2 = 0; index2 < 4; ++index2)
                            {
                                int index3 = Dust.NewDust(Position, width, height, Type, 0.0f, 0.0f, 0, new Color(), 1f);
                                Main.dust[index3].noGravity = true;
                                Main.dust[index3].velocity *= 0.3f;
                            }
                        }
                        Position.X += num13;
                        Position.Y += num14;
                        num2 = -velocity.X;
                        float num15 = -velocity.Y;
                        num8 += num7;
                        num9 = num15 + num8;
                    }
                }
            }
            else if (type == 171)
            {
                if (ai[1] == 0.0)
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                if (ai[1] < 10.0)
                {
                    Vector2 Position = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
                    float num2 = -velocity.X;
                    float num3 = -velocity.Y;
                    float num4 = 1f;
                    if (ai[0] <= 17.0)
                        num4 = ai[0] / 17f;
                    int num5 = (int)(30.0 * num4);
                    float num6 = 1f;
                    if (ai[0] <= 30.0)
                        num6 = ai[0] / 30f;
                    float num7 = 0.4f * num6;
                    float num8 = num7;
                    float num9 = num3 + num8;
                    for (int index1 = 0; index1 < num5; ++index1)
                    {
                        float num10 = (float)Math.Sqrt(num2 * num2 + num9 * num9);
                        float num11 = 5.6f;
                        if (Math.Abs(num2) + Math.Abs(num9) < 1.0)
                            num11 *= Math.Abs(num2) + Math.Abs(num9) / 1f;
                        float num12 = num11 / num10;
                        float num13 = num2 * num12;
                        float num14 = num9 * num12;
                        Math.Atan2(num14, num13);
                        if ((double)index1 > ai[1])
                        {
                            for (int index2 = 0; index2 < 4; ++index2)
                            {
                                int index3 = Dust.NewDust(Position, width, height, 129, 0.0f, 0.0f, 0, new Color(), 1f);
                                Main.dust[index3].noGravity = true;
                                Main.dust[index3].velocity *= 0.3f;
                            }
                        }
                        Position.X += num13;
                        Position.Y += num14;
                        num2 = -velocity.X;
                        float num15 = -velocity.Y;
                        num8 += num7;
                        num9 = num15 + num8;
                    }
                }
            }
            else if (type == 117)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index = 0; index < 10; ++index)
                    Dust.NewDust(new Vector2(position.X, position.Y), width, height, 26, 0.0f, 0.0f, 0, new Color(), 1f);
            }
            else if (type == 166)
            {
                Main.PlaySound(2, (int)position.X, (int)position.Y, 51);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 76, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity -= oldVelocity * 0.25f;
                }
            }
            else if (type == 158)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 9, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity -= velocity * 0.5f;
                }
            }
            else if (type == 159)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 11, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity -= velocity * 0.5f;
                }
            }
            else if (type == 160)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 19, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity -= velocity * 0.5f;
                }
            }
            else if (type == 161)
            {
                Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 11, 0.0f, 0.0f, 0, new Color(), 1f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity -= velocity * 0.5f;
                }
            }
            else if (type >= 191 && type <= 194)
            {
                int index = Gore.NewGore(new Vector2(position.X - (width / 2), position.Y - (height / 2)), new Vector2(0.0f, 0.0f), Main.rand.Next(61, 64), scale);
                Main.gore[index].velocity *= 0.1f;
            }
            else if (!Main.projPet[type])
            {
                if (type == 93)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 10; ++index1)
                    {
                        int index2 = Dust.NewDust(position, width, height, 57, 0.0f, 0.0f, 100, new Color(), 0.5f);
                        Main.dust[index2].velocity.X *= 2f;
                        Main.dust[index2].velocity.Y *= 2f;
                    }
                }
                else if (type == 99)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 30; ++index1)
                    {
                        int index2 = Dust.NewDust(position, width, height, 1, 0.0f, 0.0f, 0, new Color(), 1f);
                        if (Main.rand.Next(2) == 0)
                            Main.dust[index2].scale *= 1.4f;
                        Projectile projectile = this;
                        Vector2 vector2 = projectile.velocity * 1.9f;
                        projectile.velocity = vector2;
                    }
                }
                else if (type == 91 || type == 92)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index = 0; index < 10; ++index)
                        Dust.NewDust(position, width, height, 58, velocity.X * 0.1f, velocity.Y * 0.1f, 150, new Color(), 1.2f);
                    for (int index = 0; index < 3; ++index)
                        Gore.NewGore(position, new Vector2(velocity.X * 0.05f, velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f);
                    if (type == 12 && damage < 500)
                    {
                        for (int index = 0; index < 10; ++index)
                            Dust.NewDust(position, width, height, 57, velocity.X * 0.1f, velocity.Y * 0.1f, 150, new Color(), 1.2f);
                        for (int index = 0; index < 3; ++index)
                            Gore.NewGore(position, new Vector2(velocity.X * 0.05f, velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f);
                    }
                    if ((type == 91 || type == 92 && ai[0] > 0.0) && owner == Main.myPlayer)
                    {
                        float num2 = position.X + Main.rand.Next(-400, 400);
                        float num3 = position.Y - Main.rand.Next(600, 900);
                        Vector2 vector2 = new Vector2(num2, num3);
                        float num4 = position.X + (width / 2) - vector2.X;
                        float num5 = position.Y + (height / 2) - vector2.Y;
                        float num6 = 22f / (float)Math.Sqrt(num4 * num4 + num5 * num5);
                        float SpeedX = num4 * num6;
                        float SpeedY = num5 * num6;
                        int Damage = damage;
                        int index = NewProjectile(num2, num3, SpeedX, SpeedY, 92, Damage, knockBack, owner, 0.0f, 0.0f);
                        if (type == 91)
                        {
                            Main.projectile[index].ai[1] = position.Y;
                            Main.projectile[index].ai[0] = 1f;
                        }
                        else
                            Main.projectile[index].ai[1] = position.Y;
                    }
                }
                else if (type == 89)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 68, 0.0f, 0.0f, 0, new Color(), 1f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 1.5f;
                        Main.dust[index2].scale *= 0.9f;
                    }
                    if (type == 89 && owner == Main.myPlayer)
                    {
                        for (int index = 0; index < 3; ++index)
                        {
                            float SpeedX = (float)(-velocity.X * Main.rand.Next(40, 70) * 0.00999999977648258 + Main.rand.Next(-20, 21) * 0.400000005960464);
                            float SpeedY = (float)(-velocity.Y * Main.rand.Next(40, 70) * 0.00999999977648258 + Main.rand.Next(-20, 21) * 0.400000005960464);
                            NewProjectile(position.X + SpeedX, position.Y + SpeedY, SpeedX, SpeedY, 90, (int)(damage * 0.5), 0.0f, owner, 0.0f, 0.0f);
                        }
                    }
                }
                else if (type == 177)
                {
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 137, 0.0f, 0.0f, Main.rand.Next(0, 101), new Color(), (float)(1.0 + Main.rand.Next(-20, 40) * 0.00999999977648258));
                        Main.dust[index2].velocity -= oldVelocity * 0.2f;
                        if (Main.rand.Next(3) == 0)
                        {
                            Main.dust[index2].scale *= 0.8f;
                            Main.dust[index2].velocity *= 0.5f;
                        }
                        else
                            Main.dust[index2].noGravity = true;
                    }
                }
                else if (type == 119 || type == 118 || (type == 128 || type == 359))
                {
                    int num2 = 10;
                    if (type == 119 || type == 359)
                        num2 = 20;
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 27);
                    for (int index1 = 0; index1 < num2; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 92, 0.0f, 0.0f, 0, new Color(), 1f);
                        if (Main.rand.Next(3) != 0)
                        {
                            Main.dust[index2].velocity *= 2f;
                            Main.dust[index2].noGravity = true;
                            Main.dust[index2].scale *= 1.75f;
                        }
                        else
                            Main.dust[index2].scale *= 0.5f;
                    }
                }
                else if (type == 309)
                {
                    int num2 = 10;
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 27);
                    for (int index1 = 0; index1 < num2; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 185, 0.0f, 0.0f, 0, new Color(), 1f);
                        if (Main.rand.Next(2) == 0)
                        {
                            Main.dust[index2].velocity *= 2f;
                            Main.dust[index2].noGravity = true;
                            Main.dust[index2].scale *= 1.75f;
                        }
                    }
                }
                else if (type == 308)
                {
                    int num2 = 80;
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 27);
                    for (int index1 = 0; index1 < num2; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y + 16f), width, height - 16, 185, 0.0f, 0.0f, 0, new Color(), 1f);
                        Main.dust[index2].velocity *= 2f;
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].scale *= 1.15f;
                    }
                }
                else if (aiStyle == 29 && type <= 126)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    int Type = type - 121 + 86;
                    for (int index1 = 0; index1 < 15; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, Type, oldVelocity.X, oldVelocity.Y, 50, new Color(), 1.2f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].scale *= 1.25f;
                        Main.dust[index2].velocity *= 0.5f;
                    }
                }
                else if (type == 597)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 15; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 262, oldVelocity.X, oldVelocity.Y, 50, new Color(), 1.2f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].scale *= 1.25f;
                        Main.dust[index2].velocity *= 0.5f;
                    }
                }
                else if (type == 337)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 27);
                    for (int index1 = 0; index1 < 10; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 197, 0.0f, 0.0f, 0, new Color(), 1f);
                        Main.dust[index2].noGravity = true;
                    }
                }
                else if (type == 379 || type == 377)
                {
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(position, width, height, 171, 0.0f, 0.0f, 100, new Color(), 1f);
                        Main.dust[index2].scale = Main.rand.Next(1, 10) * 0.1f;
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].fadeIn = 1.5f;
                        Main.dust[index2].velocity *= 0.75f;
                    }
                }
                else if (type == 80)
                {
                    if (ai[0] >= 0.0)
                    {
                        Main.PlaySound(2, (int)position.X, (int)position.Y, 27);
                        for (int index = 0; index < 10; ++index)
                            Dust.NewDust(new Vector2(position.X, position.Y), width, height, 67, 0.0f, 0.0f, 0, new Color(), 1f);
                    }
                    int i = (int)position.X / 16;
                    int j = (int)position.Y / 16;
                    if (Main.tile[i, j] == null)
                        Main.tile[i, j] = new Tile();
                    if (Main.tile[i, j].type == 127 && Main.tile[i, j].active())
                        WorldGen.KillTile(i, j, false, false, false);
                }
                else if (type == 76 || type == 77 || type == 78)
                {
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(position, width, height, 27, 0.0f, 0.0f, 80, new Color(), 1.5f);
                        Main.dust[index2].noGravity = true;
                    }
                }
                else if (type == 55)
                {
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 18, 0.0f, 0.0f, 0, new Color(), 1.5f);
                        Main.dust[index2].noGravity = true;
                    }
                }
                else if (type == 51 || type == 267)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 5; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 0, 0.0f, 0.0f, 0, new Color(), 0.7f);
                }
                else if (type == 478)
                {
                    if (owner == Main.myPlayer)
                        NewProjectile(Center.X, Center.Y, 0.0f, 0.0f, 480, (int)(damage * 0.8), knockBack * 0.5f, owner, 0.0f, 0.0f);
                }
                else if (type == 477 || type == 479)
                {
                    int num2 = 0;
                    while (num2 < 5)
                        ++num2;
                    Collision.HitTiles(position, velocity, width, height);
                }
                else if (type == 2 || type == 82)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 10; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1f);
                }
                else if (type == 474)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 20; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 26, 0.0f, 0.0f, 0, new Color(), 0.9f);
                }
                else if (type == 172)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 20; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 135, 0.0f, 0.0f, 100, new Color(), 1f);
                }
                else if (type == 103)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 75, 0.0f, 0.0f, 100, new Color(), 1f);
                        if (Main.rand.Next(2) == 0)
                        {
                            Main.dust[index2].scale *= 2.5f;
                            Main.dust[index2].noGravity = true;
                            Main.dust[index2].velocity *= 5f;
                        }
                    }
                }
                else if (type == 278)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 169, 0.0f, 0.0f, 100, new Color(), 1f);
                        if (Main.rand.Next(2) == 0)
                        {
                            Main.dust[index2].scale *= 1.5f;
                            Main.dust[index2].noGravity = true;
                            Main.dust[index2].velocity *= 5f;
                        }
                    }
                }
                else if (type == 3 || type == 48 || (type == 54 || type == 599))
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 10; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 1, velocity.X * 0.1f, velocity.Y * 0.1f, 0, new Color(), 0.75f);
                }
                else if (type == 330)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 10; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 0, velocity.X * 0.4f, velocity.Y * 0.4f, 0, new Color(), 0.75f);
                }
                else if (type == 4)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 10; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14, 0.0f, 0.0f, 150, new Color(), 1.1f);
                }
                else if (type == 5)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index = 0; index < 60; ++index)
                    {
                        int Type;
                        switch (Main.rand.Next(3))
                        {
                            case 0:
                                Type = 15;
                                break;
                            case 1:
                                Type = 57;
                                break;
                            default:
                                Type = 58;
                                break;
                        }
                        Dust.NewDust(position, width, height, Type, velocity.X * 0.5f, velocity.Y * 0.5f, 150, new Color(), 1.5f);
                    }
                }
                else if (type == 9 || type == 12 || type == 503)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    int num2 = 10;
                    int num3 = 3;
                    if (type == 503)
                    {
                        num2 = 40;
                        num3 = 2;
                        Projectile projectile = this;
                        Vector2 vector2 = projectile.velocity / 2f;
                        projectile.velocity = vector2;
                    }
                    for (int index = 0; index < num2; ++index)
                        Dust.NewDust(position, width, height, 58, velocity.X * 0.1f, velocity.Y * 0.1f, 150, new Color(), 1.2f);
                    for (int index = 0; index < num3; ++index)
                    {
                        int Type = Main.rand.Next(16, 18);
                        if (type == 503)
                            Type = 16;
                        Gore.NewGore(position, new Vector2(velocity.X * 0.05f, velocity.Y * 0.05f), Type, 1f);
                    }
                    if (type == 12 && damage < 100)
                    {
                        for (int index = 0; index < 10; ++index)
                            Dust.NewDust(position, width, height, 57, velocity.X * 0.1f, velocity.Y * 0.1f, 150, new Color(), 1.2f);
                        for (int index = 0; index < 3; ++index)
                            Gore.NewGore(position, new Vector2(velocity.X * 0.05f, velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f);
                    }
                }
                else if (type == 281)
                {
                    Main.PlaySound(4, (int)position.X, (int)position.Y, 1);
                    int index1 = Gore.NewGore(position, new Vector2(Main.rand.Next(-20, 21) * 0.2f, Main.rand.Next(-20, 21) * 0.2f), 76, 1f);
                    Main.gore[index1].velocity -= velocity * 0.5f;
                    int index2 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(Main.rand.Next(-20, 21) * 0.2f, Main.rand.Next(-20, 21) * 0.2f), 77, 1f);
                    Main.gore[index2].velocity -= velocity * 0.5f;
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    for (int index3 = 0; index3 < 20; ++index3)
                    {
                        int index4 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index4].velocity *= 1.4f;
                    }
                    for (int index3 = 0; index3 < 10; ++index3)
                    {
                        int index4 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f);
                        Main.dust[index4].noGravity = true;
                        Main.dust[index4].velocity *= 5f;
                        int index5 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index5].velocity *= 3f;
                    }
                    int index6 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index6].velocity *= 0.4f;
                    ++Main.gore[index6].velocity.X;
                    ++Main.gore[index6].velocity.Y;
                    int index7 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index7].velocity *= 0.4f;
                    --Main.gore[index7].velocity.X;
                    ++Main.gore[index7].velocity.Y;
                    int index8 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index8].velocity *= 0.4f;
                    ++Main.gore[index8].velocity.X;
                    --Main.gore[index8].velocity.Y;
                    int index9 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index9].velocity *= 0.4f;
                    --Main.gore[index9].velocity.X;
                    --Main.gore[index9].velocity.Y;
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 128;
                    height = 128;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                    Damage();
                }
                else if (type == 162)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index2].velocity *= 1.4f;
                    }
                    for (int index1 = 0; index1 < 10; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 5f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index3].velocity *= 3f;
                    }
                    int index4 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index4].velocity *= 0.4f;
                    ++Main.gore[index4].velocity.X;
                    ++Main.gore[index4].velocity.Y;
                    int index5 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index5].velocity *= 0.4f;
                    --Main.gore[index5].velocity.X;
                    ++Main.gore[index5].velocity.Y;
                    int index6 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index6].velocity *= 0.4f;
                    ++Main.gore[index6].velocity.X;
                    --Main.gore[index6].velocity.Y;
                    int index7 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index7].velocity *= 0.4f;
                    --Main.gore[index7].velocity.X;
                    --Main.gore[index7].velocity.Y;
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 128;
                    height = 128;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                    Damage();
                }
                else if (type == 240)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index2].velocity *= 1.4f;
                    }
                    for (int index1 = 0; index1 < 10; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 5f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index3].velocity *= 3f;
                    }
                    int index4 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index4].velocity *= 0.4f;
                    ++Main.gore[index4].velocity.X;
                    ++Main.gore[index4].velocity.Y;
                    int index5 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index5].velocity *= 0.4f;
                    --Main.gore[index5].velocity.X;
                    ++Main.gore[index5].velocity.Y;
                    int index6 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index6].velocity *= 0.4f;
                    ++Main.gore[index6].velocity.X;
                    --Main.gore[index6].velocity.Y;
                    int index7 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index7].velocity *= 0.4f;
                    --Main.gore[index7].velocity.X;
                    --Main.gore[index7].velocity.Y;
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 96;
                    height = 96;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                    Damage();
                }
                else if (type == 283 || type == 282)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 0; index1 < 10; ++index1)
                    {
                        int index2 = Dust.NewDust(position, width, height, 171, 0.0f, 0.0f, 100, new Color(), 1f);
                        Main.dust[index2].scale = Main.rand.Next(1, 10) * 0.1f;
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].fadeIn = 1.5f;
                        Main.dust[index2].velocity *= 0.75f;
                    }
                }
                else if (type == 284)
                {
                    for (int index1 = 0; index1 < 10; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, Main.rand.Next(139, 143), (float)(-velocity.X * 0.300000011920929), (float)(-velocity.Y * 0.300000011920929), 0, new Color(), 1.2f);
                        Main.dust[index2].velocity.X += Main.rand.Next(-50, 51) * 0.01f;
                        Main.dust[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.01f;
                        Main.dust[index2].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                        Main.dust[index2].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                        Main.dust[index2].velocity.X += Main.rand.Next(-50, 51) * 0.05f;
                        Main.dust[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.05f;
                        Main.dust[index2].scale *= (float)(1.0 + Main.rand.Next(-30, 31) * 0.00999999977648258);
                    }
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Gore.NewGore(position, -velocity * 0.3f, Main.rand.Next(276, 283), 1f);
                        Main.gore[index2].velocity.X += Main.rand.Next(-50, 51) * 0.01f;
                        Main.gore[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.01f;
                        Main.gore[index2].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                        Main.gore[index2].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
                        Main.gore[index2].scale *= (float)(1.0 + Main.rand.Next(-20, 21) * 0.00999999977648258);
                        Main.gore[index2].velocity.X += Main.rand.Next(-50, 51) * 0.05f;
                        Main.gore[index2].velocity.Y += Main.rand.Next(-50, 51) * 0.05f;
                    }
                }
                else if (type == 286)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    for (int index = 0; index < 7; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    for (int index1 = 0; index1 < 3; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 3f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index3].velocity *= 2f;
                    }
                    int index4 = Gore.NewGore(new Vector2(position.X - 10f, position.Y - 10f), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index4].velocity *= 0.3f;
                    Main.gore[index4].velocity.X += Main.rand.Next(-10, 11) * 0.05f;
                    Main.gore[index4].velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
                    if (owner == Main.myPlayer)
                    {
                        localAI[1] = -1f;
                        maxPenetrate = 0;
                        position.X += (width / 2);
                        position.Y += (height / 2);
                        width = 80;
                        height = 80;
                        position.X -= (width / 2);
                        position.Y -= (height / 2);
                        Damage();
                    }
                }
                else if (type == 14 || type == 20 || (type == 36 || type == 83) || (type == 84 || type == 389 || (type == 104 || type == 279)) || (type == 100 || type == 110 || (type == 180 || type == 207) || (type == 357 || type == 242 || (type == 302 || type == 257))) || (type == 259 || type == 285 || (type == 287 || type == 576) || type == 577))
                {
                    Collision.HitTiles(position, velocity, width, height);
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                }
                else if (type == 638)
                {
                    Collision.HitTiles(position, velocity, width, height);
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    int num2 = Main.rand.Next(2, 5);
                    for (int index1 = 0; index1 < num2; ++index1)
                    {
                        int index2 = Dust.NewDust(Center, 0, 0, 229, 0.0f, 0.0f, 100, new Color(), 1f);
                        Main.dust[index2].velocity *= 1.6f;
                        --Main.dust[index2].velocity.Y;
                        Main.dust[index2].position -= Vector2.One * 4f;
                        Main.dust[index2].position = Vector2.Lerp(Main.dust[index2].position, Center, 0.5f);
                        Main.dust[index2].noGravity = true;
                    }
                }
                else if (type == 15 || type == 34 || type == 321)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, (float)(-velocity.X * 0.200000002980232), (float)(-velocity.Y * 0.200000002980232), 100, new Color(), 2f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 2f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, (float)(-velocity.X * 0.200000002980232), (float)(-velocity.Y * 0.200000002980232), 100, new Color(), 1f);
                        Main.dust[index3].velocity *= 2f;
                    }
                }
                else if (type == 253)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 135, (float)(-velocity.X * 0.200000002980232), (float)(-velocity.Y * 0.200000002980232), 100, new Color(), 2f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 2f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 135, (float)(-velocity.X * 0.200000002980232), (float)(-velocity.Y * 0.200000002980232), 100, new Color(), 1f);
                        Main.dust[index3].velocity *= 2f;
                    }
                }
                else if (type == 95 || type == 96)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 75, (float)(-velocity.X * 0.200000002980232), (float)(-velocity.Y * 0.200000002980232), 100, new Color(), 2f * scale);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 2f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 75, (float)(-velocity.X * 0.200000002980232), (float)(-velocity.Y * 0.200000002980232), 100, new Color(), 1f * scale);
                        Main.dust[index3].velocity *= 2f;
                    }
                }
                else if (type == 79)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 66, 0.0f, 0.0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 4f;
                    }
                }
                else if (type == 16)
                {
                    if (type == 16 && penetrate == 1)
                    {
                        maxPenetrate = -1;
                        penetrate = -1;
                        int num2 = 60;
                        position.X -= (float)(num2 / 2);
                        position.Y -= (float)(num2 / 2);
                        width += num2;
                        height += num2;
                        tileCollide = false;
                        Projectile projectile = this;
                        Vector2 vector2 = projectile.velocity * 0.01f;
                        projectile.velocity = vector2;
                        Damage();
                        scale = 0.01f;
                    }
                    position.X += (width / 2);
                    width = 10;
                    position.X -= (width / 2);
                    position.Y += (height / 2);
                    height = 10;
                    position.Y -= (height / 2);
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X - velocity.X, position.Y - velocity.Y), width, height, 15, 0.0f, 0.0f, 100, new Color(), 2f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 2f;
                        Dust.NewDust(new Vector2(position.X - velocity.X, position.Y - velocity.Y), width, height, 15, 0.0f, 0.0f, 100, new Color(), 1f);
                    }
                }
                else if (type == 17)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 5; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 0, 0.0f, 0.0f, 0, new Color(), 1f);
                }
                else if (type == 31 || type == 42)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 32, 0.0f, 0.0f, 0, new Color(), 1f);
                        Main.dust[index2].velocity *= 0.6f;
                    }
                }
                else if (type >= 411 && type <= 414)
                {
                    int Type = 9;
                    if (type == 412 || type == 414)
                        Type = 11;
                    if (type == 413)
                        Type = 19;
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, Type, 0.0f, velocity.Y / 2f, 0, new Color(), 1f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity -= velocity * 0.5f;
                    }
                }
                else if (type == 109)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 51, 0.0f, 0.0f, 0, new Color(), 0.6f);
                        Main.dust[index2].velocity *= 0.6f;
                    }
                }
                else if (type == 39)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 38, 0.0f, 0.0f, 0, new Color(), 1f);
                        Main.dust[index2].velocity *= 0.6f;
                    }
                }
                else if (type == 71)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 53, 0.0f, 0.0f, 0, new Color(), 1f);
                        Main.dust[index2].velocity *= 0.6f;
                    }
                }
                else if (type == 40)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 36, 0.0f, 0.0f, 0, new Color(), 1f);
                        Main.dust[index2].velocity *= 0.6f;
                    }
                }
                else if (type == 21 || type == 471 || type == 532)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 10; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 26, 0.0f, 0.0f, 0, new Color(), 0.8f);
                }
                else if (type == 583)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 10; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 4, 0.0f, 0.0f, 100, new Color(20, 250, 20, 240), 0.8f);
                }
                else if (type == 584)
                {
                    Main.PlaySound(0, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 10; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 4, 0.0f, 0.0f, 100, new Color(250, 20, 120, 240), 0.8f);
                }
                else if (type == 24)
                {
                    for (int index = 0; index < 10; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 1, velocity.X * 0.1f, velocity.Y * 0.1f, 0, new Color(), 0.75f);
                }
                else if (type == 27)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 0; index1 < 30; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 172, velocity.X * 0.1f, velocity.Y * 0.1f, 100, new Color(), 1f);
                        Main.dust[index2].noGravity = true;
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 172, velocity.X * 0.1f, velocity.Y * 0.1f, 100, new Color(), 0.5f);
                    }
                }
                else if (type == 38)
                {
                    for (int index = 0; index < 10; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 42, velocity.X * 0.1f, velocity.Y * 0.1f, 0, new Color(), 1f);
                }
                else if (type == 44 || type == 45)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 0; index1 < 30; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, velocity.X, velocity.Y, 100, new Color(), 1.7f);
                        Main.dust[index2].noGravity = true;
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, velocity.X, velocity.Y, 100, new Color(), 1f);
                    }
                }
                else if (type == 41)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    for (int index = 0; index < 10; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 3f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index3].velocity *= 2f;
                    }
                    int index4 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index4].velocity *= 0.4f;
                    Main.gore[index4].velocity.X += Main.rand.Next(-10, 11) * 0.1f;
                    Main.gore[index4].velocity.Y += Main.rand.Next(-10, 11) * 0.1f;
                    int index5 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index5].velocity *= 0.4f;
                    Main.gore[index5].velocity.X += Main.rand.Next(-10, 11) * 0.1f;
                    Main.gore[index5].velocity.Y += Main.rand.Next(-10, 11) * 0.1f;
                    if (owner == Main.myPlayer)
                    {
                        penetrate = -1;
                        position.X += (width / 2);
                        position.Y += (height / 2);
                        width = 64;
                        height = 64;
                        position.X -= (width / 2);
                        position.Y -= (height / 2);
                        Damage();
                    }
                }
                else if (type == 514)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    for (int index1 = 0; index1 < 10; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.3f);
                        Main.dust[index2].velocity *= 1.4f;
                    }
                    for (int index1 = 0; index1 < 6; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2.1f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 4.6f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.3f);
                        Main.dust[index3].velocity *= 3.3f;
                        if (Main.rand.Next(2) == 0)
                        {
                            int index4 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.1f);
                            Main.dust[index4].velocity *= 2.7f;
                        }
                    }
                    if (owner == Main.myPlayer)
                    {
                        penetrate = -1;
                        position.X += (width / 2);
                        position.Y += (height / 2);
                        width = 112;
                        height = 112;
                        position.X -= (width / 2);
                        position.Y -= (height / 2);
                        ai[0] = 2f;
                        Damage();
                    }
                }
                else if (type == 306)
                {
                    Main.PlaySound(3, (int)position.X, (int)position.Y, 1);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 184, 0.0f, 0.0f, 0, new Color(), 1f);
                        Main.dust[index2].scale *= 1.1f;
                        Main.dust[index2].noGravity = true;
                    }
                    for (int index1 = 0; index1 < 30; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 184, 0.0f, 0.0f, 0, new Color(), 1f);
                        Main.dust[index2].velocity *= 2.5f;
                        Main.dust[index2].scale *= 0.8f;
                        Main.dust[index2].noGravity = true;
                    }
                    if (owner == Main.myPlayer)
                    {
                        int num2 = 2;
                        if (Main.rand.Next(10) == 0)
                            ++num2;
                        if (Main.rand.Next(10) == 0)
                            ++num2;
                        if (Main.rand.Next(10) == 0)
                            ++num2;
                        for (int index = 0; index < num2; ++index)
                            NewProjectile(position.X, position.Y, Main.rand.Next(-35, 36) * 0.02f * 10f, Main.rand.Next(-35, 36) * 0.02f * 10f, 307, (int)(damage * 0.7), (int)(knockBack * 0.35), Main.myPlayer, 0.0f, 0.0f);
                    }
                }
                else if (type == 469)
                {
                    if (owner == Main.myPlayer)
                    {
                        int num2 = 6;
                        for (int index1 = 0; index1 < num2; ++index1)
                        {
                            if (index1 % 2 != 1 || Main.rand.Next(3) == 0)
                            {
                                Vector2 vector2_1 = position;
                                Vector2 vector2_2 = oldVelocity;
                                vector2_2.Normalize();
                                vector2_2 *= 8f;
                                float num3 = Main.rand.Next(-35, 36) * 0.01f;
                                float num4 = Main.rand.Next(-35, 36) * 0.01f;
                                Vector2 vector2_3 = vector2_1 - vector2_2 * index1;
                                float SpeedX = num3 + oldVelocity.X / 6f;
                                float SpeedY = num4 + oldVelocity.Y / 6f;
                                int index2 = NewProjectile(vector2_3.X, vector2_3.Y, SpeedX, SpeedY, Main.player[owner].beeType(), Main.player[owner].beeDamage(damage / 3), Main.player[owner].beeKB(0.0f), Main.myPlayer, 0.0f, 0.0f);
                                Main.projectile[index2].magic = false;
                                Main.projectile[index2].ranged = true;
                                Main.projectile[index2].penetrate = 2;
                            }
                        }
                    }
                }
                else if (type == 183)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index2].velocity *= 1f;
                    }
                    int index3 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    ++Main.gore[index3].velocity.X;
                    ++Main.gore[index3].velocity.Y;
                    Main.gore[index3].velocity *= 0.3f;
                    int index4 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    --Main.gore[index4].velocity.X;
                    ++Main.gore[index4].velocity.Y;
                    Main.gore[index4].velocity *= 0.3f;
                    int index5 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    ++Main.gore[index5].velocity.X;
                    --Main.gore[index5].velocity.Y;
                    Main.gore[index5].velocity *= 0.3f;
                    int index6 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    --Main.gore[index6].velocity.X;
                    --Main.gore[index6].velocity.Y;
                    Main.gore[index6].velocity *= 0.3f;
                    if (owner == Main.myPlayer)
                    {
                        int num2 = Main.rand.Next(15, 25);
                        for (int index1 = 0; index1 < num2; ++index1)
                            NewProjectile(position.X, position.Y, Main.rand.Next(-35, 36) * 0.02f, Main.rand.Next(-35, 36) * 0.02f, Main.player[owner].beeType(), Main.player[owner].beeDamage(damage), Main.player[owner].beeKB(0.0f), Main.myPlayer, 0.0f, 0.0f);
                    }
                }
                else if (aiStyle == 34)
                {
                    if (owner != Main.myPlayer)
                        timeLeft = 60;
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    if (type == 167)
                    {
                        for (int index1 = 0; index1 < 400; ++index1)
                        {
                            float num2 = 16f;
                            if (index1 < 300)
                                num2 = 12f;
                            if (index1 < 200)
                                num2 = 8f;
                            if (index1 < 100)
                                num2 = 4f;
                            int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 130, 0.0f, 0.0f, 100, new Color(), 1f);
                            float num3 = Main.dust[index2].velocity.X;
                            float num4 = Main.dust[index2].velocity.Y;
                            if (num3 == 0.0 && num4 == 0.0)
                                num3 = 1f;
                            float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
                            float num6 = num2 / num5;
                            float num7 = num3 * num6;
                            float num8 = num4 * num6;
                            Main.dust[index2].velocity *= 0.5f;
                            Main.dust[index2].velocity.X += num7;
                            Main.dust[index2].velocity.Y += num8;
                            Main.dust[index2].scale = 1.3f;
                            Main.dust[index2].noGravity = true;
                        }
                    }
                    if (type == 168)
                    {
                        for (int index1 = 0; index1 < 400; ++index1)
                        {
                            float num2 = (float)(2.0 * ((double)index1 / 100.0));
                            if (index1 > 100)
                                num2 = 10f;
                            if (index1 > 250)
                                num2 = 13f;
                            int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 131, 0.0f, 0.0f, 100, new Color(), 1f);
                            float num3 = Main.dust[index2].velocity.X;
                            float num4 = Main.dust[index2].velocity.Y;
                            if (num3 == 0.0 && num4 == 0.0)
                                num3 = 1f;
                            float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
                            float num6 = num2 / num5;
                            float num7;
                            float num8;
                            if (index1 <= 200)
                            {
                                num7 = num3 * num6;
                                num8 = num4 * num6;
                            }
                            else
                            {
                                num7 = (float)(num3 * num6 * 1.25);
                                num8 = (float)(num4 * num6 * 0.75);
                            }
                            Main.dust[index2].velocity *= 0.5f;
                            Main.dust[index2].velocity.X += num7;
                            Main.dust[index2].velocity.Y += num8;
                            if (index1 > 100)
                            {
                                Main.dust[index2].scale = 1.3f;
                                Main.dust[index2].noGravity = true;
                            }
                        }
                    }
                    if (type == 169)
                    {
                        Vector2 spinningpoint = Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.283185f);
                        float num2 = Main.rand.Next(5, 9);
                        float num3 = Main.rand.Next(12, 17);
                        float num4 = Main.rand.Next(3, 7);
                        float num5 = 20f;
                        for (float num6 = 0.0f; num6 < num2; ++num6)
                        {
                            for (int index1 = 0; index1 < 2; ++index1)
                            {
                                Vector2 vector2_1 = Utils.RotatedBy(spinningpoint, (index1 == 0 ? 1.0 : -1.0) * 6.28318548202515 / (num2 * 2.0), new Vector2());
                                for (float num7 = 0.0f; num7 < num5; ++num7)
                                {
                                    Vector2 vector2_2 = Vector2.Lerp(spinningpoint, vector2_1, num7 / num5);
                                    float num8 = MathHelper.Lerp(num3, num4, num7 / num5);
                                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 133, 0.0f, 0.0f, 100, new Color(), 1.3f);
                                    Main.dust[index2].velocity *= 0.1f;
                                    Main.dust[index2].noGravity = true;
                                    Main.dust[index2].velocity += vector2_2 * num8;
                                }
                            }
                            spinningpoint = Utils.RotatedBy(spinningpoint, 6.28318548202515 / num2, new Vector2());
                        }
                        for (float num6 = 0.0f; num6 < num2; ++num6)
                        {
                            for (int index1 = 0; index1 < 2; ++index1)
                            {
                                Vector2 vector2_1 = Utils.RotatedBy(spinningpoint, (index1 == 0 ? 1.0 : -1.0) * 6.28318548202515 / (num2 * 2.0), new Vector2());
                                for (float num7 = 0.0f; num7 < num5; ++num7)
                                {
                                    Vector2 vector2_2 = Vector2.Lerp(spinningpoint, vector2_1, num7 / num5);
                                    float num8 = MathHelper.Lerp(num3, num4, num7 / num5) / 2f;
                                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 133, 0.0f, 0.0f, 100, new Color(), 1.3f);
                                    Main.dust[index2].velocity *= 0.1f;
                                    Main.dust[index2].noGravity = true;
                                    Main.dust[index2].velocity += vector2_2 * num8;
                                }
                            }
                            spinningpoint = Utils.RotatedBy(spinningpoint, 6.28318548202515 / num2, new Vector2());
                        }
                        for (int index1 = 0; index1 < 100; ++index1)
                        {
                            float num6 = num3;
                            int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 132, 0.0f, 0.0f, 100, new Color(), 1f);
                            float num7 = Main.dust[index2].velocity.X;
                            float num8 = Main.dust[index2].velocity.Y;
                            if (num7 == 0.0 && num8 == 0.0)
                                num7 = 1f;
                            float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8);
                            float num10 = num6 / num9;
                            float num11 = num7 * num10;
                            float num12 = num8 * num10;
                            Main.dust[index2].velocity *= 0.5f;
                            Main.dust[index2].velocity.X += num11;
                            Main.dust[index2].velocity.Y += num12;
                            Main.dust[index2].scale = 1.3f;
                            Main.dust[index2].noGravity = true;
                        }
                    }
                    if (type == 170)
                    {
                        for (int index1 = 0; index1 < 400; ++index1)
                        {
                            int Type = 133;
                            float num2 = 16f;
                            if (index1 > 100)
                                num2 = 11f;
                            if (index1 > 100)
                                Type = 134;
                            if (index1 > 200)
                                num2 = 8f;
                            if (index1 > 200)
                                Type = 133;
                            if (index1 > 300)
                                num2 = 5f;
                            if (index1 > 300)
                                Type = 134;
                            int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, Type, 0.0f, 0.0f, 100, new Color(), 1f);
                            float num3 = Main.dust[index2].velocity.X;
                            float num4 = Main.dust[index2].velocity.Y;
                            if (num3 == 0.0 && num4 == 0.0)
                                num3 = 1f;
                            float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
                            float num6 = num2 / num5;
                            float num7;
                            float num8;
                            if (index1 > 300)
                            {
                                num7 = (float)(num3 * num6 * 0.699999988079071);
                                num8 = num4 * num6;
                            }
                            else if (index1 > 200)
                            {
                                num7 = num3 * num6;
                                num8 = (float)(num4 * num6 * 0.699999988079071);
                            }
                            else if (index1 > 100)
                            {
                                num7 = (float)(num3 * num6 * 0.699999988079071);
                                num8 = num4 * num6;
                            }
                            else
                            {
                                num7 = num3 * num6;
                                num8 = (float)(num4 * num6 * 0.699999988079071);
                            }
                            Main.dust[index2].velocity *= 0.5f;
                            Main.dust[index2].velocity.X += num7;
                            Main.dust[index2].velocity.Y += num8;
                            if (Main.rand.Next(3) != 0)
                            {
                                Main.dust[index2].scale = 1.3f;
                                Main.dust[index2].noGravity = true;
                            }
                        }
                    }
                    if (type == 415)
                    {
                        Vector2 spinningpoint = Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.283185f);
                        float num2 = Main.rand.Next(5, 9);
                        float num3 = Main.rand.Next(10, 15) * 0.66f;
                        float num4 = Main.rand.Next(4, 7) / 2f;
                        int num5 = 30;
                        for (int index1 = 0; (double)index1 < num5 * num2; ++index1)
                        {
                            if (index1 % num5 == 0)
                                spinningpoint = Utils.RotatedBy(spinningpoint, 6.28318548202515 / num2, new Vector2());
                            float num6 = MathHelper.Lerp(num4, num3, (float)(index1 % num5) / num5);
                            int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 130, 0.0f, 0.0f, 100, new Color(), 1f);
                            Main.dust[index2].velocity *= 0.1f;
                            Main.dust[index2].velocity += spinningpoint * num6;
                            Main.dust[index2].scale = 1.3f;
                            Main.dust[index2].noGravity = true;
                        }
                        for (int index1 = 0; index1 < 100; ++index1)
                        {
                            float num6 = num3;
                            if (index1 < 30)
                                num6 = (float)((num4 + num3) / 2.0);
                            int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 130, 0.0f, 0.0f, 100, new Color(), 1f);
                            float num7 = Main.dust[index2].velocity.X;
                            float num8 = Main.dust[index2].velocity.Y;
                            if (num7 == 0.0 && num8 == 0.0)
                                num7 = 1f;
                            float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8);
                            float num10 = num6 / num9;
                            float num11 = num7 * num10;
                            float num12 = num8 * num10;
                            Main.dust[index2].velocity *= 0.5f;
                            Main.dust[index2].velocity.X += num11;
                            Main.dust[index2].velocity.Y += num12;
                            Main.dust[index2].scale = 1.3f;
                            Main.dust[index2].noGravity = true;
                        }
                    }
                    if (type == 416)
                    {
                        Vector2 spinningpoint1 = Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.283185f);
                        Vector2 spinningpoint2 = spinningpoint1;
                        float num2 = (float)(Main.rand.Next(3, 6) * 2);
                        int num3 = 20;
                        float num4 = Main.rand.Next(2) == 0 ? 1f : -1f;
                        bool flag = true;
                        for (int index1 = 0; (double)index1 < num3 * num2; ++index1)
                        {
                            if (index1 % num3 == 0)
                            {
                                spinningpoint2 = Utils.RotatedBy(spinningpoint2, num4 * (6.28318548202515 / num2), new Vector2());
                                spinningpoint1 = spinningpoint2;
                                flag = !flag;
                            }
                            else
                            {
                                float num5 = 6.283185f / (num3 * num2);
                                spinningpoint1 = Utils.RotatedBy(spinningpoint1, num5 * num4 * 3.0, new Vector2());
                            }
                            float num6 = MathHelper.Lerp(1f, 8f, (float)(index1 % num3) / num3);
                            int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 131, 0.0f, 0.0f, 100, new Color(), 1.4f);
                            Main.dust[index2].velocity *= 0.1f;
                            Main.dust[index2].velocity += spinningpoint1 * num6;
                            if (flag)
                                Main.dust[index2].scale = 0.9f;
                            Main.dust[index2].noGravity = true;
                        }
                    }
                    if (type == 417)
                    {
                        float num2 = (float)Main.rand.NextDouble() * 6.283185f;
                        float num3 = (float)Main.rand.NextDouble() * 6.283185f;
                        float num4 = (float)(4.0 + Main.rand.NextDouble() * 3.0);
                        float num5 = (float)(4.0 + Main.rand.NextDouble() * 3.0);
                        float num6 = num4;
                        if (num5 > num6)
                            num6 = num5;
                        for (int index1 = 0; index1 < 150; ++index1)
                        {
                            int Type = 132;
                            float num7 = num6;
                            if (index1 > 50)
                                num7 = num5;
                            if (index1 > 50)
                                Type = 133;
                            if (index1 > 100)
                                num7 = num4;
                            if (index1 > 100)
                                Type = 132;
                            int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, Type, 0.0f, 0.0f, 100, new Color(), 1f);
                            Vector2 vector2 = Main.dust[index2].velocity;
                            vector2.Normalize();
                            Vector2 spinningpoint = vector2 * num7;
                            if (index1 > 100)
                            {
                                spinningpoint.X *= 0.5f;
                                spinningpoint = Utils.RotatedBy(spinningpoint, num2, new Vector2());
                            }
                            else if (index1 > 50)
                            {
                                spinningpoint.Y *= 0.5f;
                                spinningpoint = Utils.RotatedBy(spinningpoint, num3, new Vector2());
                            }
                            Main.dust[index2].velocity *= 0.2f;
                            Main.dust[index2].velocity += spinningpoint;
                            if (index1 <= 200)
                            {
                                Main.dust[index2].scale = 1.3f;
                                Main.dust[index2].noGravity = true;
                            }
                        }
                    }
                    if (type == 418)
                    {
                        Vector2 spinningpoint = Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.283185f);
                        float num2 = Main.rand.Next(5, 12);
                        float num3 = Main.rand.Next(9, 14) * 0.66f;
                        float num4 = Main.rand.Next(2, 4) * 0.66f;
                        float num5 = 15f;
                        for (float num6 = 0.0f; num6 < num2; ++num6)
                        {
                            for (int index1 = 0; index1 < 2; ++index1)
                            {
                                Vector2 vector2_1 = Utils.RotatedBy(spinningpoint, (index1 == 0 ? 1.0 : -1.0) * 6.28318548202515 / (num2 * 2.0), new Vector2());
                                for (float num7 = 0.0f; num7 < num5; ++num7)
                                {
                                    Vector2 vector2_2 = Vector2.SmoothStep(spinningpoint, vector2_1, num7 / num5);
                                    float num8 = MathHelper.SmoothStep(num3, num4, num7 / num5);
                                    int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 134, 0.0f, 0.0f, 100, new Color(), 1.3f);
                                    Main.dust[index2].velocity *= 0.1f;
                                    Main.dust[index2].noGravity = true;
                                    Main.dust[index2].velocity += vector2_2 * num8;
                                }
                            }
                            spinningpoint = Utils.RotatedBy(spinningpoint, 6.28318548202515 / num2, new Vector2());
                        }
                        for (int index1 = 0; index1 < 120; ++index1)
                        {
                            float num6 = num3;
                            int Type = 133;
                            if (index1 < 80)
                                num6 = num4 - 0.5f;
                            else
                                Type = 131;
                            int index2 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, Type, 0.0f, 0.0f, 100, new Color(), 1f);
                            float num7 = Main.dust[index2].velocity.X;
                            float num8 = Main.dust[index2].velocity.Y;
                            if (num7 == 0.0 && num8 == 0.0)
                                num7 = 1f;
                            float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8);
                            float num10 = num6 / num9;
                            float num11 = num7 * num10;
                            float num12 = num8 * num10;
                            Main.dust[index2].velocity *= 0.2f;
                            Main.dust[index2].velocity.X += num11;
                            Main.dust[index2].velocity.Y += num12;
                            Main.dust[index2].scale = 1.3f;
                            Main.dust[index2].noGravity = true;
                        }
                    }
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 192;
                    height = 192;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                    penetrate = -1;
                    Damage();
                }
                else if (type == 312)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 22;
                    height = 22;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                    for (int index1 = 0; index1 < 30; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index2].velocity *= 1.4f;
                    }
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 3.5f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 7f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index3].velocity *= 3f;
                    }
                    for (int index1 = 0; index1 < 2; ++index1)
                    {
                        float num2 = 0.4f;
                        if (index1 == 1)
                            num2 = 0.8f;
                        int index2 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index2].velocity *= num2;
                        ++Main.gore[index2].velocity.X;
                        ++Main.gore[index2].velocity.Y;
                        int index3 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index3].velocity *= num2;
                        --Main.gore[index3].velocity.X;
                        ++Main.gore[index3].velocity.Y;
                        int index4 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index4].velocity *= num2;
                        ++Main.gore[index4].velocity.X;
                        --Main.gore[index4].velocity.Y;
                        int index5 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index5].velocity *= num2;
                        --Main.gore[index5].velocity.X;
                        --Main.gore[index5].velocity.Y;
                    }
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 128;
                    height = 128;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                    Damage();
                }
                else if (type == 133 || type == 134 || (type == 135 || type == 136) || (type == 137 || type == 138 || (type == 303 || type == 338)) || type == 339)
                {
                    if (type == 30 || type == 133 || (type == 136 || type == 139))
                        Main.PlaySound(2, (int)position.X, (int)position.Y, 62);
                    else
                        Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 22;
                    height = 22;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                    for (int index1 = 0; index1 < 30; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index2].velocity *= 1.4f;
                    }
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 3.5f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 7f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index3].velocity *= 3f;
                    }
                    for (int index1 = 0; index1 < 2; ++index1)
                    {
                        float num2 = 0.4f;
                        if (index1 == 1)
                            num2 = 0.8f;
                        int index2 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index2].velocity *= num2;
                        ++Main.gore[index2].velocity.X;
                        ++Main.gore[index2].velocity.Y;
                        int index3 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index3].velocity *= num2;
                        --Main.gore[index3].velocity.X;
                        ++Main.gore[index3].velocity.Y;
                        int index4 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index4].velocity *= num2;
                        ++Main.gore[index4].velocity.X;
                        --Main.gore[index4].velocity.Y;
                        int index5 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index5].velocity *= num2;
                        --Main.gore[index5].velocity.X;
                        --Main.gore[index5].velocity.Y;
                    }
                }
                else if (type == 139 || type == 140 || (type == 141 || type == 142) || (type == 143 || type == 144 || (type == 340 || type == 341)))
                {
                    if (type == 30 || type == 133 || (type == 136 || type == 139))
                        Main.PlaySound(2, (int)position.X, (int)position.Y, 62);
                    else
                        Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 80;
                    height = 80;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                    for (int index1 = 0; index1 < 40; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 2f);
                        Main.dust[index2].velocity *= 3f;
                        if (Main.rand.Next(2) == 0)
                        {
                            Main.dust[index2].scale = 0.5f;
                            Main.dust[index2].fadeIn = (float)(1.0 + Main.rand.Next(10) * 0.100000001490116);
                        }
                    }
                    for (int index1 = 0; index1 < 70; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 3f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 5f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2f);
                        Main.dust[index3].velocity *= 2f;
                    }
                    for (int index1 = 0; index1 < 3; ++index1)
                    {
                        float num2 = 0.33f;
                        if (index1 == 1)
                            num2 = 0.66f;
                        if (index1 == 2)
                            num2 = 1f;
                        int index2 = Gore.NewGore(new Vector2((float)(position.X + (width / 2) - 24.0), (float)(position.Y + (height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index2].velocity *= num2;
                        ++Main.gore[index2].velocity.X;
                        ++Main.gore[index2].velocity.Y;
                        int index3 = Gore.NewGore(new Vector2((float)(position.X + (width / 2) - 24.0), (float)(position.Y + (height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index3].velocity *= num2;
                        --Main.gore[index3].velocity.X;
                        ++Main.gore[index3].velocity.Y;
                        int index4 = Gore.NewGore(new Vector2((float)(position.X + (width / 2) - 24.0), (float)(position.Y + (height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index4].velocity *= num2;
                        ++Main.gore[index4].velocity.X;
                        --Main.gore[index4].velocity.Y;
                        int index5 = Gore.NewGore(new Vector2((float)(position.X + (width / 2) - 24.0), (float)(position.Y + (height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index5].velocity *= num2;
                        --Main.gore[index5].velocity.X;
                        --Main.gore[index5].velocity.Y;
                    }
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 10;
                    height = 10;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                }
                else if (type == 246)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    for (int index1 = 0; index1 < 10; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index2].velocity *= 0.9f;
                    }
                    for (int index1 = 0; index1 < 5; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 3f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index3].velocity *= 2f;
                    }
                    int index4 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index4].velocity *= 0.3f;
                    Main.gore[index4].velocity.X += Main.rand.Next(-1, 2);
                    Main.gore[index4].velocity.Y += Main.rand.Next(-1, 2);
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 150;
                    height = 150;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                    penetrate = -1;
                    maxPenetrate = 0;
                    Damage();
                    if (owner == Main.myPlayer)
                    {
                        int num2 = Main.rand.Next(2, 6);
                        for (int index1 = 0; index1 < num2; ++index1)
                        {
                            float num3 = Main.rand.Next(-100, 101) + 0.01f;
                            float num4 = Main.rand.Next(-100, 101);
                            float num5 = num3 - 0.01f;
                            float num6 = 8f / (float)Math.Sqrt(num5 * num5 + num4 * num4);
                            int index2 = NewProjectile(Center.X - oldVelocity.X, Center.Y - oldVelocity.Y, num5 * num6, num4 * num6, 249, damage, knockBack, owner, 0.0f, 0.0f);
                            Main.projectile[index2].maxPenetrate = 0;
                        }
                    }
                }
                else if (type == 249)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    for (int index1 = 0; index1 < 7; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index2].velocity *= 0.8f;
                    }
                    for (int index1 = 0; index1 < 2; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 2.5f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index3].velocity *= 1.5f;
                    }
                    int index = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index].velocity *= 0.2f;
                    Main.gore[index].velocity.X += Main.rand.Next(-1, 2);
                    Main.gore[index].velocity.Y += Main.rand.Next(-1, 2);
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 100;
                    height = 100;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                    penetrate = -1;
                    Damage();
                }
                else if (type == 588)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    position = Center;
                    width = height = 22;
                    Center = position;
                    for (int index1 = 0; index1 < 8; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 219 + Main.rand.Next(5), 0.0f, 0.0f, 0, new Color(), 1f);
                        Main.dust[index2].velocity *= 1.4f;
                        Main.dust[index2].fadeIn = 1f;
                        Main.dust[index2].noGravity = true;
                    }
                    for (int index1 = 0; index1 < 15; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 139 + Main.rand.Next(4), 0.0f, 0.0f, 0, new Color(), 1.6f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 5f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 139 + Main.rand.Next(4), 0.0f, 0.0f, 0, new Color(), 1.9f);
                        Main.dust[index3].velocity *= 3f;
                    }
                    if (Main.rand.Next(2) == 0)
                    {
                        int index = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(276, 283), 1f);
                        Main.gore[index].velocity *= 0.4f;
                        ++Main.gore[index].velocity.X;
                        ++Main.gore[index].velocity.Y;
                    }
                    if (Main.rand.Next(2) == 0)
                    {
                        int index = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(276, 283), 1f);
                        Main.gore[index].velocity *= 0.4f;
                        --Main.gore[index].velocity.X;
                        ++Main.gore[index].velocity.Y;
                    }
                    if (Main.rand.Next(2) == 0)
                    {
                        int index = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(276, 283), 1f);
                        Main.gore[index].velocity *= 0.4f;
                        ++Main.gore[index].velocity.X;
                        --Main.gore[index].velocity.Y;
                    }
                    if (Main.rand.Next(2) == 0)
                    {
                        int index = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(276, 283), 1f);
                        Main.gore[index].velocity *= 0.4f;
                        --Main.gore[index].velocity.X;
                        --Main.gore[index].velocity.Y;
                    }
                }
                else if (type == 28 || type == 30 || (type == 37 || type == 75) || (type == 102 || type == 164 || (type == 397 || type == 517)) || (type == 516 || type == 519))
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 22;
                    height = 22;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                    for (int index1 = 0; index1 < 20; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index2].velocity *= 1.4f;
                    }
                    for (int index1 = 0; index1 < 10; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 5f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f);
                        Main.dust[index3].velocity *= 3f;
                    }
                    int index4 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index4].velocity *= 0.4f;
                    ++Main.gore[index4].velocity.X;
                    ++Main.gore[index4].velocity.Y;
                    int index5 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index5].velocity *= 0.4f;
                    --Main.gore[index5].velocity.X;
                    ++Main.gore[index5].velocity.Y;
                    int index6 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index6].velocity *= 0.4f;
                    ++Main.gore[index6].velocity.X;
                    --Main.gore[index6].velocity.Y;
                    int index7 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(), Main.rand.Next(61, 64), 1f);
                    Main.gore[index7].velocity *= 0.4f;
                    --Main.gore[index7].velocity.X;
                    --Main.gore[index7].velocity.Y;
                    if (type == 102)
                    {
                        position.X += (width / 2);
                        position.Y += (height / 2);
                        width = 128;
                        height = 128;
                        position.X -= (width / 2);
                        position.Y -= (height / 2);
                        damage = 40;
                        Damage();
                    }
                }
                else if (type == 29 || type == 108 || (type == 470 || type == 637))
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 14);
                    if (type == 29)
                    {
                        position.X += (width / 2);
                        position.Y += (height / 2);
                        width = 200;
                        height = 200;
                        position.X -= (width / 2);
                        position.Y -= (height / 2);
                    }
                    for (int index1 = 0; index1 < 50; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 2f);
                        Main.dust[index2].velocity *= 1.4f;
                    }
                    for (int index1 = 0; index1 < 80; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 3f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 5f;
                        int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2f);
                        Main.dust[index3].velocity *= 3f;
                    }
                    for (int index1 = 0; index1 < 2; ++index1)
                    {
                        int index2 = Gore.NewGore(new Vector2((float)(position.X + (width / 2) - 24.0), (float)(position.Y + (height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index2].scale = 1.5f;
                        Main.gore[index2].velocity.X += 1.5f;
                        Main.gore[index2].velocity.Y += 1.5f;
                        int index3 = Gore.NewGore(new Vector2((float)(position.X + (width / 2) - 24.0), (float)(position.Y + (height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index3].scale = 1.5f;
                        Main.gore[index3].velocity.X -= 1.5f;
                        Main.gore[index3].velocity.Y += 1.5f;
                        int index4 = Gore.NewGore(new Vector2((float)(position.X + (width / 2) - 24.0), (float)(position.Y + (height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index4].scale = 1.5f;
                        Main.gore[index4].velocity.X += 1.5f;
                        Main.gore[index4].velocity.Y -= 1.5f;
                        int index5 = Gore.NewGore(new Vector2((float)(position.X + (width / 2) - 24.0), (float)(position.Y + (height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64), 1f);
                        Main.gore[index5].scale = 1.5f;
                        Main.gore[index5].velocity.X -= 1.5f;
                        Main.gore[index5].velocity.Y -= 1.5f;
                    }
                    position.X += (width / 2);
                    position.Y += (height / 2);
                    width = 10;
                    height = 10;
                    position.X -= (width / 2);
                    position.Y -= (height / 2);
                }
                else if (type == 69)
                {
                    Main.PlaySound(13, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 5; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 13, 0.0f, 0.0f, 0, new Color(), 1f);
                    for (int index1 = 0; index1 < 30; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 33, 0.0f, -2f, 0, new Color(), 1.1f);
                        Main.dust[index2].alpha = 100;
                        Main.dust[index2].velocity.X *= 1.5f;
                        Main.dust[index2].velocity *= 3f;
                    }
                }
                else if (type == 70)
                {
                    Main.PlaySound(13, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 5; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 13, 0.0f, 0.0f, 0, new Color(), 1f);
                    for (int index1 = 0; index1 < 30; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 52, 0.0f, -2f, 0, new Color(), 1.1f);
                        Main.dust[index2].alpha = 100;
                        Main.dust[index2].velocity.X *= 1.5f;
                        Main.dust[index2].velocity *= 3f;
                    }
                }
                else if (type == 621)
                {
                    Main.PlaySound(13, (int)position.X, (int)position.Y, 1);
                    for (int index = 0; index < 5; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 13, 0.0f, 0.0f, 0, new Color(), 1f);
                    for (int index1 = 0; index1 < 30; ++index1)
                    {
                        int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 266, 0.0f, -2f, 0, new Color(), 1.1f);
                        Main.dust[index2].alpha = 100;
                        Main.dust[index2].velocity.X *= 1.5f;
                        Main.dust[index2].velocity *= 3f;
                    }
                }
                else if (type == 114 || type == 115)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 4; index1 < 31; ++index1)
                    {
                        float num2 = oldVelocity.X * (30f / index1);
                        float num3 = oldVelocity.Y * (30f / index1);
                        int index2 = Dust.NewDust(new Vector2(position.X - num2, position.Y - num3), 8, 8, 27, oldVelocity.X, oldVelocity.Y, 100, new Color(), 1.4f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 0.5f;
                        int index3 = Dust.NewDust(new Vector2(position.X - num2, position.Y - num3), 8, 8, 27, oldVelocity.X, oldVelocity.Y, 100, new Color(), 0.9f);
                        Main.dust[index3].velocity *= 0.5f;
                    }
                }
                else if (type == 116)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 4; index1 < 31; ++index1)
                    {
                        float num2 = oldVelocity.X * (30f / index1);
                        float num3 = oldVelocity.Y * (30f / index1);
                        int index2 = Dust.NewDust(new Vector2(position.X - num2, position.Y - num3), 8, 8, 64, oldVelocity.X, oldVelocity.Y, 100, new Color(), 1.8f);
                        Main.dust[index2].noGravity = true;
                        int index3 = Dust.NewDust(new Vector2(position.X - num2, position.Y - num3), 8, 8, 64, oldVelocity.X, oldVelocity.Y, 100, new Color(), 1.4f);
                        Main.dust[index3].noGravity = true;
                    }
                }
                else if (type == 173)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 4; index1 < 24; ++index1)
                    {
                        float num2 = oldVelocity.X * (30f / index1);
                        float num3 = oldVelocity.Y * (30f / index1);
                        int Type;
                        switch (Main.rand.Next(3))
                        {
                            case 0:
                                Type = 15;
                                break;
                            case 1:
                                Type = 57;
                                break;
                            default:
                                Type = 58;
                                break;
                        }
                        int index2 = Dust.NewDust(new Vector2(position.X - num2, position.Y - num3), 8, 8, Type, oldVelocity.X * 0.2f, oldVelocity.Y * 0.2f, 100, new Color(), 1.8f);
                        Main.dust[index2].velocity *= 1.5f;
                        Main.dust[index2].noGravity = true;
                    }
                }
                else if (type == 132)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 4; index1 < 31; ++index1)
                    {
                        float num2 = oldVelocity.X * (30f / index1);
                        float num3 = oldVelocity.Y * (30f / index1);
                        int index2 = Dust.NewDust(new Vector2(oldPosition.X - num2, oldPosition.Y - num3), 8, 8, 107, oldVelocity.X, oldVelocity.Y, 100, new Color(), 1.8f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 0.5f;
                        int index3 = Dust.NewDust(new Vector2(oldPosition.X - num2, oldPosition.Y - num3), 8, 8, 107, oldVelocity.X, oldVelocity.Y, 100, new Color(), 1.4f);
                        Main.dust[index3].velocity *= 0.05f;
                    }
                }
                else if (type == 156)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 4; index1 < 31; ++index1)
                    {
                        float num2 = oldVelocity.X * (30f / index1);
                        float num3 = oldVelocity.Y * (30f / index1);
                        int index2 = Dust.NewDust(new Vector2(oldPosition.X - num2, oldPosition.Y - num3), 8, 8, 73, oldVelocity.X, oldVelocity.Y, 255, new Color(), 1.8f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 0.5f;
                        int index3 = Dust.NewDust(new Vector2(oldPosition.X - num2, oldPosition.Y - num3), 8, 8, 73, oldVelocity.X, oldVelocity.Y, 255, new Color(), 1.4f);
                        Main.dust[index3].velocity *= 0.05f;
                        Main.dust[index3].noGravity = true;
                    }
                }
                else if (type == 157)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 10);
                    for (int index1 = 4; index1 < 31; ++index1)
                    {
                        int index2 = Dust.NewDust(position, width, height, 107, oldVelocity.X, oldVelocity.Y, 100, new Color(), 1.8f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].velocity *= 0.5f;
                    }
                }
                else if (type == 370)
                {
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 4);
                    for (int index = 0; index < 5; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 13, 0.0f, 0.0f, 0, new Color(), 1f);
                    for (int index1 = 0; index1 < 30; ++index1)
                    {
                        Vector2 vector2 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
                        vector2.Normalize();
                        int index2 = Gore.NewGore(Center + vector2 * 10f, vector2 * Main.rand.Next(4, 9) * 0.66f + Vector2.UnitY * 1.5f, 331, Main.rand.Next(40, 141) * 0.01f);
                        Main.gore[index2].sticky = false;
                    }
                }
                else if (type == 371)
                {
                    Main.PlaySound(13, (int)position.X, (int)position.Y, 1);
                    Main.PlaySound(2, (int)position.X, (int)position.Y, 16);
                    for (int index = 0; index < 5; ++index)
                        Dust.NewDust(new Vector2(position.X, position.Y), width, height, 13, 0.0f, 0.0f, 0, new Color(), 1f);
                    for (int index1 = 0; index1 < 30; ++index1)
                    {
                        Vector2 vector2 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
                        vector2.Normalize();
                        vector2 *= 0.4f;
                        int index2 = Gore.NewGore(Center + vector2 * 10f, vector2 * Main.rand.Next(4, 9) * 0.66f + Vector2.UnitY * 1.5f, Main.rand.Next(435, 438), Main.rand.Next(20, 100) * 0.01f);
                        Main.gore[index2].sticky = false;
                    }
                }
            }
            if (owner == Main.myPlayer)
            {
                if (type == 28 || type == 29 || (type == 37 || type == 108) || (type == 136 || type == 137 || (type == 138 || type == 142)) || (type == 143 || type == 144 || (type == 339 || type == 341) || (type == 470 || type == 516 || (type == 519 || type == 637))))
                {
                    int num2 = 3;
                    if (type == 28 || type == 37 || (type == 516 || type == 519))
                        num2 = 4;
                    if (type == 29 || type == 470 || type == 637)
                        num2 = 7;
                    if (type == 142 || type == 143 || (type == 144 || type == 341))
                        num2 = 5;
                    if (type == 108)
                        num2 = 10;
                    int num3 = (int)(position.X / 16.0 - num2);
                    int num4 = (int)(position.X / 16.0 + num2);
                    int num5 = (int)(position.Y / 16.0 - num2);
                    int num6 = (int)(position.Y / 16.0 + num2);
                    if (num3 < 0)
                        num3 = 0;
                    if (num4 > Main.maxTilesX)
                        num4 = Main.maxTilesX;
                    if (num5 < 0)
                        num5 = 0;
                    if (num6 > Main.maxTilesY)
                        num6 = Main.maxTilesY;
                    bool flag1 = false;
                    for (int index1 = num3; index1 <= num4; ++index1)
                    {
                        for (int index2 = num5; index2 <= num6; ++index2)
                        {
                            float num7 = Math.Abs(index1 - position.X / 16f);
                            float num8 = Math.Abs(index2 - position.Y / 16f);
                            if (Math.Sqrt(num7 * num7 + num8 * num8) < num2 && Main.tile[index1, index2] != null && Main.tile[index1, index2].wall == 0)
                            {
                                flag1 = true;
                                break;
                            }
                        }
                    }
                    AchievementsHelper.CurrentlyMining = true;
                    for (int i1 = num3; i1 <= num4; ++i1)
                    {
                        for (int j1 = num5; j1 <= num6; ++j1)
                        {
                            float num7 = Math.Abs(i1 - position.X / 16f);
                            float num8 = Math.Abs(j1 - position.Y / 16f);
                            if (Math.Sqrt(num7 * num7 + num8 * num8) < num2)
                            {
                                bool flag2 = true;
                                if (Main.tile[i1, j1] != null && Main.tile[i1, j1].active())
                                {
                                    flag2 = true;
                                    if (Main.tileDungeon[Main.tile[i1, j1].type] || Main.tile[i1, j1].type == 21 || (Main.tile[i1, j1].type == 26 || Main.tile[i1, j1].type == 107) || (Main.tile[i1, j1].type == 108 || Main.tile[i1, j1].type == 111 || (Main.tile[i1, j1].type == 226 || Main.tile[i1, j1].type == 237)) || (Main.tile[i1, j1].type == 221 || Main.tile[i1, j1].type == 222 || (Main.tile[i1, j1].type == 223 || Main.tile[i1, j1].type == 211) || Main.tile[i1, j1].type == 404))
                                        flag2 = false;
                                    if (!Main.hardMode && Main.tile[i1, j1].type == 58)
                                        flag2 = false;
                                    if (flag2)
                                    {
                                        WorldGen.KillTile(i1, j1, false, false, false);
                                        if (!Main.tile[i1, j1].active() && Main.netMode != 0)
                                            NetMessage.SendData(17, -1, -1, "", 0, i1, j1, 0.0f, 0, 0, 0);
                                    }
                                }
                                if (flag2)
                                {
                                    for (int i2 = i1 - 1; i2 <= i1 + 1; ++i2)
                                    {
                                        for (int j2 = j1 - 1; j2 <= j1 + 1; ++j2)
                                        {
                                            if (Main.tile[i2, j2] != null && Main.tile[i2, j2].wall > 0 && flag1)
                                            {
                                                WorldGen.KillWall(i2, j2, false);
                                                if (Main.tile[i2, j2].wall == 0 && Main.netMode != 0)
                                                    NetMessage.SendData(17, -1, -1, "", 2, i2, j2, 0.0f, 0, 0, 0);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    AchievementsHelper.CurrentlyMining = false;
                }
                if (Main.netMode != 0)
                    NetMessage.SendData(29, -1, -1, "", identity, owner, 0.0f, 0.0f, 0, 0, 0);
                if (!noDropItem)
                {
                    int number = -1;
                    if (aiStyle == 10)
                    {
                        int i = (int)(position.X + (width / 2)) / 16;
                        int j = (int)(position.Y + (width / 2)) / 16;
                        int tempType = 0;
                        int Type = 2;
                        if (this.type == 109)
                        {
                            tempType = 147;
                            Type = 0;
                        }
                        if (this.type == 31)
                        {
                            tempType = 53;
                            Type = 0;
                        }
                        if (this.type == 42)
                        {
                            tempType = 53;
                            Type = 0;
                        }
                        if (this.type == 56)
                        {
                            tempType = 112;
                            Type = 0;
                        }
                        if (this.type == 65)
                        {
                            tempType = 112;
                            Type = 0;
                        }
                        if (this.type == 67)
                        {
                            tempType = 116;
                            Type = 0;
                        }
                        if (this.type == 68)
                        {
                            tempType = 116;
                            Type = 0;
                        }
                        if (this.type == 71)
                        {
                            tempType = 123;
                            Type = 0;
                        }
                        if (this.type == 39)
                        {
                            tempType = 59;
                            Type = 176;
                        }
                        if (this.type == 40)
                        {
                            tempType = 57;
                            Type = 172;
                        }
                        if (this.type == 179)
                        {
                            tempType = 224;
                            Type = 0;
                        }
                        if (this.type == 241)
                        {
                            tempType = 234;
                            Type = 0;
                        }
                        if (this.type == 354)
                        {
                            tempType = 234;
                            Type = 0;
                        }
                        if (this.type == 411)
                        {
                            tempType = 330;
                            Type = 71;
                        }
                        if (this.type == 412)
                        {
                            tempType = 331;
                            Type = 72;
                        }
                        if (this.type == 413)
                        {
                            tempType = 332;
                            Type = 73;
                        }
                        if (this.type == 414)
                        {
                            tempType = 333;
                            Type = 74;
                        }
                        if (this.type == 109)
                        {
                            int index = Player.FindClosest(position, width, height);
                            if ((Center - Main.player[index].Center).Length() > Main.maxScreenW * 0.75)
                            {
                                tempType = -1;
                                Type = 593;
                            }
                        }
                        if (Main.tile[i, j].halfBrick() && velocity.Y > 0.0 && Math.Abs(velocity.Y) > Math.Abs(velocity.X))
                            --j;
                        if (!Main.tile[i, j].active() && tempType >= 0)
                        {
                            bool flag = false;
                            if (j < Main.maxTilesY - 2 && Main.tile[i, j + 1] != null && (Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type == 314))
                                flag = true;
                            if (!flag)
                                WorldGen.PlaceTile(i, j, tempType, false, true, -1, 0);
                            if (!flag && Main.tile[i, j].active() && Main.tile[i, j].type == tempType)
                            {
                                if (Main.tile[i, j + 1].halfBrick() || Main.tile[i, j + 1].slope() != 0)
                                {
                                    WorldGen.SlopeTile(i, j + 1, 0);
                                    if (Main.netMode == 2)
                                        NetMessage.SendData(17, -1, -1, "", 14, i, (j + 1), 0.0f, 0, 0, 0);
                                }
                                if (Main.netMode != 0)
                                    NetMessage.SendData(17, -1, -1, "", 1, i, j, tempType, 0, 0, 0);
                            }
                            else if (Type > 0)
                                number = Item.NewItem((int)position.X, (int)position.Y, width, height, Type, 1, false, 0, false);
                        }
                        else if (Type > 0)
                            number = Item.NewItem((int)position.X, (int)position.Y, width, height, Type, 1, false, 0, false);
                    }
                    if (this.type == 1 && Main.rand.Next(3) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 40, 1, false, 0, false);
                    if (this.type == 474 && Main.rand.Next(3) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 3003, 1, false, 0, false);
                    if (this.type == 103 && Main.rand.Next(6) == 0)
                        number = Main.rand.Next(3) != 0 ? Item.NewItem((int)position.X, (int)position.Y, width, height, 40, 1, false, 0, false) : Item.NewItem((int)position.X, (int)position.Y, width, height, 545, 1, false, 0, false);
                    if (this.type == 2 && Main.rand.Next(3) == 0)
                        number = Main.rand.Next(3) != 0 ? Item.NewItem((int)position.X, (int)position.Y, width, height, 40, 1, false, 0, false) : Item.NewItem((int)position.X, (int)position.Y, width, height, 41, 1, false, 0, false);
                    if (this.type == 172 && Main.rand.Next(3) == 0)
                        number = Main.rand.Next(3) != 0 ? Item.NewItem((int)position.X, (int)position.Y, width, height, 40, 1, false, 0, false) : Item.NewItem((int)position.X, (int)position.Y, width, height, 988, 1, false, 0, false);
                    if (this.type == 171)
                    {
                        if (ai[1] == 0.0)
                        {
                            number = Item.NewItem((int)position.X, (int)position.Y, width, height, 985, 1, false, 0, false);
                            Main.item[number].noGrabDelay = 0;
                        }
                        else if (ai[1] < 10.0)
                        {
                            number = Item.NewItem((int)position.X, (int)position.Y, width, height, 965, (int)(10.0 - ai[1]), false, 0, false);
                            Main.item[number].noGrabDelay = 0;
                        }
                    }
                    if (this.type == 475)
                    {
                        if (ai[1] == 0.0)
                        {
                            number = Item.NewItem((int)position.X, (int)position.Y, width, height, 3005, 1, false, 0, false);
                            Main.item[number].noGrabDelay = 0;
                        }
                        else if (ai[1] < 10.0)
                        {
                            number = Item.NewItem((int)position.X, (int)position.Y, width, height, 2996, (int)(10.0 - ai[1]), false, 0, false);
                            Main.item[number].noGrabDelay = 0;
                        }
                    }
                    if (this.type == 505)
                    {
                        if (ai[1] == 0.0)
                        {
                            number = Item.NewItem((int)position.X, (int)position.Y, width, height, 3079, 1, false, 0, false);
                            Main.item[number].noGrabDelay = 0;
                        }
                        else if (ai[1] < 10.0)
                        {
                            number = Item.NewItem((int)position.X, (int)position.Y, width, height, 3077, (int)(10.0 - ai[1]), false, 0, false);
                            Main.item[number].noGrabDelay = 0;
                        }
                    }
                    if (this.type == 506)
                    {
                        if (ai[1] == 0.0)
                        {
                            number = Item.NewItem((int)position.X, (int)position.Y, width, height, 3080, 1, false, 0, false);
                            Main.item[number].noGrabDelay = 0;
                        }
                        else if (ai[1] < 10.0)
                        {
                            number = Item.NewItem((int)position.X, (int)position.Y, width, height, 3078, (int)(10.0 - ai[1]), false, 0, false);
                            Main.item[number].noGrabDelay = 0;
                        }
                    }
                    if (this.type == 91 && Main.rand.Next(6) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 516, 1, false, 0, false);
                    if (this.type == 50 && Main.rand.Next(3) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 282, 1, false, 0, false);
                    if (this.type == 515 && Main.rand.Next(3) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 3112, 1, false, 0, false);
                    if (this.type == 53 && Main.rand.Next(3) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 286, 1, false, 0, false);
                    if (this.type == 48 && Main.rand.Next(2) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 279, 1, false, 0, false);
                    if (this.type == 54 && Main.rand.Next(2) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 287, 1, false, 0, false);
                    if (this.type == 3 && Main.rand.Next(2) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 42, 1, false, 0, false);
                    if (this.type == 4 && Main.rand.Next(4) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 47, 1, false, 0, false);
                    if (this.type == 12 && damage > 500)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 75, 1, false, 0, false);
                    if (this.type == 155)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 859, 1, false, 0, false);
                    if (this.type == 598 && Main.rand.Next(4) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 3378, 1, false, 0, false);
                    if (this.type == 599 && Main.rand.Next(4) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 3379, 1, false, 0, false);
                    if (this.type == 21 && Main.rand.Next(2) == 0)
                        number = Item.NewItem((int)position.X, (int)position.Y, width, height, 154, 1, false, 0, false);
                    if (Main.netMode == 1 && number >= 0)
                        NetMessage.SendData(21, -1, -1, "", number, 1f, 0.0f, 0.0f, 0, 0, 0);
                }
                if (type == 69 || type == 70 || type == 621)
                {
                    int i = (int)(position.X + (width / 2)) / 16;
                    int j = (int)(position.Y + (height / 2)) / 16;
                    if (type == 69)
                        WorldGen.Convert(i, j, 2, 4);
                    if (type == 70)
                        WorldGen.Convert(i, j, 1, 4);
                    if (type == 621)
                        WorldGen.Convert(i, j, 4, 4);
                }
                if (this.type == 370 || this.type == 371)
                {
                    float num2 = 80f;
                    int tempType = 119;
                    if (this.type == 371)
                        tempType = 120;
                    for (int index = 0; index < 255; ++index)
                    {
                        Player player = Main.player[index];
                        if (player.active && !player.dead && Vector2.Distance(Center, player.Center) < num2)
                            player.AddBuff(tempType, 1800, true);
                    }
                    for (int index = 0; index < 200; ++index)
                    {
                        NPC npc = Main.npc[index];
                        if (npc.active && npc.life > 0 && Vector2.Distance(Center, npc.Center) < num2)
                            npc.AddBuff(tempType, 1800, false);
                    }
                }
                if (type == 378)
                {
                    int num2 = Main.rand.Next(2, 4);
                    if (Main.rand.Next(5) == 0)
                        ++num2;
                    for (int index = 0; index < num2; ++index)
                    {
                        float num3 = velocity.X;
                        float num4 = velocity.Y;
                        NewProjectile(Center.X, Center.Y, num3 * (float)(1.0 + Main.rand.Next(-20, 21) * 0.00999999977648258), num4 * (float)(1.0 + Main.rand.Next(-20, 21) * 0.00999999977648258), 379, damage, knockBack, owner, 0.0f, 0.0f);
                    }
                }
            }
            active = false;
        }

Usage Example

コード例 #1
0
        public static void SpearAI(int index, float protractSpeed = 1.5f, float retractSpeed = 1.4f, ExtraAction action = null, ExtraAction initialize = null)
        {
            Terraria.Projectile projectile = Main.projectile[index];
            if (initialize != null && projectile.localAI[1] == 0f)
            {
                projectile.localAI[1] = 1f;
                initialize();
            }
            Vector2 vector = Main.player[projectile.owner].RotatedRelativePoint(Main.player[projectile.owner].MountedCenter, true);

            projectile.direction = Main.player[projectile.owner].direction;
            Main.player[projectile.owner].heldProj = projectile.whoAmI;
            Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
            projectile.position.X = vector.X - (float)(projectile.width / 2);
            projectile.position.Y = vector.Y - (float)(projectile.height / 2);
            if (!Main.player[projectile.owner].frozen)
            {
                if (projectile.ai[0] == 0f)
                {
                    projectile.ai[0]     = 3f;
                    projectile.netUpdate = true;
                }
                if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
                {
                    projectile.ai[0] -= retractSpeed;
                }
                else
                {
                    projectile.ai[0] += protractSpeed;
                }
            }
            projectile.position += projectile.velocity * projectile.ai[0];
            if (Main.player[projectile.owner].itemAnimation == 0)
            {
                projectile.Kill();
            }
            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f;
            if (projectile.spriteDirection == -1)
            {
                projectile.rotation -= 1.57f;
            }
            if (action != null)
            {
                action();
            }
        }
All Usage Examples Of Terraria.Projectile::Kill