Terraria.Projectile.AI_026 C# (CSharp) Method

AI_026() private method

private AI_026 ( ) : void
return void
        private void AI_026()
        {
            if (!Main.player[owner].active)
            {
                active = false;
            }
            else
            {
                bool flag1 = false;
                bool flag2 = false;
                bool flag3 = false;
                bool flag4 = false;
                int num1 = 85;
                if (type == 324)
                    num1 = 120;
                if (type == 112)
                    num1 = 100;
                if (type == 127)
                    num1 = 50;
                if (type >= 191 && type <= 194)
                {
                    if (lavaWet)
                    {
                        ai[0] = 1f;
                        ai[1] = 0.0f;
                    }
                    num1 = 60 + 30 * minionPos;
                }
                else if (type == 266)
                    num1 = 60 + 30 * minionPos;
                if (type == 111)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].bunny = false;
                    if (Main.player[owner].bunny)
                        timeLeft = 2;
                }
                if (type == 112)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].penguin = false;
                    if (Main.player[owner].penguin)
                        timeLeft = 2;
                }
                if (type == 334)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].puppy = false;
                    if (Main.player[owner].puppy)
                        timeLeft = 2;
                }
                if (type == 353)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].grinch = false;
                    if (Main.player[owner].grinch)
                        timeLeft = 2;
                }
                if (type == 127)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].turtle = false;
                    if (Main.player[owner].turtle)
                        timeLeft = 2;
                }
                if (type == 175)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].eater = false;
                    if (Main.player[owner].eater)
                        timeLeft = 2;
                }
                if (type == 197)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].skeletron = false;
                    if (Main.player[owner].skeletron)
                        timeLeft = 2;
                }
                if (type == 198)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].hornet = false;
                    if (Main.player[owner].hornet)
                        timeLeft = 2;
                }
                if (type == 199)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].tiki = false;
                    if (Main.player[owner].tiki)
                        timeLeft = 2;
                }
                if (type == 200)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].lizard = false;
                    if (Main.player[owner].lizard)
                        timeLeft = 2;
                }
                if (type == 208)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].parrot = false;
                    if (Main.player[owner].parrot)
                        timeLeft = 2;
                }
                if (type == 209)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].truffle = false;
                    if (Main.player[owner].truffle)
                        timeLeft = 2;
                }
                if (type == 210)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].sapling = false;
                    if (Main.player[owner].sapling)
                        timeLeft = 2;
                }
                if (type == 324)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].cSapling = false;
                    if (Main.player[owner].cSapling)
                        timeLeft = 2;
                }
                if (type == 313)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].spider = false;
                    if (Main.player[owner].spider)
                        timeLeft = 2;
                }
                if (type == 314)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].squashling = false;
                    if (Main.player[owner].squashling)
                        timeLeft = 2;
                }
                if (type == 211)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].wisp = false;
                    if (Main.player[owner].wisp)
                        timeLeft = 2;
                }
                if (type == 236)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].dino = false;
                    if (Main.player[owner].dino)
                        timeLeft = 2;
                }
                if (type == 499)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].babyFaceMonster = false;
                    if (Main.player[owner].babyFaceMonster)
                        timeLeft = 2;
                }
                if (type == 266)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].slime = false;
                    if (Main.player[owner].slime)
                        timeLeft = 2;
                }
                if (type == 268)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].eyeSpring = false;
                    if (Main.player[owner].eyeSpring)
                        timeLeft = 2;
                }
                if (type == 269)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].snowman = false;
                    if (Main.player[owner].snowman)
                        timeLeft = 2;
                }
                if (type == 319)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].blackCat = false;
                    if (Main.player[owner].blackCat)
                        timeLeft = 2;
                }
                if (type == 380)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].zephyrfish = false;
                    if (Main.player[owner].zephyrfish)
                        timeLeft = 2;
                }
                if (type >= 191 && type <= 194)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].pygmy = false;
                    if (Main.player[owner].pygmy)
                        timeLeft = Main.rand.Next(2, 10);
                }
                if (type >= 390 && type <= 392)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].spiderMinion = false;
                    if (Main.player[owner].spiderMinion)
                        timeLeft = 2;
                }
                if (type == 398)
                {
                    if (Main.player[owner].dead)
                        Main.player[owner].miniMinotaur = false;
                    if (Main.player[owner].miniMinotaur)
                        timeLeft = 2;
                }
                if (type >= 191 && type <= 194 || type == 266 || type >= 390 && type <= 392)
                {
                    int num2 = 10;
                    int num3 = 40 * (minionPos + 1) * Main.player[owner].direction;
                    if (Main.player[owner].position.X + (Main.player[owner].width / 2) < position.X + (width / 2) - num2 + num3)
                        flag1 = true;
                    else if (Main.player[owner].position.X + (Main.player[owner].width / 2) > position.X + (width / 2) + num2 + num3)
                        flag2 = true;
                }
                else if (Main.player[owner].position.X + (Main.player[owner].width / 2) < position.X + (width / 2) - num1)
                    flag1 = true;
                else if (Main.player[owner].position.X + (Main.player[owner].width / 2) > position.X + (width / 2) + num1)
                    flag2 = true;
                if (type == 175)
                {
                    float num2 = 0.1f;
                    tileCollide = false;
                    int num3 = 300;
                    Vector2 vector2_1 = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
                    float num4 = Main.player[owner].position.X + (Main.player[owner].width / 2) - vector2_1.X;
                    float num5 = Main.player[owner].position.Y + (Main.player[owner].height / 2) - vector2_1.Y;
                    if (type == 127)
                        num5 = Main.player[owner].position.Y - vector2_1.Y;
                    float num6 = (float)Math.Sqrt(num4 * num4 + num5 * num5);
                    float num7 = 7f;
                    if (num6 < num3 && Main.player[owner].velocity.Y == 0.0 && (position.Y + (double)height <= Main.player[owner].position.Y + Main.player[owner].height && !Collision.SolidCollision(position, width, height)))
                    {
                        ai[0] = 0.0f;
                        if (velocity.Y < -6.0)
                            velocity.Y = -6f;
                    }
                    if (num6 < 150.0)
                    {
                        if (Math.Abs(velocity.X) > 2.0 || Math.Abs(velocity.Y) > 2.0)
                        {
                            Projectile projectile = this;
                            Vector2 vector2_2 = projectile.velocity * 0.99f;
                            projectile.velocity = vector2_2;
                        }
                        num2 = 0.01f;
                        if (num4 < -2.0)
                            num4 = -2f;
                        if (num4 > 2.0)
                            num4 = 2f;
                        if (num5 < -2.0)
                            num5 = -2f;
                        if (num5 > 2.0)
                            num5 = 2f;
                    }
                    else
                    {
                        if (num6 > 300.0)
                            num2 = 0.2f;
                        float num8 = num7 / num6;
                        num4 *= num8;
                        num5 *= num8;
                    }
                    if (Math.Abs(num4) > Math.Abs(num5) || num2 == 0.0500000007450581)
                    {
                        if (velocity.X < num4)
                        {
                            velocity.X += num2;
                            if (num2 > 0.0500000007450581 && velocity.X < 0.0)
                                velocity.X += num2;
                        }
                        if (velocity.X > num4)
                        {
                            velocity.X -= num2;
                            if (num2 > 0.0500000007450581 && velocity.X > 0.0)
                                velocity.X -= num2;
                        }
                    }
                    if (Math.Abs(num4) <= Math.Abs(num5) || num2 == 0.0500000007450581)
                    {
                        if (velocity.Y < num5)
                        {
                            velocity.Y += num2;
                            if (num2 > 0.0500000007450581 && velocity.Y < 0.0)
                                velocity.Y += num2;
                        }
                        if (velocity.Y > num5)
                        {
                            velocity.Y -= num2;
                            if (num2 > 0.0500000007450581 && velocity.Y > 0.0)
                                velocity.Y -= num2;
                        }
                    }
                    rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
                    ++frameCounter;
                    if (frameCounter > 6)
                    {
                        ++frame;
                        frameCounter = 0;
                    }
                    if (frame <= 1)
                        return;
                    frame = 0;
                }
                else if (type == 197)
                {
                    float num2 = 0.1f;
                    tileCollide = false;
                    int num3 = 300;
                    Vector2 vector2_1 = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
                    float num4 = Main.player[owner].position.X + (Main.player[owner].width / 2) - vector2_1.X;
                    float num5 = Main.player[owner].position.Y + (Main.player[owner].height / 2) - vector2_1.Y;
                    if (type == 127)
                        num5 = Main.player[owner].position.Y - vector2_1.Y;
                    float num6 = (float)Math.Sqrt(num4 * num4 + num5 * num5);
                    float num7 = 3f;
                    if (num6 > 500.0)
                        localAI[0] = 10000f;
                    if (localAI[0] >= 10000.0)
                        num7 = 14f;
                    if (num6 < num3 && Main.player[owner].velocity.Y == 0.0 && (position.Y + (double)height <= Main.player[owner].position.Y + Main.player[owner].height && !Collision.SolidCollision(position, width, height)))
                    {
                        ai[0] = 0.0f;
                        if (velocity.Y < -6.0)
                            velocity.Y = -6f;
                    }
                    if (num6 < 150.0)
                    {
                        if (Math.Abs(velocity.X) > 2.0 || Math.Abs(velocity.Y) > 2.0)
                        {
                            Projectile projectile = this;
                            Vector2 vector2_2 = projectile.velocity * 0.99f;
                            projectile.velocity = vector2_2;
                        }
                        num2 = 0.01f;
                        if (num4 < -2.0)
                            num4 = -2f;
                        if (num4 > 2.0)
                            num4 = 2f;
                        if (num5 < -2.0)
                            num5 = -2f;
                        if (num5 > 2.0)
                            num5 = 2f;
                    }
                    else
                    {
                        if (num6 > 300.0)
                            num2 = 0.2f;
                        float num8 = num7 / num6;
                        num4 *= num8;
                        num5 *= num8;
                    }
                    if (velocity.X < num4)
                    {
                        velocity.X += num2;
                        if (num2 > 0.0500000007450581 && velocity.X < 0.0)
                            velocity.X += num2;
                    }
                    if (velocity.X > num4)
                    {
                        velocity.X -= num2;
                        if (num2 > 0.0500000007450581 && velocity.X > 0.0)
                            velocity.X -= num2;
                    }
                    if (velocity.Y < num5)
                    {
                        velocity.Y += num2;
                        if (num2 > 0.0500000007450581 && velocity.Y < 0.0)
                            velocity.Y += num2;
                    }
                    if (velocity.Y > num5)
                    {
                        velocity.Y -= num2;
                        if (num2 > 0.0500000007450581 && velocity.Y > 0.0)
                            velocity.Y -= num2;
                    }
                    localAI[0] += Main.rand.Next(10);
                    if (localAI[0] > 10000.0)
                    {
                        if (localAI[1] == 0.0)
                            localAI[1] = velocity.X >= 0.0 ? 1f : -1f;
                        rotation += 0.25f * localAI[1];
                        if (localAI[0] > 12000.0)
                            localAI[0] = 0.0f;
                    }
                    else
                    {
                        localAI[1] = 0.0f;
                        float num8 = velocity.X * 0.1f;
                        if (rotation > num8)
                        {
                            rotation -= (float)((Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.00999999977648258);
                            if (rotation < num8)
                                rotation = num8;
                        }
                        if (rotation < num8)
                        {
                            rotation += (float)((Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.00999999977648258);
                            if (rotation > num8)
                                rotation = num8;
                        }
                    }
                    if (rotation > 6.28)
                        rotation -= 6.28f;
                    if (rotation >= -6.28)
                        return;
                    rotation += 6.28f;
                }
                else if (type == 198 || type == 380)
                {
                    float num2 = 0.4f;
                    if (type == 380)
                        num2 = 0.3f;
                    tileCollide = false;
                    int num3 = 100;
                    Vector2 vector2_1 = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
                    float num4 = Main.player[owner].position.X + (Main.player[owner].width / 2) - vector2_1.X;
                    float num5 = Main.player[owner].position.Y + (Main.player[owner].height / 2) - vector2_1.Y + Main.rand.Next(-10, 21);
                    float num6 = num4 + Main.rand.Next(-10, 21) + (60 * -Main.player[owner].direction);
                    float num7 = num5 - 60f;
                    if (type == 127)
                        num7 = Main.player[owner].position.Y - vector2_1.Y;
                    float num8 = (float)Math.Sqrt(num6 * num6 + num7 * num7);
                    float num9 = 14f;
                    if (type == 380)
                        num9 = 6f;
                    if (num8 < num3 && Main.player[owner].velocity.Y == 0.0 && (position.Y + (double)height <= Main.player[owner].position.Y + Main.player[owner].height && !Collision.SolidCollision(position, width, height)))
                    {
                        ai[0] = 0.0f;
                        if (velocity.Y < -6.0)
                            velocity.Y = -6f;
                    }
                    if (num8 < 50.0)
                    {
                        if (Math.Abs(velocity.X) > 2.0 || Math.Abs(velocity.Y) > 2.0)
                        {
                            Projectile projectile = this;
                            Vector2 vector2_2 = projectile.velocity * 0.99f;
                            projectile.velocity = vector2_2;
                        }
                        num2 = 0.01f;
                    }
                    else
                    {
                        if (type == 380)
                        {
                            if (num8 < 100.0)
                                num2 = 0.1f;
                            if (num8 > 300.0)
                                num2 = 0.4f;
                        }
                        else if (type == 198)
                        {
                            if (num8 < 100.0)
                                num2 = 0.1f;
                            if (num8 > 300.0)
                                num2 = 0.6f;
                        }
                        float num10 = num9 / num8;
                        num6 *= num10;
                        num7 *= num10;
                    }
                    if (velocity.X < num6)
                    {
                        velocity.X += num2;
                        if (num2 > 0.0500000007450581 && velocity.X < 0.0)
                            velocity.X += num2;
                    }
                    if (velocity.X > num6)
                    {
                        velocity.X -= num2;
                        if (num2 > 0.0500000007450581 && velocity.X > 0.0)
                            velocity.X -= num2;
                    }
                    if (velocity.Y < num7)
                    {
                        velocity.Y += num2;
                        if (num2 > 0.0500000007450581 && velocity.Y < 0.0)
                            velocity.Y += num2 * 2f;
                    }
                    if (velocity.Y > num7)
                    {
                        velocity.Y -= num2;
                        if (num2 > 0.0500000007450581 && velocity.Y > 0.0)
                            velocity.Y -= num2 * 2f;
                    }
                    if (velocity.X > 0.25)
                        direction = -1;
                    else if (velocity.X < -0.25)
                        direction = 1;
                    spriteDirection = direction;
                    rotation = velocity.X * 0.05f;
                    ++frameCounter;
                    int num11 = 2;
                    if (type == 380)
                        num11 = 5;
                    if (frameCounter > num11)
                    {
                        ++frame;
                        frameCounter = 0;
                    }
                    if (frame <= 3)
                        return;
                    frame = 0;
                }
                else if (type == 211)
                {
                    float num2 = 0.2f;
                    float num3 = 5f;
                    tileCollide = false;
                    Vector2 vector2_1 = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
                    float num4 = Main.player[owner].position.X + (Main.player[owner].width / 2) - vector2_1.X;
                    float num5 = Main.player[owner].position.Y + Main.player[owner].gfxOffY + (Main.player[owner].height / 2) - vector2_1.Y;
                    if (Main.player[owner].controlLeft)
                        num4 -= 120f;
                    else if (Main.player[owner].controlRight)
                        num4 += 120f;
                    float num6;
                    if (Main.player[owner].controlDown)
                    {
                        num6 = num5 + 120f;
                    }
                    else
                    {
                        if (Main.player[owner].controlUp)
                            num5 -= 120f;
                        num6 = num5 - 60f;
                    }
                    float num7 = (float)Math.Sqrt(num4 * num4 + num6 * num6);
                    if (num7 > 1000.0)
                    {
                        position.X += num4;
                        position.Y += num6;
                    }
                    if (localAI[0] == 1.0)
                    {
                        if (num7 < 10.0 && Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y) < num3 && Main.player[owner].velocity.Y == 0.0)
                            localAI[0] = 0.0f;
                        float num8 = 12f;
                        if (num7 < num8)
                        {
                            velocity.X = num4;
                            velocity.Y = num6;
                        }
                        else
                        {
                            float num9 = num8 / num7;
                            velocity.X = num4 * num9;
                            velocity.Y = num6 * num9;
                        }
                        if (velocity.X > 0.5)
                            direction = -1;
                        else if (velocity.X < -0.5)
                            direction = 1;
                        spriteDirection = direction;
                        rotation -= (float)(0.200000002980232 + Math.Abs(velocity.X) * 0.025000000372529) * direction;
                        ++frameCounter;
                        if (frameCounter > 3)
                        {
                            ++frame;
                            frameCounter = 0;
                        }
                        if (frame < 5)
                            frame = 5;
                        if (frame > 9)
                            frame = 5;
                        for (int index1 = 0; index1 < 2; ++index1)
                        {
                            int index2 = Dust.NewDust(new Vector2(position.X + 3f, position.Y + 4f), 14, 14, 156, 0.0f, 0.0f, 0, new Color(), 1f);
                            Main.dust[index2].velocity *= 0.2f;
                            Main.dust[index2].noGravity = true;
                            Main.dust[index2].scale = 1.25f;
                            Main.dust[index2].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cLight, Main.player[owner]);
                        }
                    }
                    else
                    {
                        if (num7 > 200.0)
                            localAI[0] = 1f;
                        if (velocity.X > 0.5)
                            direction = -1;
                        else if (velocity.X < -0.5)
                            direction = 1;
                        spriteDirection = direction;
                        if (num7 < 10.0)
                        {
                            velocity.X = num4;
                            velocity.Y = num6;
                            rotation = velocity.X * 0.05f;
                            if (num7 < num3)
                            {
                                Projectile projectile1 = this;
                                Vector2 vector2_2 = projectile1.position + velocity;
                                projectile1.position = vector2_2;
                                Projectile projectile2 = this;
                                Vector2 vector2_3 = projectile2.velocity * 0.0f;
                                projectile2.velocity = vector2_3;
                                num2 = 0.0f;
                            }
                            direction = -Main.player[owner].direction;
                        }
                        float num8 = num3 / num7;
                        float num9 = num4 * num8;
                        float num10 = num6 * num8;
                        if (velocity.X < num9)
                        {
                            velocity.X += num2;
                            if (velocity.X < 0.0)
                                velocity.X *= 0.99f;
                        }
                        if (velocity.X > num9)
                        {
                            velocity.X -= num2;
                            if (velocity.X > 0.0)
                                velocity.X *= 0.99f;
                        }
                        if (velocity.Y < num10)
                        {
                            velocity.Y += num2;
                            if (velocity.Y < 0.0)
                                velocity.Y *= 0.99f;
                        }
                        if (velocity.Y > num10)
                        {
                            velocity.Y -= num2;
                            if (velocity.Y > 0.0)
                                velocity.Y *= 0.99f;
                        }
                        if (velocity.X != 0.0 || velocity.Y != 0.0)
                            rotation = velocity.X * 0.05f;
                        ++frameCounter;
                        if (frameCounter > 3)
                        {
                            ++frame;
                            frameCounter = 0;
                        }
                        if (frame <= 4)
                            return;
                        frame = 0;
                    }
                }
                else if (type == 199)
                {
                    float num2 = 0.1f;
                    tileCollide = false;
                    int num3 = 200;
                    Vector2 vector2 = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
                    float num4 = Main.player[owner].position.X + (Main.player[owner].width / 2) - vector2.X;
                    float num5 = Main.player[owner].position.Y + (Main.player[owner].height / 2) - vector2.Y - 60f;
                    float num6 = num4 - 2f;
                    if (type == 127)
                        num5 = Main.player[owner].position.Y - vector2.Y;
                    float num7 = (float)Math.Sqrt(num6 * num6 + num5 * num5);
                    float num8 = 4f;
                    float num9 = num7;
                    if (num7 < num3 && Main.player[owner].velocity.Y == 0.0 && (position.Y + (double)height <= Main.player[owner].position.Y + Main.player[owner].height && !Collision.SolidCollision(position, width, height)))
                    {
                        ai[0] = 0.0f;
                        if (velocity.Y < -6.0)
                            velocity.Y = -6f;
                    }
                    if (num7 < 4.0)
                    {
                        velocity.X = num6;
                        velocity.Y = num5;
                        num2 = 0.0f;
                    }
                    else
                    {
                        if (num7 > 350.0)
                        {
                            num2 = 0.2f;
                            num8 = 10f;
                        }
                        float num10 = num8 / num7;
                        num6 *= num10;
                        num5 *= num10;
                    }
                    if (velocity.X < num6)
                    {
                        velocity.X += num2;
                        if (velocity.X < 0.0)
                            velocity.X += num2;
                    }
                    if (velocity.X > num6)
                    {
                        velocity.X -= num2;
                        if (velocity.X > 0.0)
                            velocity.X -= num2;
                    }
                    if (velocity.Y < num5)
                    {
                        velocity.Y += num2;
                        if (velocity.Y < 0.0)
                            velocity.Y += num2;
                    }
                    if (velocity.Y > num5)
                    {
                        velocity.Y -= num2;
                        if (velocity.Y > 0.0)
                            velocity.Y -= num2;
                    }
                    direction = -Main.player[owner].direction;
                    spriteDirection = 1;
                    rotation = velocity.Y * 0.05f * (float)-direction;
                    if (num9 >= 50.0)
                    {
                        ++frameCounter;
                        if (frameCounter <= 6)
                            return;
                        frameCounter = 0;
                        if (velocity.X < 0.0)
                        {
                            if (frame < 2)
                                ++frame;
                            if (frame <= 2)
                                return;
                            --frame;
                        }
                        else
                        {
                            if (frame < 6)
                                ++frame;
                            if (frame <= 6)
                                return;
                            --frame;
                        }
                    }
                    else
                    {
                        ++frameCounter;
                        if (frameCounter > 6)
                        {
                            frame += direction;
                            frameCounter = 0;
                        }
                        if (frame > 7)
                            frame = 0;
                        if (frame >= 0)
                            return;
                        frame = 7;
                    }
                }
                else
                {
                    if (ai[1] == 0.0)
                    {
                        int num2 = 500;
                        if (type == 127)
                            num2 = 200;
                        if (type == 208)
                            num2 = 300;
                        if (type >= 191 && type <= 194 || type == 266 || type >= 390 && type <= 392)
                        {
                            num2 += 40 * minionPos;
                            if (localAI[0] > 0.0)
                                num2 += 500;
                            if (type == 266 && localAI[0] > 0.0)
                                num2 += 100;
                            if (type >= 390 && type <= 392 && localAI[0] > 0.0)
                                num2 += 400;
                        }
                        if (Main.player[owner].rocketDelay2 > 0)
                            ai[0] = 1f;
                        Vector2 vector2 = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
                        float num3 = Main.player[owner].position.X + (Main.player[owner].width / 2) - vector2.X;
                        if (type >= 191)
                        {
                            int num4 = type;
                        }
                        float num5 = Main.player[owner].position.Y + (Main.player[owner].height / 2) - vector2.Y;
                        float num6 = (float)Math.Sqrt(num3 * num3 + num5 * num5);
                        if (num6 > 2000.0)
                        {
                            position.X = Main.player[owner].position.X + (Main.player[owner].width / 2) - (width / 2);
                            position.Y = Main.player[owner].position.Y + (Main.player[owner].height / 2) - (height / 2);
                        }
                        else if (num6 > num2 || Math.Abs(num5) > 300.0 && ((type < 191 || type > 194) && type != 266 && (type < 390 || type > 392) || localAI[0] <= 0.0))
                        {
                            if (type != 324)
                            {
                                if (num5 > 0.0 && velocity.Y < 0.0)
                                    velocity.Y = 0.0f;
                                if (num5 < 0.0 && velocity.Y > 0.0)
                                    velocity.Y = 0.0f;
                            }
                            ai[0] = 1f;
                        }
                    }
                    if (type == 209 && ai[0] != 0.0)
                    {
                        if (Main.player[owner].velocity.Y == 0.0 && alpha >= 100)
                        {
                            position.X = Main.player[owner].position.X + (Main.player[owner].width / 2) - (width / 2);
                            position.Y = Main.player[owner].position.Y + (float)Main.player[owner].height - height;
                            ai[0] = 0.0f;
                        }
                        else
                        {
                            velocity.X = 0.0f;
                            velocity.Y = 0.0f;
                            alpha += 5;
                            if (alpha <= 255)
                                return;
                            alpha = 255;
                        }
                    }
                    else if (ai[0] != 0.0)
                    {
                        float num2 = 0.2f;
                        int num3 = 200;
                        if (type == 127)
                            num3 = 100;
                        if (type >= 191 && type <= 194)
                        {
                            num2 = 0.5f;
                            num3 = 100;
                        }
                        tileCollide = false;
                        Vector2 vector2_1 = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
                        float num4 = Main.player[owner].position.X + (Main.player[owner].width / 2) - vector2_1.X;
                        if (type >= 191 && type <= 194 || type == 266 || type >= 390 && type <= 392)
                        {
                            num4 -= (float)(40 * Main.player[owner].direction);
                            float num5 = 700f;
                            if (type >= 191 && type <= 194)
                                num5 += 100f;
                            bool flag5 = false;
                            int num6 = -1;
                            for (int index = 0; index < 200; ++index)
                            {
                                if (Main.npc[index].CanBeChasedBy(this, false))
                                {
                                    float num7 = Main.npc[index].position.X + (float)(Main.npc[index].width / 2);
                                    float num8 = Main.npc[index].position.Y + (float)(Main.npc[index].height / 2);
                                    if ((double)(Math.Abs(Main.player[owner].position.X + (Main.player[owner].width / 2) - num7) + Math.Abs(Main.player[owner].position.Y + (Main.player[owner].height / 2) - num8)) < num5)
                                    {
                                        if (Collision.CanHit(position, width, height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
                                            num6 = index;
                                        flag5 = true;
                                        break;
                                    }
                                }
                            }
                            if (!flag5)
                                num4 -= (float)(40 * minionPos * Main.player[owner].direction);
                            if (flag5 && num6 >= 0)
                                ai[0] = 0.0f;
                        }
                        float num9 = Main.player[owner].position.Y + (Main.player[owner].height / 2) - vector2_1.Y;
                        if (type == 127)
                            num9 = Main.player[owner].position.Y - vector2_1.Y;
                        float num10 = (float)Math.Sqrt(num4 * num4 + num9 * num9);
                        float num11 = 10f;
                        float num12 = num10;
                        if (type == 111)
                            num11 = 11f;
                        if (type == 127)
                            num11 = 9f;
                        if (type == 324)
                            num11 = 20f;
                        if (type >= 191 && type <= 194)
                        {
                            num2 = 0.4f;
                            num11 = 12f;
                            if (num11 < Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y))
                                num11 = Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y);
                        }
                        if (type == 208 && Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y) > 4.0)
                            num3 = -1;
                        if (num10 < num3 && Main.player[owner].velocity.Y == 0.0 && (position.Y + (double)height <= Main.player[owner].position.Y + Main.player[owner].height && !Collision.SolidCollision(position, width, height)))
                        {
                            ai[0] = 0.0f;
                            if (velocity.Y < -6.0)
                                velocity.Y = -6f;
                        }
                        float num13;
                        float num14;
                        if (num10 < 60.0)
                        {
                            num13 = velocity.X;
                            num14 = velocity.Y;
                        }
                        else
                        {
                            float num5 = num11 / num10;
                            num13 = num4 * num5;
                            num14 = num9 * num5;
                        }
                        if (type == 324)
                        {
                            if (num12 > 1000.0)
                            {
                                if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < num11 - 1.25)
                                {
                                    Projectile projectile = this;
                                    Vector2 vector2_2 = projectile.velocity * 1.025f;
                                    projectile.velocity = vector2_2;
                                }
                                if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) > num11 + 1.25)
                                {
                                    Projectile projectile = this;
                                    Vector2 vector2_2 = projectile.velocity * 0.975f;
                                    projectile.velocity = vector2_2;
                                }
                            }
                            else if (num12 > 600.0)
                            {
                                if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < num11 - 1.0)
                                {
                                    Projectile projectile = this;
                                    Vector2 vector2_2 = projectile.velocity * 1.05f;
                                    projectile.velocity = vector2_2;
                                }
                                if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) > num11 + 1.0)
                                {
                                    Projectile projectile = this;
                                    Vector2 vector2_2 = projectile.velocity * 0.95f;
                                    projectile.velocity = vector2_2;
                                }
                            }
                            else if (num12 > 400.0)
                            {
                                if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < num11 - 0.5)
                                {
                                    Projectile projectile = this;
                                    Vector2 vector2_2 = projectile.velocity * 1.075f;
                                    projectile.velocity = vector2_2;
                                }
                                if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) > num11 + 0.5)
                                {
                                    Projectile projectile = this;
                                    Vector2 vector2_2 = projectile.velocity * 0.925f;
                                    projectile.velocity = vector2_2;
                                }
                            }
                            else
                            {
                                if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < num11 - 0.25)
                                {
                                    Projectile projectile = this;
                                    Vector2 vector2_2 = projectile.velocity * 1.1f;
                                    projectile.velocity = vector2_2;
                                }
                                if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) > num11 + 0.25)
                                {
                                    Projectile projectile = this;
                                    Vector2 vector2_2 = projectile.velocity * 0.9f;
                                    projectile.velocity = vector2_2;
                                }
                            }
                            velocity.X = (float)((velocity.X * 34.0 + num13) / 35.0);
                            velocity.Y = (float)((velocity.Y * 34.0 + num14) / 35.0);
                        }
                        else
                        {
                            if (velocity.X < num13)
                            {
                                velocity.X += num2;
                                if (velocity.X < 0.0)
                                    velocity.X += num2 * 1.5f;
                            }
                            if (velocity.X > num13)
                            {
                                velocity.X -= num2;
                                if (velocity.X > 0.0)
                                    velocity.X -= num2 * 1.5f;
                            }
                            if (velocity.Y < num14)
                            {
                                velocity.Y += num2;
                                if (velocity.Y < 0.0)
                                    velocity.Y += num2 * 1.5f;
                            }
                            if (velocity.Y > num14)
                            {
                                velocity.Y -= num2;
                                if (velocity.Y > 0.0)
                                    velocity.Y -= num2 * 1.5f;
                            }
                        }
                        if (type == 111)
                            frame = 7;
                        if (type == 112)
                            frame = 2;
                        if (type >= 191 && type <= 194 && frame < 12)
                        {
                            frame = Main.rand.Next(12, 18);
                            frameCounter = 0;
                        }
                        if (type != 313)
                        {
                            if (velocity.X > 0.5)
                                spriteDirection = -1;
                            else if (velocity.X < -0.5)
                                spriteDirection = 1;
                        }
                        if (type == 398)
                        {
                            if (velocity.X > 0.5)
                                spriteDirection = 1;
                            else if (velocity.X < -0.5)
                                spriteDirection = -1;
                        }
                        if (type == 112)
                            rotation = spriteDirection != -1 ? (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f : (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
                        else if (type >= 390 && type <= 392)
                        {
                            int index1 = (int)(Center.X / 16.0);
                            int index2 = (int)(Center.Y / 16.0);
                            if (Main.tile[index1, index2] != null && Main.tile[index1, index2].wall > 0)
                            {
                                rotation = Utils.ToRotation(velocity) + 1.570796f;
                                frameCounter = frameCounter + (int)(Math.Abs(velocity.X) + Math.Abs(velocity.Y));
                                if (frameCounter > 5)
                                {
                                    ++frame;
                                    frameCounter = 0;
                                }
                                if (frame > 7)
                                    frame = 4;
                                if (frame < 4)
                                    frame = 7;
                            }
                            else
                            {
                                frameCounter = frameCounter + 1;
                                if (frameCounter > 2)
                                {
                                    ++frame;
                                    frameCounter = 0;
                                }
                                if (frame < 8 || frame > 10)
                                    frame = 8;
                                rotation = velocity.X * 0.1f;
                            }
                        }
                        else if (type == 334)
                        {
                            frameCounter = frameCounter + 1;
                            if (frameCounter > 1)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame < 7 || frame > 10)
                                frame = 7;
                            rotation = velocity.X * 0.1f;
                        }
                        else if (type == 353)
                        {
                            frameCounter = frameCounter + 1;
                            if (frameCounter > 6)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame < 10 || frame > 13)
                                frame = 10;
                            rotation = velocity.X * 0.05f;
                        }
                        else if (type == 127)
                        {
                            frameCounter = frameCounter + 3;
                            if (frameCounter > 6)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame <= 5 || frame > 15)
                                frame = 6;
                            rotation = velocity.X * 0.1f;
                        }
                        else if (type == 269)
                        {
                            if (frame == 6)
                                frameCounter = 0;
                            else if (frame < 4 || frame > 6)
                            {
                                frameCounter = 0;
                                frame = 4;
                            }
                            else
                            {
                                frameCounter = frameCounter + 1;
                                if (frameCounter > 6)
                                {
                                    ++frame;
                                    frameCounter = 0;
                                }
                            }
                            rotation = velocity.X * 0.05f;
                        }
                        else if (type == 266)
                        {
                            frameCounter = frameCounter + 1;
                            if (frameCounter > 6)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame < 2 || frame > 5)
                                frame = 2;
                            rotation = velocity.X * 0.1f;
                        }
                        else if (type == 324)
                        {
                            frameCounter = frameCounter + 1;
                            if (frameCounter > 1)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame < 6 || frame > 9)
                                frame = 6;
                            rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.58f;
                            Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.9f, 0.6f, 0.2f);
                            for (int index1 = 0; index1 < 2; ++index1)
                            {
                                int num5 = 4;
                                int index2 = Dust.NewDust(new Vector2(Center.X - num5, Center.Y - num5) - velocity * 0.0f, num5 * 2, num5 * 2, 6, 0.0f, 0.0f, 100, new Color(), 1f);
                                Main.dust[index2].scale *= (float)(1.79999995231628 + Main.rand.Next(10) * 0.100000001490116);
                                Main.dust[index2].velocity *= 0.2f;
                                if (index1 == 1)
                                    Main.dust[index2].position -= velocity * 0.5f;
                                Main.dust[index2].noGravity = true;
                                int index3 = Dust.NewDust(new Vector2(Center.X - num5, Center.Y - num5) - velocity * 0.0f, num5 * 2, num5 * 2, 31, 0.0f, 0.0f, 100, new Color(), 0.5f);
                                Main.dust[index3].fadeIn = (float)(1.0 + Main.rand.Next(5) * 0.100000001490116);
                                Main.dust[index3].velocity *= 0.05f;
                                if (index1 == 1)
                                    Main.dust[index3].position -= velocity * 0.5f;
                            }
                        }
                        else if (type == 268)
                        {
                            frameCounter = frameCounter + 1;
                            if (frameCounter > 4)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame < 6 || frame > 7)
                                frame = 6;
                            rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.58f;
                        }
                        else if (type == 200)
                        {
                            frameCounter = frameCounter + 3;
                            if (frameCounter > 6)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame <= 5 || frame > 9)
                                frame = 6;
                            rotation = velocity.X * 0.1f;
                        }
                        else if (type == 208)
                        {
                            rotation = velocity.X * 0.075f;
                            ++frameCounter;
                            if (frameCounter > 6)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame > 4)
                                frame = 1;
                            if (frame < 1)
                                frame = 1;
                        }
                        else if (type == 236)
                        {
                            rotation = velocity.Y * 0.05f * direction;
                            if (velocity.Y < 0.0)
                                frameCounter += 2;
                            else
                                ++frameCounter;
                            if (frameCounter >= 6)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame > 12)
                                frame = 9;
                            if (frame < 9)
                                frame = 9;
                        }
                        else if (type == 499)
                        {
                            rotation = velocity.Y * 0.05f * direction;
                            if (velocity.Y < 0.0)
                                frameCounter += 2;
                            else
                                ++frameCounter;
                            if (frameCounter >= 6)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame >= 12)
                                frame = 8;
                            if (frame < 8)
                                frame = 8;
                        }
                        else if (type == 314)
                        {
                            rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.58f;
                            ++frameCounter;
                            if (frameCounter >= 3)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame > 12)
                                frame = 7;
                            if (frame < 7)
                                frame = 7;
                        }
                        else if (type == 319)
                        {
                            rotation = velocity.X * 0.05f;
                            ++frameCounter;
                            if (frameCounter >= 6)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame > 10)
                                frame = 6;
                            if (frame < 6)
                                frame = 6;
                        }
                        else if (type == 210)
                        {
                            rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.58f;
                            frameCounter += 3;
                            if (frameCounter > 6)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame > 11)
                                frame = 7;
                            if (frame < 7)
                                frame = 7;
                        }
                        else if (type == 313)
                        {
                            position.Y += height;
                            height = 54;
                            position.Y -= height;
                            position.X += (width / 2);
                            width = 54;
                            position.X -= (width / 2);
                            rotation += velocity.X * 0.01f;
                            frameCounter = 0;
                            frame = 11;
                        }
                        else if (type == 398)
                        {
                            frameCounter = frameCounter + 1;
                            if (frameCounter > 1)
                            {
                                ++frame;
                                frameCounter = 0;
                            }
                            if (frame < 6 || frame > 9)
                                frame = 6;
                            rotation = velocity.X * 0.1f;
                        }
                        else
                            rotation = spriteDirection != -1 ? (float)Math.Atan2(velocity.Y, velocity.X) + 3.14f : (float)Math.Atan2(velocity.Y, velocity.X);
                        if (type >= 191 && type <= 194 || (type == 499 || type == 398) || (type == 390 || type == 391 || (type == 392 || type == 127)) || (type == 200 || type == 208 || (type == 210 || type == 236) || (type == 266 || type == 268 || (type == 269 || type == 313))) || (type == 314 || type == 319 || (type == 324 || type == 334) || type == 353))
                            return;
                        int index4 = Dust.NewDust(new Vector2((float)(position.X + (width / 2) - 4.0), (float)(position.Y + (height / 2) - 4.0)) - velocity, 8, 8, 16, (float)(-velocity.X * 0.5), velocity.Y * 0.5f, 50, new Color(), 1.7f);
                        Main.dust[index4].velocity.X = Main.dust[index4].velocity.X * 0.2f;
                        Main.dust[index4].velocity.Y = Main.dust[index4].velocity.Y * 0.2f;
                        Main.dust[index4].noGravity = true;
                    }
                    else
                    {
                        if (type >= 191 && type <= 194)
                        {
                            float num2 = (40 * minionPos);
                            int num3 = 30;
                            int num4 = 60;
                            --localAI[0];
                            if (localAI[0] < 0.0)
                                localAI[0] = 0.0f;
                            if (ai[1] > 0.0)
                            {
                                --ai[1];
                            }
                            else
                            {
                                float num5 = position.X;
                                float num6 = position.Y;
                                float num7 = 100000f;
                                float num8 = num7;
                                int num9 = -1;
                                for (int index = 0; index < 200; ++index)
                                {
                                    if (Main.npc[index].CanBeChasedBy(this, false))
                                    {
                                        float num10 = Main.npc[index].position.X + (Main.npc[index].width / 2);
                                        float num11 = Main.npc[index].position.Y + (Main.npc[index].height / 2);
                                        float num12 = Math.Abs(position.X + (width / 2) - num10) + Math.Abs(position.Y + (height / 2) - num11);
                                        if (num12 < num7)
                                        {
                                            if (num9 == -1 && num12 <= num8)
                                            {
                                                num8 = num12;
                                                num5 = num10;
                                                num6 = num11;
                                            }
                                            if (Collision.CanHit(position, width, height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
                                            {
                                                num7 = num12;
                                                num5 = num10;
                                                num6 = num11;
                                                num9 = index;
                                            }
                                        }
                                    }
                                }
                                if (num9 == -1 && num8 < num7)
                                    num7 = num8;
                                float num13 = 400f;
                                if (position.Y > Main.worldSurface * 16.0)
                                    num13 = 200f;
                                if (num7 < num13 + num2 && num9 == -1)
                                {
                                    float num10 = num5 - (position.X + (width / 2));
                                    if (num10 < -5.0)
                                    {
                                        flag1 = true;
                                        flag2 = false;
                                    }
                                    else if (num10 > 5.0)
                                    {
                                        flag2 = true;
                                        flag1 = false;
                                    }
                                }
                                else if (num9 >= 0 && num7 < 800.0 + num2)
                                {
                                    localAI[0] = num4;
                                    float num10 = num5 - (position.X + (width / 2));
                                    if (num10 > 300.0 || num10 < -300.0)
                                    {
                                        if (num10 < -50.0)
                                        {
                                            flag1 = true;
                                            flag2 = false;
                                        }
                                        else if (num10 > 50.0)
                                        {
                                            flag2 = true;
                                            flag1 = false;
                                        }
                                    }
                                    else if (owner == Main.myPlayer)
                                    {
                                        ai[1] = num3;
                                        float num11 = 12f;
                                        Vector2 vector2 = new Vector2(position.X + width * 0.5f, (float)(position.Y + (height / 2) - 8.0));
                                        float num12 = num5 - vector2.X + Main.rand.Next(-20, 21);
                                        float num14 = (float)((double)(Math.Abs(num12) * 0.1f) * Main.rand.Next(0, 100) * (1.0 / 1000.0));
                                        float num15 = num6 - vector2.Y + Main.rand.Next(-20, 21) - num14;
                                        float num16 = (float)Math.Sqrt(num12 * num12 + num15 * num15);
                                        float num17 = num11 / num16;
                                        float SpeedX = num12 * num17;
                                        float SpeedY = num15 * num17;
                                        int Damage = damage;
                                        int Type = 195;
                                        int index = NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, Damage, knockBack, Main.myPlayer, 0.0f, 0.0f);
                                        Main.projectile[index].timeLeft = 300;
                                        if (SpeedX < 0.0)
                                            direction = -1;
                                        if (SpeedX > 0.0)
                                            direction = 1;
                                        netUpdate = true;
                                    }
                                }
                            }
                        }
                        bool flag5 = false;
                        Vector2 vector2_1 = Vector2.Zero;
                        bool flag6 = false;
                        if (type == 266 || type >= 390 && type <= 392)
                        {
                            float num2 = (40 * minionPos);
                            int num3 = 60;
                            --localAI[0];
                            if (localAI[0] < 0.0)
                                localAI[0] = 0.0f;
                            if (ai[1] > 0.0)
                            {
                                --ai[1];
                            }
                            else
                            {
                                float x = position.X;
                                float y = position.Y;
                                float num4 = 100000f;
                                float num5 = num4;
                                int index1 = -1;
                                for (int index2 = 0; index2 < 200; ++index2)
                                {
                                    if (Main.npc[index2].CanBeChasedBy(this, false))
                                    {
                                        float num6 = Main.npc[index2].position.X + (Main.npc[index2].width / 2);
                                        float num7 = Main.npc[index2].position.Y + (Main.npc[index2].height / 2);
                                        float num8 = Math.Abs(position.X + (width / 2) - num6) + Math.Abs(position.Y + (height / 2) - num7);
                                        if (num8 < num4)
                                        {
                                            if (index1 == -1 && num8 <= num5)
                                            {
                                                num5 = num8;
                                                x = num6;
                                                y = num7;
                                            }
                                            if (Collision.CanHit(position, width, height, Main.npc[index2].position, Main.npc[index2].width, Main.npc[index2].height))
                                            {
                                                num4 = num8;
                                                x = num6;
                                                y = num7;
                                                index1 = index2;
                                            }
                                        }
                                    }
                                }
                                if (type >= 390 && type <= 392 && !Collision.SolidCollision(position, width, height))
                                    tileCollide = true;
                                if (index1 == -1 && num5 < num4)
                                    num4 = num5;
                                else if (index1 >= 0)
                                {
                                    flag5 = true;
                                    vector2_1 = new Vector2(x, y) - Center;
                                    if (type >= 390 && type <= 392)
                                    {
                                        if (Main.npc[index1].position.Y > position.Y + (double)height)
                                        {
                                            int index2 = (int)(Center.X / 16.0);
                                            int index3 = (int)((position.Y + (double)height + 1.0) / 16.0);
                                            if (Main.tile[index2, index3] != null && Main.tile[index2, index3].active() && Main.tile[index2, index3].type == 19)
                                                tileCollide = false;
                                        }
                                        Rectangle rectangle1 = new Rectangle((int)position.X, (int)position.Y, width, height);
                                        Rectangle rectangle2 = new Rectangle((int)Main.npc[index1].position.X, (int)Main.npc[index1].position.Y, Main.npc[index1].width, Main.npc[index1].height);
                                        int num6 = 10;
                                        rectangle2.X -= num6;
                                        rectangle2.Y -= num6;
                                        rectangle2.Width += num6 * 2;
                                        rectangle2.Height += num6 * 2;
                                        if (rectangle1.Intersects(rectangle2))
                                        {
                                            flag6 = true;
                                            Vector2 v = Main.npc[index1].Center - Center;
                                            if (velocity.Y > 0.0 && v.Y < 0.0)
                                                velocity.Y *= 0.5f;
                                            if (velocity.Y < 0.0 && v.Y > 0.0)
                                                velocity.Y *= 0.5f;
                                            if (velocity.X > 0.0 && v.X < 0.0)
                                                velocity.X *= 0.5f;
                                            if (velocity.X < 0.0 && v.X > 0.0)
                                                velocity.X *= 0.5f;
                                            if (v.Length() > 14.0)
                                            {
                                                v.Normalize();
                                                v *= 14f;
                                            }
                                            rotation = (float)((rotation * 5.0 + Utils.ToRotation(v) + 1.57079637050629) / 6.0);
                                            velocity = (velocity * 9f + v) / 10f;
                                            for (int index2 = 0; index2 < 1000; ++index2)
                                            {
                                                if (whoAmI != index2 && owner == Main.projectile[index2].owner && (Main.projectile[index2].type >= 390 && Main.projectile[index2].type <= 392) && (Main.projectile[index2].Center - Center).Length() < 15.0)
                                                {
                                                    float num7 = 0.5f;
                                                    if (Center.Y > Main.projectile[index2].Center.Y)
                                                    {
                                                        Main.projectile[index2].velocity.Y -= num7;
                                                        velocity.Y += num7;
                                                    }
                                                    else
                                                    {
                                                        Main.projectile[index2].velocity.Y += num7;
                                                        velocity.Y -= num7;
                                                    }
                                                    if (Center.X > Main.projectile[index2].Center.X)
                                                    {
                                                        velocity.X += num7;
                                                        Main.projectile[index2].velocity.X -= num7;
                                                    }
                                                    else
                                                    {
                                                        velocity.X -= num7;
                                                        Main.projectile[index2].velocity.Y += num7;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                float num9 = 300f;
                                if (position.Y > Main.worldSurface * 16.0)
                                    num9 = 150f;
                                if (type >= 390 && type <= 392)
                                {
                                    num9 = 500f;
                                    if (position.Y > Main.worldSurface * 16.0)
                                        num9 = 250f;
                                }
                                if (num4 < num9 + num2 && index1 == -1)
                                {
                                    float num6 = x - (position.X + (width / 2));
                                    if (num6 < -5.0)
                                    {
                                        flag1 = true;
                                        flag2 = false;
                                    }
                                    else if (num6 > 5.0)
                                    {
                                        flag2 = true;
                                        flag1 = false;
                                    }
                                }
                                bool flag7 = false;
                                if (type >= 390 && type <= 392 && localAI[1] > 0.0)
                                {
                                    flag7 = true;
                                    --localAI[1];
                                }
                                if (index1 >= 0 && num4 < 800.0 + num2)
                                {
                                    friendly = true;
                                    localAI[0] = num3;
                                    float num6 = x - (position.X + (width / 2));
                                    if (num6 < -10.0)
                                    {
                                        flag1 = true;
                                        flag2 = false;
                                    }
                                    else if (num6 > 10.0)
                                    {
                                        flag2 = true;
                                        flag1 = false;
                                    }
                                    if (y < Center.Y - 100.0 && num6 > -50.0 && (num6 < 50.0 && velocity.Y == 0.0))
                                    {
                                        float num7 = Math.Abs(y - Center.Y);
                                        if (num7 < 120.0)
                                            velocity.Y = -10f;
                                        else if (num7 < 210.0)
                                            velocity.Y = -13f;
                                        else if (num7 < 270.0)
                                            velocity.Y = -15f;
                                        else if (num7 < 310.0)
                                            velocity.Y = -17f;
                                        else if (num7 < 380.0)
                                            velocity.Y = -18f;
                                    }
                                    if (flag7)
                                    {
                                        friendly = false;
                                        if (velocity.X < 0.0)
                                            flag1 = true;
                                        else if (velocity.X > 0.0)
                                            flag2 = true;
                                    }
                                }
                                else
                                    friendly = false;
                            }
                        }
                        if (ai[1] != 0.0)
                        {
                            flag1 = false;
                            flag2 = false;
                        }
                        else if (type >= 191 && type <= 194 && localAI[0] == 0.0)
                            direction = Main.player[owner].direction;
                        else if (type >= 390 && type <= 392)
                        {
                            int index1 = (int)(Center.X / 16.0);
                            int index2 = (int)(Center.Y / 16.0);
                            if (Main.tile[index1, index2] != null && Main.tile[index1, index2].wall > 0)
                                flag1 = flag2 = false;
                        }
                        if (type == 127)
                        {
                            if (rotation > -0.1 && rotation < 0.1)
                                rotation = 0.0f;
                            else if (rotation < 0.0)
                                rotation += 0.1f;
                            else
                                rotation -= 0.1f;
                        }
                        else if (type != 313 && !flag6)
                            rotation = 0.0f;
                        if (type < 390 || type > 392)
                            tileCollide = true;
                        float num18 = 0.08f;
                        float num19 = 6.5f;
                        if (type == 127)
                        {
                            num19 = 2f;
                            num18 = 0.04f;
                        }
                        if (type == 112)
                        {
                            num19 = 6f;
                            num18 = 0.06f;
                        }
                        if (type == 334)
                        {
                            num19 = 8f;
                            num18 = 0.08f;
                        }
                        if (type == 268)
                        {
                            num19 = 8f;
                            num18 = 0.4f;
                        }
                        if (type == 324)
                        {
                            num18 = 0.1f;
                            num19 = 3f;
                        }
                        if (type >= 191 && type <= 194 || type == 266 || type >= 390 && type <= 392)
                        {
                            num19 = 6f;
                            num18 = 0.2f;
                            if (num19 < Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y))
                            {
                                num19 = Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y);
                                num18 = 0.3f;
                            }
                        }
                        if (type >= 390 && type <= 392)
                            num18 *= 2f;
                        if (flag1)
                        {
                            if (velocity.X > -3.5)
                                velocity.X -= num18;
                            else
                                velocity.X -= num18 * 0.25f;
                        }
                        else if (flag2)
                        {
                            if (velocity.X < 3.5)
                                velocity.X += num18;
                            else
                                velocity.X += num18 * 0.25f;
                        }
                        else
                        {
                            velocity.X *= 0.9f;
                            if (velocity.X >= -num18 && velocity.X <= num18)
                                velocity.X = 0.0f;
                        }
                        if (type == 208)
                        {
                            velocity.X *= 0.95f;
                            if (velocity.X > -0.1 && velocity.X < 0.1)
                                velocity.X = 0.0f;
                            flag1 = false;
                            flag2 = false;
                        }
                        if (flag1 || flag2)
                        {
                            int num2 = (int)(position.X + (width / 2)) / 16;
                            int j = (int)(position.Y + (height / 2)) / 16;
                            if (type == 236)
                                num2 += direction;
                            if (flag1)
                                --num2;
                            if (flag2)
                                ++num2;
                            if (WorldGen.SolidTile(num2 + (int)velocity.X, j))
                                flag4 = true;
                        }
                        if (Main.player[owner].position.Y + Main.player[owner].height - 8.0 > position.Y + (double)height)
                            flag3 = true;
                        if (type == 268 && frameCounter < 10)
                            flag4 = false;
                        Collision.StepUp(ref position, ref velocity, width, height, ref stepSpeed, ref gfxOffY, 1, false, 0);
                        if (velocity.Y == 0.0 || type == 200)
                        {
                            if (!flag3 && (velocity.X < 0.0 || velocity.X > 0.0))
                            {
                                int i = (int)(position.X + (width / 2)) / 16;
                                int j = (int)(position.Y + (height / 2)) / 16 + 1;
                                if (flag1)
                                    --i;
                                if (flag2)
                                    ++i;
                                WorldGen.SolidTile(i, j);
                            }
                            if (flag4)
                            {
                                int i1 = (int)(position.X + (width / 2)) / 16;
                                int j = (int)(position.Y + (double)height) / 16 + 1;
                                if (WorldGen.SolidTile(i1, j) || Main.tile[i1, j].halfBrick() || (Main.tile[i1, j].slope() > 0 || type == 200))
                                {
                                    if (type == 200)
                                    {
                                        velocity.Y = -3.1f;
                                    }
                                    else
                                    {
                                        try
                                        {
                                            int num2 = (int)(position.X + (width / 2)) / 16;
                                            int num3 = (int)(position.Y + (height / 2)) / 16;
                                            if (flag1)
                                                --num2;
                                            if (flag2)
                                                ++num2;
                                            int i2 = num2 + (int)velocity.X;
                                            if (!WorldGen.SolidTile(i2, num3 - 1) && !WorldGen.SolidTile(i2, num3 - 2))
                                                velocity.Y = -5.1f;
                                            else if (!WorldGen.SolidTile(i2, num3 - 2))
                                                velocity.Y = -7.1f;
                                            else if (WorldGen.SolidTile(i2, num3 - 5))
                                                velocity.Y = -11.1f;
                                            else if (WorldGen.SolidTile(i2, num3 - 4))
                                                velocity.Y = -10.1f;
                                            else
                                                velocity.Y = -9.1f;
                                        }
                                        catch
                                        {
                                            velocity.Y = -9.1f;
                                        }
                                    }
                                    if (type == 127)
                                        ai[0] = 1f;
                                }
                            }
                            else if (type == 266 && (flag1 || flag2))
                                velocity.Y -= 6f;
                        }
                        if (velocity.X > num19)
                            velocity.X = num19;
                        if (velocity.X < -num19)
                            velocity.X = -num19;
                        if (velocity.X < 0.0)
                            direction = -1;
                        if (velocity.X > 0.0)
                            direction = 1;
                        if (velocity.X > num18 && flag2)
                            direction = 1;
                        if (velocity.X < -num18 && flag1)
                            direction = -1;
                        if (type != 313)
                        {
                            if (direction == -1)
                                spriteDirection = 1;
                            if (direction == 1)
                                spriteDirection = -1;
                        }
                        if (type == 398)
                            spriteDirection = direction;
                        if (type >= 191 && type <= 194)
                        {
                            if (ai[1] > 0.0)
                            {
                                if (localAI[1] == 0.0)
                                {
                                    localAI[1] = 1f;
                                    frame = 1;
                                }
                                if (frame != 0)
                                {
                                    ++frameCounter;
                                    if (frameCounter > 4)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame == 4)
                                        frame = 0;
                                }
                            }
                            else if (velocity.Y == 0.0)
                            {
                                localAI[1] = 0.0f;
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.8 || velocity.X > 0.8)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame < 5)
                                        frame = 5;
                                    if (frame >= 11)
                                        frame = 5;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else if (velocity.Y < 0.0)
                            {
                                frameCounter = 0;
                                frame = 4;
                            }
                            else if (velocity.Y > 0.0)
                            {
                                frameCounter = 0;
                                frame = 4;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y > 10.0)
                                velocity.Y = 10f;
                            double num2 = velocity.Y;
                        }
                        else if (type == 268)
                        {
                            if (velocity.Y == 0.0)
                            {
                                if (frame > 5)
                                    frameCounter = 0;
                                if (velocity.X == 0.0)
                                {
                                    int num2 = 3;
                                    ++frameCounter;
                                    if (frameCounter < num2)
                                        frame = 0;
                                    else if (frameCounter < num2 * 2)
                                        frame = 1;
                                    else if (frameCounter < num2 * 3)
                                        frame = 2;
                                    else if (frameCounter < num2 * 4)
                                        frame = 3;
                                    else
                                        frameCounter = num2 * 4;
                                }
                                else
                                {
                                    velocity.X *= 0.8f;
                                    ++frameCounter;
                                    int num2 = 3;
                                    if (frameCounter < num2)
                                        frame = 0;
                                    else if (frameCounter < num2 * 2)
                                        frame = 1;
                                    else if (frameCounter < num2 * 3)
                                        frame = 2;
                                    else if (frameCounter < num2 * 4)
                                        frame = 3;
                                    else if (flag1 || flag2)
                                    {
                                        velocity.X *= 2f;
                                        frame = 4;
                                        velocity.Y = -6.1f;
                                        frameCounter = 0;
                                        for (int index1 = 0; index1 < 4; ++index1)
                                        {
                                            int index2 = Dust.NewDust(new Vector2(position.X, (float)(position.Y + (double)height - 2.0)), width, 4, 5, 0.0f, 0.0f, 0, new Color(), 1f);
                                            Main.dust[index2].velocity += velocity;
                                            Main.dust[index2].velocity *= 0.4f;
                                        }
                                    }
                                    else
                                        frameCounter = num2 * 4;
                                }
                            }
                            else if (velocity.Y < 0.0)
                            {
                                frameCounter = 0;
                                frame = 5;
                            }
                            else
                            {
                                frame = 4;
                                frameCounter = 3;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 269)
                        {
                            if (velocity.Y >= 0.0 && velocity.Y <= 0.8)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.8 || velocity.X > 0.8)
                                {
                                    int index = Dust.NewDust(new Vector2(position.X, (float)(position.Y + (double)height - 2.0)), width, 6, 76, 0.0f, 0.0f, 0, new Color(), 1f);
                                    Main.dust[index].noGravity = true;
                                    Main.dust[index].velocity *= 0.3f;
                                    Main.dust[index].noLight = true;
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame > 3)
                                        frame = 0;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else
                            {
                                frameCounter = 0;
                                frame = 2;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 313)
                        {
                            int index1 = (int)(Center.X / 16.0);
                            int index2 = (int)(Center.Y / 16.0);
                            if (Main.tile[index1, index2] != null && Main.tile[index1, index2].wall > 0)
                            {
                                position.Y += height;
                                height = 34;
                                position.Y -= height;
                                position.X += (width / 2);
                                width = 34;
                                position.X -= (width / 2);
                                float num2 = 4f;
                                Vector2 vector2_2 = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
                                float num3 = Main.player[owner].Center.X - vector2_2.X;
                                float num4 = Main.player[owner].Center.Y - vector2_2.Y;
                                float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
                                float num6 = num2 / num5;
                                float num7 = num3 * num6;
                                float num8 = num4 * num6;
                                if (num5 < 120.0)
                                {
                                    velocity.X *= 0.9f;
                                    velocity.Y *= 0.9f;
                                    if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 0.1)
                                    {
                                        Projectile projectile = this;
                                        Vector2 vector2_3 = projectile.velocity * 0.0f;
                                        projectile.velocity = vector2_3;
                                    }
                                }
                                else
                                {
                                    velocity.X = (float)((velocity.X * 9.0 + num7) / 10.0);
                                    velocity.Y = (float)((velocity.Y * 9.0 + num8) / 10.0);
                                }
                                if (num5 >= 120.0)
                                {
                                    spriteDirection = direction;
                                    rotation = (float)Math.Atan2(velocity.Y * (double)-direction, velocity.X * (double)-direction);
                                }
                                frameCounter = frameCounter + (int)(Math.Abs(velocity.X) + Math.Abs(velocity.Y));
                                if (frameCounter > 6)
                                {
                                    ++frame;
                                    frameCounter = 0;
                                }
                                if (frame > 10)
                                    frame = 5;
                                if (frame >= 5)
                                    return;
                                frame = 10;
                            }
                            else
                            {
                                rotation = 0.0f;
                                if (direction == -1)
                                    spriteDirection = 1;
                                if (direction == 1)
                                    spriteDirection = -1;
                                position.Y += height;
                                height = 30;
                                position.Y -= height;
                                position.X += (width / 2);
                                width = 30;
                                position.X -= (width / 2);
                                if (velocity.Y >= 0.0 && velocity.Y <= 0.8)
                                {
                                    if (velocity.X == 0.0)
                                    {
                                        frame = 0;
                                        frameCounter = 0;
                                    }
                                    else if (velocity.X < -0.8 || velocity.X > 0.8)
                                    {
                                        frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                        ++frameCounter;
                                        if (frameCounter > 6)
                                        {
                                            ++frame;
                                            frameCounter = 0;
                                        }
                                        if (frame > 3)
                                            frame = 0;
                                    }
                                    else
                                    {
                                        frame = 0;
                                        frameCounter = 0;
                                    }
                                }
                                else
                                {
                                    frameCounter = 0;
                                    frame = 4;
                                }
                                velocity.Y += 0.4f;
                                if (velocity.Y <= 10.0)
                                    return;
                                velocity.Y = 10f;
                            }
                        }
                        else if (type >= 390 && type <= 392)
                        {
                            int index1 = (int)(Center.X / 16.0);
                            int index2 = (int)(Center.Y / 16.0);
                            if (Main.tile[index1, index2] != null && Main.tile[index1, index2].wall > 0)
                            {
                                position.Y += height;
                                height = 34;
                                position.Y -= height;
                                position.X += (width / 2);
                                width = 34;
                                position.X -= (width / 2);
                                float num2 = 9f;
                                float num3 = (float)(40 * (minionPos + 1));
                                Vector2 v = Main.player[owner].Center - Center;
                                if (flag5)
                                {
                                    v = vector2_1;
                                    num3 = 10f;
                                }
                                else if (!Collision.CanHitLine(Center, 1, 1, Main.player[owner].Center, 1, 1))
                                    ai[0] = 1f;
                                if ((double)v.Length() < num3)
                                {
                                    Projectile projectile1 = this;
                                    Vector2 vector2_2 = projectile1.velocity * 0.9f;
                                    projectile1.velocity = vector2_2;
                                    if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 0.1)
                                    {
                                        Projectile projectile2 = this;
                                        Vector2 vector2_3 = projectile2.velocity * 0.0f;
                                        projectile2.velocity = vector2_3;
                                    }
                                }
                                else if (v.Length() < 800.0 || !flag5)
                                    velocity = (velocity * 9f + Vector2.Normalize(v) * num2) / 10f;
                                if ((double)v.Length() >= num3)
                                {
                                    spriteDirection = direction;
                                    rotation = Utils.ToRotation(velocity) + 1.570796f;
                                }
                                else
                                    rotation = Utils.ToRotation(v) + 1.570796f;
                                frameCounter = frameCounter + (int)(Math.Abs(velocity.X) + Math.Abs(velocity.Y));
                                if (frameCounter > 5)
                                {
                                    ++frame;
                                    frameCounter = 0;
                                }
                                if (frame > 7)
                                    frame = 4;
                                if (frame >= 4)
                                    return;
                                frame = 7;
                            }
                            else
                            {
                                if (!flag6)
                                    rotation = 0.0f;
                                if (direction == -1)
                                    spriteDirection = 1;
                                if (direction == 1)
                                    spriteDirection = -1;
                                position.Y += height;
                                height = 30;
                                position.Y -= height;
                                position.X += (width / 2);
                                width = 30;
                                position.X -= (width / 2);
                                if (!flag5 && !Collision.CanHitLine(Center, 1, 1, Main.player[owner].Center, 1, 1))
                                    ai[0] = 1f;
                                if (!flag6 && frame >= 4 && frame <= 7)
                                {
                                    Vector2 vector2_2 = Main.player[owner].Center - Center;
                                    if (flag5)
                                        vector2_2 = vector2_1;
                                    float num2 = -vector2_2.Y;
                                    if (vector2_2.Y <= 0.0)
                                    {
                                        if (num2 < 120.0)
                                            velocity.Y = -10f;
                                        else if (num2 < 210.0)
                                            velocity.Y = -13f;
                                        else if (num2 < 270.0)
                                            velocity.Y = -15f;
                                        else if (num2 < 310.0)
                                            velocity.Y = -17f;
                                        else if (num2 < 380.0)
                                            velocity.Y = -18f;
                                    }
                                }
                                if (flag6)
                                {
                                    ++frameCounter;
                                    if (frameCounter > 3)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame >= 8)
                                        frame = 4;
                                    if (frame <= 3)
                                        frame = 7;
                                }
                                else if (velocity.Y >= 0.0 && velocity.Y <= 0.8)
                                {
                                    if (velocity.X == 0.0)
                                    {
                                        frame = 0;
                                        frameCounter = 0;
                                    }
                                    else if (velocity.X < -0.8 || velocity.X > 0.8)
                                    {
                                        frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                        ++frameCounter;
                                        if (frameCounter > 5)
                                        {
                                            ++frame;
                                            frameCounter = 0;
                                        }
                                        if (frame > 2)
                                            frame = 0;
                                    }
                                    else
                                    {
                                        frame = 0;
                                        frameCounter = 0;
                                    }
                                }
                                else
                                {
                                    frameCounter = 0;
                                    frame = 3;
                                }
                                velocity.Y += 0.4f;
                                if (velocity.Y <= 10.0)
                                    return;
                                velocity.Y = 10f;
                            }
                        }
                        else if (type == 314)
                        {
                            if (velocity.Y >= 0.0 && velocity.Y <= 0.8)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.8 || velocity.X > 0.8)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame > 6)
                                        frame = 1;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else
                            {
                                frameCounter = 0;
                                frame = 7;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 319)
                        {
                            if (velocity.Y >= 0.0 && velocity.Y <= 0.8)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.8 || velocity.X > 0.8)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 8)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame > 5)
                                        frame = 2;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else
                            {
                                frameCounter = 0;
                                frame = 1;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 236)
                        {
                            if (velocity.Y >= 0.0 && velocity.Y <= 0.8)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.8 || velocity.X > 0.8)
                                {
                                    if (frame < 2)
                                        frame = 2;
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame > 8)
                                        frame = 2;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else
                            {
                                frameCounter = 0;
                                frame = 1;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 499)
                        {
                            if (velocity.Y >= 0.0 && velocity.Y <= 0.8)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.8 || velocity.X > 0.8)
                                {
                                    if (frame < 2)
                                        frame = 2;
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame >= 8)
                                        frame = 2;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else
                            {
                                frameCounter = 0;
                                frame = 1;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 266)
                        {
                            if (velocity.Y >= 0.0 && velocity.Y <= 0.8)
                            {
                                if (velocity.X == 0.0)
                                    ++frameCounter;
                                else
                                    frameCounter += 3;
                            }
                            else
                                frameCounter += 5;
                            if (frameCounter >= 20)
                            {
                                frameCounter -= 20;
                                ++frame;
                            }
                            if (frame > 1)
                                frame = 0;
                            if (wet && Main.player[owner].position.Y + Main.player[owner].height < position.Y + (double)height && localAI[0] == 0.0)
                            {
                                if (velocity.Y > -4.0)
                                    velocity.Y -= 0.2f;
                                if (velocity.Y > 0.0)
                                    velocity.Y *= 0.95f;
                            }
                            else
                                velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 334)
                        {
                            if (velocity.Y == 0.0)
                            {
                                if (velocity.X == 0.0)
                                {
                                    if (frame > 0)
                                    {
                                        frameCounter += 2;
                                        if (frameCounter > 6)
                                        {
                                            ++frame;
                                            frameCounter = 0;
                                        }
                                        if (frame >= 7)
                                            frame = 0;
                                    }
                                    else
                                    {
                                        frame = 0;
                                        frameCounter = 0;
                                    }
                                }
                                else if (velocity.X < -0.8 || velocity.X > 0.8)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X * 0.75);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame >= 7 || frame < 1)
                                        frame = 1;
                                }
                                else if (frame > 0)
                                {
                                    frameCounter += 2;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame >= 7)
                                        frame = 0;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else if (velocity.Y < 0.0)
                            {
                                frameCounter = 0;
                                frame = 2;
                            }
                            else if (velocity.Y > 0.0)
                            {
                                frameCounter = 0;
                                frame = 4;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 353)
                        {
                            if (velocity.Y == 0.0)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.8 || velocity.X > 0.8)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame > 9)
                                        frame = 2;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else if (velocity.Y < 0.0)
                            {
                                frameCounter = 0;
                                frame = 1;
                            }
                            else if (velocity.Y > 0.0)
                            {
                                frameCounter = 0;
                                frame = 1;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 111)
                        {
                            if (velocity.Y == 0.0)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.8 || velocity.X > 0.8)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame >= 7)
                                        frame = 0;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else if (velocity.Y < 0.0)
                            {
                                frameCounter = 0;
                                frame = 4;
                            }
                            else if (velocity.Y > 0.0)
                            {
                                frameCounter = 0;
                                frame = 6;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 112)
                        {
                            if (velocity.Y == 0.0)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.8 || velocity.X > 0.8)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame >= 3)
                                        frame = 0;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else if (velocity.Y < 0.0)
                            {
                                frameCounter = 0;
                                frame = 2;
                            }
                            else if (velocity.Y > 0.0)
                            {
                                frameCounter = 0;
                                frame = 2;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 127)
                        {
                            if (velocity.Y == 0.0)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.1 || velocity.X > 0.1)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame > 5)
                                        frame = 0;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else
                            {
                                frame = 0;
                                frameCounter = 0;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 200)
                        {
                            if (velocity.Y == 0.0)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.1 || velocity.X > 0.1)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame > 5)
                                        frame = 0;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else
                            {
                                rotation = velocity.X * 0.1f;
                                ++frameCounter;
                                if (velocity.Y < 0.0)
                                    frameCounter += 2;
                                if (frameCounter > 6)
                                {
                                    ++frame;
                                    frameCounter = 0;
                                }
                                if (frame > 9)
                                    frame = 6;
                                if (frame < 6)
                                    frame = 6;
                            }
                            velocity.Y += 0.1f;
                            if (velocity.Y <= 4.0)
                                return;
                            velocity.Y = 4f;
                        }
                        else if (type == 208)
                        {
                            if (velocity.Y == 0.0 && velocity.X == 0.0)
                            {
                                if (Main.player[owner].position.X + (Main.player[owner].width / 2) < position.X + (width / 2))
                                    direction = -1;
                                else if (Main.player[owner].position.X + (Main.player[owner].width / 2) > position.X + (width / 2))
                                    direction = 1;
                                rotation = 0.0f;
                                frame = 0;
                            }
                            else
                            {
                                rotation = velocity.X * 0.075f;
                                ++frameCounter;
                                if (frameCounter > 6)
                                {
                                    ++frame;
                                    frameCounter = 0;
                                }
                                if (frame > 4)
                                    frame = 1;
                                if (frame < 1)
                                    frame = 1;
                            }
                            velocity.Y += 0.1f;
                            if (velocity.Y <= 4.0)
                                return;
                            velocity.Y = 4f;
                        }
                        else if (type == 209)
                        {
                            if (alpha > 0)
                            {
                                alpha -= 5;
                                if (alpha < 0)
                                    alpha = 0;
                            }
                            if (velocity.Y == 0.0)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.1 || velocity.X > 0.1)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame > 11)
                                        frame = 2;
                                    if (frame < 2)
                                        frame = 2;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else
                            {
                                frame = 1;
                                frameCounter = 0;
                                rotation = 0.0f;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else if (type == 324)
                        {
                            if (velocity.Y == 0.0)
                            {
                                if (velocity.X < -0.1 || velocity.X > 0.1)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame > 5)
                                        frame = 2;
                                    if (frame < 2)
                                        frame = 2;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else
                            {
                                frameCounter = 0;
                                frame = 1;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 14.0)
                                return;
                            velocity.Y = 14f;
                        }
                        else if (type == 210)
                        {
                            if (velocity.Y == 0.0)
                            {
                                if (velocity.X < -0.1 || velocity.X > 0.1)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame > 6)
                                        frame = 0;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else
                            {
                                rotation = velocity.X * 0.05f;
                                ++frameCounter;
                                if (frameCounter > 6)
                                {
                                    ++frame;
                                    frameCounter = 0;
                                }
                                if (frame > 11)
                                    frame = 7;
                                if (frame < 7)
                                    frame = 7;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                        else
                        {
                            if (type != 398)
                                return;
                            if (velocity.Y == 0.0)
                            {
                                if (velocity.X == 0.0)
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                                else if (velocity.X < -0.8 || velocity.X > 0.8)
                                {
                                    frameCounter = frameCounter + (int)Math.Abs(velocity.X);
                                    ++frameCounter;
                                    if (frameCounter > 6)
                                    {
                                        ++frame;
                                        frameCounter = 0;
                                    }
                                    if (frame >= 5)
                                        frame = 0;
                                }
                                else
                                {
                                    frame = 0;
                                    frameCounter = 0;
                                }
                            }
                            else if (velocity.Y != 0.0)
                            {
                                frameCounter = 0;
                                frame = 5;
                            }
                            velocity.Y += 0.4f;
                            if (velocity.Y <= 10.0)
                                return;
                            velocity.Y = 10f;
                        }
                    }
                }
            }
        }