// Decompiled with JetBrains decompiler
// Type: Terraria.Projectile
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe

using Microsoft.Xna.Framework;
using ReLogic.Utilities;
using System;
using System.Collections.Generic;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.GameContent;
using Terraria.GameContent.Achievements;
using Terraria.GameContent.Events;
using Terraria.GameContent.UI;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.Localization;
using Terraria.World.Generation;

namespace Terraria
{
  public class Projectile : Entity
  {
    public static uint[][] perIDStaticNPCImmunity = new uint[714][];
    public static int SentryLifeTime = 7200;
    public float ownerHitCheckDistance = 1000f;
    public bool arrow;
    public int numHits;
    public bool bobber;
    public bool netImportant;
    public bool noDropItem;
    public static int maxAI = 2;
    public bool counterweight;
    public float scale = 1f;
    public float rotation;
    public int type;
    public int alpha;
    public bool sentry;
    public short glowMask;
    public int owner = (int) byte.MaxValue;
    public float[] ai = new float[Projectile.maxAI];
    public float[] localAI = new float[Projectile.maxAI];
    public float gfxOffY;
    public float stepSpeed = 1f;
    public int aiStyle;
    public int timeLeft;
    public int soundDelay;
    public int damage;
    public int spriteDirection = 1;
    public bool hostile;
    public float knockBack;
    public bool friendly;
    public int penetrate = 1;
    private int[] localNPCImmunity = new int[200];
    private bool usesLocalNPCImmunity;
    private bool usesIDStaticNPCImmunity;
    public int maxPenetrate = 1;
    public int identity;
    public float light;
    public bool netUpdate;
    public bool netUpdate2;
    public int netSpam;
    public Vector2[] oldPos = new Vector2[10];
    public float[] oldRot = new float[10];
    public int[] oldSpriteDirection = new int[10];
    public bool minion;
    public float minionSlots;
    public int minionPos;
    public int restrikeDelay;
    public bool tileCollide;
    public int extraUpdates;
    public int numUpdates;
    public bool ignoreWater;
    public bool hide;
    public bool ownerHitCheck;
    public int[] playerImmune = new int[(int) byte.MaxValue];
    public string miscText = "";
    public bool melee;
    public bool ranged;
    public bool thrown;
    public bool magic;
    public bool coldDamage;
    public bool noEnchantments;
    public bool trap;
    public bool npcProj;
    public int frameCounter;
    public int frame;
    public bool manualDirectionChange;
    public int projUUID = -1;
    public int localNPCHitCooldown = -2;
    public int idStaticNPCHitCooldown = -1;
    private static float[] _CompanionCubeScreamCooldown = new float[(int) byte.MaxValue];

    public string Name => Lang.GetProjectileName(this.type).Value;

    public static void InitializeStaticThings()
    {
      Projectile.perIDStaticNPCImmunity = new uint[714][];
      for (int index = 0; index < Projectile.perIDStaticNPCImmunity.Length; ++index)
        Projectile.perIDStaticNPCImmunity[index] = new uint[200];
      WorldGen.Hooks.OnWorldLoad += new Action(Projectile.ResetImmunity);
    }

    public static void ResetImmunity()
    {
      for (int index1 = 0; index1 < 714; ++index1)
      {
        for (int index2 = 0; index2 < 200; ++index2)
          Projectile.perIDStaticNPCImmunity[index1][index2] = 0U;
      }
    }

    public static bool IsNPCImmune(int projectileType, int npcIndex) => Projectile.perIDStaticNPCImmunity[projectileType][npcIndex] <= Main.GameUpdateCount;

    public bool WipableTurret => this.owner == Main.myPlayer && this.sentry && !this.TurretShouldPersist();

    public bool TurretShouldPersist()
    {
      switch (this.type)
      {
        case 663:
        case 665:
        case 667:
        case 677:
        case 678:
        case 679:
        case 688:
        case 689:
        case 690:
        case 691:
        case 692:
        case 693:
          return DD2Event.Ongoing;
        default:
          return false;
      }
    }

    public float Opacity
    {
      get => (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
      set => this.alpha = (int) MathHelper.Clamp((float) ((1.0 - (double) value) * (double) byte.MaxValue), 0.0f, (float) byte.MaxValue);
    }

    public int MaxUpdates
    {
      get => this.extraUpdates + 1;
      set => this.extraUpdates = value - 1;
    }

    public NPC OwnerMinionAttackTargetNPC => Main.player[this.owner].MinionAttackTargetNPC < 0 ? (NPC) null : Main.npc[Main.player[this.owner].MinionAttackTargetNPC];

    public void SetDefaults(int Type)
    {
      this.ownerHitCheckDistance = 1000f;
      this.counterweight = false;
      this.sentry = false;
      this.arrow = false;
      this.bobber = false;
      this.numHits = 0;
      this.netImportant = false;
      this.manualDirectionChange = false;
      this.localNPCHitCooldown = -2;
      this.idStaticNPCHitCooldown = -1;
      this.usesLocalNPCImmunity = false;
      this.usesIDStaticNPCImmunity = false;
      int newSize = 10;
      if (Type >= 0)
        newSize = ProjectileID.Sets.TrailCacheLength[Type];
      if (newSize != this.oldPos.Length)
      {
        Array.Resize<Vector2>(ref this.oldPos, newSize);
        Array.Resize<float>(ref this.oldRot, newSize);
        Array.Resize<int>(ref this.oldSpriteDirection, newSize);
      }
      for (int index = 0; index < this.oldPos.Length; ++index)
      {
        this.oldPos[index].X = 0.0f;
        this.oldPos[index].Y = 0.0f;
        this.oldRot[index] = 0.0f;
        this.oldSpriteDirection[index] = 0;
      }
      for (int index = 0; index < Projectile.maxAI; ++index)
      {
        this.ai[index] = 0.0f;
        this.localAI[index] = 0.0f;
      }
      for (int index = 0; index < (int) byte.MaxValue; ++index)
        this.playerImmune[index] = 0;
      for (int index = 0; index < 200; ++index)
        this.localNPCImmunity[index] = 0;
      this.noDropItem = false;
      this.minion = false;
      this.minionSlots = 0.0f;
      this.soundDelay = 0;
      this.spriteDirection = 1;
      this.melee = false;
      this.ranged = false;
      this.thrown = false;
      this.magic = false;
      this.ownerHitCheck = false;
      this.hide = false;
      this.lavaWet = false;
      this.wetCount = (byte) 0;
      this.wet = false;
      this.ignoreWater = false;
      this.hostile = false;
      this.netUpdate = false;
      this.netUpdate2 = false;
      this.netSpam = 0;
      this.numUpdates = 0;
      this.extraUpdates = 0;
      this.identity = 0;
      this.restrikeDelay = 0;
      this.light = 0.0f;
      this.penetrate = 1;
      this.tileCollide = true;
      this.position = Vector2.Zero;
      this.velocity = Vector2.Zero;
      this.aiStyle = 0;
      this.alpha = 0;
      this.glowMask = (short) -1;
      this.type = Type;
      this.active = true;
      this.rotation = 0.0f;
      this.scale = 1f;
      this.owner = (int) byte.MaxValue;
      this.timeLeft = 3600;
      this.friendly = false;
      this.damage = 0;
      this.knockBack = 0.0f;
      this.miscText = "";
      this.coldDamage = false;
      this.noEnchantments = false;
      this.trap = false;
      this.npcProj = false;
      this.projUUID = -1;
      this.frame = 0;
      this.frameCounter = 0;
      if (this.type == 1)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
      }
      else if (this.type == 2)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.light = 1f;
        this.ranged = true;
      }
      else if (this.type == 3)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 4;
        this.thrown = true;
      }
      else if (this.type == 4)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.light = 0.35f;
        this.penetrate = 5;
        this.ranged = true;
      }
      else if (this.type == 5)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.light = 0.4f;
        this.penetrate = -1;
        this.timeLeft = 120;
        this.alpha = 100;
        this.ignoreWater = true;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 6)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 3;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.light = 0.4f;
      }
      else if (this.type == 7 || this.type == 8)
      {
        this.width = 28;
        this.height = 28;
        this.aiStyle = 4;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.magic = true;
      }
      else if (this.type == 9)
      {
        this.width = 24;
        this.height = 24;
        this.aiStyle = 5;
        this.friendly = true;
        this.penetrate = 2;
        this.alpha = 50;
        this.scale = 0.8f;
        this.tileCollide = false;
        this.melee = true;
      }
      else if (this.type == 10)
      {
        this.width = 64;
        this.height = 64;
        this.aiStyle = 6;
        this.friendly = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
      }
      else if (this.type == 11)
      {
        this.width = 48;
        this.height = 48;
        this.aiStyle = 6;
        this.friendly = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
      }
      else if (this.type == 12)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 5;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = 50;
        this.light = 1f;
      }
      else if (this.type == 13)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 14)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.scale = 1.2f;
        this.timeLeft = 600;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 15)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 8;
        this.friendly = true;
        this.light = 0.8f;
        this.alpha = 100;
        this.magic = true;
      }
      else if (this.type == 16)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 9;
        this.friendly = true;
        this.light = 0.8f;
        this.alpha = 100;
        this.magic = true;
      }
      else if (this.type == 17)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.ignoreWater = true;
      }
      else if (this.type == 18)
      {
        this.netImportant = true;
        this.width = 32;
        this.height = 32;
        this.aiStyle = 11;
        this.friendly = true;
        this.light = 0.9f;
        this.alpha = 150;
        this.tileCollide = false;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.ignoreWater = true;
        this.scale = 0.8f;
      }
      else if (this.type == 19)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 3;
        this.friendly = true;
        this.penetrate = -1;
        this.light = 1f;
        this.melee = true;
      }
      else if (this.type == 20)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 3;
        this.light = 0.75f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.4f;
        this.timeLeft = 600;
        this.magic = true;
      }
      else if (this.type == 21)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 2;
        this.scale = 1.2f;
        this.friendly = true;
        this.thrown = true;
      }
      else if (this.type == 22)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 12;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 2;
        this.ignoreWater = true;
        this.magic = true;
      }
      else if (this.type == 23)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 13;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.ranged = true;
      }
      else if (this.type == 24)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 14;
        this.friendly = true;
        this.penetrate = 6;
        this.thrown = true;
      }
      else if (this.type == 25)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 15;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.scale = 0.8f;
      }
      else if (this.type == 26)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 15;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.scale = 0.8f;
      }
      else if (this.type == 27)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 8;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft /= 2;
        this.penetrate = 10;
        this.magic = true;
      }
      else if (this.type == 28)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
      }
      else if (this.type == 29)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
      }
      else if (this.type == 30)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.thrown = true;
      }
      else if (this.type == 31)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 32)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 33)
      {
        this.width = 38;
        this.height = 38;
        this.aiStyle = 3;
        this.friendly = true;
        this.scale = 0.9f;
        this.penetrate = -1;
        this.melee = true;
      }
      else if (this.type == 34)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 9;
        this.friendly = true;
        this.light = 0.8f;
        this.alpha = 100;
        this.penetrate = 1;
        this.magic = true;
      }
      else if (this.type == 35)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 15;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.scale = 0.8f;
      }
      else if (this.type == 36)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 2;
        this.light = 0.6f;
        this.alpha = (int) byte.MaxValue;
        this.scale = 1.4f;
        this.timeLeft = 600;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 37)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
      }
      else if (this.type == 38)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 0;
        this.hostile = true;
        this.penetrate = -1;
        this.aiStyle = 1;
        this.tileCollide = true;
      }
      else if (this.type == 39)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 40)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 41)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
        this.light = 0.3f;
      }
      else if (this.type == 42)
      {
        this.knockBack = 8f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 43)
      {
        this.knockBack = 12f;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 17;
        this.penetrate = -1;
      }
      else if (this.type == 44)
      {
        this.width = 48;
        this.height = 48;
        this.alpha = 100;
        this.light = 0.2f;
        this.aiStyle = 18;
        this.hostile = true;
        this.penetrate = -1;
        this.tileCollide = true;
        this.scale = 0.9f;
      }
      else if (this.type == 45)
      {
        this.width = 48;
        this.height = 48;
        this.alpha = 100;
        this.light = 0.2f;
        this.aiStyle = 18;
        this.friendly = true;
        this.penetrate = 5;
        this.tileCollide = true;
        this.scale = 0.9f;
        this.magic = true;
      }
      else if (this.type == 46)
      {
        this.width = 20;
        this.height = 20;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.1f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 47)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.1f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 48)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 2;
        this.thrown = true;
      }
      else if (this.type == 49)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.2f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 50)
      {
        this.netImportant = true;
        this.width = 6;
        this.height = 6;
        this.aiStyle = 14;
        this.penetrate = -1;
        this.alpha = 75;
        this.light = 1f;
        this.timeLeft *= 5;
      }
      else if (this.type == 51)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 1;
        this.friendly = true;
      }
      else if (this.type == 52)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 3;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
      }
      else if (this.type == 53)
      {
        this.netImportant = true;
        this.width = 6;
        this.height = 6;
        this.aiStyle = 14;
        this.penetrate = -1;
        this.alpha = 75;
        this.light = 1f;
        this.timeLeft *= 5;
        this.tileCollide = false;
      }
      else if (this.type == 54)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 2;
        this.thrown = true;
      }
      else if (this.type == 55)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 0;
        this.hostile = true;
        this.penetrate = -1;
        this.aiStyle = 1;
        this.tileCollide = true;
      }
      else if (this.type == 56)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 57)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 58)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 1.08f;
      }
      else if (this.type == 59)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 0.9f;
      }
      else if (this.type == 60)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 0.9f;
      }
      else if (this.type == 61)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 1.16f;
      }
      else if (this.type == 62)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 0.9f;
      }
      else if (this.type == 63)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 15;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
      }
      else if (this.type == 64)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.25f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 65)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.penetrate = -1;
        this.extraUpdates = 1;
      }
      else if (this.type == 66)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.27f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 67)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 68)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.penetrate = -1;
        this.extraUpdates = 1;
      }
      else if (this.type == 69)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 1;
      }
      else if (this.type == 70)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 1;
      }
      else if (this.type == 621)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 1;
      }
      else if (this.type == 71)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 72)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 11;
        this.friendly = true;
        this.light = 0.9f;
        this.tileCollide = false;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.ignoreWater = true;
        this.scale = 0.8f;
      }
      else if (this.type == 73 || this.type == 74)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
        this.light = 0.4f;
      }
      else if (this.type == 75)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 16;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 76 || this.type == 77 || this.type == 78)
      {
        if (this.type == 76)
        {
          this.width = 10;
          this.height = 22;
        }
        else if (this.type == 77)
        {
          this.width = 18;
          this.height = 24;
        }
        else
        {
          this.width = 22;
          this.height = 24;
        }
        this.aiStyle = 21;
        this.friendly = true;
        this.ranged = true;
        this.alpha = 100;
        this.light = 0.3f;
        this.penetrate = -1;
        this.timeLeft = 180;
        this.magic = true;
      }
      else if (this.type == 79)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 9;
        this.friendly = true;
        this.light = 0.8f;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
      }
      else if (this.type == 80)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 22;
        this.friendly = true;
        this.magic = true;
        this.tileCollide = false;
        this.light = 0.5f;
        this.coldDamage = true;
      }
      else if (this.type == 81)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.hostile = true;
        this.ranged = true;
      }
      else if (this.type == 82)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.hostile = true;
        this.ranged = true;
      }
      else if (this.type == 83)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = 3;
        this.light = 0.75f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.7f;
        this.timeLeft = 600;
        this.magic = true;
      }
      else if (this.type == 84)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = 3;
        this.light = 0.75f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.2f;
        this.timeLeft = 600;
        this.magic = true;
      }
      else if (this.type == 85)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 23;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = 3;
        this.extraUpdates = 2;
        this.ranged = true;
      }
      else if (this.type == 86)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 11;
        this.friendly = true;
        this.light = 0.9f;
        this.tileCollide = false;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.ignoreWater = true;
        this.scale = 0.8f;
      }
      else if (this.type == 87)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 11;
        this.friendly = true;
        this.light = 0.9f;
        this.tileCollide = false;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.ignoreWater = true;
        this.scale = 0.8f;
      }
      else if (this.type == 88)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 3;
        this.light = 0.75f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 4;
        this.scale = 1.4f;
        this.timeLeft = 600;
        this.magic = true;
      }
      else if (this.type == 89)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.scale = 1.2f;
        this.timeLeft = 600;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 90)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 24;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = 50;
        this.scale = 1.2f;
        this.timeLeft = 600;
        this.ranged = true;
        this.tileCollide = false;
      }
      else if (this.type == 91)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
      }
      else if (this.type == 92)
      {
        this.width = 24;
        this.height = 24;
        this.aiStyle = 5;
        this.friendly = true;
        this.penetrate = 2;
        this.alpha = 50;
        this.scale = 0.8f;
        this.tileCollide = false;
        this.ranged = true;
      }
      else if (this.type == 93)
      {
        this.light = 0.15f;
        this.width = 12;
        this.height = 12;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 2;
        this.magic = true;
      }
      else if (this.type == 94)
      {
        this.ignoreWater = true;
        this.width = 8;
        this.height = 8;
        this.aiStyle = 24;
        this.friendly = true;
        this.light = 0.5f;
        this.alpha = 50;
        this.scale = 1.2f;
        this.timeLeft = 600;
        this.magic = true;
        this.tileCollide = true;
        this.penetrate = 1;
      }
      else if (this.type == 95)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 8;
        this.friendly = true;
        this.light = 0.8f;
        this.alpha = 100;
        this.magic = true;
        this.penetrate = 2;
      }
      else if (this.type == 96)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 8;
        this.hostile = true;
        this.light = 0.8f;
        this.alpha = 100;
        this.magic = true;
        this.penetrate = -1;
        this.scale = 0.9f;
        this.scale = 1.3f;
      }
      else if (this.type == 97)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.1f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 98)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
        this.trap = true;
      }
      else if (this.type == 99)
      {
        this.width = 31;
        this.height = 31;
        this.aiStyle = 25;
        this.friendly = true;
        this.hostile = true;
        this.ranged = true;
        this.penetrate = -1;
        this.trap = true;
      }
      else if (this.type == 100)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = 3;
        this.light = 0.75f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.8f;
        this.timeLeft = 2700;
        this.magic = true;
      }
      else if (this.type == 101)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 23;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 3;
        this.magic = true;
      }
      else if (this.type == 102)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 16;
        this.hostile = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 103)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.light = 1f;
        this.ranged = true;
      }
      else if (this.type == 104)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.scale = 1.2f;
        this.timeLeft = 600;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 105)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.3f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 106)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 3;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.light = 0.4f;
      }
      else if (this.type == 107)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 1.1f;
      }
      else if (this.type == 108)
      {
        this.width = 260;
        this.height = 260;
        this.aiStyle = 16;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 2;
        this.trap = true;
      }
      else if (this.type == 109)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.hostile = true;
        this.scale = 0.9f;
        this.penetrate = -1;
        this.coldDamage = true;
        this.thrown = true;
      }
      else if (this.type == 110)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.scale = 1.2f;
        this.timeLeft = 600;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 111)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 112)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 113)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 3;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.light = 0.4f;
        this.coldDamage = true;
      }
      else if (this.type == 114)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 27;
        this.magic = true;
        this.penetrate = 3;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
      }
      else if (this.type == 115)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 27;
        this.hostile = true;
        this.magic = true;
        this.penetrate = -1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
      }
      else if (this.type == 116)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 27;
        this.melee = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
      }
      else if (this.type == 117)
      {
        this.arrow = true;
        this.extraUpdates = 2;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
      }
      else if (this.type == 118)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 28;
        this.alpha = (int) byte.MaxValue;
        this.melee = true;
        this.penetrate = 1;
        this.friendly = true;
        this.coldDamage = true;
      }
      else if (this.type == 119)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 28;
        this.alpha = (int) byte.MaxValue;
        this.melee = true;
        this.penetrate = 2;
        this.friendly = true;
      }
      else if (this.type == 120)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
        this.coldDamage = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 121)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 29;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 1;
        this.friendly = true;
      }
      else if (this.type == 122)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 29;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 1;
        this.friendly = true;
      }
      else if (this.type == 123)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 29;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 1;
        this.friendly = true;
      }
      else if (this.type == 124)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 29;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 2;
        this.friendly = true;
      }
      else if (this.type == 125)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 29;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 2;
        this.friendly = true;
      }
      else if (this.type == 126)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 29;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 2;
        this.friendly = true;
      }
      else if (this.type == (int) sbyte.MaxValue)
      {
        this.netImportant = true;
        this.width = 22;
        this.height = 22;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 128)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 28;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.friendly = false;
        this.hostile = true;
        this.coldDamage = true;
      }
      else if (this.type == 129)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 28;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.friendly = false;
        this.hostile = true;
        this.tileCollide = false;
      }
      else if (this.type == 130)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.2f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 131)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 30;
        this.friendly = true;
        this.penetrate = 1;
        this.tileCollide = false;
        this.melee = true;
        this.light = 0.5f;
      }
      else if (this.type == 132)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 27;
        this.melee = true;
        this.penetrate = 3;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
      }
      else if (this.type == 133)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 134)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 135)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 136)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 137)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 138)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 139)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 140)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 141)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 142)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 143)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 144)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 145)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 31;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 2;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 146)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 31;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 2;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 147)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 31;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 2;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 148)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 31;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 2;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 149)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 31;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 2;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 150 || this.type == 151 || this.type == 152)
      {
        this.width = 28;
        this.height = 28;
        this.aiStyle = 4;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.magic = true;
      }
      else if (this.type == 153)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.1f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 154)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 15;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.scale = 0.8f;
      }
      else if (this.type == 155)
      {
        this.netImportant = true;
        this.width = 44;
        this.height = 44;
        this.aiStyle = 32;
        this.friendly = true;
      }
      else if (this.type == 156)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 27;
        this.melee = true;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
      }
      else if (this.type == 157)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 27;
        this.melee = true;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.scale = 1.2f;
      }
      else if (this.type == 158)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 159)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 160)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 161)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 162)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 4;
        this.alpha = (int) byte.MaxValue;
      }
      else if (this.type == 163)
      {
        this.netImportant = true;
        this.width = 6;
        this.height = 6;
        this.aiStyle = 33;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 36000;
      }
      else if (this.type == 164)
      {
        this.width = 128;
        this.height = 128;
        this.aiStyle = 16;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 2;
      }
      else if (this.type == 165)
      {
        this.netImportant = true;
        this.width = 12;
        this.height = 12;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 166)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 2;
        this.friendly = true;
        this.ranged = true;
        this.coldDamage = true;
      }
      else if (this.type == 167 || this.type == 168 || this.type == 169 || this.type == 170)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 34;
        this.friendly = true;
        this.ranged = true;
        this.timeLeft = 45;
      }
      else if (this.type == 171 || this.type == 505 || this.type == 506)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 35;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft = 400;
      }
      else if (this.type == 172)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.light = 1f;
        this.ranged = true;
        this.coldDamage = true;
      }
      else if (this.type == 173)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 27;
        this.melee = true;
        this.penetrate = 1;
        this.light = 0.2f;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
      }
      else if (this.type == 174)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 6;
        this.height = 6;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
        this.coldDamage = true;
      }
      else if (this.type == 175)
      {
        this.width = 34;
        this.height = 34;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 176)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 6;
        this.height = 6;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 177)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 28;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.friendly = false;
        this.hostile = true;
        this.coldDamage = true;
      }
      else if (this.type == 178)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.timeLeft = 2;
      }
      else if (this.type == 179)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 180)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.scale = 1.2f;
        this.timeLeft = 600;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 181)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 36;
        this.friendly = true;
        this.penetrate = 3;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.extraUpdates = 3;
      }
      else if (this.type == 182)
      {
        this.light = 0.15f;
        this.width = 30;
        this.height = 30;
        this.aiStyle = 3;
        this.friendly = true;
        this.penetrate = 10;
        this.melee = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 183)
      {
        this.width = 14;
        this.height = 22;
        this.aiStyle = 14;
        this.penetrate = 1;
        this.ranged = true;
        this.timeLeft = 180;
        this.thrown = true;
        this.friendly = true;
      }
      else if (this.type == 184)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 1;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
        this.trap = true;
      }
      else if (this.type == 185)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 14;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft = 900;
        this.trap = true;
      }
      else if (this.type == 186)
      {
        this.width = 10;
        this.height = 14;
        this.aiStyle = 37;
        this.friendly = true;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft = 300;
        this.trap = true;
      }
      else if (this.type == 187)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 38;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.timeLeft = 60;
        this.trap = true;
      }
      else if (this.type == 188)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 23;
        this.friendly = true;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 2;
        this.trap = true;
      }
      else if (this.type == 189)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 36;
        this.friendly = true;
        this.penetrate = 4;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.magic = true;
        this.extraUpdates = 3;
      }
      else if (this.type == 190)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 39;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.ranged = true;
      }
      else if (this.type >= 191 && this.type <= 194)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 26;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.minionSlots = 1f;
        if (this.type == 192)
          this.scale = 1.025f;
        if (this.type == 193)
          this.scale = 1.05f;
        if (this.type == 194)
          this.scale = 1.075f;
      }
      else if (this.type == 195)
      {
        this.tileCollide = false;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
      }
      else if (this.type == 196)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 14;
        this.penetrate = -1;
        this.scale = 0.8f;
      }
      else if (this.type == 197)
      {
        this.netImportant = true;
        this.width = 42;
        this.height = 42;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 198)
      {
        this.netImportant = true;
        this.width = 26;
        this.height = 26;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 199)
      {
        this.netImportant = true;
        this.width = 28;
        this.height = 28;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 200)
      {
        this.netImportant = true;
        this.width = 28;
        this.height = 28;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 201)
      {
        this.knockBack = 12f;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 17;
        this.penetrate = -1;
      }
      else if (this.type == 202)
      {
        this.knockBack = 12f;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 17;
        this.penetrate = -1;
      }
      else if (this.type == 203)
      {
        this.knockBack = 12f;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 17;
        this.penetrate = -1;
      }
      else if (this.type == 204)
      {
        this.knockBack = 12f;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 17;
        this.penetrate = -1;
      }
      else if (this.type == 205)
      {
        this.knockBack = 12f;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 17;
        this.penetrate = -1;
      }
      else if (this.type == 206)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 40;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.magic = true;
      }
      else if (this.type == 207)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.2f;
        this.timeLeft = 600;
        this.ranged = true;
      }
      else if (this.type == 208)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 36;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 209)
      {
        this.width = 12;
        this.height = 32;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.light = 0.5f;
      }
      else if (this.type == 210)
      {
        this.netImportant = true;
        this.width = 14;
        this.height = 30;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 211)
      {
        this.netImportant = true;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.light = 1f;
        this.ignoreWater = true;
      }
      else if (this.type == 212)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.12f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 213)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 0.92f;
      }
      else if (this.type == 214)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 215)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.27f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 216)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 0.93f;
      }
      else if (this.type == 217)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 1.12f;
      }
      else if (this.type == 218)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.28f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 219)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 0.95f;
      }
      else if (this.type == 220)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 1.2f;
      }
      else if (this.type == 221)
      {
        this.width = 20;
        this.height = 20;
        this.aiStyle = 41;
        this.friendly = true;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.timeLeft = 120;
        this.penetrate = -1;
        this.scale = (float) (1.0 + (double) Main.rand.Next(30) * 0.00999999977648258);
        this.extraUpdates = 2;
      }
      else if (this.type == 222)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.3f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 223)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 1f;
      }
      else if (this.type == 224)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 1.1f;
      }
      else if (this.type == 225)
      {
        this.arrow = true;
        this.penetrate = 2;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
      }
      else if (this.type == 226)
      {
        this.netImportant = true;
        this.width = 22;
        this.height = 42;
        this.aiStyle = 42;
        this.friendly = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.light = 0.4f;
        this.ignoreWater = true;
      }
      else if (this.type == 227)
      {
        this.netImportant = true;
        this.tileCollide = false;
        this.light = 0.1f;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 43;
        this.friendly = true;
        this.penetrate = 1;
        this.timeLeft = 180;
      }
      else if (this.type == 228)
      {
        this.tileCollide = false;
        this.width = 30;
        this.height = 30;
        this.aiStyle = 44;
        this.friendly = true;
        this.scale = 1.1f;
        this.penetrate = -1;
      }
      else if (this.type == 229)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 44;
        this.friendly = true;
        this.penetrate = -1;
        this.light = 0.2f;
      }
      else if (this.type >= 230 && this.type <= 235)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 236)
      {
        this.netImportant = true;
        this.width = 34;
        this.height = 34;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 237)
      {
        this.netImportant = true;
        this.width = 28;
        this.height = 28;
        this.aiStyle = 45;
        this.penetrate = -1;
      }
      else if (this.type == 238)
      {
        this.tileCollide = false;
        this.ignoreWater = true;
        this.width = 54;
        this.height = 28;
        this.aiStyle = 45;
        this.penetrate = -1;
      }
      else if (this.type == 239)
      {
        this.ignoreWater = true;
        this.width = 4;
        this.height = 40;
        this.aiStyle = 45;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft = 300;
        this.scale = 1.1f;
        this.magic = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 240)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 2;
        this.hostile = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
      }
      else if (this.type == 241)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 242)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 7;
        this.scale = 1.18f;
        this.timeLeft = 600;
        this.ranged = true;
        this.ignoreWater = true;
      }
      else if (this.type == 243)
      {
        this.width = 28;
        this.height = 28;
        this.aiStyle = 45;
        this.penetrate = -1;
      }
      else if (this.type == 244)
      {
        this.tileCollide = false;
        this.ignoreWater = true;
        this.width = 54;
        this.height = 28;
        this.aiStyle = 45;
        this.penetrate = -1;
      }
      else if (this.type == 245)
      {
        this.ignoreWater = true;
        this.width = 4;
        this.height = 40;
        this.aiStyle = 45;
        this.friendly = true;
        this.penetrate = 2;
        this.timeLeft = 300;
        this.scale = 1.1f;
        this.magic = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 246)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 1;
      }
      else if (this.type == 247)
      {
        this.width = 34;
        this.height = 34;
        this.aiStyle = 15;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
      }
      else if (this.type == 248)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 1;
        this.friendly = true;
        this.melee = true;
      }
      else if (this.type == 249)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 2;
        this.friendly = true;
        this.ranged = true;
      }
      else if (this.type == 250)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 46;
        this.penetrate = -1;
        this.magic = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.scale = 1.25f;
      }
      else if (this.type == 251)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 46;
        this.friendly = true;
        this.penetrate = -1;
        this.magic = true;
        this.alpha = (int) byte.MaxValue;
        this.light = 0.3f;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.scale = 1.25f;
      }
      else if (this.type == 252)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 1.1f;
      }
      else if (this.type == 253)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 8;
        this.friendly = true;
        this.light = 0.8f;
        this.alpha = 100;
        this.magic = true;
      }
      else if (this.type == 254)
      {
        this.width = 38;
        this.height = 38;
        this.aiStyle = 47;
        this.magic = true;
        this.timeLeft = 660;
        this.light = 0.5f;
      }
      else if (this.type == (int) byte.MaxValue)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 48;
        this.friendly = true;
        this.magic = true;
        this.extraUpdates = 100;
        this.timeLeft = 100;
      }
      else if (this.type == 256)
      {
        this.netImportant = true;
        this.tileCollide = false;
        this.width = 6;
        this.height = 6;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.scale = 1f;
        this.timeLeft *= 10;
      }
      else if (this.type == 257)
      {
        this.ignoreWater = true;
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
        this.light = 0.75f;
        this.alpha = (int) byte.MaxValue;
        this.scale = 1.2f;
        this.timeLeft = 600;
        this.magic = true;
        this.coldDamage = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 258)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 8;
        this.hostile = true;
        this.penetrate = -1;
        this.alpha = 100;
        this.timeLeft = 300;
      }
      else if (this.type == 259)
      {
        this.ignoreWater = true;
        this.tileCollide = false;
        this.width = 8;
        this.height = 8;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
        this.light = 0.3f;
        this.scale = 1.1f;
        this.magic = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 260)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 48;
        this.friendly = true;
        this.magic = true;
        this.extraUpdates = 100;
        this.timeLeft = 200;
        this.penetrate = -1;
      }
      else if (this.type == 261)
      {
        this.width = 32;
        this.height = 34;
        this.aiStyle = 14;
        this.friendly = true;
        this.penetrate = 6;
        this.magic = true;
        this.ignoreWater = true;
      }
      else if (this.type == 262)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 13;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.melee = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 263)
      {
        this.width = 34;
        this.height = 34;
        this.alpha = 100;
        this.light = 0.5f;
        this.aiStyle = 18;
        this.friendly = true;
        this.penetrate = 5;
        this.tileCollide = true;
        this.scale = 1f;
        this.melee = true;
        this.timeLeft = 180;
        this.coldDamage = true;
      }
      else if (this.type == 264)
      {
        this.ignoreWater = true;
        this.width = 4;
        this.height = 40;
        this.aiStyle = 45;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft = 120;
        this.scale = 1.1f;
        this.extraUpdates = 1;
      }
      else if (this.type == 265)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.magic = true;
        this.penetrate = 4;
      }
      else if (this.type == 266)
      {
        this.netImportant = true;
        this.alpha = 75;
        this.width = 24;
        this.height = 16;
        this.aiStyle = 26;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.minionSlots = 1f;
      }
      else if (this.type == 267)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
      }
      else if (this.type == 268)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 32;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 269)
      {
        this.netImportant = true;
        this.width = 20;
        this.height = 26;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 270)
      {
        this.width = 26;
        this.height = 26;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.magic = true;
        this.penetrate = 3;
      }
      else if (this.type == 271)
      {
        this.width = 20;
        this.height = 20;
        this.aiStyle = 13;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.melee = true;
        this.scale = 1.2f;
      }
      else if (this.type == 272)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 3;
        this.friendly = true;
        this.scale = 0.9f;
        this.penetrate = -1;
        this.melee = true;
      }
      else if (this.type == 273)
      {
        this.width = 26;
        this.height = 26;
        this.aiStyle = 13;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.melee = true;
      }
      else if (this.type == 274)
      {
        this.width = 42;
        this.height = 42;
        this.alpha = 100;
        this.light = 0.5f;
        this.aiStyle = 18;
        this.friendly = true;
        this.penetrate = 5;
        this.tileCollide = false;
        this.scale = 1.1f;
        this.melee = true;
        this.timeLeft = 180;
      }
      else if (this.type == 275)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 1;
        this.hostile = true;
      }
      else if (this.type == 276)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 1;
        this.hostile = true;
      }
      else if (this.type == 277)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 38;
        this.height = 38;
        this.aiStyle = 14;
        this.hostile = true;
      }
      else if (this.type == 278)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.light = 1f;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 279)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.25f;
        this.timeLeft = 600;
        this.ranged = true;
      }
      else if (this.type == 280)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 12;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = 5;
        this.extraUpdates = 2;
        this.ignoreWater = true;
        this.magic = true;
      }
      else if (this.type == 281)
      {
        this.width = 28;
        this.height = 28;
        this.aiStyle = 49;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
      }
      else if (this.type == 282)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 283)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.25f;
        this.timeLeft = 600;
        this.ranged = true;
      }
      else if (this.type == 284)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.3f;
        this.timeLeft = 600;
        this.ranged = true;
      }
      else if (this.type == 285)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.3f;
        this.timeLeft = 600;
        this.ranged = true;
      }
      else if (this.type == 286)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.3f;
        this.timeLeft = 600;
        this.ranged = true;
      }
      else if (this.type == 287)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.light = 0.5f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.3f;
        this.timeLeft = 600;
        this.ranged = true;
      }
      else if (this.type == 288)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 12;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 2;
        this.ignoreWater = true;
        this.magic = true;
      }
      else if (this.type == 289)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.timeLeft = 2;
      }
      else if (this.type == 290)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 48;
        this.hostile = true;
        this.magic = true;
        this.extraUpdates = 100;
        this.timeLeft = 100;
        this.penetrate = -1;
      }
      else if (this.type == 291)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 50;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.tileCollide = false;
        this.penetrate = -1;
      }
      else if (this.type == 292)
      {
        this.width = 130;
        this.height = 130;
        this.aiStyle = 50;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.tileCollide = false;
        this.penetrate = -1;
      }
      else if (this.type == 293)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 51;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.extraUpdates = 1;
      }
      else if (this.type == 294)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 48;
        this.friendly = true;
        this.magic = true;
        this.extraUpdates = 100;
        this.timeLeft = 300;
        this.penetrate = -1;
      }
      else if (this.type == 295)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 50;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.tileCollide = true;
      }
      else if (this.type == 296)
      {
        this.width = 150;
        this.height = 150;
        this.aiStyle = 50;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.tileCollide = false;
        this.penetrate = -1;
      }
      else if (this.type == 297)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 51;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 298)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 52;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.tileCollide = false;
        this.extraUpdates = 3;
      }
      else if (this.type == 299)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 1;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 2;
        this.magic = true;
        this.ignoreWater = true;
        this.tileCollide = false;
      }
      else if (this.type == 300)
      {
        this.width = 38;
        this.height = 38;
        this.aiStyle = 2;
        this.hostile = true;
        this.penetrate = -1;
        this.ignoreWater = true;
        this.tileCollide = false;
      }
      else if (this.type == 301)
      {
        this.width = 38;
        this.height = 38;
        this.aiStyle = 3;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.extraUpdates = 2;
      }
      else if (this.type == 302)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
        this.light = 0.3f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 7;
        this.scale = 1.18f;
        this.timeLeft = 300;
        this.ranged = true;
        this.ignoreWater = true;
      }
      else if (this.type == 303)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.hostile = true;
        this.penetrate = -1;
        this.ranged = true;
      }
      else if (this.type == 304)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 30;
        this.height = 30;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 1;
        this.melee = true;
        this.light = 0.2f;
        this.ignoreWater = true;
        this.extraUpdates = 0;
      }
      else if (this.type == 305)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 52;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.extraUpdates = 10;
      }
      else if (this.type == 306)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 1;
        this.melee = true;
        this.ignoreWater = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 307)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 36;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.melee = true;
        this.extraUpdates = 3;
      }
      else if (this.type == 308)
      {
        this.width = 80;
        this.height = 74;
        this.aiStyle = 53;
        this.timeLeft = Projectile.SentryLifeTime;
        this.light = 0.25f;
        this.ignoreWater = true;
        this.coldDamage = true;
        this.sentry = true;
      }
      else if (this.type == 309)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 28;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = 1;
        this.friendly = true;
        this.extraUpdates = 3;
        this.coldDamage = true;
      }
      else if (this.type == 310)
      {
        this.netImportant = true;
        this.width = 6;
        this.height = 6;
        this.aiStyle = 33;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 36000;
      }
      else if (this.type == 311)
      {
        this.width = 10;
        this.height = 12;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 3;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.ranged = true;
      }
      else if (this.type == 312)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 32;
        this.height = 32;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
        this.timeLeft = 300;
      }
      else if (this.type == 313)
      {
        this.netImportant = true;
        this.width = 30;
        this.height = 30;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 314)
      {
        this.netImportant = true;
        this.width = 24;
        this.height = 40;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 315)
      {
        this.netImportant = true;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 316)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 16;
        this.height = 16;
        this.aiStyle = 36;
        this.friendly = true;
        this.penetrate = 1;
        this.timeLeft = 600;
        this.magic = true;
      }
      else if (this.type == 317)
      {
        this.netImportant = true;
        this.width = 28;
        this.height = 28;
        this.aiStyle = 54;
        this.penetrate = 1;
        this.timeLeft *= 5;
        this.minion = true;
        this.minionSlots = 1f;
      }
      else if (this.type == 318)
      {
        this.width = 12;
        this.height = 14;
        this.aiStyle = 2;
        this.friendly = true;
        this.thrown = true;
      }
      else if (this.type == 319)
      {
        this.netImportant = true;
        this.width = 36;
        this.height = 30;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 320)
      {
        this.width = 34;
        this.height = 34;
        this.aiStyle = 3;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
      }
      else if (this.type == 321)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 55;
        this.friendly = true;
        this.melee = true;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 322)
      {
        this.netImportant = true;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 323)
      {
        this.penetrate = 10;
        this.extraUpdates = 3;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.ranged = true;
        this.scale = 0.8f;
      }
      else if (this.type == 324)
      {
        this.netImportant = true;
        this.width = 26;
        this.height = 38;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 325)
      {
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 1;
        this.hostile = true;
        this.tileCollide = false;
      }
      else if (this.type >= 326 && this.type <= 328)
      {
        if (this.type == 326)
        {
          this.width = 14;
          this.height = 16;
        }
        else if (this.type == 327)
        {
          this.width = 12;
          this.height = 14;
        }
        else
        {
          this.width = 6;
          this.height = 12;
        }
        this.aiStyle = 14;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft = 360;
      }
      else if (this.type == 329)
      {
        this.width = 80;
        this.height = 80;
        this.light = 0.25f;
        this.aiStyle = 56;
        this.hostile = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft = 420;
      }
      else if (this.type == 330)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 6;
        this.thrown = true;
      }
      else if (this.type == 331)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 332)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
        this.light = 0.5f;
      }
      else if (this.type == 333)
      {
        this.width = 38;
        this.height = 38;
        this.aiStyle = 3;
        this.friendly = true;
        this.scale = 0.9f;
        this.penetrate = -1;
        this.melee = true;
      }
      else if (this.type == 334)
      {
        this.netImportant = true;
        this.width = 28;
        this.height = 28;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 335)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 1;
        this.melee = true;
      }
      else if (this.type == 336)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.magic = true;
        this.scale = 0.8f;
        this.extraUpdates = 1;
      }
      else if (this.type == 337)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.magic = true;
        this.tileCollide = false;
        this.coldDamage = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 338 || this.type == 339 || this.type == 340 || this.type == 341)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.penetrate = -1;
        this.friendly = true;
        this.ranged = true;
        this.scale = 0.9f;
      }
      else if (this.type == 342)
      {
        this.width = 22;
        this.height = 2;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.1f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.coldDamage = true;
      }
      else if (this.type == 343)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 57;
        this.friendly = true;
        this.melee = true;
        this.scale = 1.1f;
        this.penetrate = 3;
        this.coldDamage = true;
      }
      else if (this.type == 344)
      {
        this.width = 26;
        this.height = 26;
        this.aiStyle = 1;
        this.friendly = true;
        this.scale = 0.9f;
        this.alpha = (int) byte.MaxValue;
        this.melee = true;
        this.coldDamage = true;
        this.tileCollide = false;
      }
      else if (this.type == 345)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.hostile = true;
        this.scale = 0.8f;
      }
      else if (this.type == 346)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 14;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft = 300;
      }
      else if (this.type == 347)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 2;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 348)
      {
        this.aiStyle = 1;
        this.width = 48;
        this.height = 48;
        this.hostile = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.coldDamage = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 349)
      {
        this.aiStyle = 1;
        this.width = 12;
        this.height = 12;
        this.hostile = true;
        this.penetrate = -1;
        this.coldDamage = true;
      }
      else if (this.type == 350)
      {
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 1;
        this.hostile = true;
        this.tileCollide = false;
        this.timeLeft /= 2;
      }
      else if (this.type == 351)
      {
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 58;
        this.hostile = true;
        this.tileCollide = false;
      }
      else if (this.type == 352)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 14;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft /= 3;
      }
      else if (this.type == 353)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 28;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 354)
      {
        this.knockBack = 6f;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 10;
        this.friendly = true;
        this.penetrate = -1;
        this.extraUpdates = 1;
      }
      else if (this.type == 355)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.magic = true;
        this.penetrate = 7;
      }
      else if (this.type == 356)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 59;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.tileCollide = false;
        this.extraUpdates = 3;
      }
      else if (this.type == 357)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 6;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.2f;
        this.timeLeft = 600;
        this.ranged = true;
      }
      else if (this.type == 358)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 60;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 2;
        this.ignoreWater = true;
      }
      else if (this.type == 359)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 28;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 2;
        this.friendly = true;
        this.coldDamage = true;
      }
      else if (this.type >= 360 && this.type <= 366 || this.type == 381 || this.type == 382)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 61;
        this.penetrate = -1;
        this.bobber = true;
      }
      else if (this.type == 367)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.scale = 1.1f;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 368)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 19;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 369)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 370)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 1;
      }
      else if (this.type == 371)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 1;
      }
      else if (this.type == 372)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 373)
      {
        this.netImportant = true;
        this.width = 24;
        this.height = 26;
        this.aiStyle = 62;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.minionSlots = 1f;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 374)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 0;
        this.friendly = true;
        this.penetrate = 1;
        this.aiStyle = 1;
        this.tileCollide = true;
        this.scale *= 0.9f;
      }
      else if (this.type == 375)
      {
        this.netImportant = true;
        this.width = 34;
        this.height = 26;
        this.aiStyle = 62;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.minionSlots = 1f;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 376)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 0;
        this.friendly = true;
        this.penetrate = -1;
        this.aiStyle = 1;
        this.tileCollide = true;
        this.timeLeft = 100;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 1;
      }
      else if (this.type == 377)
      {
        this.width = 66;
        this.height = 50;
        this.aiStyle = 53;
        this.timeLeft = Projectile.SentryLifeTime;
        this.ignoreWater = true;
        this.sentry = true;
      }
      else if (this.type == 378)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 14;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft = 60;
        this.scale = 0.9f;
      }
      else if (this.type == 379)
      {
        this.width = 14;
        this.height = 10;
        this.aiStyle = 63;
        this.friendly = true;
        this.timeLeft = 300;
        this.penetrate = 1;
      }
      else if (this.type == 380)
      {
        this.netImportant = true;
        this.width = 26;
        this.height = 26;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 383)
      {
        this.width = 34;
        this.height = 34;
        this.aiStyle = 3;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
      }
      else if (this.type == 384)
      {
        this.width = 150;
        this.height = 42;
        this.hostile = true;
        this.penetrate = -1;
        this.aiStyle = 64;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 540;
      }
      else if (this.type == 385)
      {
        this.width = 30;
        this.height = 30;
        this.hostile = true;
        this.penetrate = -1;
        this.aiStyle = 65;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 300;
      }
      else if (this.type == 386)
      {
        this.width = 150;
        this.height = 42;
        this.hostile = true;
        this.penetrate = -1;
        this.aiStyle = 64;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 840;
      }
      else if (this.type == 387)
      {
        this.netImportant = true;
        this.width = 40;
        this.height = 20;
        this.aiStyle = 66;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.minionSlots = 0.5f;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.friendly = true;
      }
      else if (this.type == 388)
      {
        this.netImportant = true;
        this.width = 40;
        this.height = 20;
        this.aiStyle = 66;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.minionSlots = 0.5f;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.friendly = true;
      }
      else if (this.type == 389)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 3;
        this.light = 0.75f;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.2f;
        this.timeLeft = 600;
      }
      else if (this.type == 390 || this.type == 391 || this.type == 392)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 26;
        this.penetrate = -1;
        this.netImportant = true;
        this.timeLeft *= 5;
        this.minion = true;
        this.minionSlots = 0.75f;
        int type = this.type;
        if (this.type != 392)
          ;
      }
      else if (this.type == 393 || this.type == 394 || this.type == 395)
      {
        this.width = 20;
        this.height = 30;
        this.aiStyle = 67;
        this.penetrate = -1;
        this.netImportant = true;
        this.timeLeft *= 5;
        this.minion = true;
        this.minionSlots = 1f;
        int type = this.type;
        if (this.type != 395)
          ;
      }
      else if (this.type == 396)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
        this.alpha = 100;
      }
      else if (this.type == 397)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.thrown = true;
        this.tileCollide = false;
      }
      else if (this.type == 398)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 38;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 399)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 68;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.thrown = true;
        this.noEnchantments = true;
      }
      else if (this.type >= 400 && this.type <= 402)
      {
        if (this.type == 400)
        {
          this.width = 14;
          this.height = 16;
        }
        else if (this.type == 401)
        {
          this.width = 12;
          this.height = 14;
        }
        else
        {
          this.width = 6;
          this.height = 12;
        }
        this.penetrate = 3;
        this.aiStyle = 14;
        this.friendly = true;
        this.timeLeft = 360;
        this.ranged = true;
        this.noEnchantments = true;
      }
      else if (this.type == 403)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 18;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 404)
      {
        this.width = 26;
        this.height = 26;
        this.aiStyle = 69;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.melee = true;
      }
      else if (this.type == 405)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 70;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 90;
        this.melee = true;
        this.noEnchantments = true;
      }
      else if (this.type == 406)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 60;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.extraUpdates = 2;
        this.ignoreWater = true;
      }
      else if (this.type == 407)
      {
        this.netImportant = true;
        this.width = 28;
        this.height = 40;
        this.aiStyle = 62;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.friendly = true;
        this.minionSlots = 1f;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 408)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
      }
      else if (this.type == 409)
      {
        this.width = 30;
        this.height = 30;
        this.penetrate = -1;
        this.aiStyle = 71;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 360;
        this.friendly = true;
        this.tileCollide = true;
        this.extraUpdates = 2;
        this.magic = true;
        this.ignoreWater = true;
      }
      else if (this.type == 410)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 72;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 50;
        this.magic = true;
        this.ignoreWater = true;
      }
      else if (this.type >= 411 && this.type <= 414)
      {
        switch (this.type)
        {
          default:
            this.width = 10;
            this.height = 10;
            this.aiStyle = 10;
            break;
        }
      }
      else if (this.type == 415 || this.type == 416 || this.type == 417 || this.type == 418)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 34;
        this.friendly = true;
        this.ranged = true;
        this.timeLeft = 45;
      }
      else if (this.type >= 419 && this.type <= 422)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 73;
        this.friendly = true;
      }
      else if (this.type == 423)
      {
        this.netImportant = true;
        this.width = 28;
        this.height = 28;
        this.aiStyle = 62;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.friendly = true;
        this.minionSlots = 1f;
        this.ignoreWater = true;
      }
      else if (this.type >= 424 && this.type <= 426)
      {
        this.width = 24;
        this.height = 24;
        this.aiStyle = 1;
        this.friendly = true;
        this.magic = true;
        this.tileCollide = false;
        this.extraUpdates = 2;
      }
      else if (this.type == 427)
      {
        this.width = 22;
        this.height = 56;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.glowMask = (short) 2;
      }
      else if (this.type == 428)
      {
        this.width = 26;
        this.height = 54;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.glowMask = (short) 3;
      }
      else if (this.type == 429)
      {
        this.width = 18;
        this.height = 56;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.glowMask = (short) 7;
      }
      else if (this.type == 430)
      {
        this.width = 30;
        this.height = 54;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.glowMask = (short) 8;
      }
      else if (this.type == 431)
      {
        this.width = 28;
        this.height = 64;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 432)
      {
        this.width = 30;
        this.height = 54;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
      }
      else if (this.type == 610)
      {
        this.width = 28;
        this.height = 64;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.glowMask = (short) 179;
      }
      else if (this.type == 609)
      {
        this.width = 30;
        this.height = 54;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.glowMask = (short) 180;
      }
      else if (this.type == 433)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 48;
        this.friendly = true;
        this.extraUpdates = 100;
        this.timeLeft = 100;
        this.ignoreWater = true;
      }
      else if (this.type == 434)
      {
        this.width = 1;
        this.height = 1;
        this.aiStyle = 74;
        this.friendly = true;
        this.extraUpdates = 100;
        this.penetrate = -1;
      }
      else if (this.type == 435)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.hostile = true;
        this.ignoreWater = true;
      }
      else if (this.type == 436)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.hostile = true;
        this.ignoreWater = true;
      }
      else if (this.type == 437)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.hostile = true;
        this.extraUpdates = 2;
        this.ignoreWater = true;
      }
      else if (this.type == 438)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 1;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 3;
        this.ignoreWater = true;
      }
      else if (this.type == 439)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 75;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.magic = true;
        this.ignoreWater = true;
      }
      else if (this.type == 440)
      {
        this.width = 5;
        this.height = 5;
        this.aiStyle = 1;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1f;
        this.timeLeft = 600;
        this.magic = true;
        this.ignoreWater = true;
      }
      else if (this.type == 441)
      {
        this.width = 1;
        this.height = 1;
        this.aiStyle = 76;
        this.ignoreWater = true;
        this.tileCollide = false;
      }
      else if (this.type == 442)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 1;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.scale = 1f;
        this.timeLeft = 600;
        this.ranged = true;
      }
      else if (this.type == 443)
      {
        this.width = 80;
        this.height = 80;
        this.aiStyle = 77;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.scale = 1f;
        this.ranged = true;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.penetrate = -1;
      }
      else if (this.type == 444)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 78;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.scale = 1f;
        this.ranged = true;
        this.ignoreWater = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 445)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 75;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.melee = true;
        this.ignoreWater = true;
        this.ownerHitCheck = true;
      }
      else if (this.type == 446)
      {
        this.netImportant = true;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
        this.light = 0.7f;
      }
      else if (this.type == 447)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 79;
        this.hostile = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.timeLeft = 240;
      }
      else if (this.type == 448)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 80;
        this.hostile = true;
        this.penetrate = -1;
        this.tileCollide = false;
      }
      else if (this.type == 449)
      {
        this.width = 5;
        this.height = 5;
        this.aiStyle = 1;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 1;
        this.scale = 1f;
        this.timeLeft = 600;
        this.ignoreWater = true;
      }
      else if (this.type == 450)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 14;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft = 360;
      }
      else if (this.type == 451)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 81;
        this.melee = true;
        this.penetrate = 3;
        this.light = 0.2f;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
      }
      else if (this.type == 452)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 82;
        this.hostile = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
      }
      else if (this.type == 453)
      {
        this.width = 1;
        this.height = 1;
        this.aiStyle = 76;
        this.ignoreWater = true;
        this.tileCollide = false;
      }
      else if (this.type == 454)
      {
        this.width = 46;
        this.height = 46;
        this.aiStyle = 83;
        this.hostile = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.tileCollide = false;
      }
      else if (this.type == 455)
      {
        this.width = 36;
        this.height = 36;
        this.aiStyle = 84;
        this.hostile = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.tileCollide = false;
      }
      else if (this.type == 456)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 85;
        this.hostile = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.tileCollide = false;
      }
      else if (this.type == 459)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 1;
        this.friendly = true;
        this.magic = true;
        this.alpha = (int) byte.MaxValue;
        this.scale = 1f;
        this.ignoreWater = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 460)
      {
        this.width = 14;
        this.height = 18;
        this.aiStyle = 75;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.magic = true;
        this.ignoreWater = true;
      }
      else if (this.type == 461)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 84;
        this.friendly = true;
        this.magic = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.hide = true;
      }
      else if (this.type == 462)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 1;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 3;
        this.ignoreWater = true;
        this.tileCollide = false;
      }
      else if (this.type == 463)
      {
        this.width = 48;
        this.height = 48;
        this.aiStyle = 6;
        this.friendly = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
      }
      else if (this.type == 464)
      {
        this.width = 60;
        this.height = 60;
        this.aiStyle = 86;
        this.hostile = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
      }
      else if (this.type == 467)
      {
        this.width = 40;
        this.height = 40;
        this.aiStyle = 1;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 468)
      {
        this.width = 40;
        this.height = 40;
        this.aiStyle = 1;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 465)
      {
        this.width = 80;
        this.height = 80;
        this.aiStyle = 88;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.tileCollide = false;
      }
      else if (this.type == 466)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 88;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.tileCollide = true;
        this.extraUpdates = 4;
        this.timeLeft = 120 * (this.extraUpdates + 1);
      }
      else if (this.type == 491)
      {
        this.width = 26;
        this.height = 26;
        this.aiStyle = 9;
        this.friendly = true;
        this.melee = true;
        this.penetrate = -1;
      }
      else if (this.type == 500)
      {
        this.width = 20;
        this.height = 20;
        this.aiStyle = 67;
        this.penetrate = -1;
        this.netImportant = true;
        this.timeLeft *= 5;
        this.friendly = true;
        this.ignoreWater = true;
        this.scale = 0.8f;
      }
      else if (this.type == 499)
      {
        this.netImportant = true;
        this.width = 34;
        this.height = 34;
        this.aiStyle = 26;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 469)
      {
        this.alpha = (int) byte.MaxValue;
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
      }
      else if (this.type == 470)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
      }
      else if (this.type == 471)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 2;
        this.scale = 1.2f;
        this.hostile = true;
        this.ranged = true;
      }
      else if (this.type == 472)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 0;
        this.hostile = true;
        this.penetrate = -1;
        this.aiStyle = 1;
        this.tileCollide = true;
        this.timeLeft = 50;
      }
      else if (this.type == 474)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
      }
      else if (this.type == 473)
      {
        this.netImportant = true;
        this.width = 8;
        this.height = 8;
        this.aiStyle = 14;
        this.penetrate = -1;
        this.alpha = 75;
        this.light = 1f;
        this.timeLeft *= 2;
      }
      else if (this.type == 475)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 35;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft = 400;
      }
      else if (this.type == 476)
      {
        this.width = 200;
        this.height = 200;
        this.aiStyle = -1;
        this.friendly = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.timeLeft = 3;
      }
      else if (this.type == 477)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 7;
        this.extraUpdates = 1;
        this.ranged = true;
      }
      else if (this.type == 478)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 1;
        this.friendly = true;
        this.timeLeft = 300;
        this.ranged = true;
      }
      else if (this.type == 479)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
      }
      else if (this.type == 480)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 12;
        this.height = 12;
        this.penetrate = 3;
        this.aiStyle = 14;
        this.friendly = true;
        this.timeLeft = 120;
        this.ranged = true;
        this.noEnchantments = true;
      }
      else if (this.type == 481)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 13;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.melee = true;
        this.extraUpdates = 0;
      }
      else if (this.type == 482)
      {
        this.width = 16;
        this.height = 200;
        this.aiStyle = 87;
        this.friendly = true;
        this.tileCollide = false;
        this.penetrate = 20;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.timeLeft = 2700;
      }
      else if (this.type == 483)
      {
        this.arrow = true;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 14;
        this.friendly = true;
        this.melee = true;
      }
      else if (this.type == 484)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.melee = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 485)
      {
        this.arrow = true;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
        this.penetrate = -1;
      }
      else if (this.type >= 486 && this.type <= 489)
      {
        if (this.type == 486)
        {
          this.width = 12;
          this.height = 12;
        }
        else if (this.type == 487)
        {
          this.width = 22;
          this.height = 22;
        }
        else if (this.type == 488)
        {
          this.width = 12;
          this.height = 12;
          this.light = 0.3f;
        }
        else if (this.type == 489)
        {
          this.width = 20;
          this.height = 16;
        }
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 492)
      {
        this.netImportant = true;
        this.width = 18;
        this.height = 32;
        this.aiStyle = 90;
        this.friendly = true;
        this.penetrate = -1;
        this.timeLeft *= 5;
      }
      else if (this.type == 490)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 89;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.timeLeft = 600;
        this.netImportant = true;
      }
      else if (this.type == 493 || this.type == 494)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 4;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.magic = true;
        this.light = 0.2f;
      }
      else if (this.type == 495)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
        this.penetrate = 3;
      }
      else if (this.type == 496)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 40;
        this.height = 40;
        this.aiStyle = 91;
        this.friendly = true;
        this.magic = true;
        this.MaxUpdates = 3;
        this.penetrate = 3;
      }
      else if (this.type == 497)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 3;
        this.melee = true;
      }
      else if (this.type == 498)
      {
        this.width = 6;
        this.height = 6;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft = 180;
      }
      else if (this.type == 501)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 2;
        this.scale = 1.1f;
        this.hostile = true;
        this.ranged = true;
      }
      else if (this.type == 502)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 8;
        this.friendly = true;
        this.melee = true;
        this.penetrate = 5;
      }
      else if (this.type == 503)
      {
        this.width = 24;
        this.height = 24;
        this.aiStyle = 5;
        this.friendly = true;
        this.penetrate = 2;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.melee = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 504)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 2;
        this.friendly = true;
        this.magic = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = 2;
      }
      else if (this.type == 507)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 1;
        this.friendly = true;
        this.melee = true;
        this.penetrate = 3;
      }
      else if (this.type == 508)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 509)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 20;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ownerHitCheck = true;
        this.melee = true;
        this.scale = 1.2f;
      }
      else if (this.type == 510)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 1;
        this.magic = true;
      }
      else if (this.type == 511)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 92;
        this.friendly = true;
        this.penetrate = -1;
        this.scale = 1.1f;
        this.magic = true;
      }
      else if (this.type == 512)
      {
        this.width = 40;
        this.height = 38;
        this.aiStyle = 92;
        this.friendly = true;
        this.penetrate = -1;
        this.scale = 1.1f;
        this.magic = true;
      }
      else if (this.type == 513)
      {
        this.width = 30;
        this.height = 28;
        this.aiStyle = 92;
        this.friendly = true;
        this.penetrate = -1;
        this.scale = 1.1f;
        this.magic = true;
      }
      else if (this.type == 514)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 93;
        this.friendly = true;
        this.penetrate = 3;
        this.alpha = (int) byte.MaxValue;
        this.ranged = true;
      }
      else if (this.type == 515)
      {
        this.netImportant = true;
        this.width = 6;
        this.height = 6;
        this.aiStyle = 14;
        this.penetrate = -1;
        this.alpha = 75;
        this.light = 1f;
        this.timeLeft *= 5;
      }
      else if (this.type == 516)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
      }
      else if (this.type == 517)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.thrown = true;
      }
      else if (this.type == 518)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 94;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 519)
      {
        this.width = 24;
        this.height = 24;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
      }
      else if (this.type == 520)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 3;
        this.thrown = true;
      }
      else if (this.type == 521)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 29;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 1;
        this.friendly = true;
      }
      else if (this.type == 522)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 29;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 1;
        this.friendly = true;
      }
      else if (this.type == 523)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 95;
        this.alpha = (int) byte.MaxValue;
        this.ranged = true;
        this.penetrate = 1;
        this.friendly = true;
      }
      else if (this.type == 524)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 96;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.ignoreWater = true;
        this.melee = true;
        this.extraUpdates = 5;
      }
      else if (this.type == 525)
      {
        this.width = 30;
        this.height = 24;
        this.aiStyle = 97;
        this.tileCollide = false;
        this.timeLeft = 10800;
      }
      else if (this.type == 526)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 98;
        this.tileCollide = false;
        this.timeLeft = 120;
        this.alpha = (int) byte.MaxValue;
      }
      else if (this.type >= 527 && this.type <= 531)
      {
        this.knockBack = 12f;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 17;
        this.penetrate = -1;
      }
      else if (this.type == 532)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 1;
        this.scale = 1f;
        this.friendly = true;
        this.thrown = true;
        this.penetrate = 3;
        this.extraUpdates = 1;
      }
      else if (this.type == 533)
      {
        this.netImportant = true;
        this.width = 20;
        this.height = 20;
        this.aiStyle = 66;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.minionSlots = 1f;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.friendly = true;
      }
      else if (this.type == 534)
      {
        this.extraUpdates = 0;
        this.width = 16;
        this.height = 16;
        this.aiStyle = 99;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.scale = 1f;
      }
      else if (this.type >= 541 && this.type <= 555)
      {
        this.extraUpdates = 0;
        this.width = 16;
        this.height = 16;
        this.aiStyle = 99;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.scale = 1f;
        if (this.type == 547)
          this.scale = 1.1f;
        if (this.type == 554)
          this.scale = 1.2f;
        if (this.type == 555)
          this.scale = 1.15f;
        if (this.type == 551 || this.type == 550)
          this.scale = 1.1f;
      }
      else if (this.type >= 562 && this.type <= 564)
      {
        this.extraUpdates = 0;
        this.width = 16;
        this.height = 16;
        this.aiStyle = 99;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.scale = 1f;
        if (this.type == 563)
          this.scale = 1.05f;
        if (this.type == 564)
          this.scale = 1.075f;
      }
      else if (this.type == 603)
      {
        this.extraUpdates = 0;
        this.width = 16;
        this.height = 16;
        this.aiStyle = 99;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.scale = 1.15f;
      }
      else if (this.type == 604)
      {
        this.extraUpdates = 0;
        this.width = 14;
        this.height = 14;
        this.aiStyle = 115;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.scale = 1.2f;
      }
      else if (this.type >= 556 && this.type <= 561)
      {
        this.extraUpdates = 0;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 99;
        this.friendly = true;
        this.penetrate = -1;
        this.melee = true;
        this.scale = 1f;
        this.counterweight = true;
      }
      else if (this.type == 535)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 100;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.magic = true;
        this.ignoreWater = true;
      }
      else if (this.type == 536)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 101;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.magic = true;
        this.ignoreWater = true;
      }
      else if (this.type == 537)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 84;
        this.hostile = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 240;
        this.tileCollide = false;
      }
      else if (this.type == 538)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 14;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft = 120;
        this.extraUpdates = 1;
        this.alpha = (int) byte.MaxValue;
      }
      else if (this.type == 539)
      {
        this.width = 18;
        this.height = 30;
        this.aiStyle = 102;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft = 600;
      }
      else if (this.type == 540)
      {
        this.width = 20;
        this.height = 20;
        this.aiStyle = 103;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft = 300;
        this.alpha = (int) byte.MaxValue;
      }
      else if (this.type == 565)
      {
        this.width = 28;
        this.height = 28;
        this.aiStyle = 104;
        this.penetrate = -1;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.alpha = (int) byte.MaxValue;
        this.scale = 0.8f;
      }
      else if (this.type == 566)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 36;
        this.friendly = true;
        this.penetrate = 4;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 660;
        this.extraUpdates = 3;
      }
      else if (this.type == 567 || this.type == 568)
      {
        if (this.type == 567)
        {
          this.width = 14;
          this.height = 14;
        }
        else
        {
          this.width = 16;
          this.height = 16;
        }
        this.aiStyle = 105;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 3600;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type >= 569 && this.type <= 571)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 106;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 3600;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 575)
      {
        this.width = 24;
        this.height = 24;
        this.aiStyle = 107;
        this.hostile = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft = 420;
        this.alpha = (int) byte.MaxValue;
      }
      else if (this.type == 573)
      {
        this.width = 18;
        this.height = 30;
        this.aiStyle = 102;
        this.hostile = true;
        this.penetrate = -1;
        this.timeLeft = 600;
      }
      else if (this.type == 574)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 102;
        this.hostile = true;
        this.timeLeft = 600;
        this.tileCollide = false;
      }
      else if (this.type == 572)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.friendly = false;
        this.hostile = true;
      }
      else if (this.type == 576)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.2f;
        this.timeLeft = 600;
      }
      else if (this.type == 577)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1.2f;
        this.timeLeft = 600;
      }
      else if (this.type == 578 || this.type == 579)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 108;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.hostile = true;
        this.hide = true;
      }
      else if (this.type == 580)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 88;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.tileCollide = true;
        this.extraUpdates = 4;
        this.timeLeft = 600;
      }
      else if (this.type == 581)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.friendly = false;
        this.hostile = true;
      }
      else if (this.type == 582)
      {
        this.width = 20;
        this.height = 20;
        this.aiStyle = 109;
        this.friendly = true;
        this.penetrate = -1;
        this.MaxUpdates = 2;
      }
      else if (this.type == 583)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 2;
        this.friendly = true;
        this.scale = 0.8f;
      }
      else if (this.type == 589)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 2;
        this.friendly = true;
      }
      else if (this.type == 584)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 110;
        this.friendly = true;
        this.scale = 0.8f;
        this.penetrate = 3;
      }
      else if (this.type == 585)
      {
        this.width = 26;
        this.height = 26;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.penetrate = 3;
      }
      else if (this.type == 586)
      {
        this.width = 26;
        this.height = 26;
        this.aiStyle = 111;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.penetrate = -1;
      }
      else if (this.type == 587)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.ranged = true;
      }
      else if (this.type == 588)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
        this.thrown = true;
      }
      else if (this.type == 590)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 112;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 900;
        this.tileCollide = false;
        this.ignoreWater = true;
      }
      else if (this.type == 591)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 101;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ignoreWater = true;
      }
      else if (this.type == 592)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 1;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 3;
        this.ignoreWater = true;
      }
      else if (this.type == 593)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 1;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 1;
        this.ignoreWater = true;
      }
      else if (this.type == 594)
      {
        this.width = 40;
        this.height = 40;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
      }
      else if (this.type == 595)
      {
        this.width = 68;
        this.height = 64;
        this.aiStyle = 75;
        this.friendly = true;
        this.tileCollide = false;
        this.melee = true;
        this.penetrate = -1;
        this.ownerHitCheck = true;
      }
      else if (this.type == 596)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 107;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.timeLeft = 180;
        this.tileCollide = false;
      }
      else if (this.type == 597)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 29;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 2;
        this.friendly = true;
      }
      else if (this.type == 598)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 113;
        this.friendly = true;
        this.melee = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.hide = true;
      }
      else if (this.type == 599)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 2;
        this.friendly = true;
        this.penetrate = 6;
        this.thrown = true;
      }
      else if (this.type == 600)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 75;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ignoreWater = true;
      }
      else if (this.type == 601)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.extraUpdates = 30;
      }
      else if (this.type == 602)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 114;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.tileCollide = false;
        this.netImportant = true;
      }
      else if (this.type == 605)
      {
        this.alpha = (int) byte.MaxValue;
        this.width = 6;
        this.height = 6;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 606)
      {
        this.width = 5;
        this.height = 5;
        this.aiStyle = 1;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
        this.scale = 1f;
        this.timeLeft = 600;
        this.ignoreWater = true;
      }
      else if (this.type == 607)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 116;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.penetrate = -1;
      }
      else if (this.type == 608)
      {
        this.width = 160;
        this.height = 160;
        this.aiStyle = 117;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 3;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.hide = true;
      }
      else if (this.type == 611)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 75;
        this.friendly = true;
        this.melee = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.hide = true;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.usesLocalNPCImmunity = true;
      }
      else if (this.type == 612)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 117;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.timeLeft = 60;
        this.tileCollide = false;
        this.penetrate = -1;
        this.usesLocalNPCImmunity = true;
      }
      else if (this.type == 613)
      {
        this.netImportant = true;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 62;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.friendly = true;
        this.minionSlots = 1f;
        this.ignoreWater = true;
      }
      else if (this.type == 614)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 113;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
      }
      else if (this.type == 615)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 75;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ranged = true;
        this.ignoreWater = true;
      }
      else if (this.type == 616)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.ranged = true;
        this.extraUpdates = 2;
        this.timeLeft = 90 * this.MaxUpdates;
      }
      else if (this.type == 617)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 118;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.hide = true;
        this.magic = true;
        this.penetrate = 3;
        this.usesLocalNPCImmunity = true;
      }
      else if (this.type == 618)
      {
        this.tileCollide = false;
        this.width = 18;
        this.height = 30;
        this.aiStyle = 119;
        this.penetrate = -1;
        this.timeLeft = 420;
        this.magic = true;
        this.friendly = true;
        this.usesLocalNPCImmunity = true;
      }
      else if (this.type == 619)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 29;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 1;
        this.friendly = true;
      }
      else if (this.type == 620)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 29;
        this.alpha = (int) byte.MaxValue;
        this.magic = true;
        this.penetrate = 1;
        this.friendly = true;
      }
      else if (this.type == 622)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 2;
      }
      else if (this.type == 623)
      {
        this.netImportant = true;
        this.width = 50;
        this.height = 80;
        this.aiStyle = 120;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.friendly = true;
        this.minionSlots = 0.0f;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.netImportant = true;
      }
      else if (this.type == 624)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 117;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.timeLeft = 60;
        this.tileCollide = false;
        this.penetrate = -1;
      }
      else if (this.type >= 625 && this.type <= 628)
      {
        if (this.type == 625 || this.type == 628)
          this.netImportant = true;
        if (this.type == 626 || this.type == 627)
          this.minionSlots = 0.5f;
        this.width = 24;
        this.height = 24;
        this.aiStyle = 121;
        this.penetrate = -1;
        this.timeLeft *= 5;
        this.minion = true;
        this.friendly = true;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.alpha = (int) byte.MaxValue;
        this.hide = true;
        this.netImportant = true;
      }
      else if (this.type == 629)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 122;
        this.hostile = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.timeLeft = 3600;
        this.tileCollide = false;
        this.penetrate = -1;
        this.extraUpdates = 2;
      }
      else if (this.type == 630 || this.type == 705)
      {
        this.width = 22;
        this.height = 22;
        this.aiStyle = 75;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.hide = true;
        this.ranged = true;
        this.ignoreWater = true;
      }
      else if (this.type == 631)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 122;
        this.friendly = true;
        this.ranged = true;
        this.tileCollide = false;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 633)
      {
        this.width = 14;
        this.height = 18;
        this.aiStyle = 75;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.magic = true;
        this.ignoreWater = true;
      }
      else if (this.type == 632)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 84;
        this.friendly = true;
        this.magic = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
      }
      else if (this.type == 634)
      {
        this.width = 40;
        this.height = 40;
        this.aiStyle = 1;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.extraUpdates = 2;
        this.magic = true;
      }
      else if (this.type == 635)
      {
        this.width = 40;
        this.height = 40;
        this.aiStyle = 1;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.extraUpdates = 3;
        this.magic = true;
      }
      else if (this.type == 636)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 113;
        this.friendly = true;
        this.melee = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.hide = true;
        this.MaxUpdates = 2;
      }
      else if (this.type == 637)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 16;
        this.friendly = true;
        this.penetrate = -1;
      }
      else if (this.type == 638)
      {
        this.width = 4;
        this.height = 4;
        this.aiStyle = 1;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.extraUpdates = 5;
        this.timeLeft = 600;
        this.ranged = true;
        this.ignoreWater = true;
        this.usesLocalNPCImmunity = true;
        this.penetrate = -1;
      }
      else if (this.type == 639)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
        this.MaxUpdates = 2;
        this.timeLeft = this.MaxUpdates * 45;
        this.ignoreWater = true;
        this.usesLocalNPCImmunity = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = 4;
      }
      else if (this.type == 640)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
        this.MaxUpdates = 3;
        this.timeLeft = 90;
        this.ignoreWater = true;
        this.usesLocalNPCImmunity = true;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = 4;
      }
      else if (this.type == 642)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 84;
        this.friendly = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.usesLocalNPCImmunity = true;
      }
      else if (this.type == 641)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 123;
        this.timeLeft = Projectile.SentryLifeTime;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.alpha = (int) byte.MaxValue;
        this.hide = true;
        this.sentry = true;
      }
      else if (this.type == 643)
      {
        this.width = 32;
        this.height = 32;
        this.aiStyle = 123;
        this.timeLeft = Projectile.SentryLifeTime;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.alpha = (int) byte.MaxValue;
        this.sentry = true;
      }
      else if (this.type == 644)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 112;
        this.penetrate = 1;
        this.timeLeft = 900;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.alpha = (int) byte.MaxValue;
      }
      else if (this.type == 645)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.magic = true;
        this.tileCollide = false;
        this.extraUpdates = 5;
        this.penetrate = -1;
        this.usesLocalNPCImmunity = true;
      }
      else if (this.type >= 646 && this.type <= 649)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 650)
      {
        this.width = 20;
        this.height = 20;
        this.aiStyle = 124;
        this.penetrate = -1;
        this.netImportant = true;
        this.timeLeft *= 5;
        this.friendly = true;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.manualDirectionChange = true;
      }
      else if (this.type == 651)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 125;
        this.friendly = true;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.penetrate = -1;
      }
      else if (this.type == 652)
      {
        this.width = 18;
        this.height = 18;
        this.aiStyle = 7;
        this.friendly = true;
        this.penetrate = -1;
        this.tileCollide = false;
        this.timeLeft *= 10;
      }
      else if (this.type == 653)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 67;
        this.penetrate = -1;
        this.netImportant = true;
        this.timeLeft *= 5;
        this.friendly = true;
        this.ignoreWater = true;
        this.scale = 0.8f;
      }
      else if (this.type == 654)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 126;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.timeLeft = 120;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
        this.trap = true;
      }
      else if (this.type == 655)
      {
        this.width = 31;
        this.height = 31;
        this.aiStyle = 25;
        this.friendly = true;
        this.hostile = true;
        this.penetrate = -1;
        this.trap = true;
      }
      else if (this.type == 656)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = (int) sbyte.MaxValue;
        this.friendly = true;
        this.magic = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.usesLocalNPCImmunity = true;
        this.timeLeft = 1200;
      }
      else if (this.type == 657)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = (int) sbyte.MaxValue;
        this.hostile = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.timeLeft = 1200;
      }
      else if (this.type == 658)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 128;
        this.penetrate = 1;
        this.timeLeft = 900;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.alpha = (int) byte.MaxValue;
        this.hostile = true;
      }
      else if (this.type == 659)
      {
        this.width = 8;
        this.height = 8;
        this.aiStyle = 129;
        this.friendly = true;
        this.magic = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.timeLeft = 180;
        this.tileCollide = false;
        this.penetrate = -1;
      }
      else if (this.type == 660)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.magic = true;
        this.ignoreWater = true;
      }
      else if (this.type == 661)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 40;
        this.extraUpdates = 1;
        this.ranged = true;
        this.ignoreWater = true;
        this.usesLocalNPCImmunity = true;
      }
      else if (this.type == 662 || this.type == 685)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 1;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 663 || this.type == 665 || this.type == 667)
      {
        this.width = 30;
        this.height = 54;
        this.aiStyle = 130;
        this.timeLeft = Projectile.SentryLifeTime;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.manualDirectionChange = true;
        switch (this.type)
        {
          case 665:
            this.height = 58;
            this.width = 28;
            break;
          case 667:
            this.height = 60;
            this.width = 28;
            break;
        }
        this.sentry = true;
      }
      else if (this.type == 664 || this.type == 666 || this.type == 668)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 131;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.usesLocalNPCImmunity = true;
        this.localNPCHitCooldown = -1;
      }
      else if (this.type == 669)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 68;
        this.friendly = true;
        this.penetrate = 1;
        this.alpha = (int) byte.MaxValue;
        this.thrown = true;
        this.noEnchantments = true;
      }
      else if (this.type == 670)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 126;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.timeLeft = 120;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 671)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.friendly = false;
        this.hostile = true;
      }
      else if (this.type == 672)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 132;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.timeLeft = 900;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 674 || this.type == 673)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 133;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.timeLeft = 900;
        this.hostile = true;
        this.penetrate = -1;
        this.hide = true;
      }
      else if (this.type == 675)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.friendly = false;
        this.hostile = true;
      }
      else if (this.type == 676)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.friendly = false;
        this.hostile = true;
      }
      else if (this.type == 677 || this.type == 678 || this.type == 679)
      {
        this.width = 26;
        this.height = 54;
        this.aiStyle = 134;
        this.timeLeft = Projectile.SentryLifeTime;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.manualDirectionChange = true;
        this.sentry = true;
      }
      else if (this.type == 680)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 1;
        this.friendly = true;
        this.penetrate = 4;
        this.usesLocalNPCImmunity = true;
        this.localNPCHitCooldown = -1;
      }
      else if (this.type == 681)
      {
        this.width = 14;
        this.height = 14;
        this.aiStyle = 16;
        this.hostile = true;
        this.penetrate = -1;
        this.thrown = true;
      }
      else if (this.type == 682)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.hostile = true;
        this.ignoreWater = true;
        this.timeLeft = 30;
        this.scale = 1.2f;
      }
      else if (this.type == 683)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 135;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.timeLeft = 120;
        this.hostile = true;
        this.penetrate = -1;
      }
      else if (this.type == 684)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 1;
        this.melee = true;
        this.penetrate = 5;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.tileCollide = false;
      }
      else if (this.type == 686)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.friendly = false;
        this.hostile = true;
      }
      else if (this.type == 687)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 136;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.friendly = false;
        this.hostile = true;
      }
      else if (this.type == 688 || this.type == 689 || this.type == 690)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 137;
        this.friendly = true;
        this.usesLocalNPCImmunity = true;
        this.timeLeft = Projectile.SentryLifeTime;
        this.localNPCHitCooldown = 3;
        this.tileCollide = false;
        this.penetrate = -1;
        this.sentry = true;
      }
      else if (this.type == 691 || this.type == 692 || this.type == 693)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 138;
        this.friendly = true;
        this.timeLeft = Projectile.SentryLifeTime;
        this.tileCollide = false;
        this.penetrate = -1;
        this.hide = true;
        this.sentry = true;
      }
      else if (this.type == 694 || this.type == 695 || this.type == 696)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 139;
        this.friendly = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.usesLocalNPCImmunity = true;
        this.localNPCHitCooldown = 30;
        this.alpha = (int) byte.MaxValue;
        this.width = 96;
        this.height = 96;
      }
      else if (this.type == 697)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 140;
        this.friendly = true;
        this.melee = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.hide = true;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.usesLocalNPCImmunity = true;
        this.localNPCHitCooldown = 12;
        this.ownerHitCheck = true;
      }
      else if (this.type == 698)
      {
        this.width = 50;
        this.height = 200;
        this.aiStyle = 141;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.timeLeft = 120;
        this.friendly = true;
        this.penetrate = -1;
        this.usesLocalNPCImmunity = true;
        this.localNPCHitCooldown = -1;
        this.melee = true;
      }
      else if (this.type == 699)
      {
        this.width = 24;
        this.height = 24;
        this.aiStyle = 142;
        this.friendly = true;
        this.melee = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.hide = true;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.usesIDStaticNPCImmunity = true;
        this.idStaticNPCHitCooldown = 36;
        this.ownerHitCheck = true;
      }
      else if (this.type == 700)
      {
        this.width = 40;
        this.height = 40;
        this.aiStyle = 143;
        this.alpha = (int) byte.MaxValue;
        this.penetrate = -1;
        this.friendly = true;
        this.melee = true;
        this.usesLocalNPCImmunity = true;
        this.localNPCHitCooldown = -1;
        this.ignoreWater = true;
        this.tileCollide = false;
      }
      else if (this.type == 703 || this.type == 701 || this.type == 702)
      {
        this.width = 20;
        this.height = 20;
        this.aiStyle = 144;
        this.penetrate = -1;
        this.netImportant = true;
        this.timeLeft *= 5;
        this.scale = 0.85f;
        this.friendly = true;
        this.ignoreWater = true;
        this.tileCollide = false;
        this.manualDirectionChange = true;
      }
      else if (this.type == 704)
      {
        this.width = 60;
        this.height = 210;
        this.aiStyle = 145;
        this.friendly = true;
        this.magic = true;
        this.tileCollide = false;
        this.penetrate = -1;
        this.usesLocalNPCImmunity = true;
        this.timeLeft = 600;
        this.localNPCHitCooldown = -1;
        this.ignoreWater = true;
      }
      else if (this.type == 706)
      {
        this.width = 66;
        this.height = 66;
        this.aiStyle = 1;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 300;
        this.ranged = true;
        this.usesLocalNPCImmunity = true;
        this.penetrate = -1;
        this.localNPCHitCooldown = 10;
      }
      else if (this.type == 707)
      {
        this.width = 16;
        this.height = 16;
        this.aiStyle = 140;
        this.friendly = true;
        this.melee = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.hide = true;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.usesLocalNPCImmunity = true;
        this.localNPCHitCooldown = 6;
        this.ownerHitCheck = true;
      }
      else if (this.type == 708)
      {
        this.width = 24;
        this.height = 24;
        this.aiStyle = 142;
        this.friendly = true;
        this.melee = true;
        this.penetrate = -1;
        this.alpha = (int) byte.MaxValue;
        this.hide = true;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.usesLocalNPCImmunity = true;
        this.localNPCHitCooldown = 6;
        this.ownerHitCheck = true;
      }
      else if (this.type == 709)
      {
        this.width = 12;
        this.height = 12;
        this.aiStyle = 1;
        this.friendly = true;
        this.melee = true;
        this.alpha = (int) byte.MaxValue;
        this.ignoreWater = true;
        this.extraUpdates = 1;
        this.noEnchantments = true;
        this.scale = 0.6f;
      }
      else if (this.type == 710)
      {
        this.arrow = true;
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.ranged = true;
        this.ignoreWater = true;
        this.extraUpdates = 1;
        this.timeLeft = this.extraUpdates * 60 * 5;
        this.usesLocalNPCImmunity = true;
        this.alpha = (int) byte.MaxValue;
        this.localNPCHitCooldown = -1;
      }
      else if (this.type == 711)
      {
        this.width = 30;
        this.height = 30;
        this.aiStyle = 1;
        this.alpha = (int) byte.MaxValue;
        this.friendly = true;
        this.magic = true;
        this.extraUpdates = 1;
        this.scale = 0.7f;
        this.usesLocalNPCImmunity = true;
        this.localNPCHitCooldown = -1;
      }
      else if (this.type == 712)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 1;
        this.friendly = true;
        this.alpha = (int) byte.MaxValue;
        this.timeLeft = 600;
        this.magic = true;
        this.extraUpdates = 1;
      }
      else if (this.type == 713)
      {
        this.width = 10;
        this.height = 10;
        this.aiStyle = 146;
        this.alpha = (int) byte.MaxValue;
        this.tileCollide = false;
        this.ignoreWater = true;
        this.timeLeft = 900;
        this.hostile = true;
        this.penetrate = -1;
      }
      else
        this.active = false;
      this.width = (int) ((double) this.width * (double) this.scale);
      this.height = (int) ((double) this.height * (double) this.scale);
      this.maxPenetrate = this.penetrate;
    }

    public static int GetNextSlot()
    {
      int num = 1000;
      for (int index = 0; index < 1000; ++index)
      {
        if (!Main.projectile[index].active)
        {
          num = index;
          break;
        }
      }
      return num;
    }

    public static int NewProjectile(
      Vector2 position,
      Vector2 velocity,
      int Type,
      int Damage,
      float KnockBack,
      int Owner = 255,
      float ai0 = 0.0f,
      float ai1 = 0.0f)
    {
      return Projectile.NewProjectile(position.X, position.Y, velocity.X, velocity.Y, Type, Damage, KnockBack, Owner, ai0, ai1);
    }

    public static int NewProjectile(
      float X,
      float Y,
      float SpeedX,
      float SpeedY,
      int Type,
      int Damage,
      float KnockBack,
      int Owner = 255,
      float ai0 = 0.0f,
      float ai1 = 0.0f)
    {
      int number = 1000;
      for (int index = 0; index < 1000; ++index)
      {
        if (!Main.projectile[index].active)
        {
          number = index;
          break;
        }
      }
      if (number == 1000)
        return number;
      Projectile projectile = Main.projectile[number];
      projectile.SetDefaults(Type);
      projectile.position.X = X - (float) projectile.width * 0.5f;
      projectile.position.Y = Y - (float) projectile.height * 0.5f;
      projectile.owner = Owner;
      projectile.velocity.X = SpeedX;
      projectile.velocity.Y = SpeedY;
      projectile.damage = Damage;
      projectile.knockBack = KnockBack;
      projectile.identity = number;
      projectile.gfxOffY = 0.0f;
      projectile.stepSpeed = 1f;
      projectile.wet = Collision.WetCollision(projectile.position, projectile.width, projectile.height);
      if (projectile.ignoreWater)
        projectile.wet = false;
      projectile.honeyWet = Collision.honey;
      Main.projectileIdentity[Owner, number] = number;
      if (projectile.aiStyle == 1)
      {
        for (; (double) projectile.velocity.X >= 16.0 || (double) projectile.velocity.X <= -16.0 || (double) projectile.velocity.Y >= 16.0 || (double) projectile.velocity.Y < -16.0; projectile.velocity.Y *= 0.97f)
          projectile.velocity.X *= 0.97f;
      }
      if (Owner == Main.myPlayer)
      {
        switch (Type)
        {
          case 206:
            projectile.ai[0] = (float) Main.rand.Next(-100, 101) * 0.0005f;
            projectile.ai[1] = (float) Main.rand.Next(-100, 101) * 0.0005f;
            break;
          case 335:
            projectile.ai[1] = (float) Main.rand.Next(4);
            break;
          case 358:
            projectile.ai[1] = (float) Main.rand.Next(10, 31) * 0.1f;
            break;
          case 406:
            projectile.ai[1] = (float) Main.rand.Next(10, 21) * 0.1f;
            break;
          default:
            projectile.ai[0] = ai0;
            projectile.ai[1] = ai1;
            break;
        }
      }
      if (Type == 434)
      {
        projectile.ai[0] = projectile.position.X;
        projectile.ai[1] = projectile.position.Y;
      }
      if (Type > 0 && Type < 714)
      {
        if (ProjectileID.Sets.NeedsUUID[Type])
          projectile.projUUID = projectile.identity;
        if (ProjectileID.Sets.StardustDragon[Type])
        {
          int projUuid = Main.projectile[(int) projectile.ai[0]].projUUID;
          if (projUuid >= 0)
            projectile.ai[0] = (float) projUuid;
        }
      }
      if (Main.netMode != 0 && Owner == Main.myPlayer)
        NetMessage.SendData(27, number: number);
      if (Owner == Main.myPlayer)
      {
        if (Type == 28)
          projectile.timeLeft = 180;
        if (Type == 516)
          projectile.timeLeft = 180;
        if (Type == 519)
          projectile.timeLeft = 180;
        if (Type == 29)
          projectile.timeLeft = 300;
        if (Type == 470)
          projectile.timeLeft = 300;
        if (Type == 637)
          projectile.timeLeft = 300;
        if (Type == 30)
          projectile.timeLeft = 180;
        if (Type == 517)
          projectile.timeLeft = 180;
        if (Type == 37)
          projectile.timeLeft = 180;
        if (Type == 75)
          projectile.timeLeft = 180;
        if (Type == 133)
          projectile.timeLeft = 180;
        if (Type == 136)
          projectile.timeLeft = 180;
        if (Type == 139)
          projectile.timeLeft = 180;
        if (Type == 142)
          projectile.timeLeft = 180;
        if (Type == 397)
          projectile.timeLeft = 180;
        if (Type == 419)
          projectile.timeLeft = 600;
        if (Type == 420)
          projectile.timeLeft = 600;
        if (Type == 421)
          projectile.timeLeft = 600;
        if (Type == 422)
          projectile.timeLeft = 600;
        if (Type == 588)
          projectile.timeLeft = 180;
        if (Type == 443)
          projectile.timeLeft = 300;
        if (Type == 681)
          projectile.timeLeft = 600;
        if (Type == 684)
          projectile.timeLeft = 60;
        if (Type == 706)
          projectile.timeLeft = 120;
        if (Type == 680 && Main.player[projectile.owner].setSquireT2)
          projectile.penetrate = 7;
      }
      if (Type == 249)
        projectile.frame = Main.rand.Next(5);
      return number;
    }

    public void StatusNPC(int i)
    {
      if (this.melee && Main.player[this.owner].meleeEnchant > (byte) 0 && !this.noEnchantments)
      {
        int meleeEnchant = (int) Main.player[this.owner].meleeEnchant;
        if (meleeEnchant == 1)
          Main.npc[i].AddBuff(70, 60 * Main.rand.Next(5, 10));
        if (meleeEnchant == 2)
          Main.npc[i].AddBuff(39, 60 * Main.rand.Next(3, 7));
        if (meleeEnchant == 3)
          Main.npc[i].AddBuff(24, 60 * Main.rand.Next(3, 7));
        if (meleeEnchant == 5)
          Main.npc[i].AddBuff(69, 60 * Main.rand.Next(10, 20));
        if (meleeEnchant == 6)
          Main.npc[i].AddBuff(31, 60 * Main.rand.Next(1, 4));
        if (meleeEnchant == 8)
          Main.npc[i].AddBuff(20, 60 * Main.rand.Next(5, 10));
        if (meleeEnchant == 4)
          Main.npc[i].AddBuff(72, 120);
      }
      if (this.type == 195)
      {
        if (Main.rand.Next(3) == 0)
          Main.npc[i].AddBuff(70, 60 * Main.rand.Next(10, 21));
        else
          Main.npc[i].AddBuff(20, 60 * Main.rand.Next(10, 21));
      }
      if (this.type == 664 && Main.rand.Next(3) == 0)
        Main.npc[i].AddBuff(24, 60 * Main.rand.Next(3, 6));
      if (this.type == 666 && Main.rand.Next(2) == 0)
        Main.npc[i].AddBuff(24, 60 * Main.rand.Next(3, 9));
      if (this.type == 668 && Main.rand.Next(3) != 0)
        Main.npc[i].AddBuff(24, 60 * Main.rand.Next(6, 9));
      if (this.type == 567 || this.type == 568)
        Main.npc[i].AddBuff(20, 60 * Main.rand.Next(5, 11));
      if (this.type == 598)
        Main.npc[i].AddBuff(169, 900);
      if (this.type == 636)
        Main.npc[i].AddBuff(189, 300);
      if (this.type == 611)
        Main.npc[i].AddBuff(189, 300);
      if (this.type == 612)
        Main.npc[i].AddBuff(189, 300);
      if (this.type == 711)
        Main.npc[i].AddBuff(203, 600);
      if (this.type == 706)
        Main.npc[i].AddBuff(24, 480);
      if (this.type == 614)
        Main.npc[i].AddBuff(183, 900);
      if (this.type == 585)
        Main.npc[i].AddBuff(153, 60 * Main.rand.Next(5, 11));
      if (this.type == 583)
        Main.npc[i].AddBuff(20, 60 * Main.rand.Next(3, 6));
      if (this.type == 524)
        Main.npc[i].AddBuff(69, 60 * Main.rand.Next(3, 8));
      if (this.type == 504 && Main.rand.Next(3) == 0)
      {
        if (Main.rand.Next(3) == 0)
          Main.npc[i].AddBuff(24, Main.rand.Next(60, 180));
        else
          Main.npc[i].AddBuff(24, Main.rand.Next(30, 120));
      }
      if ((this.type == 694 || this.type == 695 || this.type == 696) && Main.player[this.owner].setHuntressT2 && Main.rand.Next(2) == 0)
        Main.npc[i].AddBuff(204, Main.rand.Next(8, 18) * 30);
      if (this.type == 545 && Main.rand.Next(3) == 0)
        Main.npc[i].AddBuff(24, Main.rand.Next(60, 240));
      if (this.type == 553)
        Main.npc[i].AddBuff(24, Main.rand.Next(180, 480));
      if (this.type == 552 && Main.rand.Next(3) != 0)
        Main.npc[i].AddBuff(44, Main.rand.Next(120, 320));
      if (this.type == 495)
        Main.npc[i].AddBuff(153, Main.rand.Next(120, 300));
      if (this.type == 497)
        Main.npc[i].AddBuff(153, Main.rand.Next(60, 180));
      if (this.type == 496)
        Main.npc[i].AddBuff(153, Main.rand.Next(240, 480));
      if (this.type == 476)
        Main.npc[i].AddBuff(151, 30);
      if (this.type == 523)
        Main.npc[i].AddBuff(20, 60 * Main.rand.Next(10, 30));
      if (this.type == 478 || this.type == 480)
        Main.npc[i].AddBuff(39, 60 * Main.rand.Next(3, 7));
      if (this.type == 479)
        Main.npc[i].AddBuff(69, 60 * Main.rand.Next(7, 15));
      if (this.type == 379)
        Main.npc[i].AddBuff(70, 60 * Main.rand.Next(4, 7));
      if (this.type >= 390 && this.type <= 392)
        Main.npc[i].AddBuff(70, 60 * Main.rand.Next(2, 5));
      if (this.type == 374)
        Main.npc[i].AddBuff(20, 60 * Main.rand.Next(4, 7));
      if (this.type == 376)
        Main.npc[i].AddBuff(24, 60 * Main.rand.Next(3, 7));
      if (this.type >= 399 && this.type <= 402)
        Main.npc[i].AddBuff(24, 60 * Main.rand.Next(3, 7));
      if (this.type == 295 || this.type == 296)
        Main.npc[i].AddBuff(24, 60 * Main.rand.Next(8, 16));
      if ((this.melee || this.ranged) && Main.player[this.owner].frostBurn && !this.noEnchantments)
        Main.npc[i].AddBuff(44, 60 * Main.rand.Next(5, 15));
      if (this.melee && Main.player[this.owner].magmaStone && !this.noEnchantments)
      {
        if (Main.rand.Next(7) == 0)
          Main.npc[i].AddBuff(24, 360);
        else if (Main.rand.Next(3) == 0)
          Main.npc[i].AddBuff(24, 120);
        else
          Main.npc[i].AddBuff(24, 60);
      }
      if (this.type == 287)
        Main.npc[i].AddBuff(72, 120);
      if (this.type == 285)
      {
        if (Main.rand.Next(3) == 0)
          Main.npc[i].AddBuff(31, 180);
        else
          Main.npc[i].AddBuff(31, 60);
      }
      if (this.type == 2 && Main.rand.Next(3) == 0)
        Main.npc[i].AddBuff(24, 180);
      if (this.type == 172)
      {
        if (Main.rand.Next(3) == 0)
          Main.npc[i].AddBuff(44, 180);
      }
      else if (this.type == 15)
      {
        if (Main.rand.Next(2) == 0)
          Main.npc[i].AddBuff(24, 300);
      }
      else if (this.type == 253)
      {
        if (Main.rand.Next(2) == 0)
          Main.npc[i].AddBuff(44, 480);
      }
      else if (this.type == 19)
      {
        if (Main.rand.Next(5) == 0)
          Main.npc[i].AddBuff(24, 180);
      }
      else if (this.type == 33)
      {
        if (Main.rand.Next(5) == 0)
          Main.npc[i].AddBuff(20, 420);
      }
      else if (this.type == 34)
      {
        if (Main.rand.Next(2) == 0)
          Main.npc[i].AddBuff(24, Main.rand.Next(240, 480));
      }
      else if (this.type == 35)
      {
        if (Main.rand.Next(4) == 0)
          Main.npc[i].AddBuff(24, 180);
      }
      else if (this.type == 54)
      {
        if (Main.rand.Next(2) == 0)
          Main.npc[i].AddBuff(20, 600);
      }
      else if (this.type == 267)
      {
        if (Main.rand.Next(3) == 0)
          Main.npc[i].AddBuff(20, 3600);
        else
          Main.npc[i].AddBuff(20, 1800);
      }
      else if (this.type == 63)
      {
        if (Main.rand.Next(5) != 0)
          Main.npc[i].AddBuff(31, 60 * Main.rand.Next(2, 5));
      }
      else if (this.type == 85 || this.type == 188)
        Main.npc[i].AddBuff(24, 1200);
      else if (this.type == 95 || this.type == 103 || this.type == 104)
        Main.npc[i].AddBuff(39, 420);
      else if (this.type == 278 || this.type == 279 || this.type == 280)
        Main.npc[i].AddBuff(69, 600);
      else if (this.type == 282 || this.type == 283)
        Main.npc[i].AddBuff(70, 600);
      if (this.type == 163 || this.type == 310)
      {
        if (Main.rand.Next(3) == 0)
          Main.npc[i].AddBuff(24, 600);
        else
          Main.npc[i].AddBuff(24, 300);
      }
      else if (this.type == 98)
        Main.npc[i].AddBuff(20, 600);
      else if (this.type == 184)
        Main.npc[i].AddBuff(20, 900);
      else if (this.type == 265)
      {
        Main.npc[i].AddBuff(20, 1800);
      }
      else
      {
        if (this.type != 355)
          return;
        Main.npc[i].AddBuff(70, 1800);
      }
    }

    public void StatusPvP(int i)
    {
      if (this.melee && Main.player[this.owner].meleeEnchant > (byte) 0 && !this.noEnchantments)
      {
        int meleeEnchant = (int) Main.player[this.owner].meleeEnchant;
        if (meleeEnchant == 1)
          Main.player[i].AddBuff(70, 60 * Main.rand.Next(5, 10));
        if (meleeEnchant == 2)
          Main.player[i].AddBuff(39, 60 * Main.rand.Next(3, 7));
        if (meleeEnchant == 3)
          Main.player[i].AddBuff(24, 60 * Main.rand.Next(3, 7));
        if (meleeEnchant == 5)
          Main.player[i].AddBuff(69, 60 * Main.rand.Next(10, 20));
        if (meleeEnchant == 6)
          Main.player[i].AddBuff(31, 60 * Main.rand.Next(1, 4));
        if (meleeEnchant == 8)
          Main.player[i].AddBuff(20, 60 * Main.rand.Next(5, 10));
      }
      if (this.type == 295 || this.type == 296)
        Main.player[i].AddBuff(24, 60 * Main.rand.Next(8, 16));
      if (this.type == 478 || this.type == 480)
        Main.player[i].AddBuff(39, 60 * Main.rand.Next(3, 7));
      if ((this.melee || this.ranged) && Main.player[this.owner].frostBurn && !this.noEnchantments)
        Main.player[i].AddBuff(44, 60 * Main.rand.Next(1, 8), false);
      if (this.melee && Main.player[this.owner].magmaStone && !this.noEnchantments)
      {
        if (Main.rand.Next(4) == 0)
          Main.player[i].AddBuff(24, 360);
        else if (Main.rand.Next(2) == 0)
          Main.player[i].AddBuff(24, 240);
        else
          Main.player[i].AddBuff(24, 120);
      }
      if (this.type == 2 && Main.rand.Next(3) == 0)
        Main.player[i].AddBuff(24, 180, false);
      if (this.type == 172)
      {
        if (Main.rand.Next(3) == 0)
          Main.player[i].AddBuff(44, 240, false);
      }
      else if (this.type == 15)
      {
        if (Main.rand.Next(2) == 0)
          Main.player[i].AddBuff(24, 300, false);
      }
      else if (this.type == 253)
      {
        if (Main.rand.Next(2) == 0)
          Main.player[i].AddBuff(44, 480, false);
      }
      else if (this.type == 19)
      {
        if (Main.rand.Next(5) == 0)
          Main.player[i].AddBuff(24, 180, false);
      }
      else if (this.type == 33)
      {
        if (Main.rand.Next(5) == 0)
          Main.player[i].AddBuff(20, 420, false);
      }
      else if (this.type == 34)
      {
        if (Main.rand.Next(2) == 0)
          Main.player[i].AddBuff(24, 240, false);
      }
      else if (this.type == 35)
      {
        if (Main.rand.Next(4) == 0)
          Main.player[i].AddBuff(24, 180, false);
      }
      else if (this.type == 54)
      {
        if (Main.rand.Next(2) == 0)
          Main.player[i].AddBuff(20, 600, false);
      }
      else if (this.type == 267)
      {
        if (Main.rand.Next(3) == 0)
          Main.player[i].AddBuff(20, 3600);
        else
          Main.player[i].AddBuff(20, 1800);
      }
      else if (this.type == 63)
      {
        if (Main.rand.Next(3) != 0)
          Main.player[i].AddBuff(31, 120);
      }
      else if (this.type == 85 || this.type == 188)
        Main.player[i].AddBuff(24, 1200, false);
      else if (this.type == 95 || this.type == 103 || this.type == 104)
        Main.player[i].AddBuff(39, 420);
      else if (this.type == 278 || this.type == 279 || this.type == 280)
        Main.player[i].AddBuff(69, 900);
      else if (this.type == 282 || this.type == 283)
        Main.player[i].AddBuff(70, 600);
      if (this.type == 163 || this.type == 310)
      {
        if (Main.rand.Next(3) == 0)
          Main.player[i].AddBuff(24, 600);
        else
          Main.player[i].AddBuff(24, 300);
      }
      else if (this.type == 265)
      {
        Main.player[i].AddBuff(20, 1200);
      }
      else
      {
        if (this.type != 355)
          return;
        Main.player[i].AddBuff(70, 1800);
      }
    }

    public void ghostHurt(int dmg, Vector2 Position)
    {
      if (!this.magic)
        return;
      int Damage = this.damage / 2;
      if (dmg / 2 <= 1)
        return;
      int num1 = 1000;
      if ((double) Main.player[Main.myPlayer].ghostDmg > (double) num1)
        return;
      Main.player[Main.myPlayer].ghostDmg += (float) Damage;
      int[] numArray1 = new int[200];
      int maxValue1 = 0;
      int[] numArray2 = new int[200];
      int maxValue2 = 0;
      for (int index = 0; index < 200; ++index)
      {
        if (Main.npc[index].CanBeChasedBy((object) this))
        {
          float num2 = Math.Abs(Main.npc[index].position.X + (float) (Main.npc[index].width / 2) - this.position.X + (float) (this.width / 2)) + Math.Abs(Main.npc[index].position.Y + (float) (Main.npc[index].height / 2) - this.position.Y + (float) (this.height / 2));
          if ((double) num2 < 800.0)
          {
            if (Collision.CanHit(this.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && (double) num2 > 50.0)
            {
              numArray1[maxValue2] = index;
              ++maxValue2;
            }
            else if (maxValue2 == 0)
            {
              numArray1[maxValue1] = index;
              ++maxValue1;
            }
          }
        }
      }
      if (maxValue1 == 0 && maxValue2 == 0)
        return;
      int num3 = maxValue2 <= 0 ? numArray1[Main.rand.Next(maxValue1)] : numArray1[Main.rand.Next(maxValue2)];
      float num4 = (float) Main.rand.Next(-100, 101);
      float num5 = (float) Main.rand.Next(-100, 101);
      float num6 = (float) (4.0 / Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5));
      float SpeedX = num4 * num6;
      float SpeedY = num5 * num6;
      Projectile.NewProjectile(Position.X, Position.Y, SpeedX, SpeedY, 356, Damage, 0.0f, this.owner, (float) num3);
    }

    public void ghostHeal(int dmg, Vector2 Position)
    {
      float num1 = 0.2f - (float) this.numHits * 0.05f;
      if ((double) num1 <= 0.0)
        return;
      float ai1 = (float) dmg * num1;
      if ((int) ai1 <= 0 || (double) Main.player[Main.myPlayer].lifeSteal <= 0.0)
        return;
      Main.player[Main.myPlayer].lifeSteal -= ai1;
      if (!this.magic)
        return;
      float num2 = 0.0f;
      int num3 = this.owner;
      for (int index = 0; index < (int) byte.MaxValue; ++index)
      {
        if (Main.player[index].active && !Main.player[index].dead && (!Main.player[this.owner].hostile && !Main.player[index].hostile || Main.player[this.owner].team == Main.player[index].team) && (double) Math.Abs(Main.player[index].position.X + (float) (Main.player[index].width / 2) - this.position.X + (float) (this.width / 2)) + (double) Math.Abs(Main.player[index].position.Y + (float) (Main.player[index].height / 2) - this.position.Y + (float) (this.height / 2)) < 1200.0 && (double) (Main.player[index].statLifeMax2 - Main.player[index].statLife) > (double) num2)
        {
          num2 = (float) (Main.player[index].statLifeMax2 - Main.player[index].statLife);
          num3 = index;
        }
      }
      Projectile.NewProjectile(Position.X, Position.Y, 0.0f, 0.0f, 298, 0, 0.0f, this.owner, (float) num3, ai1);
    }

    public void vampireHeal(int dmg, Vector2 Position)
    {
      float ai1 = (float) dmg * 0.075f;
      if ((int) ai1 == 0 || (double) Main.player[Main.myPlayer].lifeSteal <= 0.0)
        return;
      Main.player[Main.myPlayer].lifeSteal -= ai1;
      int owner = this.owner;
      Projectile.NewProjectile(Position.X, Position.Y, 0.0f, 0.0f, 305, 0, 0.0f, this.owner, (float) owner, ai1);
    }

    public void StatusPlayer(int i)
    {
      if (this.type == 472)
        Main.player[i].AddBuff(149, Main.rand.Next(30, 150));
      if (this.type == 467)
        Main.player[i].AddBuff(24, Main.rand.Next(30, 150));
      if (this.type == 581)
      {
        if (Main.expertMode)
          Main.player[i].AddBuff(164, Main.rand.Next(300, 540));
        else if (Main.rand.Next(2) == 0)
          Main.player[i].AddBuff(164, Main.rand.Next(360, 720));
      }
      if (this.type == 687)
        Main.player[i].AddBuff(24, 60 * Main.rand.Next(7, 11));
      if (this.type == 258 && Main.rand.Next(2) == 0)
        Main.player[i].AddBuff(24, 60 * Main.rand.Next(5, 8));
      if (this.type == 572 && Main.rand.Next(3) != 0)
        Main.player[i].AddBuff(20, Main.rand.Next(120, 240));
      if (this.type == 276)
      {
        if (Main.expertMode)
          Main.player[i].AddBuff(20, Main.rand.Next(120, 540));
        else if (Main.rand.Next(2) == 0)
          Main.player[i].AddBuff(20, Main.rand.Next(180, 420));
      }
      if (this.type == 436 && Main.rand.Next(5) >= 2)
        Main.player[i].AddBuff(31, 300);
      if (this.type == 435 && Main.rand.Next(3) != 0)
        Main.player[i].AddBuff(144, 300);
      if (this.type == 682)
        Main.player[i].AddBuff(196, 300);
      if (this.type == 437)
        Main.player[i].AddBuff(144, 60 * Main.rand.Next(4, 9));
      if (this.type == 348)
      {
        if (Main.rand.Next(2) == 0)
          Main.player[i].AddBuff(46, 600);
        else
          Main.player[i].AddBuff(46, 300);
        if (Main.rand.Next(3) != 0)
        {
          if (Main.rand.Next(16) == 0)
            Main.player[i].AddBuff(47, 60);
          else if (Main.rand.Next(12) == 0)
            Main.player[i].AddBuff(47, 40);
          else if (Main.rand.Next(8) == 0)
            Main.player[i].AddBuff(47, 20);
        }
      }
      if (this.type == 349)
      {
        if (Main.rand.Next(3) == 0)
          Main.player[i].AddBuff(46, 600);
        else if (Main.rand.Next(2) == 0)
          Main.player[i].AddBuff(46, 300);
      }
      if (this.type >= 399 && this.type <= 402)
        Main.npc[i].AddBuff(24, 60 * Main.rand.Next(3, 7));
      if (this.type == 55)
      {
        if (Main.rand.Next(3) == 0)
          Main.player[i].AddBuff(20, 600);
        else if (Main.expertMode)
          Main.player[i].AddBuff(20, Main.rand.Next(60, 300));
      }
      if (this.type == 44 && Main.rand.Next(3) == 0)
        Main.player[i].AddBuff(22, 900);
      if (this.type == 293)
        Main.player[i].AddBuff(80, 60 * Main.rand.Next(2, 7));
      if (this.type == 82 && Main.rand.Next(3) == 0)
        Main.player[i].AddBuff(24, 420);
      if (this.type == 285)
      {
        if (Main.rand.Next(3) == 0)
          Main.player[i].AddBuff(31, 180);
        else
          Main.player[i].AddBuff(31, 60);
      }
      if (this.type == 96 || this.type == 101)
      {
        if (Main.rand.Next(6) == 0)
          Main.player[i].AddBuff(39, 480);
        else if (Main.rand.Next(4) == 0)
          Main.player[i].AddBuff(39, 300);
        else if (Main.rand.Next(2) == 0)
          Main.player[i].AddBuff(39, 180);
      }
      else if (this.type == 288)
        Main.player[i].AddBuff(69, 900);
      else if (this.type == 253 && Main.rand.Next(2) == 0)
        Main.player[i].AddBuff(44, 600);
      if (this.type == 291 || this.type == 292)
        Main.player[i].AddBuff(24, 60 * Main.rand.Next(8, 16));
      if (this.type == 98)
        Main.player[i].AddBuff(20, 600);
      if (this.type == 184)
        Main.player[i].AddBuff(20, 900);
      if (this.type == 290)
        Main.player[i].AddBuff(32, 60 * Main.rand.Next(5, 16));
      if (this.type == 174)
      {
        Main.player[i].AddBuff(46, 1200);
        if (!Main.player[i].frozen && Main.rand.Next(20) == 0)
          Main.player[i].AddBuff(47, 90);
        else if (!Main.player[i].frozen && Main.expertMode && Main.rand.Next(20) == 0)
          Main.player[i].AddBuff(47, 60);
      }
      if (this.type == 257)
      {
        Main.player[i].AddBuff(46, 2700);
        if (!Main.player[i].frozen && Main.rand.Next(5) == 0)
          Main.player[i].AddBuff(47, 60);
      }
      if (this.type == 177)
      {
        Main.player[i].AddBuff(46, 1500);
        if (!Main.player[i].frozen && Main.rand.Next(10) == 0)
          Main.player[i].AddBuff(47, Main.rand.Next(30, 120));
      }
      if (this.type != 176)
        return;
      if (Main.rand.Next(4) == 0)
      {
        Main.player[i].AddBuff(20, 1200);
      }
      else
      {
        if (Main.rand.Next(2) != 0)
          return;
        Main.player[i].AddBuff(20, 300);
      }
    }

    public bool CanHit(Entity ent)
    {
      if ((double) this.Distance(ent.Center) > (double) this.ownerHitCheckDistance)
        return false;
      return Collision.CanHit(Main.player[this.owner].position, Main.player[this.owner].width, Main.player[this.owner].height, ent.position, ent.width, ent.height) || Collision.CanHitLine(Main.player[this.owner].Center + new Vector2((float) (Main.player[this.owner].direction * Main.player[this.owner].width / 2), (float) ((double) Main.player[this.owner].gravDir * (double) -Main.player[this.owner].height / 3.0)), 0, 0, ent.Center + new Vector2(0.0f, (float) (-ent.height / 3)), 0, 0) || Collision.CanHitLine(Main.player[this.owner].Center + new Vector2((float) (Main.player[this.owner].direction * Main.player[this.owner].width / 2), (float) ((double) Main.player[this.owner].gravDir * (double) -Main.player[this.owner].height / 3.0)), 0, 0, ent.Center, 0, 0) || Collision.CanHitLine(Main.player[this.owner].Center + new Vector2((float) (Main.player[this.owner].direction * Main.player[this.owner].width / 2), 0.0f), 0, 0, ent.Center + new Vector2(0.0f, (float) (ent.height / 3)), 0, 0);
    }

    public void Damage()
    {
      if (this.type == 18 || this.type == 72 || this.type == 86 || this.type == 87 || this.aiStyle == 31 || this.aiStyle == 32 || this.type == 226 || this.type == 378 || this.type == 613 || this.type == 650 || this.type == 434 && (double) this.localAI[0] != 0.0 || this.type == 439 || this.type == 444 || this.type == 451 && ((int) ((double) this.ai[0] - 1.0) / this.penetrate == 0 || (double) this.ai[1] < 5.0) && (double) this.ai[0] != 0.0 || this.type == 500 || this.type == 653 || this.type == 460 || this.type == 633 || this.type == 600 || this.type == 601 || this.type == 602 || this.type == 535 || this.type == 631 && (double) this.localAI[1] == 0.0 || this.type == 651 || this.aiStyle == 137 && (double) this.ai[0] != 0.0 || this.aiStyle == 138 || this.aiStyle == 93 && (double) this.ai[0] != 0.0 && (double) this.ai[0] != 2.0 || this.aiStyle == 10 && (double) this.localAI[1] == -1.0 || Main.projPet[this.type] && this.type != 266 && this.type != 407 && this.type != 317 && (this.type != 388 || (double) this.ai[0] != 2.0) && (this.type < 390 || this.type > 392) && (this.type < 393 || this.type > 395) && (this.type != 533 || (double) this.ai[0] < 6.0 || (double) this.ai[0] > 8.0) && (this.type < 625 || this.type > 628))
        return;
      Microsoft.Xna.Framework.Rectangle myRect = new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height);
      if (this.type == 85 || this.type == 101)
      {
        int num = 30;
        myRect.X -= num;
        myRect.Y -= num;
        myRect.Width += num * 2;
        myRect.Height += num * 2;
      }
      if (this.type == 188)
      {
        int num = 20;
        myRect.X -= num;
        myRect.Y -= num;
        myRect.Width += num * 2;
        myRect.Height += num * 2;
      }
      if (this.aiStyle == 29)
      {
        int num = 4;
        myRect.X -= num;
        myRect.Y -= num;
        myRect.Width += num * 2;
        myRect.Height += num * 2;
      }
      if (this.friendly && this.owner == Main.myPlayer && !this.npcProj)
      {
        if (this.aiStyle == 16 && this.type != 338 && this.type != 339 && this.type != 340 && this.type != 341 && (this.timeLeft <= 1 || this.type == 108 || this.type == 164) || this.type == 286 && (double) this.localAI[1] == -1.0)
        {
          int player = Main.myPlayer;
          if (Main.player[player].active && !Main.player[player].dead && !Main.player[player].immune && (!this.ownerHitCheck || this.CanHit((Entity) Main.player[player])))
          {
            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.player[player].position.X, (int) Main.player[player].position.Y, Main.player[player].width, Main.player[player].height);
            if (myRect.Intersects(rectangle))
            {
              if ((double) Main.player[player].position.X + (double) (Main.player[player].width / 2) < (double) this.position.X + (double) (this.width / 2))
                this.direction = -1;
              else
                this.direction = 1;
              int Damage = Main.DamageVar((float) this.damage);
              this.StatusPlayer(player);
              Main.player[player].Hurt(PlayerDeathReason.ByProjectile(this.owner, this.whoAmI), Damage, this.direction, true);
              if (this.trap)
              {
                Main.player[player].trapDebuffSource = true;
                if (Main.player[player].dead)
                  AchievementsHelper.HandleSpecialEvent(Main.player[player], 4);
              }
            }
          }
        }
        this.CutTiles();
      }
      if (this.owner == Main.myPlayer)
      {
        if (this.damage > 0)
        {
          for (int index1 = 0; index1 < 200; ++index1)
          {
            bool flag1 = !this.usesLocalNPCImmunity && !this.usesIDStaticNPCImmunity || this.usesLocalNPCImmunity && this.localNPCImmunity[index1] == 0 || this.usesIDStaticNPCImmunity && Projectile.IsNPCImmune(this.type, index1);
            if (((!Main.npc[index1].active ? 0 : (!Main.npc[index1].dontTakeDamage ? 1 : 0)) & (flag1 ? 1 : 0)) != 0 && (this.friendly && (!Main.npc[index1].friendly || this.type == 318 || Main.npc[index1].type == 22 && this.owner < (int) byte.MaxValue && Main.player[this.owner].killGuide || Main.npc[index1].type == 54 && this.owner < (int) byte.MaxValue && Main.player[this.owner].killClothier) || this.hostile && Main.npc[index1].friendly && !Main.npc[index1].dontTakeDamageFromHostiles) && (this.owner < 0 || Main.npc[index1].immune[this.owner] == 0 || this.maxPenetrate == 1))
            {
              bool flag2 = false;
              if (this.type == 11 && (Main.npc[index1].type == 47 || Main.npc[index1].type == 57))
                flag2 = true;
              else if (this.type == 31 && Main.npc[index1].type == 69)
                flag2 = true;
              else if (Main.npc[index1].trapImmune && this.trap)
                flag2 = true;
              else if (Main.npc[index1].immortal && this.npcProj)
                flag2 = true;
              if (!flag2 && (Main.npc[index1].noTileCollide || !this.ownerHitCheck || this.CanHit((Entity) Main.npc[index1])))
              {
                bool flag3;
                if (Main.npc[index1].type == 414)
                {
                  Microsoft.Xna.Framework.Rectangle rect = Main.npc[index1].getRect();
                  int num = 8;
                  rect.X -= num;
                  rect.Y -= num;
                  rect.Width += num * 2;
                  rect.Height += num * 2;
                  flag3 = this.Colliding(myRect, rect);
                }
                else
                  flag3 = this.Colliding(myRect, Main.npc[index1].getRect());
                if (flag3)
                {
                  if (this.type == 604)
                    Main.player[this.owner].Counterweight(Main.npc[index1].Center, this.damage, this.knockBack);
                  if (Main.npc[index1].reflectingProjectiles && this.CanReflect())
                  {
                    Main.npc[index1].ReflectProjectile(this.whoAmI);
                    return;
                  }
                  int num1 = this.damage;
                  if (this.type > 0 && this.type < 714 && ProjectileID.Sets.StardustDragon[this.type])
                  {
                    float num2 = Utils.Clamp<float>((float) (((double) this.scale - 1.0) * 100.0), 0.0f, 50f);
                    num1 = (int) ((double) num1 * (1.0 + (double) num2 * 0.230000004172325));
                  }
                  int Damage1 = Main.DamageVar((float) num1);
                  bool flag4 = !this.npcProj && !this.trap;
                  if (this.trap && NPCID.Sets.BelongsToInvasionOldOnesArmy[Main.npc[index1].type])
                    Damage1 /= 2;
                  if (this.type == 604)
                  {
                    this.friendly = false;
                    this.ai[1] = 1000f;
                  }
                  if ((this.type == 400 || this.type == 401 || this.type == 402) && Main.npc[index1].type >= 13 && Main.npc[index1].type <= 15)
                  {
                    Damage1 = (int) ((double) Damage1 * 0.65);
                    if (this.penetrate > 1)
                      --this.penetrate;
                  }
                  if (this.type == 710)
                  {
                    if (!WorldUtils.Find(this.Center.ToTileCoordinates(), Searches.Chain((GenSearch) new Searches.Down(12), (GenCondition) new Conditions.IsSolid()), out Point _))
                      Damage1 = (int) ((double) Damage1 * 1.5);
                  }
                  if (this.type == 504)
                    this.ai[0] += (float) ((60.0 - (double) this.ai[0]) / 2.0);
                  if (this.aiStyle == 3 && this.type != 301)
                  {
                    if ((double) this.ai[0] == 0.0)
                    {
                      this.velocity.X = -this.velocity.X;
                      this.velocity.Y = -this.velocity.Y;
                      this.netUpdate = true;
                    }
                    this.ai[0] = 1f;
                  }
                  else if (this.type == 582)
                  {
                    if ((double) this.ai[0] != 0.0)
                      this.direction *= -1;
                  }
                  else if (this.type == 612)
                    this.direction = Main.player[this.owner].direction;
                  else if (this.type == 624)
                  {
                    float num3 = 1f;
                    if ((double) Main.npc[index1].knockBackResist > 0.0)
                      num3 = 1f / Main.npc[index1].knockBackResist;
                    this.knockBack = 4f * num3;
                    if ((double) Main.npc[index1].Center.X < (double) this.Center.X)
                      this.direction = 1;
                    else
                      this.direction = -1;
                  }
                  else if (this.aiStyle == 16)
                  {
                    if (this.timeLeft > 3)
                      this.timeLeft = 3;
                    if ((double) Main.npc[index1].position.X + (double) (Main.npc[index1].width / 2) < (double) this.position.X + (double) (this.width / 2))
                      this.direction = -1;
                    else
                      this.direction = 1;
                  }
                  else if (this.aiStyle == 68)
                  {
                    if (this.timeLeft > 3)
                      this.timeLeft = 3;
                    if ((double) Main.npc[index1].position.X + (double) (Main.npc[index1].width / 2) < (double) this.position.X + (double) (this.width / 2))
                      this.direction = -1;
                    else
                      this.direction = 1;
                  }
                  else if (this.aiStyle == 50)
                  {
                    if ((double) Main.npc[index1].position.X + (double) (Main.npc[index1].width / 2) < (double) this.position.X + (double) (this.width / 2))
                      this.direction = -1;
                    else
                      this.direction = 1;
                  }
                  if (this.type == 509)
                  {
                    int num4 = Main.rand.Next(2, 6);
                    for (int index2 = 0; index2 < num4; ++index2)
                    {
                      Vector2 vector2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
                      vector2 += this.velocity * 3f;
                      vector2.Normalize();
                      vector2 *= (float) Main.rand.Next(35, 81) * 0.1f;
                      int Damage2 = (int) ((double) this.damage * 0.5);
                      Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2.X, vector2.Y, 504, Damage2, this.knockBack * 0.2f, this.owner);
                    }
                  }
                  if (this.type == 598 || this.type == 636 || this.type == 614)
                  {
                    this.ai[0] = 1f;
                    this.ai[1] = (float) index1;
                    this.velocity = (Main.npc[index1].Center - this.Center) * 0.75f;
                    this.netUpdate = true;
                  }
                  if (this.type >= 511 && this.type <= 513)
                    this.timeLeft = 0;
                  if (this.type == 659)
                    this.timeLeft = 0;
                  if (this.type == 524)
                  {
                    this.netUpdate = true;
                    this.ai[0] += 50f;
                  }
                  if ((this.type == 688 || this.type == 689 || this.type == 690) && Main.npc[index1].type != 68 && Main.npc[index1].defense < 999)
                    Damage1 += Main.npc[index1].defense / 2;
                  if (this.aiStyle == 39)
                  {
                    if ((double) this.ai[1] == 0.0)
                    {
                      this.ai[1] = (float) (index1 + 1);
                      this.netUpdate = true;
                    }
                    if ((double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2) < (double) this.position.X + (double) (this.width / 2))
                      this.direction = 1;
                    else
                      this.direction = -1;
                  }
                  if (this.type == 41 && this.timeLeft > 1)
                    this.timeLeft = 1;
                  bool crit = false;
                  if (flag4)
                  {
                    if (this.melee && Main.rand.Next(1, 101) <= Main.player[this.owner].meleeCrit)
                      crit = true;
                    if (this.ranged && Main.rand.Next(1, 101) <= Main.player[this.owner].rangedCrit)
                      crit = true;
                    if (this.magic && Main.rand.Next(1, 101) <= Main.player[this.owner].magicCrit)
                      crit = true;
                    if (this.thrown && Main.rand.Next(1, 101) <= Main.player[this.owner].thrownCrit)
                      crit = true;
                    switch (this.type)
                    {
                      case 688:
                      case 689:
                      case 690:
                        if (Main.player[this.owner].setMonkT3)
                        {
                          if (Main.rand.Next(4) == 0)
                          {
                            crit = true;
                            break;
                          }
                          break;
                        }
                        if (Main.player[this.owner].setMonkT2 && Main.rand.Next(6) == 0)
                        {
                          crit = true;
                          break;
                        }
                        break;
                    }
                  }
                  if (this.aiStyle == 99)
                  {
                    Main.player[this.owner].Counterweight(Main.npc[index1].Center, this.damage, this.knockBack);
                    if ((double) Main.npc[index1].Center.X < (double) Main.player[this.owner].Center.X)
                      this.direction = -1;
                    else
                      this.direction = 1;
                    if ((double) this.ai[0] >= 0.0)
                    {
                      Vector2 vector2 = this.Center - Main.npc[index1].Center;
                      vector2.Normalize();
                      float num5 = 16f;
                      this.velocity = this.velocity * -0.5f;
                      this.velocity = this.velocity + vector2 * num5;
                      this.netUpdate = true;
                      this.localAI[0] += 20f;
                      if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.owner].position, Main.player[this.owner].width, Main.player[this.owner].height))
                      {
                        this.localAI[0] += 40f;
                        Damage1 = (int) ((double) Damage1 * 0.75);
                      }
                    }
                  }
                  if (this.aiStyle == 93)
                  {
                    if ((double) this.ai[0] == 0.0)
                    {
                      this.ai[1] = 0.0f;
                      this.ai[0] = (float) (-index1 - 1);
                      this.velocity = Main.npc[index1].Center - this.Center;
                    }
                    Damage1 = (double) this.ai[0] != 2.0 ? (int) ((double) Damage1 * 0.15) : (int) ((double) Damage1 * 1.35);
                  }
                  if (flag4)
                  {
                    int num6 = Item.NPCtoBanner(Main.npc[index1].BannerID());
                    if (num6 >= 0)
                      Main.player[Main.myPlayer].lastCreatureHit = num6;
                  }
                  if (Main.netMode != 2 & flag4)
                  {
                    int banner = Item.NPCtoBanner(Main.npc[index1].BannerID());
                    if (banner > 0 && Main.player[this.owner].NPCBannerBuff[banner])
                      Damage1 = !Main.expertMode ? (int) ((double) Damage1 * (double) ItemID.Sets.BannerStrength[Item.BannerToItem(banner)].NormalDamageDealt) : (int) ((double) Damage1 * (double) ItemID.Sets.BannerStrength[Item.BannerToItem(banner)].ExpertDamageDealt);
                  }
                  if (Main.expertMode)
                  {
                    if ((this.type == 30 || this.type == 28 || this.type == 29 || this.type == 470 || this.type == 517 || this.type == 588 || this.type == 637) && Main.npc[index1].type >= 13 && Main.npc[index1].type <= 15)
                      Damage1 /= 5;
                    if (this.type == 280 && (Main.npc[index1].type >= 134 && Main.npc[index1].type <= 136 || Main.npc[index1].type == 139))
                      Damage1 = (int) ((double) Damage1 * 0.75);
                  }
                  if (Main.netMode != 2 && Main.npc[index1].type == 439 && this.type >= 0 && this.type <= 714 && ProjectileID.Sets.Homing[this.type])
                    Damage1 = (int) ((double) Damage1 * 0.75);
                  if (this.type == 497 && this.penetrate != 1)
                  {
                    this.ai[0] = 25f;
                    float num7 = this.velocity.Length();
                    Vector2 vector2 = Main.npc[index1].Center - this.Center;
                    vector2.Normalize();
                    this.velocity = -(vector2 * num7) * 0.9f;
                    this.netUpdate = true;
                  }
                  if (this.type == 323 && (Main.npc[index1].type == 158 || Main.npc[index1].type == 159))
                    Damage1 *= 10;
                  if (this.type == 294)
                    this.damage = (int) ((double) this.damage * 0.8);
                  if (this.type == 477 && this.penetrate > 1)
                  {
                    int[] numArray = new int[10];
                    int maxValue = 0;
                    int num8 = 700;
                    int num9 = 20;
                    for (int index3 = 0; index3 < 200; ++index3)
                    {
                      if (index3 != index1 && Main.npc[index3].CanBeChasedBy((object) this))
                      {
                        float num10 = (this.Center - Main.npc[index3].Center).Length();
                        if ((double) num10 > (double) num9 && (double) num10 < (double) num8 && Collision.CanHitLine(this.Center, 1, 1, Main.npc[index3].Center, 1, 1))
                        {
                          numArray[maxValue] = index3;
                          ++maxValue;
                          if (maxValue >= 9)
                            break;
                        }
                      }
                    }
                    if (maxValue > 0)
                    {
                      int index4 = Main.rand.Next(maxValue);
                      Vector2 vector2 = Main.npc[numArray[index4]].Center - this.Center;
                      float num11 = this.velocity.Length();
                      vector2.Normalize();
                      this.velocity = vector2 * num11;
                      this.netUpdate = true;
                    }
                  }
                  if (this.type == 261)
                  {
                    float num12 = (float) Math.Sqrt((double) this.velocity.X * (double) this.velocity.X + (double) this.velocity.Y * (double) this.velocity.Y);
                    if ((double) num12 < 1.0)
                      num12 = 1f;
                    Damage1 = (int) ((double) Damage1 * (double) num12 / 8.0);
                  }
                  if (flag4 && this.melee && Main.player[this.owner].parryDamageBuff)
                  {
                    Damage1 *= 5;
                    Main.player[this.owner].parryDamageBuff = false;
                    Main.player[this.owner].ClearBuff(198);
                  }
                  this.StatusNPC(index1);
                  if (flag4 && this.type != 221 && this.type != 227 && this.type != 614)
                    Main.player[this.owner].OnHit(Main.npc[index1].Center.X, Main.npc[index1].Center.Y, (Entity) Main.npc[index1]);
                  if (this.type == 317)
                  {
                    this.ai[1] = -1f;
                    this.netUpdate = true;
                  }
                  int hitDirection = this.direction;
                  if (this.type == 697 || this.type == 699 || this.type == 707 || this.type == 708)
                    hitDirection = (double) Main.player[this.owner].Center.X < (double) Main.npc[index1].Center.X ? 1 : -1;
                  if (flag4 && !this.hostile && Main.player[this.owner].armorPenetration > 0)
                    Damage1 += Main.npc[index1].checkArmorPenetration(Main.player[this.owner].armorPenetration);
                  int dmg = !flag4 ? (int) Main.npc[index1].StrikeNPCNoInteraction(Damage1, this.knockBack, hitDirection, crit) : (int) Main.npc[index1].StrikeNPC(Damage1, this.knockBack, hitDirection, crit);
                  if (flag4 && Main.player[this.owner].accDreamCatcher)
                    Main.player[this.owner].addDPS(dmg);
                  if (flag4 && !Main.npc[index1].immortal)
                  {
                    if (this.type == 304 && dmg > 0 && Main.npc[index1].lifeMax > 5 && !Main.player[this.owner].moonLeech)
                      this.vampireHeal(dmg, new Vector2(Main.npc[index1].Center.X, Main.npc[index1].Center.Y));
                    if ((double) Main.npc[index1].value > 0.0 && Main.player[this.owner].coins && Main.rand.Next(5) == 0)
                    {
                      int Type = 71;
                      if (Main.rand.Next(10) == 0)
                        Type = 72;
                      if (Main.rand.Next(100) == 0)
                        Type = 73;
                      int number = Item.NewItem((int) Main.npc[index1].position.X, (int) Main.npc[index1].position.Y, Main.npc[index1].width, Main.npc[index1].height, Type);
                      Main.item[number].stack = Main.rand.Next(1, 11);
                      Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f;
                      Main.item[number].velocity.X = (float) Main.rand.Next(10, 31) * 0.2f * (float) this.direction;
                      if (Main.netMode == 1)
                        NetMessage.SendData(21, number: number);
                    }
                    if (dmg > 0 && Main.npc[index1].lifeMax > 5 && this.friendly && !this.hostile && this.aiStyle != 59)
                    {
                      if (Main.npc[index1].canGhostHeal)
                      {
                        if (Main.player[this.owner].ghostHeal && !Main.player[this.owner].moonLeech)
                          this.ghostHeal(dmg, new Vector2(Main.npc[index1].Center.X, Main.npc[index1].Center.Y));
                        if (Main.player[this.owner].ghostHurt)
                          this.ghostHurt(dmg, new Vector2(Main.npc[index1].Center.X, Main.npc[index1].Center.Y));
                        if (Main.player[this.owner].setNebula && Main.player[this.owner].nebulaCD == 0 && Main.rand.Next(3) == 0)
                        {
                          Main.player[this.owner].nebulaCD = 30;
                          int Type = Utils.SelectRandom<int>(Main.rand, 3453, 3454, 3455);
                          int number = Item.NewItem((int) Main.npc[index1].position.X, (int) Main.npc[index1].position.Y, Main.npc[index1].width, Main.npc[index1].height, Type);
                          Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f;
                          Main.item[number].velocity.X = (float) Main.rand.Next(10, 31) * 0.2f * (float) this.direction;
                          if (Main.netMode == 1)
                            NetMessage.SendData(21, number: number);
                        }
                      }
                      if (this.melee && Main.player[this.owner].beetleOffense && !Main.npc[index1].immortal)
                      {
                        if (Main.player[this.owner].beetleOrbs == 0)
                          Main.player[this.owner].beetleCounter += (float) (dmg * 3);
                        else if (Main.player[this.owner].beetleOrbs == 1)
                          Main.player[this.owner].beetleCounter += (float) (dmg * 2);
                        else
                          Main.player[this.owner].beetleCounter += (float) dmg;
                        Main.player[this.owner].beetleCountdown = 0;
                      }
                      if (this.arrow && this.type != 631 && Main.player[this.owner].phantasmTime > 0)
                      {
                        Vector2 Source = Main.player[this.owner].position + Main.player[this.owner].Size * Utils.RandomVector2(Main.rand, 0.0f, 1f);
                        Vector2 vector2 = Main.npc[index1].DirectionFrom(Source) * 6f;
                        int Damage3 = (int) ((double) this.damage * 0.300000011920929);
                        Projectile.NewProjectile(Source.X, Source.Y, vector2.X, vector2.Y, 631, Damage3, 0.0f, this.owner, (float) index1);
                        Projectile.NewProjectile(Source.X, Source.Y, vector2.X, vector2.Y, 631, Damage3, 0.0f, this.owner, (float) index1, 15f);
                        Projectile.NewProjectile(Source.X, Source.Y, vector2.X, vector2.Y, 631, Damage3, 0.0f, this.owner, (float) index1, 30f);
                      }
                    }
                  }
                  if (flag4 && this.melee && Main.player[this.owner].meleeEnchant == (byte) 7)
                    Projectile.NewProjectile(Main.npc[index1].Center.X, Main.npc[index1].Center.Y, Main.npc[index1].velocity.X, Main.npc[index1].velocity.Y, 289, 0, 0.0f, this.owner);
                  if (Main.netMode != 0)
                  {
                    if (crit)
                      NetMessage.SendData(28, number: index1, number2: ((float) Damage1), number3: this.knockBack, number4: ((float) this.direction), number5: 1);
                    else
                      NetMessage.SendData(28, number: index1, number2: ((float) Damage1), number3: this.knockBack, number4: ((float) this.direction));
                  }
                  if (this.type >= 390 && this.type <= 392)
                    this.localAI[1] = 20f;
                  if (this.usesIDStaticNPCImmunity)
                  {
                    Main.npc[index1].immune[this.owner] = 0;
                    Projectile.perIDStaticNPCImmunity[this.type][index1] = Main.GameUpdateCount + (uint) this.idStaticNPCHitCooldown;
                  }
                  else if (this.type == 434)
                    this.numUpdates = 0;
                  else if (this.type == 598 || this.type == 636 || this.type == 614)
                  {
                    this.damage = 0;
                    int length = 6;
                    if (this.type == 614)
                      length = 10;
                    if (this.type == 636)
                      length = 8;
                    Point[] pointArray = new Point[length];
                    int num13 = 0;
                    for (int x = 0; x < 1000; ++x)
                    {
                      if (x != this.whoAmI && Main.projectile[x].active && Main.projectile[x].owner == Main.myPlayer && Main.projectile[x].type == this.type && (double) Main.projectile[x].ai[0] == 1.0 && (double) Main.projectile[x].ai[1] == (double) index1)
                      {
                        pointArray[num13++] = new Point(x, Main.projectile[x].timeLeft);
                        if (num13 >= pointArray.Length)
                          break;
                      }
                    }
                    if (num13 >= pointArray.Length)
                    {
                      int index5 = 0;
                      for (int index6 = 1; index6 < pointArray.Length; ++index6)
                      {
                        if (pointArray[index6].Y < pointArray[index5].Y)
                          index5 = index6;
                      }
                      Main.projectile[pointArray[index5].X].Kill();
                    }
                  }
                  else if (this.type == 632)
                    Main.npc[index1].immune[this.owner] = 5;
                  else if (this.type == 514)
                    Main.npc[index1].immune[this.owner] = 1;
                  else if (this.type == 611)
                  {
                    if ((double) this.localAI[1] <= 0.0)
                      Projectile.NewProjectile(Main.npc[index1].Center.X, Main.npc[index1].Center.Y, 0.0f, 0.0f, 612, this.damage, 10f, this.owner, ai1: ((float) (0.850000023841858 + (double) Main.rand.NextFloat() * 1.14999997615814)));
                    this.localAI[1] = 4f;
                  }
                  else if (this.type == 595)
                    Main.npc[index1].immune[this.owner] = 5;
                  else if (this.type >= 625 && this.type <= 628)
                    Main.npc[index1].immune[this.owner] = 6;
                  else if (this.type == 286)
                    Main.npc[index1].immune[this.owner] = 5;
                  else if (this.type == 514)
                    Main.npc[index1].immune[this.owner] = 3;
                  else if (this.type == 443)
                    Main.npc[index1].immune[this.owner] = 8;
                  else if (this.type >= 424 && this.type <= 426)
                    Main.npc[index1].immune[this.owner] = 5;
                  else if (this.type == 634 || this.type == 635)
                    Main.npc[index1].immune[this.owner] = 5;
                  else if (this.type == 659)
                    Main.npc[index1].immune[this.owner] = 5;
                  else if (this.type == 246)
                    Main.npc[index1].immune[this.owner] = 7;
                  else if (this.type == 249)
                    Main.npc[index1].immune[this.owner] = 7;
                  else if (this.type == 190)
                    Main.npc[index1].immune[this.owner] = 8;
                  else if (this.type == 409)
                    Main.npc[index1].immune[this.owner] = 6;
                  else if (this.type == 407)
                    Main.npc[index1].immune[this.owner] = 20;
                  else if (this.type == 311)
                    Main.npc[index1].immune[this.owner] = 7;
                  else if (this.type == 582)
                  {
                    Main.npc[index1].immune[this.owner] = 7;
                    if ((double) this.ai[0] != 1.0)
                    {
                      this.ai[0] = 1f;
                      this.netUpdate = true;
                    }
                  }
                  else
                  {
                    if (this.type == 451)
                    {
                      if ((double) this.ai[0] == 0.0)
                        this.ai[0] += (float) this.penetrate;
                      else
                        this.ai[0] -= (float) (this.penetrate + 1);
                      this.ai[1] = 0.0f;
                      this.netUpdate = true;
                      break;
                    }
                    if (this.type == 661)
                    {
                      this.localNPCImmunity[index1] = 8;
                      Main.npc[index1].immune[this.owner] = 0;
                    }
                    else if (this.usesLocalNPCImmunity && this.localNPCHitCooldown != -2)
                    {
                      Main.npc[index1].immune[this.owner] = 0;
                      this.localNPCImmunity[index1] = this.localNPCHitCooldown;
                    }
                    else if (this.penetrate != 1)
                      Main.npc[index1].immune[this.owner] = 10;
                  }
                  if (this.type == 710)
                    this.BetsySharpnel(index1);
                  if (this.penetrate > 0 && this.type != 317)
                  {
                    if (this.type == 357)
                      this.damage = (int) ((double) this.damage * 0.9);
                    --this.penetrate;
                    if (this.penetrate == 0)
                      break;
                  }
                  if (this.aiStyle == 7)
                  {
                    this.ai[0] = 1f;
                    this.damage = 0;
                    this.netUpdate = true;
                  }
                  else if (this.aiStyle == 13)
                  {
                    this.ai[0] = 1f;
                    this.netUpdate = true;
                  }
                  else if (this.aiStyle == 69)
                  {
                    this.ai[0] = 1f;
                    this.netUpdate = true;
                  }
                  else if (this.type == 607)
                  {
                    this.ai[0] = 1f;
                    this.netUpdate = true;
                    this.friendly = false;
                  }
                  else if (this.type == 638 || this.type == 639 || this.type == 640)
                  {
                    this.localNPCImmunity[index1] = -1;
                    Main.npc[index1].immune[this.owner] = 0;
                    this.damage = (int) ((double) this.damage * 0.96);
                  }
                  else if (this.type == 617)
                  {
                    this.localNPCImmunity[index1] = 8;
                    Main.npc[index1].immune[this.owner] = 0;
                  }
                  else if (this.type == 656)
                  {
                    this.localNPCImmunity[index1] = 8;
                    Main.npc[index1].immune[this.owner] = 0;
                    ++this.localAI[0];
                  }
                  else if (this.type == 618)
                  {
                    this.localNPCImmunity[index1] = 20;
                    Main.npc[index1].immune[this.owner] = 0;
                  }
                  else if (this.type == 642)
                  {
                    this.localNPCImmunity[index1] = 10;
                    Main.npc[index1].immune[this.owner] = 0;
                  }
                  else if (this.type == 611 || this.type == 612)
                  {
                    this.localNPCImmunity[index1] = 6;
                    Main.npc[index1].immune[this.owner] = 4;
                  }
                  else if (this.type == 645)
                  {
                    this.localNPCImmunity[index1] = -1;
                    Main.npc[index1].immune[this.owner] = 0;
                    if ((double) this.ai[1] != -1.0)
                    {
                      this.ai[0] = 0.0f;
                      this.ai[1] = -1f;
                      this.netUpdate = true;
                    }
                  }
                  ++this.numHits;
                  if (this.type == 697)
                  {
                    if ((double) this.ai[0] >= 42.0)
                      this.localAI[1] = 1f;
                  }
                  else if (this.type == 699)
                    this.SummonMonkGhast();
                  else if (this.type == 706)
                    this.damage = (int) ((double) this.damage * 0.949999988079071);
                }
              }
            }
          }
        }
        if (this.damage > 0 && Main.player[Main.myPlayer].hostile)
        {
          for (int index = 0; index < (int) byte.MaxValue; ++index)
          {
            if (index != this.owner && Main.player[index].active && !Main.player[index].dead && !Main.player[index].immune && Main.player[index].hostile && this.playerImmune[index] <= 0 && (Main.player[Main.myPlayer].team == 0 || Main.player[Main.myPlayer].team != Main.player[index].team) && (!this.ownerHitCheck || this.CanHit((Entity) Main.player[index])) && this.Colliding(myRect, Main.player[index].getRect()))
            {
              if (this.aiStyle == 3)
              {
                if ((double) this.ai[0] == 0.0)
                {
                  this.velocity.X = -this.velocity.X;
                  this.velocity.Y = -this.velocity.Y;
                  this.netUpdate = true;
                }
                this.ai[0] = 1f;
              }
              else if (this.aiStyle == 16)
              {
                if (this.timeLeft > 3)
                  this.timeLeft = 3;
                if ((double) Main.player[index].position.X + (double) (Main.player[index].width / 2) < (double) this.position.X + (double) (this.width / 2))
                  this.direction = -1;
                else
                  this.direction = 1;
              }
              else if (this.aiStyle == 68)
              {
                if (this.timeLeft > 3)
                  this.timeLeft = 3;
                if ((double) Main.player[index].position.X + (double) (Main.player[index].width / 2) < (double) this.position.X + (double) (this.width / 2))
                  this.direction = -1;
                else
                  this.direction = 1;
              }
              PlayerDeathReason playerDeathReason = PlayerDeathReason.ByProjectile(this.owner, this.whoAmI);
              if (this.type == 41 && this.timeLeft > 1)
                this.timeLeft = 1;
              bool flag = false;
              if (this.melee && Main.rand.Next(1, 101) <= Main.player[this.owner].meleeCrit)
                flag = true;
              int num = Main.DamageVar((float) this.damage);
              if (!Main.player[index].immune)
                this.StatusPvP(index);
              if (this.type != 221 && this.type != 227 && this.type != 614)
                Main.player[this.owner].OnHit(Main.player[index].Center.X, Main.player[index].Center.Y, (Entity) Main.player[index]);
              int dmg = (int) Main.player[index].Hurt(playerDeathReason, num, this.direction, true, Crit: flag);
              if (dmg > 0 && Main.player[this.owner].ghostHeal && this.friendly && !this.hostile)
                this.ghostHeal(dmg, new Vector2(Main.player[index].Center.X, Main.player[index].Center.Y));
              if (this.type == 304 && dmg > 0)
                this.vampireHeal(dmg, new Vector2(Main.player[index].Center.X, Main.player[index].Center.Y));
              if (this.melee && Main.player[this.owner].meleeEnchant == (byte) 7)
                Projectile.NewProjectile(Main.player[index].Center.X, Main.player[index].Center.Y, Main.player[index].velocity.X, Main.player[index].velocity.Y, 289, 0, 0.0f, this.owner);
              if (Main.netMode != 0)
                NetMessage.SendPlayerHurt(index, playerDeathReason, num, this.direction, flag, true, 0);
              this.playerImmune[index] = 40;
              if (this.penetrate > 0)
              {
                --this.penetrate;
                if (this.penetrate == 0)
                  break;
              }
              if (this.aiStyle == 7)
              {
                this.ai[0] = 1f;
                this.damage = 0;
                this.netUpdate = true;
              }
              else if (this.aiStyle == 13)
              {
                this.ai[0] = 1f;
                this.netUpdate = true;
              }
              else if (this.aiStyle == 69)
              {
                this.ai[0] = 1f;
                this.netUpdate = true;
              }
            }
          }
        }
      }
      if (this.type == 10 && Main.netMode != 1)
      {
        for (int index = 0; index < 200; ++index)
        {
          if (Main.npc[index].active && Main.npc[index].type == 534)
          {
            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
            if (myRect.Intersects(rectangle))
              Main.npc[index].Transform(441);
          }
        }
      }
      if (this.type == 11 && Main.netMode != 1)
      {
        for (int index = 0; index < 200; ++index)
        {
          if (Main.npc[index].active)
          {
            if (Main.npc[index].type == 46 || Main.npc[index].type == 303)
            {
              Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
              if (myRect.Intersects(rectangle))
                Main.npc[index].Transform(47);
            }
            else if (Main.npc[index].type == 55)
            {
              Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
              if (myRect.Intersects(rectangle))
                Main.npc[index].Transform(57);
            }
            else if (Main.npc[index].type == 148 || Main.npc[index].type == 149)
            {
              Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
              if (myRect.Intersects(rectangle))
                Main.npc[index].Transform(168);
            }
          }
        }
      }
      if (this.type == 463 && Main.netMode != 1)
      {
        for (int index = 0; index < 200; ++index)
        {
          if (Main.npc[index].active)
          {
            if (Main.npc[index].type == 46 || Main.npc[index].type == 303)
            {
              Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
              if (myRect.Intersects(rectangle))
                Main.npc[index].Transform(464);
            }
            else if (Main.npc[index].type == 55)
            {
              Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
              if (myRect.Intersects(rectangle))
                Main.npc[index].Transform(465);
            }
            else if (Main.npc[index].type == 148 || Main.npc[index].type == 149)
            {
              Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
              if (myRect.Intersects(rectangle))
                Main.npc[index].Transform(470);
            }
          }
        }
      }
      if (Main.netMode == 2 || !this.hostile || Main.myPlayer >= (int) byte.MaxValue || this.damage <= 0)
        return;
      int cooldownCounter = -1;
      if (this.type == 455 || this.type == 452 || this.type == 454 || this.type == 462)
        cooldownCounter = 1;
      int player1 = Main.myPlayer;
      if (!Main.player[player1].active || Main.player[player1].dead || Main.player[player1].immune && cooldownCounter == -1 || !this.Colliding(myRect, Main.player[player1].getRect()))
        return;
      int direction = this.direction;
      int hitDirection1 = (double) Main.player[player1].position.X + (double) (Main.player[player1].width / 2) >= (double) this.position.X + (double) (this.width / 2) ? 1 : -1;
      if (!Main.player[player1].CanParryAgainst(Main.player[player1].Hitbox, this.Hitbox, this.velocity))
      {
        int num = Main.DamageVar((float) this.damage);
        if (!Main.player[player1].immune)
          this.StatusPlayer(player1);
        if (Main.player[player1].resistCold && this.coldDamage)
          num = (int) ((double) num * 0.699999988079071);
        if (Main.expertMode)
          num = (int) ((double) num * (double) Main.expertDamage);
        Main.player[player1].Hurt(PlayerDeathReason.ByProjectile(-1, this.whoAmI), num * 2, hitDirection1, cooldownCounter: cooldownCounter);
        if (this.trap)
        {
          Main.player[player1].trapDebuffSource = true;
          if (Main.player[player1].dead)
            AchievementsHelper.HandleSpecialEvent(Main.player[player1], 4);
        }
      }
      if (false)
        return;
      if (this.type == 435 || this.type == 682)
        --this.penetrate;
      if (this.type == 436)
        --this.penetrate;
      if (this.type == 681)
        this.timeLeft = 0;
      if (this.type != 437)
        return;
      --this.penetrate;
    }

    private void SummonMonkGhast()
    {
      if ((double) this.localAI[0] > 0.0)
        return;
      this.localAI[0] = 1000f;
      List<NPC> npcList = new List<NPC>();
      for (int index = 0; index < 200; ++index)
      {
        NPC npc = Main.npc[index];
        if (npc.CanBeChasedBy((object) this) && (double) this.Distance(npc.Center) < 800.0)
          npcList.Add(npc);
      }
      Vector2 center = this.Center;
      Vector2 vector2_1 = Vector2.Zero;
      if (npcList.Count > 0)
      {
        NPC npc = npcList[Main.rand.Next(npcList.Count)];
        center = npc.Center;
        vector2_1 = npc.velocity;
      }
      int num = Main.rand.Next(2) * 2 - 1;
      Vector2 vector2_2 = new Vector2((float) num * (4f + (float) Main.rand.Next(3)), 0.0f);
      Vector2 position = center + new Vector2((float) (-num * 120), 0.0f);
      Vector2 velocity = vector2_2 + (center + vector2_1 * 15f - position).SafeNormalize(Vector2.Zero) * 2f;
      Projectile.NewProjectile(position, velocity, 700, this.damage, 0.0f, this.owner);
    }

    private void CutTiles()
    {
      if (!this.CanCutTiles())
        return;
      int num1 = (int) ((double) this.position.X / 16.0);
      int num2 = (int) (((double) this.position.X + (double) this.width) / 16.0) + 1;
      int num3 = (int) ((double) this.position.Y / 16.0);
      int num4 = (int) (((double) this.position.Y + (double) this.height) / 16.0) + 1;
      if (num1 < 0)
        num1 = 0;
      if (num2 > Main.maxTilesX)
        num2 = Main.maxTilesX;
      if (num3 < 0)
        num3 = 0;
      if (num4 > Main.maxTilesY)
        num4 = Main.maxTilesY;
      AchievementsHelper.CurrentlyMining = true;
      for (int index1 = num1; index1 < num2; ++index1)
      {
        for (int index2 = num3; index2 < num4; ++index2)
        {
          if (Main.tile[index1, index2] != null && Main.tileCut[(int) Main.tile[index1, index2].type] && WorldGen.CanCutTile(index1, index2, TileCuttingContext.AttackProjectile))
          {
            WorldGen.KillTile(index1, index2);
            if (Main.netMode != 0)
              NetMessage.SendData(17, number2: ((float) index1), number3: ((float) index2));
          }
        }
      }
      if (this.type == 461 || this.type == 632 || this.type == 642)
      {
        DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
        Utils.PlotTileLine(this.Center, this.Center + this.velocity * this.localAI[1], (float) this.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles));
      }
      else if (this.type == 611)
      {
        DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
        Utils.PlotTileLine(this.Center, this.Center + this.velocity, (float) this.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles));
      }
      else if (this.type == 697 || this.type == 707)
      {
        float num5 = 40f;
        if (this.type == 707)
          num5 = 60f;
        float f = this.rotation - 0.7853982f * (float) Math.Sign(this.velocity.X);
        DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
        Utils.PlotTileLine(this.Center + f.ToRotationVector2() * -num5, this.Center + f.ToRotationVector2() * num5, (float) this.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles));
      }
      AchievementsHelper.CurrentlyMining = false;
    }

    private bool CanCutTiles()
    {
      if (this.aiStyle == 45 || this.aiStyle == 137 || this.aiStyle == 92 || this.aiStyle == 105 || this.aiStyle == 106 || this.type == 463 || this.type == 69 || this.type == 70 || this.type == 621 || this.type == 10 || this.type == 11 || this.type == 379 || this.type == 407 || this.type == 476 || this.type == 623)
        return false;
      return this.type < 625 || this.type > 628;
    }

    public bool Colliding(Microsoft.Xna.Framework.Rectangle myRect, Microsoft.Xna.Framework.Rectangle targetRect)
    {
      if (this.type == 598 && targetRect.Width > 8 && targetRect.Height > 8)
        targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
      else if (this.type == 614 && targetRect.Width > 8 && targetRect.Height > 8)
        targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
      else if (this.type == 636 && targetRect.Width > 8 && targetRect.Height > 8)
        targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
      else if (this.type == 607)
      {
        myRect.X += (int) this.velocity.X;
        myRect.Y += (int) this.velocity.Y;
      }
      else if (this.type == 661)
      {
        if ((double) Vector2.Distance(myRect.Center.ToVector2(), targetRect.Center.ToVector2()) > 500.0 || !Collision.CanHitLine(myRect.Center.ToVector2(), 0, 0, targetRect.Center.ToVector2(), 0, 0))
          return false;
      }
      else if (this.aiStyle == 137)
        return myRect.Intersects(targetRect) && (double) targetRect.Distance(this.Center) < (double) (this.height / 2 - 20) && (this.AI_137_CanHit(targetRect.Center.ToVector2()) || this.AI_137_CanHit(targetRect.TopLeft() + new Vector2((float) (targetRect.Width / 2), 0.0f)));
      if (myRect.Intersects(targetRect))
        return true;
      if (this.type == 461)
      {
        float collisionPoint = 0.0f;
        if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity * this.localAI[1], 22f * this.scale, ref collisionPoint))
          return true;
      }
      else if (this.type == 697 || this.type == 707)
      {
        float f = this.rotation - 0.7853982f * (float) Math.Sign(this.velocity.X);
        float collisionPoint = 0.0f;
        float num = 50f;
        if (this.type == 707)
          num = 110f;
        if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center + f.ToRotationVector2() * -num, this.Center + f.ToRotationVector2() * num, 23f * this.scale, ref collisionPoint))
          return true;
      }
      else if (this.type == 699)
      {
        float f = (float) ((double) this.rotation - 0.785398185253143 * (double) Math.Sign(this.velocity.X) + (this.spriteDirection == -1 ? 3.14159274101257 : 0.0));
        float collisionPoint = 0.0f;
        float num = -95f;
        if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + f.ToRotationVector2() * num, 23f * this.scale, ref collisionPoint))
          return true;
      }
      else if (this.type == 642)
      {
        float collisionPoint = 0.0f;
        if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity * this.localAI[1], 30f * this.scale, ref collisionPoint))
          return true;
      }
      else if (this.type == 632)
      {
        float collisionPoint = 0.0f;
        if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity * this.localAI[1], 22f * this.scale, ref collisionPoint))
          return true;
      }
      else if (this.type == 455)
      {
        float collisionPoint = 0.0f;
        if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity * this.localAI[1], 36f * this.scale, ref collisionPoint))
          return true;
      }
      else if (this.type == 611)
      {
        float collisionPoint = 0.0f;
        if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity, 16f * this.scale, ref collisionPoint))
          return true;
      }
      else if (this.type == 684)
      {
        float collisionPoint = 0.0f;
        Vector2 vector2 = this.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(-1.57079637050629) * this.scale;
        if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center - vector2 * 40f, this.Center + vector2 * 40f, 16f * this.scale, ref collisionPoint))
          return true;
      }
      else if (this.type == 537)
      {
        float collisionPoint = 0.0f;
        if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity * this.localAI[1], 22f * this.scale, ref collisionPoint))
          return true;
      }
      else if (this.type == 687)
      {
        float collisionPoint = 0.0f;
        float num1 = this.ai[0] / 25f;
        if ((double) num1 > 1.0)
          num1 = 1f;
        float num2 = (float) (((double) this.ai[0] - 38.0) / 40.0);
        if ((double) num2 < 0.0)
          num2 = 0.0f;
        Vector2 lineStart = this.Center + this.rotation.ToRotationVector2() * 400f * num2;
        Vector2 lineEnd = this.Center + this.rotation.ToRotationVector2() * 400f * num1;
        if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), lineStart, lineEnd, 40f * this.scale, ref collisionPoint))
          return true;
      }
      else if (this.type == 466 || this.type == 580 || this.type == 686)
      {
        for (int index = 0; index < this.oldPos.Length && ((double) this.oldPos[index].X != 0.0 || (double) this.oldPos[index].Y != 0.0); ++index)
        {
          myRect.X = (int) this.oldPos[index].X;
          myRect.Y = (int) this.oldPos[index].Y;
          if (myRect.Intersects(targetRect))
            return true;
        }
      }
      else if (this.type == 711)
      {
        if (this.penetrate != -1)
        {
          for (int index = 0; index < this.oldPos.Length && ((double) this.oldPos[index].X != 0.0 || (double) this.oldPos[index].Y != 0.0); ++index)
          {
            myRect.X = (int) this.oldPos[index].X;
            myRect.Y = (int) this.oldPos[index].Y;
            if (myRect.Intersects(targetRect))
              return true;
          }
        }
      }
      else if (this.type == 464 && (double) this.ai[1] != 1.0)
      {
        Vector2 spinningpoint = new Vector2(0.0f, -720f).RotatedBy((double) this.velocity.ToRotation()) * (float) ((double) this.ai[0] % 45.0 / 45.0);
        for (int index = 0; index < 6; ++index)
        {
          float num = (float) ((double) index * 6.28318548202515 / 6.0);
          if (Utils.CenteredRectangle(this.Center + spinningpoint.RotatedBy((double) num), new Vector2(30f, 30f)).Intersects(targetRect))
            return true;
        }
      }
      return false;
    }

    public void ProjLight()
    {
      if ((double) this.light <= 0.0)
        return;
      float R = this.light;
      float G = this.light;
      float B = this.light;
      if (this.type == 446)
      {
        R *= 0.0f;
        B *= 0.8f;
      }
      else if (this.type == 493 || this.type == 494)
        G *= 0.3f;
      else if (this.type == 332)
      {
        B *= 0.1f;
        G *= 0.6f;
      }
      else if (this.type == 259)
        B *= 0.1f;
      else if (this.type == 329)
      {
        B *= 0.1f;
        G *= 0.9f;
      }
      else if (this.type == 2 || this.type == 82)
      {
        G *= 0.75f;
        B *= 0.55f;
      }
      else if (this.type == 172)
      {
        G *= 0.55f;
        R *= 0.35f;
      }
      else if (this.type == 308)
      {
        G *= 0.7f;
        R *= 0.1f;
      }
      else if (this.type == 304)
      {
        G *= 0.2f;
        B *= 0.1f;
      }
      else if (this.type == 263)
      {
        G *= 0.7f;
        R *= 0.1f;
      }
      else if (this.type == 274)
      {
        G *= 0.1f;
        R *= 0.7f;
      }
      else if (this.type == 254)
        R *= 0.1f;
      else if (this.type == 94)
      {
        R *= 0.5f;
        G *= 0.0f;
      }
      else if (this.type == 95 || this.type == 96 || this.type == 103 || this.type == 104)
      {
        R *= 0.35f;
        G *= 1f;
        B *= 0.0f;
      }
      else if (this.type == 4)
      {
        G *= 0.1f;
        R *= 0.5f;
      }
      else if (this.type == 257)
      {
        G *= 0.9f;
        R *= 0.1f;
      }
      else if (this.type == 9)
      {
        G *= 0.1f;
        B *= 0.6f;
      }
      else if (this.type == 488)
      {
        R = 0.3f;
        B = 0.25f;
        G = 0.0f;
      }
      else if (this.type == 92)
      {
        G *= 0.6f;
        R *= 0.8f;
      }
      else if (this.type == 93)
      {
        G *= 1f;
        R *= 1f;
        B *= 0.01f;
      }
      else if (this.type == 12)
      {
        R *= 0.9f;
        G *= 0.8f;
        B *= 0.1f;
      }
      else if (this.type == 14 || this.type == 110 || this.type == 180 || this.type == 242 || this.type == 302)
      {
        G *= 0.7f;
        B *= 0.1f;
      }
      else if (this.type == 15)
      {
        G *= 0.4f;
        B *= 0.1f;
        R = 1f;
      }
      else if (this.type == 16)
      {
        R *= 0.1f;
        G *= 0.4f;
        B = 1f;
      }
      else if (this.type == 18)
      {
        G *= 0.1f;
        R *= 0.6f;
      }
      else if (this.type == 19)
      {
        G *= 0.5f;
        B *= 0.1f;
      }
      else if (this.type == 20)
      {
        R *= 0.1f;
        B *= 0.3f;
      }
      else if (this.type == 22)
      {
        R = 0.0f;
        G = 0.0f;
      }
      else if (this.type == 27)
      {
        R *= 0.0f;
        G *= 0.3f;
        B = 1f;
      }
      else if (this.type == 34)
      {
        G *= 0.1f;
        B *= 0.1f;
      }
      else if (this.type == 36)
      {
        R = 0.8f;
        G *= 0.2f;
        B *= 0.6f;
      }
      else if (this.type == 41)
      {
        G *= 0.8f;
        B *= 0.6f;
      }
      else if (this.type == 44 || this.type == 45)
      {
        B = 1f;
        R *= 0.6f;
        G *= 0.1f;
      }
      else if (this.type == 50)
      {
        R *= 0.7f;
        B *= 0.8f;
      }
      else if (this.type == 515)
      {
        G *= 0.6f;
        B *= 0.85f;
      }
      else if (this.type == 53)
      {
        R *= 0.7f;
        G *= 0.8f;
      }
      else if (this.type == 473)
      {
        R *= 1.05f;
        G *= 0.95f;
        B *= 0.55f;
      }
      else if (this.type == 72)
      {
        R *= 0.45f;
        G *= 0.75f;
        B = 1f;
      }
      else if (this.type == 86)
      {
        R *= 1f;
        G *= 0.45f;
        B = 0.75f;
      }
      else if (this.type == 87)
      {
        R *= 0.45f;
        G = 1f;
        B *= 0.75f;
      }
      else if (this.type == 73)
      {
        R *= 0.4f;
        G *= 0.6f;
        B *= 1f;
      }
      else if (this.type == 74)
      {
        R *= 1f;
        G *= 0.4f;
        B *= 0.6f;
      }
      else if (this.type == 284)
      {
        R *= 1f;
        G *= 0.1f;
        B *= 0.8f;
      }
      else if (this.type == 285)
      {
        R *= 0.1f;
        G *= 0.5f;
        B *= 1f;
      }
      else if (this.type == 286)
      {
        R *= 1f;
        G *= 0.5f;
        B *= 0.1f;
      }
      else if (this.type == 287)
      {
        R *= 0.9f;
        G *= 1f;
        B *= 0.4f;
      }
      else if (this.type == 283)
      {
        R *= 0.8f;
        G *= 0.1f;
      }
      else if (this.type == 76 || this.type == 77 || this.type == 78)
      {
        R *= 1f;
        G *= 0.3f;
        B *= 0.6f;
      }
      else if (this.type == 79)
      {
        R = (float) Main.DiscoR / (float) byte.MaxValue;
        G = (float) Main.DiscoG / (float) byte.MaxValue;
        B = (float) Main.DiscoB / (float) byte.MaxValue;
      }
      else if (this.type == 80)
      {
        R *= 0.0f;
        G *= 0.8f;
        B *= 1f;
      }
      else if (this.type == 83 || this.type == 88)
      {
        R *= 0.7f;
        G *= 0.0f;
        B *= 1f;
      }
      else if (this.type == 100)
      {
        R *= 1f;
        G *= 0.5f;
        B *= 0.0f;
      }
      else if (this.type == 84 || this.type == 389)
      {
        R *= 0.8f;
        G *= 0.0f;
        B *= 0.5f;
      }
      else if (this.type == 89 || this.type == 90)
      {
        G *= 0.2f;
        B *= 1f;
        R *= 0.05f;
      }
      else if (this.type == 106)
      {
        R *= 0.0f;
        G *= 0.5f;
        B *= 1f;
      }
      else if (this.type == 113)
      {
        R *= 0.25f;
        G *= 0.75f;
        B *= 1f;
      }
      else if (this.type == 114 || this.type == 115)
      {
        R *= 0.5f;
        G *= 0.05f;
        B *= 1f;
      }
      else if (this.type == 116)
        B *= 0.25f;
      else if (this.type == 131)
      {
        R *= 0.1f;
        G *= 0.4f;
      }
      else if (this.type == 132 || this.type == 157)
      {
        R *= 0.2f;
        B *= 0.6f;
      }
      else if (this.type == 156)
      {
        R *= 1f;
        B *= 0.6f;
        G = 0.0f;
      }
      else if (this.type == 173)
      {
        R *= 0.3f;
        B *= 1f;
        G = 0.4f;
      }
      else if (this.type == 207)
      {
        R *= 0.4f;
        B *= 0.4f;
      }
      else if (this.type == 253)
      {
        R = 0.0f;
        G *= 0.4f;
      }
      else if (this.type == 211)
      {
        R *= 0.5f;
        G *= 0.9f;
        B *= 1f;
        this.light = (double) this.localAI[0] != 0.0 ? 1f : 1.5f;
      }
      else if (this.type == 209)
      {
        float num1 = (float) (((double) byte.MaxValue - (double) this.alpha) / (double) byte.MaxValue);
        float num2 = R * 0.3f;
        float num3 = G * 0.4f;
        B = B * 1.75f * num1;
        R = num2 * num1;
        G = num3 * num1;
      }
      else if (this.type == 226 || this.type == 227 | this.type == 229)
      {
        R *= 0.25f;
        G *= 1f;
        B *= 0.5f;
      }
      else if (this.type == 251)
      {
        float num4 = (float) Main.DiscoR / (float) byte.MaxValue;
        float num5 = (float) Main.DiscoG / (float) byte.MaxValue;
        float num6 = (float) Main.DiscoB / (float) byte.MaxValue;
        float num7 = (float) (((double) num4 + 1.0) / 2.0);
        float num8 = (float) (((double) num5 + 1.0) / 2.0);
        float num9 = (float) (((double) num6 + 1.0) / 2.0);
        R = num7 * this.light;
        G = num8 * this.light;
        B = num9 * this.light;
      }
      else if (this.type == 278 || this.type == 279)
      {
        R *= 1f;
        G *= 1f;
        B *= 0.0f;
      }
      Lighting.AddLight((int) (((double) this.position.X + (double) (this.width / 2)) / 16.0), (int) (((double) this.position.Y + (double) (this.height / 2)) / 16.0), R, G, B);
    }

    public Microsoft.Xna.Framework.Rectangle getRect() => new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height);

    public void Update(int i)
    {
      if (!this.active)
        return;
      this.numUpdates = this.extraUpdates;
      while (this.numUpdates >= 0)
      {
        --this.numUpdates;
        if (this.type == 640 && (double) this.ai[1] > 0.0)
        {
          --this.ai[1];
        }
        else
        {
          if ((double) this.position.X <= (double) Main.leftWorld || (double) this.position.X + (double) this.width >= (double) Main.rightWorld || (double) this.position.Y <= (double) Main.topWorld || (double) this.position.Y + (double) this.height >= (double) Main.bottomWorld)
          {
            this.active = false;
            return;
          }
          if (this.type != 344 && !this.npcProj)
          {
            if (Main.player[this.owner].frostBurn && (this.melee || this.ranged) && this.friendly && !this.hostile && !this.noEnchantments && Main.rand.Next(2 * (1 + this.extraUpdates)) == 0)
            {
              int index = Dust.NewDust(this.position, this.width, this.height, 135, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 2f);
              Main.dust[index].noGravity = true;
              Main.dust[index].velocity *= 0.7f;
              Main.dust[index].velocity.Y -= 0.5f;
            }
            if (this.melee && Main.player[this.owner].meleeEnchant > (byte) 0 && !this.noEnchantments)
            {
              if (Main.player[this.owner].meleeEnchant == (byte) 1 && Main.rand.Next(3) == 0)
              {
                int index = Dust.NewDust(this.position, this.width, this.height, 171, Alpha: 100);
                Main.dust[index].noGravity = true;
                Main.dust[index].fadeIn = 1.5f;
                Main.dust[index].velocity *= 0.25f;
              }
              if (Main.player[this.owner].meleeEnchant == (byte) 1)
              {
                if (Main.rand.Next(3) == 0)
                {
                  int index = Dust.NewDust(this.position, this.width, this.height, 171, Alpha: 100);
                  Main.dust[index].noGravity = true;
                  Main.dust[index].fadeIn = 1.5f;
                  Main.dust[index].velocity *= 0.25f;
                }
              }
              else if (Main.player[this.owner].meleeEnchant == (byte) 2)
              {
                if (Main.rand.Next(2) == 0)
                {
                  int index = Dust.NewDust(this.position, this.width, this.height, 75, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 2.5f);
                  Main.dust[index].noGravity = true;
                  Main.dust[index].velocity *= 0.7f;
                  Main.dust[index].velocity.Y -= 0.5f;
                }
              }
              else if (Main.player[this.owner].meleeEnchant == (byte) 3)
              {
                if (Main.rand.Next(2) == 0)
                {
                  int index = Dust.NewDust(this.position, this.width, this.height, 6, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 2.5f);
                  Main.dust[index].noGravity = true;
                  Main.dust[index].velocity *= 0.7f;
                  Main.dust[index].velocity.Y -= 0.5f;
                }
              }
              else if (Main.player[this.owner].meleeEnchant == (byte) 4)
              {
                if (Main.rand.Next(2) == 0)
                {
                  int index = Dust.NewDust(this.position, this.width, this.height, 57, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 1.1f);
                  Main.dust[index].noGravity = true;
                  Main.dust[index].velocity.X /= 2f;
                  Main.dust[index].velocity.Y /= 2f;
                }
              }
              else if (Main.player[this.owner].meleeEnchant == (byte) 5)
              {
                if (Main.rand.Next(2) == 0)
                {
                  int index = Dust.NewDust(this.position, this.width, this.height, 169, Alpha: 100);
                  Main.dust[index].velocity.X += (float) this.direction;
                  Main.dust[index].velocity.Y += 0.2f;
                  Main.dust[index].noGravity = true;
                }
              }
              else if (Main.player[this.owner].meleeEnchant == (byte) 6)
              {
                if (Main.rand.Next(2) == 0)
                {
                  int index = Dust.NewDust(this.position, this.width, this.height, 135, Alpha: 100);
                  Main.dust[index].velocity.X += (float) this.direction;
                  Main.dust[index].velocity.Y += 0.2f;
                  Main.dust[index].noGravity = true;
                }
              }
              else if (Main.player[this.owner].meleeEnchant == (byte) 7)
              {
                Vector2 velocity = this.velocity;
                if ((double) velocity.Length() > 4.0)
                  velocity *= 4f / velocity.Length();
                if (Main.rand.Next(20) == 0)
                {
                  int index = Dust.NewDust(this.position, this.width, this.height, Main.rand.Next(139, 143), velocity.X, velocity.Y, Scale: 1.2f);
                  Main.dust[index].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
                  Main.dust[index].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
                  Main.dust[index].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f;
                  Main.dust[index].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f;
                  Main.dust[index].scale *= (float) (1.0 + (double) Main.rand.Next(-30, 31) * 0.00999999977648258);
                }
                if (Main.rand.Next(40) == 0)
                {
                  int Type = Main.rand.Next(276, 283);
                  int index = Gore.NewGore(this.position, velocity, Type);
                  Main.gore[index].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
                  Main.gore[index].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
                  Main.gore[index].scale *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258);
                  Main.gore[index].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f;
                  Main.gore[index].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f;
                }
              }
              else if (Main.player[this.owner].meleeEnchant == (byte) 8 && Main.rand.Next(4) == 0)
              {
                int index = Dust.NewDust(this.position, this.width, this.height, 46, Alpha: 100);
                Main.dust[index].noGravity = true;
                Main.dust[index].fadeIn = 1.5f;
                Main.dust[index].velocity *= 0.25f;
              }
            }
            if (this.melee && Main.player[this.owner].magmaStone && !this.noEnchantments && Main.rand.Next(3) != 0)
            {
              int index = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y - 4f), this.width + 8, this.height + 8, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 2f);
              if (Main.rand.Next(2) == 0)
                Main.dust[index].scale = 1.5f;
              Main.dust[index].noGravity = true;
              Main.dust[index].velocity.X *= 2f;
              Main.dust[index].velocity.Y *= 2f;
            }
          }
          if (this.minion && this.numUpdates == -1 && this.type != 625 && this.type != 628)
          {
            this.minionPos = Main.player[this.owner].numMinions;
            if ((double) Main.player[this.owner].slotsMinions + (double) this.minionSlots > (double) Main.player[this.owner].maxMinions && this.owner == Main.myPlayer)
            {
              if (this.type == 627 || this.type == 626)
              {
                int byUuid = Projectile.GetByUUID(this.owner, this.ai[0]);
                if (byUuid != -1)
                {
                  Projectile projectile1 = Main.projectile[byUuid];
                  if (projectile1.type != 625)
                    projectile1.localAI[1] = this.localAI[1];
                  Projectile projectile2 = Main.projectile[(int) this.localAI[1]];
                  projectile2.ai[0] = this.ai[0];
                  projectile2.ai[1] = 1f;
                  projectile2.netUpdate = true;
                }
              }
              this.Kill();
            }
            else
            {
              ++Main.player[this.owner].numMinions;
              Main.player[this.owner].slotsMinions += this.minionSlots;
            }
          }
          float num1 = (float) (1.0 + (double) Math.Abs(this.velocity.X) / 3.0);
          if ((double) this.gfxOffY > 0.0)
          {
            this.gfxOffY -= num1 * this.stepSpeed;
            if ((double) this.gfxOffY < 0.0)
              this.gfxOffY = 0.0f;
          }
          else if ((double) this.gfxOffY < 0.0)
          {
            this.gfxOffY += num1 * this.stepSpeed;
            if ((double) this.gfxOffY > 0.0)
              this.gfxOffY = 0.0f;
          }
          if ((double) this.gfxOffY > 16.0)
            this.gfxOffY = 16f;
          if ((double) this.gfxOffY < -16.0)
            this.gfxOffY = -16f;
          Vector2 velocity1 = this.velocity;
          this.oldVelocity = this.velocity;
          this.whoAmI = i;
          if (this.soundDelay > 0)
            --this.soundDelay;
          this.netUpdate = false;
          for (int index = 0; index < (int) byte.MaxValue; ++index)
          {
            if (this.playerImmune[index] > 0)
              --this.playerImmune[index];
          }
          if (this.usesLocalNPCImmunity)
          {
            for (int index = 0; index < 200; ++index)
            {
              if (this.localNPCImmunity[index] > 0)
                --this.localNPCImmunity[index];
            }
          }
          this.AI();
          if (this.owner < (int) byte.MaxValue && !Main.player[this.owner].active)
            this.Kill();
          if (this.type == 242 || this.type == 302 || this.type == 638)
            this.wet = false;
          if (!this.ignoreWater)
          {
            bool flag1;
            bool flag2;
            try
            {
              flag1 = Collision.LavaCollision(this.position, this.width, this.height);
              flag2 = Collision.WetCollision(this.position, this.width, this.height);
              if (flag1)
                this.lavaWet = true;
              if (Collision.honey)
                this.honeyWet = true;
            }
            catch
            {
              this.active = false;
              return;
            }
            if (this.wet && !this.lavaWet)
            {
              if (this.type == 85 || this.type == 15 || this.type == 34 || this.type == 188)
                this.Kill();
              if (this.type == 2)
              {
                this.type = 1;
                this.light = 0.0f;
              }
            }
            if (this.type == 80)
            {
              flag2 = false;
              this.wet = false;
              if (flag1 && (double) this.ai[0] >= 0.0)
                this.Kill();
            }
            if (flag2)
            {
              if (this.type != 155 && this.wetCount == (byte) 0 && !this.wet)
              {
                if (!flag1)
                {
                  if (this.honeyWet)
                  {
                    for (int index1 = 0; index1 < 10; ++index1)
                    {
                      int index2 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, 152);
                      --Main.dust[index2].velocity.Y;
                      Main.dust[index2].velocity.X *= 2.5f;
                      Main.dust[index2].scale = 1.3f;
                      Main.dust[index2].alpha = 100;
                      Main.dust[index2].noGravity = true;
                    }
                    Main.PlaySound(19, (int) this.position.X, (int) this.position.Y);
                  }
                  else
                  {
                    for (int index3 = 0; index3 < 10; ++index3)
                    {
                      int index4 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, Dust.dustWater());
                      Main.dust[index4].velocity.Y -= 4f;
                      Main.dust[index4].velocity.X *= 2.5f;
                      Main.dust[index4].scale = 1.3f;
                      Main.dust[index4].alpha = 100;
                      Main.dust[index4].noGravity = true;
                    }
                    Main.PlaySound(19, (int) this.position.X, (int) this.position.Y);
                  }
                }
                else
                {
                  for (int index5 = 0; index5 < 10; ++index5)
                  {
                    int index6 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, 35);
                    Main.dust[index6].velocity.Y -= 1.5f;
                    Main.dust[index6].velocity.X *= 2.5f;
                    Main.dust[index6].scale = 1.3f;
                    Main.dust[index6].alpha = 100;
                    Main.dust[index6].noGravity = true;
                  }
                  Main.PlaySound(19, (int) this.position.X, (int) this.position.Y);
                }
              }
              this.wet = true;
            }
            else if (this.wet)
            {
              this.wet = false;
              if (this.type == 155)
                this.velocity.Y *= 0.5f;
              else if (this.wetCount == (byte) 0)
              {
                this.wetCount = (byte) 10;
                if (!this.lavaWet)
                {
                  if (this.honeyWet)
                  {
                    for (int index7 = 0; index7 < 10; ++index7)
                    {
                      int index8 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, 152);
                      --Main.dust[index8].velocity.Y;
                      Main.dust[index8].velocity.X *= 2.5f;
                      Main.dust[index8].scale = 1.3f;
                      Main.dust[index8].alpha = 100;
                      Main.dust[index8].noGravity = true;
                    }
                    Main.PlaySound(19, (int) this.position.X, (int) this.position.Y);
                  }
                  else
                  {
                    for (int index9 = 0; index9 < 10; ++index9)
                    {
                      int index10 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float) (this.height / 2)), this.width + 12, 24, Dust.dustWater());
                      Main.dust[index10].velocity.Y -= 4f;
                      Main.dust[index10].velocity.X *= 2.5f;
                      Main.dust[index10].scale = 1.3f;
                      Main.dust[index10].alpha = 100;
                      Main.dust[index10].noGravity = true;
                    }
                    Main.PlaySound(19, (int) this.position.X, (int) this.position.Y);
                  }
                }
                else
                {
                  for (int index11 = 0; index11 < 10; ++index11)
                  {
                    int index12 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, 35);
                    Main.dust[index12].velocity.Y -= 1.5f;
                    Main.dust[index12].velocity.X *= 2.5f;
                    Main.dust[index12].scale = 1.3f;
                    Main.dust[index12].alpha = 100;
                    Main.dust[index12].noGravity = true;
                  }
                  Main.PlaySound(19, (int) this.position.X, (int) this.position.Y);
                }
              }
            }
            if (!this.wet)
            {
              this.lavaWet = false;
              this.honeyWet = false;
            }
            if (this.wetCount > (byte) 0)
              --this.wetCount;
          }
          this.oldPosition = this.position;
          this.oldDirection = this.direction;
          this.HandleMovement(velocity1, out int _, out int _);
          if ((this.aiStyle != 3 || (double) this.ai[0] != 1.0) && (this.aiStyle != 7 || (double) this.ai[0] != 1.0) && (this.aiStyle != 13 || (double) this.ai[0] != 1.0) && this.aiStyle != 65 && this.aiStyle != 69 && this.aiStyle != 114 && this.aiStyle != 123 && this.aiStyle != 112 && !this.manualDirectionChange && this.aiStyle != 67 && this.aiStyle != 26 && this.aiStyle != 15)
          {
            if ((double) this.velocity.X < 0.0)
              this.direction = -1;
            else
              this.direction = 1;
          }
          if (!this.active)
            return;
          this.ProjLight();
          if (!this.npcProj && this.friendly && Main.player[this.owner].magicQuiver && this.extraUpdates < 1 && this.arrow)
            this.extraUpdates = 1;
          if (this.type == 2 || this.type == 82)
            Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100);
          else if (this.type == 172)
            Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, Alpha: 100);
          else if (this.type == 103)
          {
            int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 75, Alpha: 100);
            if (Main.rand.Next(2) == 0)
            {
              Main.dust[index].noGravity = true;
              Main.dust[index].scale *= 2f;
            }
          }
          else if (this.type == 278)
          {
            int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 169, Alpha: 100);
            if (Main.rand.Next(2) == 0)
            {
              Main.dust[index].noGravity = true;
              Main.dust[index].scale *= 1.5f;
            }
          }
          else if (this.type == 4)
          {
            if (Main.rand.Next(5) == 0)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, Alpha: 150, Scale: 1.1f);
          }
          else if (this.type == 5)
          {
            int Type;
            switch (Main.rand.Next(3))
            {
              case 0:
                Type = 15;
                break;
              case 1:
                Type = 57;
                break;
              default:
                Type = 58;
                break;
            }
            Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, Scale: 1.2f);
          }
          this.Damage();
          if (this.type == 434 && (double) this.localAI[0] == 0.0 && this.numUpdates == 0)
          {
            this.extraUpdates = 1;
            this.velocity = Vector2.Zero;
            this.localAI[0] = 1f;
            this.localAI[1] = 0.9999f;
            this.netUpdate = true;
          }
          if (Main.netMode != 1 && (this.type == 99 || this.type == 444))
            Collision.SwitchTiles(this.position, this.width, this.height, this.oldPosition, 3);
          if (ProjectileID.Sets.TrailingMode[this.type] == 0)
          {
            for (int index = this.oldPos.Length - 1; index > 0; --index)
              this.oldPos[index] = this.oldPos[index - 1];
            this.oldPos[0] = this.position;
          }
          else if (ProjectileID.Sets.TrailingMode[this.type] == 1)
          {
            if (this.frameCounter == 0 || this.oldPos[0] == Vector2.Zero)
            {
              for (int index = this.oldPos.Length - 1; index > 0; --index)
                this.oldPos[index] = this.oldPos[index - 1];
              this.oldPos[0] = this.position;
              if (this.velocity == Vector2.Zero && this.type == 466)
              {
                float num2 = (float) ((double) this.rotation + 1.57079637050629 + (Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629);
                float num3 = (float) (Main.rand.NextDouble() * 2.0 + 2.0);
                Vector2 vector2 = new Vector2((float) Math.Cos((double) num2) * num3, (float) Math.Sin((double) num2) * num3);
                int index = Dust.NewDust(this.oldPos[this.oldPos.Length - 1], 0, 0, 229, vector2.X, vector2.Y);
                Main.dust[index].noGravity = true;
                Main.dust[index].scale = 1.7f;
              }
              if (this.velocity == Vector2.Zero && this.type == 580)
              {
                float num4 = (float) ((double) this.rotation + 1.57079637050629 + (Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629);
                float num5 = (float) (Main.rand.NextDouble() * 2.0 + 2.0);
                Vector2 vector2 = new Vector2((float) Math.Cos((double) num4) * num5, (float) Math.Sin((double) num4) * num5);
                int index = Dust.NewDust(this.oldPos[this.oldPos.Length - 1], 0, 0, 229, vector2.X, vector2.Y);
                Main.dust[index].noGravity = true;
                Main.dust[index].scale = 1.7f;
              }
            }
          }
          else if (ProjectileID.Sets.TrailingMode[this.type] == 2)
          {
            for (int index = this.oldPos.Length - 1; index > 0; --index)
            {
              this.oldPos[index] = this.oldPos[index - 1];
              this.oldRot[index] = this.oldRot[index - 1];
              this.oldSpriteDirection[index] = this.oldSpriteDirection[index - 1];
            }
            this.oldPos[0] = this.position;
            this.oldRot[0] = this.rotation;
            this.oldSpriteDirection[0] = this.spriteDirection;
          }
          if (ProjectileID.Sets.IsADD2Turret[this.type] && DD2Event.Ongoing)
            ++this.timeLeft;
          --this.timeLeft;
          if (this.timeLeft <= 0)
            this.Kill();
          if (this.penetrate == 0)
            this.Kill();
          if (this.active && this.owner == Main.myPlayer)
          {
            if (this.netUpdate2)
              this.netUpdate = true;
            if (!this.active)
              this.netSpam = 0;
            if (this.netUpdate)
            {
              if (this.netSpam < 60)
              {
                this.netSpam += 5;
                NetMessage.SendData(27, number: i);
                this.netUpdate2 = false;
              }
              else
                this.netUpdate2 = true;
            }
            if (this.netSpam > 0)
              --this.netSpam;
          }
        }
      }
      this.netUpdate = false;
    }

    private void HandleMovement(Vector2 wetVelocity, out int overrideWidth, out int overrideHeight)
    {
      bool flag1 = false;
      overrideWidth = -1;
      overrideHeight = -1;
      bool flag2 = false;
      bool? nullable1 = ProjectileID.Sets.ForcePlateDetection[this.type];
      bool flag3 = nullable1.HasValue && !nullable1.Value;
      bool flag4 = nullable1.HasValue && nullable1.Value;
      if (this.tileCollide)
      {
        Vector2 velocity1 = this.velocity;
        bool flag5 = true;
        Vector2? nullable2 = new Vector2?();
        if (Main.projPet[this.type])
        {
          flag5 = false;
          if ((double) Main.player[this.owner].position.Y + (double) Main.player[this.owner].height - 12.0 > (double) this.position.Y + (double) this.height)
            flag5 = true;
        }
        if (this.type == 500)
        {
          flag5 = false;
          if ((double) Main.player[this.owner].Bottom.Y > (double) this.Bottom.Y + 4.0)
            flag5 = true;
        }
        if (this.type == 653)
        {
          flag5 = false;
          if ((double) Main.player[this.owner].Bottom.Y > (double) this.Bottom.Y + 4.0)
            flag5 = true;
        }
        if (this.aiStyle == 62)
          flag5 = true;
        if (this.aiStyle == 66)
          flag5 = true;
        if (this.type == 317)
          flag5 = true;
        if (this.type == 373)
          flag5 = true;
        if (this.aiStyle == 53)
          flag5 = false;
        if (this.type == 9 || this.type == 12 || this.type == 15 || this.type == 13 || this.type == 31 || this.type == 39 || this.type == 40)
          flag5 = false;
        if (this.type == 24)
          flag5 = false;
        switch (this.type)
        {
          case 663:
          case 665:
          case 667:
          case 677:
          case 678:
          case 679:
          case 688:
          case 689:
          case 690:
          case 691:
          case 692:
          case 693:
            flag5 = false;
            break;
        }
        if (this.aiStyle == 29 || this.type == 28 || this.aiStyle == 49)
        {
          overrideWidth = this.width - 8;
          overrideHeight = this.height - 8;
        }
        else if (this.type == 250 || this.type == 267 || this.type == 297 || this.type == 323 || this.type == 3 || this.type == 711)
        {
          overrideWidth = 6;
          overrideHeight = 6;
        }
        else if (this.type == 308)
        {
          overrideWidth = 26;
          overrideHeight = this.height;
        }
        else if (this.type == 663 || this.type == 665 || this.type == 667 || this.type == 677 || this.type == 678 || this.type == 679 || this.type == 691 || this.type == 692 || this.type == 693)
        {
          overrideWidth = 16;
          overrideHeight = this.height;
        }
        else if (this.type == 688 || this.type == 689 || this.type == 690)
        {
          overrideWidth = 16;
          overrideHeight = this.height;
          nullable2 = new Vector2?(new Vector2(0.5f, 1f));
        }
        else if (this.type == 669 || this.type == 706)
        {
          overrideWidth = 10;
          overrideHeight = 10;
        }
        else if (this.type == 261 || this.type == 277)
        {
          overrideWidth = 26;
          overrideHeight = 26;
        }
        else if (this.type == 481 || this.type == 491 || this.type == 106 || this.type == 262 || this.type == 271 || this.type == 270 || this.type == 272 || this.type == 273 || this.type == 274 || this.type == 280 || this.type == 288 || this.type == 301 || this.type == 320 || this.type == 333 || this.type == 335 || this.type == 343 || this.type == 344 || this.type == 497 || this.type == 496 || this.type == 6 || this.type == 19 || this.type == 113 || this.type == 52 || this.type == 520 || this.type == 523 || this.type == 585 || this.type == 598 || this.type == 599 || this.type == 636)
        {
          overrideWidth = 10;
          overrideHeight = 10;
        }
        else if (this.type == 514)
        {
          overrideWidth = 4;
          overrideHeight = 4;
        }
        else if (this.type == 248 || this.type == 247 || this.type == 507 || this.type == 508 || this.type == 662 || this.type == 680 || this.type == 685)
        {
          overrideWidth = this.width - 12;
          overrideHeight = this.height - 12;
        }
        else if (this.aiStyle == 18 || this.type == 254)
        {
          overrideWidth = this.width - 36;
          overrideHeight = this.height - 36;
        }
        else if (this.type == 182 || this.type == 190 || this.type == 33 || this.type == 229 || this.type == 237 || this.type == 243)
        {
          overrideWidth = this.width - 20;
          overrideHeight = this.height - 20;
        }
        else if (this.aiStyle == 27)
        {
          overrideWidth = this.width - 12;
          overrideHeight = this.height - 12;
        }
        else if (this.type == 533 && (double) this.ai[0] >= 6.0)
        {
          overrideWidth = this.width + 6;
          overrideHeight = this.height + 6;
        }
        else if (this.type == 582 || this.type == 634 || this.type == 635)
        {
          overrideWidth = 8;
          overrideHeight = 8;
        }
        else if (this.type == 617)
        {
          overrideWidth = (int) (20.0 * (double) this.scale);
          overrideHeight = (int) (20.0 * (double) this.scale);
        }
        if ((this.type != 440 && this.type != 449 && this.type != 606 || (double) this.ai[1] != 1.0) && (this.type != 466 || (double) this.localAI[1] != 1.0) && (this.type != 580 || (double) this.localAI[1] <= 0.0) && (this.type != 640 || (double) this.localAI[1] <= 0.0))
        {
          if (this.aiStyle == 10)
          {
            if (this.type == 42 || this.type == 65 || this.type == 68 || this.type == 354 || this.type == 31 && (double) this.ai[0] == 2.0)
              this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, flag5, flag5);
            else
              this.velocity = Collision.AnyCollision(this.position, this.velocity, this.width, this.height, true);
          }
          else
          {
            Vector2 Position = this.position;
            int num1 = overrideWidth != -1 ? overrideWidth : this.width;
            int num2 = overrideHeight != -1 ? overrideHeight : this.height;
            if (overrideHeight != -1 || overrideWidth != -1)
              Position = !nullable2.HasValue ? new Vector2(this.position.X + (float) (this.width / 2) - (float) (num1 / 2), this.position.Y + (float) (this.height / 2) - (float) (num2 / 2)) : this.Center - new Vector2((float) num1, (float) num2) * nullable2.Value;
            if (this.wet)
            {
              if (this.honeyWet)
              {
                Vector2 velocity2 = this.velocity;
                this.velocity = Collision.TileCollision(Position, this.velocity, num1, num2, flag5, flag5);
                wetVelocity = this.velocity * 0.25f;
                if ((double) this.velocity.X != (double) velocity2.X)
                  wetVelocity.X = this.velocity.X;
                if ((double) this.velocity.Y != (double) velocity2.Y)
                  wetVelocity.Y = this.velocity.Y;
              }
              else
              {
                Vector2 velocity3 = this.velocity;
                this.velocity = Collision.TileCollision(Position, this.velocity, num1, num2, flag5, flag5);
                wetVelocity = this.velocity * 0.5f;
                if ((double) this.velocity.X != (double) velocity3.X)
                  wetVelocity.X = this.velocity.X;
                if ((double) this.velocity.Y != (double) velocity3.Y)
                  wetVelocity.Y = this.velocity.Y;
              }
            }
            else
            {
              int num3 = Math.Min(num1, num2);
              if (num3 < 3)
                num3 = 3;
              if (num3 > 16)
                num3 = 16;
              if ((double) this.velocity.Length() > (double) num3)
              {
                Vector2 vector2_1 = Collision.TileCollision(Position, this.velocity, num1, num2, flag5, flag5);
                float num4 = this.velocity.Length();
                float num5 = (float) num3;
                Vector2 vector2_2 = Vector2.Normalize(this.velocity);
                if ((double) vector2_1.Y == 0.0)
                  vector2_2.Y = 0.0f;
                Vector2 zero1 = Vector2.Zero;
                Vector2 zero2 = Vector2.Zero;
                Vector2 zero3 = Vector2.Zero;
                int num6 = 0;
                while ((double) num4 > 0.0)
                {
                  ++num6;
                  if (num6 <= 300)
                  {
                    Vector2 oldPosition = Position;
                    float num7 = num4;
                    if ((double) num7 > (double) num5)
                      num7 = num5;
                    num4 -= num7;
                    Vector2 Velocity = vector2_2 * num7;
                    Vector2 vector2_3 = Collision.TileCollision(Position, Velocity, num1, num2, flag5, flag5);
                    Position += vector2_3;
                    this.velocity = vector2_3;
                    if (!Main.projPet[this.type])
                    {
                      Vector4 vector4 = Collision.SlopeCollision(Position, this.velocity, num1, num2, fall: true);
                      Vector2 vector2_4 = this.position - Position;
                      if ((double) Position.X != (double) vector4.X)
                        flag1 = true;
                      if ((double) Position.Y != (double) vector4.Y)
                        flag1 = true;
                      if ((double) this.velocity.X != (double) vector4.Z)
                        flag1 = true;
                      if ((double) this.velocity.Y != (double) vector4.W)
                        flag1 = true;
                      Position.X = vector4.X;
                      Position.Y = vector4.Y;
                      zero3 += Position + vector2_4 - this.position;
                      this.velocity.X = vector4.Z;
                      this.velocity.Y = vector4.W;
                    }
                    flag2 = true;
                    if (this.owner == Main.myPlayer && Position != oldPosition && !flag3)
                      Collision.SwitchTiles(Position, num1, num2, oldPosition, 4);
                    Vector2 velocity4 = this.velocity;
                    zero1 += velocity4;
                  }
                  else
                    break;
                }
                this.velocity = zero1;
                if ((double) Math.Abs(this.velocity.X - velocity1.X) < 9.99999974737875E-05)
                  this.velocity.X = velocity1.X;
                if ((double) Math.Abs(this.velocity.Y - velocity1.Y) < 9.99999974737875E-05)
                  this.velocity.Y = velocity1.Y;
                if (!Main.projPet[this.type])
                {
                  Vector4 vector4 = Collision.SlopeCollision(Position, this.velocity, num1, num2, fall: true);
                  Vector2 vector2_5 = this.position - Position;
                  if ((double) Position.X != (double) vector4.X)
                    flag1 = true;
                  if ((double) Position.Y != (double) vector4.Y)
                    flag1 = true;
                  if ((double) this.velocity.X != (double) vector4.Z)
                    flag1 = true;
                  if ((double) this.velocity.Y != (double) vector4.W)
                    flag1 = true;
                  Position.X = vector4.X;
                  Position.Y = vector4.Y;
                  this.position = Position + vector2_5;
                  this.velocity.X = vector4.Z;
                  this.velocity.Y = vector4.W;
                }
              }
              else
              {
                this.velocity = Collision.TileCollision(Position, this.velocity, num1, num2, flag5, flag5);
                if (!Main.projPet[this.type])
                {
                  Vector4 vector4 = Collision.SlopeCollision(Position, this.velocity, num1, num2, fall: true);
                  Vector2 vector2 = this.position - Position;
                  if ((double) Position.X != (double) vector4.X)
                    flag1 = true;
                  if ((double) Position.Y != (double) vector4.Y)
                    flag1 = true;
                  if ((double) this.velocity.X != (double) vector4.Z)
                    flag1 = true;
                  if ((double) this.velocity.Y != (double) vector4.W)
                    flag1 = true;
                  Position.X = vector4.X;
                  Position.Y = vector4.Y;
                  this.position = Position + vector2;
                  this.velocity.X = vector4.Z;
                  this.velocity.Y = vector4.W;
                }
              }
            }
          }
        }
        if (velocity1 != this.velocity)
          flag1 = true;
        if (flag1)
        {
          if (this.type == 663 || this.type == 665 || this.type == 667 || this.type == 677 || this.type == 678 || this.type == 679 || this.type == 691 || this.type == 692 || this.type == 693 || this.type == 688 || this.type == 689 || this.type == 690)
          {
            this.position = this.position + this.velocity;
            this.velocity = Vector2.Zero;
          }
          else if (this.type == 434)
          {
            this.position = this.position + this.velocity;
            this.numUpdates = 0;
          }
          else if (this.type == 601)
          {
            if (this.owner == Main.myPlayer)
              PortalHelper.TryPlacingPortal(this, velocity1, this.velocity);
            this.position = this.position + this.velocity;
            this.Kill();
          }
          else if (this.type == 451)
          {
            this.ai[0] = 1f;
            this.ai[1] = 0.0f;
            this.netUpdate = true;
            this.velocity = velocity1 / 2f;
          }
          else if (this.type == 645)
          {
            this.ai[0] = 0.0f;
            this.ai[1] = -1f;
            this.netUpdate = true;
          }
          else if (this.type == 584)
          {
            bool flag6 = false;
            if ((double) this.velocity.X != (double) velocity1.X)
            {
              this.velocity.X = velocity1.X * -0.75f;
              flag6 = true;
            }
            if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 2.0 || (double) this.velocity.Y == 0.0)
            {
              this.velocity.Y = velocity1.Y * -0.75f;
              flag6 = true;
            }
            if (flag6)
            {
              float num = velocity1.Length() / this.velocity.Length();
              if ((double) num == 0.0)
                num = 1f;
              this.velocity = this.velocity / num;
              --this.penetrate;
            }
          }
          else if (this.type == 532)
          {
            bool flag7 = false;
            if ((double) this.velocity.X != (double) velocity1.X)
            {
              this.velocity.X = velocity1.X * -0.75f;
              flag7 = true;
            }
            if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 2.0 || (double) this.velocity.Y == 0.0)
            {
              this.velocity.Y = velocity1.Y * -0.75f;
              flag7 = true;
            }
            if (flag7)
            {
              float num = velocity1.Length() / this.velocity.Length();
              if ((double) num == 0.0)
                num = 1f;
              this.velocity = this.velocity / num;
              --this.penetrate;
              Collision.HitTiles(this.position, velocity1, this.width, this.height);
            }
          }
          else if (this.type == 533)
          {
            float num8 = 1f;
            bool flag8 = false;
            if ((double) this.velocity.X != (double) velocity1.X)
            {
              this.velocity.X = velocity1.X * -num8;
              flag8 = true;
            }
            if ((double) this.velocity.Y != (double) velocity1.Y || (double) this.velocity.Y == 0.0)
            {
              this.velocity.Y = (float) ((double) velocity1.Y * -(double) num8 * 0.5);
              flag8 = true;
            }
            if (flag8)
            {
              float num9 = velocity1.Length() / this.velocity.Length();
              if ((double) num9 == 0.0)
                num9 = 1f;
              this.velocity = this.velocity / num9;
              if ((double) this.ai[0] == 7.0 && (double) this.velocity.Y < -0.1)
                this.velocity.Y += 0.1f;
              if ((double) this.ai[0] >= 6.0 && (double) this.ai[0] < 9.0)
                Collision.HitTiles(this.position, velocity1, this.width, this.height);
            }
          }
          else if (this.type == 502)
          {
            ++this.ai[0];
            Main.PlaySound(37, (int) this.position.X, (int) this.position.Y, 5 + (int) this.ai[0]);
            if ((double) this.ai[0] >= 5.0)
            {
              this.position = this.position + this.velocity;
              this.Kill();
            }
            else
            {
              if ((double) this.velocity.Y != (double) velocity1.Y)
                this.velocity.Y = -velocity1.Y;
              if ((double) this.velocity.X != (double) velocity1.X)
                this.velocity.X = -velocity1.X;
            }
            Vector2 spinningpoint = new Vector2(0.0f, -3f - this.ai[0]).RotatedByRandom(3.14159274101257);
            float num10 = (float) (10.0 + (double) this.ai[0] * 4.0);
            Vector2 vector2 = new Vector2(1.05f, 1f);
            for (float num11 = 0.0f; (double) num11 < (double) num10; ++num11)
            {
              int index = Dust.NewDust(this.Center, 0, 0, 66, newColor: Color.Transparent);
              Main.dust[index].position = this.Center;
              Main.dust[index].velocity = spinningpoint.RotatedBy(6.28318548202515 * (double) num11 / (double) num10) * vector2 * (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.400000005960464);
              Main.dust[index].color = Main.hslToRgb(num11 / num10, 1f, 0.5f);
              Main.dust[index].noGravity = true;
              Main.dust[index].scale = (float) (1.0 + (double) this.ai[0] / 3.0);
            }
            if (Main.myPlayer == this.owner)
            {
              int width = this.width;
              int height = this.height;
              int penetrate = this.penetrate;
              this.position = this.Center;
              this.width = this.height = 40 + 8 * (int) this.ai[0];
              this.Center = this.position;
              this.penetrate = -1;
              this.Damage();
              this.penetrate = penetrate;
              this.position = this.Center;
              this.width = width;
              this.height = height;
              this.Center = this.position;
            }
          }
          else if (this.type == 653)
          {
            if ((double) this.velocity.Y != (double) velocity1.Y && (double) this.velocity.Y == 0.0 && (double) velocity1.Y > 1.0 && (double) velocity1.Y < 4.0)
              this.velocity.Y = (float) (-(double) velocity1.Y * 2.0);
          }
          else if (this.type == 444)
          {
            if ((double) this.velocity.X != (double) velocity1.X)
              this.velocity.X = -velocity1.X;
            if ((double) this.velocity.Y != (double) velocity1.Y)
              this.velocity.Y = -velocity1.Y;
            this.ai[0] = this.velocity.ToRotation();
          }
          else if (this.type == 617)
          {
            if ((double) this.velocity.X != (double) velocity1.X)
              this.velocity.X = (float) (-(double) velocity1.X * 0.349999994039536);
            if ((double) this.velocity.Y != (double) velocity1.Y)
              this.velocity.Y = (float) (-(double) velocity1.Y * 0.349999994039536);
          }
          else if (this.type == 440 || this.type == 449 || this.type == 606)
          {
            if ((double) this.ai[1] != 1.0)
            {
              this.ai[1] = 1f;
              this.position = this.position + this.velocity;
              this.velocity = velocity1;
            }
          }
          else if (this.type == 466 || this.type == 580 || this.type == 640)
          {
            if ((double) this.localAI[1] < 1.0)
            {
              this.localAI[1] += 2f;
              this.position = this.position + this.velocity;
              this.velocity = Vector2.Zero;
            }
          }
          else if (this.aiStyle == 54)
          {
            if ((double) this.velocity.X != (double) velocity1.X)
              this.velocity.X = velocity1.X * -0.6f;
            if ((double) this.velocity.Y != (double) velocity1.Y)
              this.velocity.Y = velocity1.Y * -0.6f;
          }
          else if (!Main.projPet[this.type] && this.type != 500 && this.type != 650)
          {
            if (this.aiStyle == 99)
            {
              if (this.type >= 556 && this.type <= 561)
              {
                bool flag9 = false;
                if ((double) this.velocity.X != (double) velocity1.X)
                {
                  flag9 = true;
                  this.velocity.X = velocity1.X * -1f;
                }
                if ((double) this.velocity.Y != (double) velocity1.Y)
                {
                  flag9 = true;
                  this.velocity.Y = velocity1.Y * -1f;
                }
                if (flag9)
                {
                  Vector2 vector2 = Main.player[this.owner].Center - this.Center;
                  vector2.Normalize();
                  vector2 *= this.velocity.Length();
                  vector2 *= 0.25f;
                  this.velocity = this.velocity * 0.75f;
                  this.velocity = this.velocity + vector2;
                  if ((double) this.velocity.Length() > 6.0)
                    this.velocity = this.velocity * 0.5f;
                }
              }
            }
            else if (this.type == 604)
            {
              if ((double) this.velocity.X != (double) velocity1.X)
                this.velocity.X = -velocity1.X;
              if ((double) this.velocity.Y != (double) velocity1.Y)
                this.velocity.Y = -velocity1.Y;
            }
            else if (this.type == 379)
            {
              if ((double) this.velocity.X != (double) velocity1.X)
                this.velocity.X = velocity1.X * -0.6f;
              if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 2.0)
                this.velocity.Y = velocity1.Y * -0.6f;
            }
            else if (this.type == 491)
            {
              if ((double) this.ai[0] <= 0.0)
                this.ai[0] = -10f;
              if ((double) this.velocity.X != (double) velocity1.X && (double) Math.Abs(velocity1.X) > 0.0)
                this.velocity.X = velocity1.X * -1f;
              if ((double) this.velocity.Y != (double) velocity1.Y && (double) Math.Abs(velocity1.Y) > 0.0)
                this.velocity.Y = velocity1.Y * -1f;
            }
            else if (this.type >= 515 && this.type <= 517 || this.type == 637)
            {
              if ((double) this.velocity.X != (double) velocity1.X && (double) Math.Abs(velocity1.X) > 1.0)
                this.velocity.X = velocity1.X * -0.9f;
              if ((double) this.velocity.Y != (double) velocity1.Y && (double) Math.Abs(velocity1.Y) > 1.0)
                this.velocity.Y = velocity1.Y * -0.9f;
            }
            else if (this.type == 681)
              this.timeLeft = 4;
            else if (this.type == 409)
            {
              if ((double) this.velocity.X != (double) velocity1.X)
                this.velocity.X = velocity1.X * -1f;
              if ((double) this.velocity.Y != (double) velocity1.Y)
                this.velocity.Y = velocity1.Y * -1f;
            }
            else if (this.type == 254)
            {
              this.tileCollide = false;
              this.velocity = velocity1;
              if (this.timeLeft > 30)
                this.timeLeft = 30;
            }
            else if (this.type == 225 && this.penetrate > 0)
            {
              this.velocity.X = -velocity1.X;
              this.velocity.Y = -velocity1.Y;
              --this.penetrate;
            }
            else if (this.type == 155)
            {
              if ((double) this.ai[1] > 10.0)
              {
                NetworkText text = NetworkText.FromKey("Game.BallBounceResult", (object) NetworkText.FromKey(Lang.GetProjectileName(this.type).Key), (object) this.ai[1]);
                switch (Main.netMode)
                {
                  case 0:
                    Main.NewText(text.ToString(), G: (byte) 240, B: (byte) 20);
                    break;
                  case 2:
                    NetMessage.BroadcastChatMessage(text, new Color((int) byte.MaxValue, 240, 20));
                    break;
                }
              }
              this.ai[1] = 0.0f;
              if ((double) this.velocity.X != (double) velocity1.X)
                this.velocity.X = velocity1.X * -0.6f;
              if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 2.0)
                this.velocity.Y = velocity1.Y * -0.6f;
            }
            else if (this.aiStyle == 33)
            {
              if ((double) this.localAI[0] == 0.0)
              {
                if (this.wet)
                  this.position = this.position + velocity1 / 2f;
                else
                  this.position = this.position + velocity1;
                this.velocity = this.velocity * 0.0f;
                this.localAI[0] = 1f;
              }
            }
            else if (this.type != 308 && this.type != 377)
            {
              if (this.type == 477)
              {
                if ((double) this.velocity.Y != (double) velocity1.Y || (double) this.velocity.X != (double) velocity1.X)
                {
                  --this.penetrate;
                  if (this.penetrate <= 0)
                    this.Kill();
                  if ((double) this.velocity.X != (double) velocity1.X)
                    this.velocity.X = -velocity1.X;
                  if ((double) this.velocity.Y != (double) velocity1.Y)
                    this.velocity.Y = -velocity1.Y;
                }
                if (this.penetrate > 0 && this.owner == Main.myPlayer)
                {
                  int[] numArray = new int[10];
                  int maxValue = 0;
                  int num12 = 700;
                  int num13 = 20;
                  for (int index = 0; index < 200; ++index)
                  {
                    if (Main.npc[index].CanBeChasedBy((object) this))
                    {
                      float num14 = (this.Center - Main.npc[index].Center).Length();
                      if ((double) num14 > (double) num13 && (double) num14 < (double) num12 && Collision.CanHitLine(this.Center, 1, 1, Main.npc[index].Center, 1, 1))
                      {
                        numArray[maxValue] = index;
                        ++maxValue;
                        if (maxValue >= 9)
                          break;
                      }
                    }
                  }
                  if (maxValue > 0)
                  {
                    int index = Main.rand.Next(maxValue);
                    Vector2 vector2 = Main.npc[numArray[index]].Center - this.Center;
                    float num15 = this.velocity.Length();
                    vector2.Normalize();
                    this.velocity = vector2 * num15;
                    this.netUpdate = true;
                  }
                }
              }
              else if (this.type == 94)
              {
                if ((double) this.velocity.X != (double) velocity1.X)
                  this.velocity.X = -velocity1.X;
                if ((double) this.velocity.Y != (double) velocity1.Y)
                  this.velocity.Y = -velocity1.Y;
              }
              else if (this.type == 496)
              {
                if ((double) this.velocity.X != (double) velocity1.X)
                {
                  if ((double) Math.Abs(this.velocity.X) < 1.0)
                    this.velocity.X = -velocity1.X;
                  else
                    this.Kill();
                }
                if ((double) this.velocity.Y != (double) velocity1.Y)
                {
                  if ((double) Math.Abs(this.velocity.Y) < 1.0)
                    this.velocity.Y = -velocity1.Y;
                  else
                    this.Kill();
                }
              }
              else if (this.type == 311)
              {
                if ((double) this.velocity.X != (double) velocity1.X)
                {
                  this.velocity.X = -velocity1.X;
                  ++this.ai[1];
                }
                if ((double) this.velocity.Y != (double) velocity1.Y)
                {
                  this.velocity.Y = -velocity1.Y;
                  ++this.ai[1];
                }
                if ((double) this.ai[1] > 4.0)
                  this.Kill();
              }
              else if (this.type == 312)
              {
                if ((double) this.velocity.X != (double) velocity1.X)
                {
                  this.velocity.X = -velocity1.X;
                  ++this.ai[1];
                }
                if ((double) this.velocity.Y != (double) velocity1.Y)
                {
                  this.velocity.Y = -velocity1.Y;
                  ++this.ai[1];
                }
              }
              else if (this.type == 522 || this.type == 620)
              {
                if ((double) this.velocity.X != (double) velocity1.X)
                  this.velocity.X = -velocity1.X;
                if ((double) this.velocity.Y != (double) velocity1.Y)
                  this.velocity.Y = -velocity1.Y;
              }
              else if (this.type == 524)
              {
                this.ai[0] += 100f;
                if ((double) this.velocity.X != (double) velocity1.X)
                  this.velocity.X = -velocity1.X;
                if ((double) this.velocity.Y != (double) velocity1.Y)
                  this.velocity.Y = -velocity1.Y;
              }
              else if (this.aiStyle == 93)
              {
                if (this.velocity != velocity1)
                {
                  this.ai[1] = 0.0f;
                  this.ai[0] = 1f;
                  this.netUpdate = true;
                  this.tileCollide = false;
                  this.position = this.position + this.velocity;
                  this.velocity = velocity1;
                  this.velocity.Normalize();
                  this.velocity = this.velocity * 3f;
                }
              }
              else if (this.type == 281)
              {
                if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < 2.0 || (double) this.ai[1] == 2.0)
                {
                  this.ai[1] = 2f;
                }
                else
                {
                  if ((double) this.velocity.X != (double) velocity1.X)
                    this.velocity.X = (float) (-(double) velocity1.X * 0.5);
                  if ((double) this.velocity.Y != (double) velocity1.Y)
                    this.velocity.Y = (float) (-(double) velocity1.Y * 0.5);
                }
              }
              else if (this.type == 290 || this.type == 294)
              {
                if ((double) this.velocity.X != (double) velocity1.X)
                {
                  this.position.X += this.velocity.X;
                  this.velocity.X = -velocity1.X;
                }
                if ((double) this.velocity.Y != (double) velocity1.Y)
                {
                  this.position.Y += this.velocity.Y;
                  this.velocity.Y = -velocity1.Y;
                }
              }
              else if ((this.type == 181 || this.type == 189 || this.type == 357 || this.type == 566) && this.penetrate > 0)
              {
                if (this.type == 357)
                  this.damage = (int) ((double) this.damage * 0.9);
                --this.penetrate;
                if ((double) this.velocity.X != (double) velocity1.X)
                  this.velocity.X = -velocity1.X;
                if ((double) this.velocity.Y != (double) velocity1.Y)
                  this.velocity.Y = -velocity1.Y;
              }
              else if (this.type == 307 && (double) this.ai[1] < 5.0)
              {
                ++this.ai[1];
                if ((double) this.velocity.X != (double) velocity1.X)
                  this.velocity.X = -velocity1.X;
                if ((double) this.velocity.Y != (double) velocity1.Y)
                  this.velocity.Y = -velocity1.Y;
              }
              else if (this.type == 99)
              {
                if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 5.0)
                {
                  Collision.HitTiles(this.position, this.velocity, this.width, this.height);
                  Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
                  this.velocity.Y = (float) (-(double) velocity1.Y * 0.200000002980232);
                }
                if ((double) this.velocity.X != (double) velocity1.X)
                  this.Kill();
              }
              else if (this.type == 444)
              {
                if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 5.0)
                {
                  Collision.HitTiles(this.position, this.velocity, this.width, this.height);
                  Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
                  this.velocity.Y = (float) (-(double) velocity1.Y * 0.200000002980232);
                }
                if ((double) this.velocity.X != (double) velocity1.X)
                  this.Kill();
              }
              else if (this.type == 36)
              {
                if (this.penetrate > 1)
                {
                  Collision.HitTiles(this.position, this.velocity, this.width, this.height);
                  Main.PlaySound(SoundID.Item10, this.position);
                  --this.penetrate;
                  if ((double) this.velocity.X != (double) velocity1.X)
                    this.velocity.X = -velocity1.X;
                  if ((double) this.velocity.Y != (double) velocity1.Y)
                    this.velocity.Y = -velocity1.Y;
                }
                else
                  this.Kill();
              }
              else if (this.aiStyle == 21)
              {
                if ((double) this.velocity.X != (double) velocity1.X)
                  this.velocity.X = -velocity1.X;
                if ((double) this.velocity.Y != (double) velocity1.Y)
                  this.velocity.Y = -velocity1.Y;
              }
              else if (this.aiStyle == 17)
              {
                if ((double) this.velocity.X != (double) velocity1.X)
                  this.velocity.X = velocity1.X * -0.75f;
                if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 1.5)
                  this.velocity.Y = velocity1.Y * -0.7f;
              }
              else if (this.aiStyle == 15)
              {
                bool flag10 = false;
                if ((double) velocity1.X != (double) this.velocity.X)
                {
                  if ((double) Math.Abs(velocity1.X) > 4.0)
                    flag10 = true;
                  this.position.X += this.velocity.X;
                  this.velocity.X = (float) (-(double) velocity1.X * 0.200000002980232);
                }
                if ((double) velocity1.Y != (double) this.velocity.Y)
                {
                  if ((double) Math.Abs(velocity1.Y) > 4.0)
                    flag10 = true;
                  this.position.Y += this.velocity.Y;
                  this.velocity.Y = (float) (-(double) velocity1.Y * 0.200000002980232);
                }
                this.ai[0] = 1f;
                if (flag10)
                {
                  this.netUpdate = true;
                  Collision.HitTiles(this.position, this.velocity, this.width, this.height);
                  Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
                }
                if (this.wet)
                  wetVelocity = this.velocity;
              }
              else if (this.aiStyle == 39)
              {
                Collision.HitTiles(this.position, this.velocity, this.width, this.height);
                if (this.type == 33 || this.type == 106)
                {
                  if ((double) this.velocity.X != (double) velocity1.X)
                    this.velocity.X = -velocity1.X;
                  if ((double) this.velocity.Y != (double) velocity1.Y)
                    this.velocity.Y = -velocity1.Y;
                }
                else
                {
                  this.ai[0] = 1f;
                  if (this.aiStyle == 3)
                  {
                    this.velocity.X = -velocity1.X;
                    this.velocity.Y = -velocity1.Y;
                  }
                }
                this.netUpdate = true;
                Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
              }
              else if (this.aiStyle == 3 || this.aiStyle == 13 || this.aiStyle == 69 || this.aiStyle == 109)
              {
                Collision.HitTiles(this.position, this.velocity, this.width, this.height);
                if (this.type == 33 || this.type == 106)
                {
                  if ((double) this.velocity.X != (double) velocity1.X)
                    this.velocity.X = -velocity1.X;
                  if ((double) this.velocity.Y != (double) velocity1.Y)
                    this.velocity.Y = -velocity1.Y;
                }
                else
                {
                  this.ai[0] = 1f;
                  if ((this.aiStyle == 3 || this.aiStyle == 109) && this.type != 383)
                  {
                    this.velocity.X = -velocity1.X;
                    this.velocity.Y = -velocity1.Y;
                  }
                }
                this.netUpdate = true;
                Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
              }
              else if (this.aiStyle == 8 && this.type != 96)
              {
                Main.PlaySound(SoundID.Item10, this.position);
                ++this.ai[0];
                if ((double) this.ai[0] >= 5.0 && this.type != 253 || this.type == 253 && (double) this.ai[0] >= 8.0)
                {
                  this.position = this.position + this.velocity;
                  this.Kill();
                }
                else
                {
                  if (this.type == 15 && (double) this.velocity.Y > 4.0)
                  {
                    if ((double) this.velocity.Y != (double) velocity1.Y)
                      this.velocity.Y = (float) (-(double) velocity1.Y * 0.800000011920929);
                  }
                  else if ((double) this.velocity.Y != (double) velocity1.Y)
                    this.velocity.Y = -velocity1.Y;
                  if ((double) this.velocity.X != (double) velocity1.X)
                    this.velocity.X = -velocity1.X;
                }
              }
              else if (this.aiStyle == 61)
              {
                if ((double) this.velocity.X != (double) velocity1.X)
                  this.velocity.X = velocity1.X * -0.3f;
                if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 1.0)
                  this.velocity.Y = velocity1.Y * -0.3f;
              }
              else if (this.aiStyle == 14)
              {
                if (this.type == 261 && ((double) this.velocity.X != (double) velocity1.X && ((double) velocity1.X < -3.0 || (double) velocity1.X > 3.0) || (double) this.velocity.Y != (double) velocity1.Y && ((double) velocity1.Y < -3.0 || (double) velocity1.Y > 3.0)))
                {
                  Collision.HitTiles(this.position, this.velocity, this.width, this.height);
                  Main.PlaySound(0, (int) this.Center.X, (int) this.Center.Y);
                }
                if (this.type >= 326 && this.type <= 328 && (double) this.velocity.X != (double) velocity1.X)
                  this.velocity.X = velocity1.X * -0.1f;
                if (this.type >= 400 && this.type <= 402)
                {
                  if ((double) this.velocity.X != (double) velocity1.X)
                    this.velocity.X = velocity1.X * -0.1f;
                }
                else if (this.type == 50)
                {
                  if ((double) this.velocity.X != (double) velocity1.X)
                    this.velocity.X = velocity1.X * -0.2f;
                  if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 1.5)
                    this.velocity.Y = velocity1.Y * -0.2f;
                }
                else if (this.type == 185)
                {
                  if ((double) this.velocity.X != (double) velocity1.X)
                    this.velocity.X = velocity1.X * -0.9f;
                  if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 1.0)
                    this.velocity.Y = velocity1.Y * -0.9f;
                }
                else if (this.type == 277)
                {
                  if ((double) this.velocity.X != (double) velocity1.X)
                    this.velocity.X = velocity1.X * -0.9f;
                  if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 3.0)
                    this.velocity.Y = velocity1.Y * -0.9f;
                }
                else if (this.type != 480)
                {
                  if (this.type == 450)
                  {
                    if ((double) this.velocity.X != (double) velocity1.X)
                      this.velocity.X = velocity1.X * -0.1f;
                  }
                  else
                  {
                    if ((double) this.velocity.X != (double) velocity1.X)
                      this.velocity.X = velocity1.X * -0.5f;
                    if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 1.0)
                      this.velocity.Y = velocity1.Y * -0.5f;
                  }
                }
              }
              else if (this.aiStyle == 16)
              {
                if ((double) this.velocity.X != (double) velocity1.X)
                {
                  this.velocity.X = velocity1.X * -0.4f;
                  if (this.type == 29)
                    this.velocity.X *= 0.8f;
                }
                if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 0.7 && this.type != 102)
                {
                  this.velocity.Y = velocity1.Y * -0.4f;
                  if (this.type == 29)
                    this.velocity.Y *= 0.8f;
                }
                if (this.type == 134 || this.type == 137 || this.type == 140 || this.type == 143 || this.type == 303 || this.type >= 338 && this.type <= 341)
                {
                  this.velocity = this.velocity * 0.0f;
                  this.alpha = (int) byte.MaxValue;
                  this.timeLeft = 3;
                }
              }
              else if (this.aiStyle == 68)
              {
                this.velocity = this.velocity * 0.0f;
                this.alpha = (int) byte.MaxValue;
                this.timeLeft = 3;
              }
              else if (this.aiStyle != 9 || this.owner == Main.myPlayer)
              {
                this.position = this.position + this.velocity;
                this.Kill();
              }
            }
          }
        }
      }
      this.UpdatePosition(wetVelocity);
      if (flag2 || flag3 || this.owner != Main.myPlayer || !(this.tileCollide | flag4) || !(this.position != this.oldPosition))
        return;
      Vector2 Position1 = this.position;
      Vector2 oldPosition1 = this.oldPosition;
      int Width = overrideWidth != -1 ? overrideWidth : this.width;
      int Height = overrideHeight != -1 ? overrideHeight : this.height;
      if (overrideHeight != -1 || overrideWidth != -1)
      {
        Position1 = new Vector2(this.position.X + (float) (this.width / 2) - (float) (Width / 2), this.position.Y + (float) (this.height / 2) - (float) (Height / 2));
        oldPosition1 = new Vector2(this.oldPosition.X + (float) (this.width / 2) - (float) (Width / 2), this.oldPosition.Y + (float) (this.height / 2) - (float) (Height / 2));
      }
      Collision.SwitchTiles(Position1, Width, Height, oldPosition1, 4);
    }

    private void UpdatePosition(Vector2 wetVelocity)
    {
      if (this.aiStyle == 4 || this.aiStyle == 38 || this.aiStyle == 84 || this.aiStyle == 7 && (double) this.ai[0] == 2.0 || (this.type == 440 || this.type == 449 || this.type == 606) && (double) this.ai[1] == 1.0 || this.aiStyle == 93 && (double) this.ai[0] < 0.0 || this.type == 540)
        return;
      if (this.wet)
        this.position = this.position + wetVelocity;
      else
        this.position = this.position + this.velocity;
      if (!Main.projPet[this.type] || !this.tileCollide)
        return;
      Vector4 vector4 = Collision.SlopeCollision(this.position, this.velocity, this.width, this.height);
      this.position.X = vector4.X;
      this.position.Y = vector4.Y;
      this.velocity.X = vector4.Z;
      this.velocity.Y = vector4.W;
    }

    public void FishingCheck()
    {
      int index = (int) ((double) this.Center.X / 16.0);
      int j1 = (int) ((double) this.Center.Y / 16.0);
      if (Main.tile[index, j1].liquid < (byte) 0)
        ++j1;
      bool flag1 = false;
      bool flag2 = false;
      int i1 = index;
      int i2 = index;
      while (i1 > 10 && Main.tile[i1, j1].liquid > (byte) 0 && !WorldGen.SolidTile(i1, j1))
        --i1;
      while (i2 < Main.maxTilesX - 10 && Main.tile[i2, j1].liquid > (byte) 0 && !WorldGen.SolidTile(i2, j1))
        ++i2;
      int num1 = 0;
      for (int i3 = i1; i3 <= i2; ++i3)
      {
        int j2 = j1;
        while (Main.tile[i3, j2].liquid > (byte) 0 && !WorldGen.SolidTile(i3, j2) && j2 < Main.maxTilesY - 10)
        {
          ++num1;
          ++j2;
          if (Main.tile[i3, j2].lava())
            flag1 = true;
          else if (Main.tile[i3, j2].honey())
            flag2 = true;
        }
      }
      if (flag2)
        num1 = (int) ((double) num1 * 1.5);
      if (num1 < 75)
      {
        Main.player[this.owner].displayedFishingInfo = Language.GetTextValue("GameUI.NotEnoughWater");
      }
      else
      {
        int num2 = Main.player[this.owner].FishingLevel();
        if (num2 == 0)
          return;
        Main.player[this.owner].displayedFishingInfo = Language.GetTextValue("GameUI.FishingPower", (object) num2);
        if (num2 < 0)
        {
          if (num2 != -1)
            return;
          Main.player[this.owner].displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning");
          if (index >= 380 && index <= Main.maxTilesX - 380 || num1 <= 1000 || NPC.AnyNPCs(370))
            return;
          this.ai[1] = (float) (Main.rand.Next(-180, -60) - 100);
          this.localAI[1] = (float) num2;
          this.netUpdate = true;
        }
        else
        {
          int num3 = 300;
          float num4 = (float) (Main.maxTilesX / 4200);
          float num5 = (float) (((double) this.position.Y / 16.0 - (60.0 + 10.0 * (double) (num4 * num4))) / (Main.worldSurface / 6.0));
          if ((double) num5 < 0.25)
            num5 = 0.25f;
          if ((double) num5 > 1.0)
            num5 = 1f;
          int num6 = (int) ((double) num3 * (double) num5);
          float num7 = (float) num1 / (float) num6;
          if ((double) num7 < 1.0)
            num2 = (int) ((double) num2 * (double) num7);
          float num8 = 1f - num7;
          if (num1 < num6)
            Main.player[this.owner].displayedFishingInfo = Language.GetTextValue("GameUI.FullFishingPower", (object) num2, (object) -Math.Round((double) num8 * 100.0));
          int num9 = (num2 + 75) / 2;
          if (Main.player[this.owner].wet || Main.rand.Next(100) > num9)
            return;
          int Type = 0;
          int num10 = (double) j1 >= Main.worldSurface * 0.5 ? ((double) j1 >= Main.worldSurface ? ((double) j1 >= Main.rockLayer ? (j1 >= Main.maxTilesY - 300 ? 4 : 3) : 2) : 1) : 0;
          int num11 = 150;
          int maxValue1 = num11 / num2;
          int maxValue2 = num11 * 2 / num2;
          int maxValue3 = num11 * 7 / num2;
          int maxValue4 = num11 * 15 / num2;
          int maxValue5 = num11 * 30 / num2;
          if (maxValue1 < 2)
            maxValue1 = 2;
          if (maxValue2 < 3)
            maxValue2 = 3;
          if (maxValue3 < 4)
            maxValue3 = 4;
          if (maxValue4 < 5)
            maxValue4 = 5;
          if (maxValue5 < 6)
            maxValue5 = 6;
          bool flag3 = false;
          bool flag4 = false;
          bool flag5 = false;
          bool flag6 = false;
          bool flag7 = false;
          if (Main.rand.Next(maxValue1) == 0)
            flag3 = true;
          if (Main.rand.Next(maxValue2) == 0)
            flag4 = true;
          if (Main.rand.Next(maxValue3) == 0)
            flag5 = true;
          if (Main.rand.Next(maxValue4) == 0)
            flag6 = true;
          if (Main.rand.Next(maxValue5) == 0)
            flag7 = true;
          int num12 = 10;
          if (Main.player[this.owner].cratePotion)
            num12 += 10;
          int type = Main.anglerQuestItemNetIDs[Main.anglerQuest];
          if (Main.player[this.owner].HasItem(type))
            type = -1;
          if (Main.anglerQuestFinished)
            type = -1;
          if (flag1)
          {
            if (!ItemID.Sets.CanFishInLava[Main.player[this.owner].HeldItem.type])
              return;
            if (flag7)
              Type = 2331;
            else if (flag6)
              Type = 2312;
            else if (flag5)
              Type = 2315;
          }
          else if (flag2)
          {
            if (flag5 || flag4 && Main.rand.Next(2) == 0)
              Type = 2314;
            else if (flag4 && type == 2451)
              Type = 2451;
          }
          else if (Main.rand.Next(50) > num2 && Main.rand.Next(50) > num2 && num1 < num6)
            Type = Main.rand.Next(2337, 2340);
          else if (Main.rand.Next(100) < num12)
            Type = !(flag6 | flag7) ? (!flag5 || !Main.player[this.owner].ZoneCorrupt ? (!flag5 || !Main.player[this.owner].ZoneCrimson ? (!flag5 || !Main.player[this.owner].ZoneHoly ? (!flag5 || !Main.player[this.owner].ZoneDungeon ? (!flag5 || !Main.player[this.owner].ZoneJungle ? (!flag5 || num10 != 0 ? (!flag4 ? 2334 : 2335) : 3206) : 3208) : 3205) : 3207) : 3204) : 3203) : 2336;
          else if (flag7 && Main.rand.Next(5) == 0)
            Type = 2423;
          else if (flag7 && Main.rand.Next(5) == 0)
            Type = 3225;
          else if (flag7 && Main.rand.Next(10) == 0)
            Type = 2420;
          else if (((flag7 ? 0 : (!flag6 ? 1 : 0)) & (flag4 ? 1 : 0)) != 0 && Main.rand.Next(5) == 0)
          {
            Type = 3196;
          }
          else
          {
            bool flag8 = Main.player[this.owner].ZoneCorrupt;
            bool flag9 = Main.player[this.owner].ZoneCrimson;
            if (flag8 & flag9)
            {
              if (Main.rand.Next(2) == 0)
                flag9 = false;
              else
                flag8 = false;
            }
            if (flag8)
            {
              if (flag7 && Main.hardMode && Main.player[this.owner].ZoneSnow && num10 == 3 && Main.rand.Next(3) != 0)
                Type = 2429;
              else if (flag7 && Main.hardMode && Main.rand.Next(2) == 0)
                Type = 3210;
              else if (flag5)
                Type = 2330;
              else if (flag4 && type == 2454)
                Type = 2454;
              else if (flag4 && type == 2485)
                Type = 2485;
              else if (flag4 && type == 2457)
                Type = 2457;
              else if (flag4)
                Type = 2318;
            }
            else if (flag9)
            {
              if (flag7 && Main.hardMode && Main.player[this.owner].ZoneSnow && num10 == 3 && Main.rand.Next(3) != 0)
                Type = 2429;
              else if (flag7 && Main.hardMode && Main.rand.Next(2) == 0)
                Type = 3211;
              else if (flag4 && type == 2477)
                Type = 2477;
              else if (flag4 && type == 2463)
                Type = 2463;
              else if (flag4)
                Type = 2319;
              else if (flag3)
                Type = 2305;
            }
            else if (Main.player[this.owner].ZoneHoly)
            {
              if (flag7 && Main.hardMode && Main.player[this.owner].ZoneSnow && num10 == 3 && Main.rand.Next(3) != 0)
                Type = 2429;
              else if (flag7 && Main.hardMode && Main.rand.Next(2) == 0)
                Type = 3209;
              else if (num10 > 1 & flag6)
                Type = 2317;
              else if (num10 > 1 & flag5 && type == 2465)
                Type = 2465;
              else if (num10 < 2 & flag5 && type == 2468)
                Type = 2468;
              else if (flag5)
                Type = 2310;
              else if (flag4 && type == 2471)
                Type = 2471;
              else if (flag4)
                Type = 2307;
            }
            if (Type == 0 && Main.player[this.owner].ZoneSnow)
            {
              if (num10 < 2 & flag4 && type == 2467)
                Type = 2467;
              else if (num10 == 1 & flag4 && type == 2470)
                Type = 2470;
              else if (num10 >= 2 & flag4 && type == 2484)
                Type = 2484;
              else if (num10 > 1 & flag4 && type == 2466)
                Type = 2466;
              else if (flag3 && Main.rand.Next(12) == 0 || flag4 && Main.rand.Next(6) == 0)
                Type = 3197;
              else if (flag4)
                Type = 2306;
              else if (flag3)
                Type = 2299;
              else if (num10 > 1 && Main.rand.Next(3) == 0)
                Type = 2309;
            }
            if (Type == 0 && Main.player[this.owner].ZoneJungle)
            {
              if (num10 == 1 & flag4 && type == 2452)
                Type = 2452;
              else if (num10 == 1 & flag4 && type == 2483)
                Type = 2483;
              else if (num10 == 1 & flag4 && type == 2488)
                Type = 2488;
              else if (num10 >= 1 & flag4 && type == 2486)
                Type = 2486;
              else if (num10 > 1 & flag4)
                Type = 2311;
              else if (flag4)
                Type = 2313;
              else if (flag3)
                Type = 2302;
            }
            if (Type == 0 && Main.shroomTiles > 200 && flag4 && type == 2475)
              Type = 2475;
            if (Type == 0)
            {
              if (num10 <= 1 && (index < 380 || index > Main.maxTilesX - 380) && num1 > 1000)
              {
                Type = !flag6 || Main.rand.Next(2) != 0 ? (!flag6 ? (!flag5 || Main.rand.Next(5) != 0 ? (!flag5 || Main.rand.Next(2) != 0 ? (!flag4 || type != 2480 ? (!flag4 || type != 2481 ? (!flag4 ? (!flag3 || Main.rand.Next(2) != 0 ? (!flag3 ? 2297 : 2300) : 2301) : 2316) : 2481) : 2480) : 2332) : 2438) : 2342) : 2341;
              }
              else
              {
                int sandTiles = Main.sandTiles;
              }
            }
            if (Type == 0)
              Type = !(num10 < 2 & flag4) || type != 2461 ? (!(num10 == 0 & flag4) || type != 2453 ? (!(num10 == 0 & flag4) || type != 2473 ? (!(num10 == 0 & flag4) || type != 2476 ? (!(num10 < 2 & flag4) || type != 2458 ? (!(num10 < 2 & flag4) || type != 2459 ? (!(num10 == 0 & flag4) ? (((num10 <= 0 ? 0 : (num10 < 3 ? 1 : 0)) & (flag4 ? 1 : 0)) == 0 || type != 2455 ? (!(num10 == 1 & flag4) || type != 2479 ? (!(num10 == 1 & flag4) || type != 2456 ? (!(num10 == 1 & flag4) || type != 2474 ? (!(num10 > 1 & flag5) || Main.rand.Next(5) != 0 ? (!(num10 > 1 & flag7) ? (!(num10 > 1 & flag6) || Main.rand.Next(2) != 0 ? (!(num10 > 1 & flag5) ? (!(num10 > 1 & flag4) || type != 2478 ? (!(num10 > 1 & flag4) || type != 2450 ? (!(num10 > 1 & flag4) || type != 2464 ? (!(num10 > 1 & flag4) || type != 2469 ? (!(num10 > 2 & flag4) || type != 2462 ? (!(num10 > 2 & flag4) || type != 2482 ? (!(num10 > 2 & flag4) || type != 2472 ? (!(num10 > 2 & flag4) || type != 2460 ? (!(num10 > 1 & flag4) || Main.rand.Next(4) == 0 ? (num10 <= 1 || !(flag4 | flag3) && Main.rand.Next(4) != 0 ? (!flag4 || type != 2487 ? (!(num1 > 1000 & flag3) ? 2290 : 2298) : 2487) : (Main.rand.Next(4) != 0 ? 2309 : 2303)) : 2303) : 2460) : 2472) : 2482) : 2462) : 2469) : 2464) : 2450) : 2478) : 2321) : 2320) : 2308) : (!Main.hardMode || Main.rand.Next(2) != 0 ? 2436 : 2437)) : 2474) : 2456) : 2479) : 2455) : 2304) : 2459) : 2458) : 2476) : 2473) : 2453) : 2461;
          }
          if (Type <= 0)
            return;
          if (Main.player[this.owner].sonarPotion)
          {
            Item newItem = new Item();
            newItem.SetDefaults(Type);
            newItem.position = this.position;
            ItemText.NewText(newItem, 1, true);
          }
          float num13 = (float) num2;
          this.ai[1] = (float) Main.rand.Next(-240, -90) - num13;
          this.localAI[1] = (float) Type;
          this.netUpdate = true;
        }
      }
    }

    public bool CanReflect() => this.active && this.friendly && !this.hostile && this.damage > 0 && (this.aiStyle == 1 || this.aiStyle == 2 || this.aiStyle == 8 || this.aiStyle == 21 || this.aiStyle == 24 || this.aiStyle == 28 || this.aiStyle == 29 || this.aiStyle == 131);

    public float GetPrismHue(float indexing)
    {
      if (Main.player[this.owner].active)
      {
        switch (Main.player[this.owner].name)
        {
          case "Aeroblop":
            return (float) (0.25 + Math.Cos(Main.time / 180.0 * 6.28318548202515) * 0.100000001490116);
          case "Arkhalis":
          case "Darkhalis":
            return (float) (0.75 + Math.Cos(Main.time / 180.0 * 6.28318548202515) * 0.0700000002980232);
          case "Devalaous":
            return (float) (0.660000026226044 + Math.Cos(Main.time / 180.0 * 6.28318548202515) * 0.100000001490116);
          case "Doylee":
            return 0.0f;
          case "Ghostar":
            return 0.33f;
          case "Grox The Great":
            return (float) (0.310000002384186 + Math.Cos(Main.time / 120.0 * 6.28318548202515) * 0.0299999993294477);
          case "Leinfors":
            return 0.77f;
          case "Nike Leon":
            return (float) (0.0750000029802322 + Math.Cos(Main.time / 180.0 * 6.28318548202515) * 0.0700000002980232);
          case "Random":
            return Main.rand.NextFloat();
          case "Suweeka":
            return (float) (0.5 + Math.Cos(Main.time / 180.0 * 6.28318548202515) * 0.180000007152557);
          case "Tsuki":
          case "Yoraiz0r":
            return 0.85f;
          case "W1K":
            return (float) (0.75 + Math.Cos(Main.time / 120.0 * 6.28318548202515) * 0.0500000007450581);
        }
      }
      return (float) (int) indexing / 6f;
    }

    public static int GetByUUID(int owner, float uuid) => Projectile.GetByUUID(owner, (int) uuid);

    public static int GetByUUID(int owner, int uuid)
    {
      if (uuid < 0 || uuid >= 1000 || owner < 0 || owner >= (int) byte.MaxValue)
        return -1;
      int index = Main.projectileIdentity[owner, uuid];
      return index >= 0 && Main.projectile[index].active ? index : -1;
    }

    public void ProjectileFixDesperation()
    {
      if (this.owner < 0 || this.owner >= 1000)
        return;
      switch (this.type)
      {
        case 461:
        case 632:
        case 642:
        case 644:
          for (int index = 0; index < 1000; ++index)
          {
            if (Main.projectile[index].owner == this.owner && (double) Main.projectile[index].identity == (double) this.ai[1] && Main.projectile[index].active)
            {
              this.ai[1] = (float) index;
              break;
            }
          }
          break;
      }
    }

    public void AI()
    {
      // ISSUE: The method is too long to display (80533 instructions)
    }

    private void AI_061_FishingBobber()
    {
      this.timeLeft = 60;
      if (Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].fishingPole == 0 || Main.player[this.owner].CCed || Main.player[this.owner].noItems)
        this.Kill();
      else if (Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].shoot != this.type)
        this.Kill();
      else if (Main.player[this.owner].pulley)
        this.Kill();
      else if (Main.player[this.owner].dead)
        this.Kill();
      if ((double) this.ai[1] > 0.0 && (double) this.localAI[1] >= 0.0)
      {
        this.localAI[1] = -1f;
        if (!this.lavaWet && !this.honeyWet)
        {
          for (int index1 = 0; index1 < 100; ++index1)
          {
            int index2 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y - 10f), this.width + 12, 24, Dust.dustWater());
            Main.dust[index2].velocity.Y -= 4f;
            Main.dust[index2].velocity.X *= 2.5f;
            Main.dust[index2].scale = 0.8f;
            Main.dust[index2].alpha = 100;
            Main.dust[index2].noGravity = true;
          }
          Main.PlaySound(19, (int) this.position.X, (int) this.position.Y, 0);
        }
      }
      if ((double) this.ai[0] >= 1.0)
      {
        if ((double) this.ai[0] == 2.0)
        {
          ++this.ai[0];
          Main.PlaySound(SoundID.Item17, this.position);
          if (!this.lavaWet && !this.honeyWet)
          {
            for (int index3 = 0; index3 < 100; ++index3)
            {
              int index4 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y - 10f), this.width + 12, 24, Dust.dustWater());
              Main.dust[index4].velocity.Y -= 4f;
              Main.dust[index4].velocity.X *= 2.5f;
              Main.dust[index4].scale = 0.8f;
              Main.dust[index4].alpha = 100;
              Main.dust[index4].noGravity = true;
            }
            Main.PlaySound(19, (int) this.position.X, (int) this.position.Y, 0);
          }
        }
        if ((double) this.localAI[0] < 100.0)
          ++this.localAI[0];
        this.tileCollide = false;
        int num1 = 10;
        Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
        float num2 = Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2) - vector2.X;
        float num3 = Main.player[this.owner].position.Y + (float) (Main.player[this.owner].height / 2) - vector2.Y;
        float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3);
        if ((double) num4 > 3000.0)
          this.Kill();
        float num5 = (float) (15.8999996185303 / (double) num4);
        float num6 = num2 * num5;
        float num7 = num3 * num5;
        this.velocity.X = (this.velocity.X * (float) (num1 - 1) + num6) / (float) num1;
        this.velocity.Y = (this.velocity.Y * (float) (num1 - 1) + num7) / (float) num1;
        if (Main.myPlayer == this.owner && new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height).Intersects(new Microsoft.Xna.Framework.Rectangle((int) Main.player[this.owner].position.X, (int) Main.player[this.owner].position.Y, Main.player[this.owner].width, Main.player[this.owner].height)))
        {
          if ((double) this.ai[1] > 0.0 && (double) this.ai[1] < 3930.0)
          {
            int Type = (int) this.ai[1];
            Item newItem = new Item();
            newItem.SetDefaults(Type);
            if (Type == 3196)
            {
              int num8 = Main.player[this.owner].FishingLevel();
              int minValue = (num8 / 20 + 3) / 2;
              int num9 = (num8 / 10 + 6) / 2;
              if (Main.rand.Next(50) < num8)
                ++num9;
              if (Main.rand.Next(100) < num8)
                ++num9;
              if (Main.rand.Next(150) < num8)
                ++num9;
              if (Main.rand.Next(200) < num8)
                ++num9;
              int num10 = Main.rand.Next(minValue, num9 + 1);
              newItem.stack = num10;
            }
            if (Type == 3197)
            {
              int num11 = Main.player[this.owner].FishingLevel();
              int minValue = (num11 / 4 + 15) / 2;
              int num12 = (num11 / 2 + 30) / 2;
              if (Main.rand.Next(50) < num11)
                num12 += 4;
              if (Main.rand.Next(100) < num11)
                num12 += 4;
              if (Main.rand.Next(150) < num11)
                num12 += 4;
              if (Main.rand.Next(200) < num11)
                num12 += 4;
              int num13 = Main.rand.Next(minValue, num12 + 1);
              newItem.stack = num13;
            }
            newItem.newAndShiny = true;
            if (Main.player[this.owner].GetItem(this.owner, newItem).stack > 0)
            {
              int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, noGrabDelay: true);
              if (Main.netMode == 1)
                NetMessage.SendData(21, number: number, number2: 1f);
            }
            else
            {
              newItem.position.X = this.Center.X - (float) (newItem.width / 2);
              newItem.position.Y = this.Center.Y - (float) (newItem.height / 2);
              newItem.active = true;
              ItemText.NewText(newItem, 0);
            }
          }
          this.Kill();
        }
        this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
      }
      else
      {
        bool flag = false;
        Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
        float num14 = Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2) - vector2.X;
        float num15 = Main.player[this.owner].position.Y + (float) (Main.player[this.owner].height / 2) - vector2.Y;
        this.rotation = (float) Math.Atan2((double) num15, (double) num14) + 1.57f;
        if (Math.Sqrt((double) num14 * (double) num14 + (double) num15 * (double) num15) > 900.0)
          this.ai[0] = 1f;
        if (this.wet)
        {
          this.rotation = 0.0f;
          this.velocity.X *= 0.9f;
          int index5 = (int) ((double) this.Center.X + (double) ((this.width / 2 + 8) * this.direction)) / 16;
          int index6 = (int) ((double) this.Center.Y / 16.0);
          double num16 = (double) this.position.Y / 16.0;
          int index7 = (int) (((double) this.position.Y + (double) this.height) / 16.0);
          if (Main.tile[index5, index6] == null)
            Main.tile[index5, index6] = new Tile();
          if (Main.tile[index5, index7] == null)
            Main.tile[index5, index7] = new Tile();
          if ((double) this.velocity.Y > 0.0)
            this.velocity.Y *= 0.5f;
          int index8 = (int) ((double) this.Center.X / 16.0);
          int index9 = (int) ((double) this.Center.Y / 16.0);
          float num17 = this.position.Y + (float) this.height;
          if (Main.tile[index8, index9 - 1] == null)
            Main.tile[index8, index9 - 1] = new Tile();
          if (Main.tile[index8, index9] == null)
            Main.tile[index8, index9] = new Tile();
          if (Main.tile[index8, index9 + 1] == null)
            Main.tile[index8, index9 + 1] = new Tile();
          if (Main.tile[index8, index9 - 1].liquid > (byte) 0)
            num17 = (float) (index9 * 16) - (float) ((int) Main.tile[index8, index9 - 1].liquid / 16);
          else if (Main.tile[index8, index9].liquid > (byte) 0)
            num17 = (float) ((index9 + 1) * 16) - (float) ((int) Main.tile[index8, index9].liquid / 16);
          else if (Main.tile[index8, index9 + 1].liquid > (byte) 0)
            num17 = (float) ((index9 + 2) * 16) - (float) ((int) Main.tile[index8, index9 + 1].liquid / 16);
          if ((double) this.Center.Y > (double) num17)
          {
            this.velocity.Y -= 0.1f;
            if ((double) this.velocity.Y < -8.0)
              this.velocity.Y = -8f;
            if ((double) this.Center.Y + (double) this.velocity.Y < (double) num17)
              this.velocity.Y = num17 - this.Center.Y;
          }
          else
            this.velocity.Y = num17 - this.Center.Y;
          if ((double) this.velocity.Y >= -0.01 && (double) this.velocity.Y <= 0.01)
            flag = true;
        }
        else
        {
          if ((double) this.velocity.Y == 0.0)
            this.velocity.X *= 0.95f;
          this.velocity.X *= 0.98f;
          this.velocity.Y += 0.2f;
          if ((double) this.velocity.Y > 15.8999996185303)
            this.velocity.Y = 15.9f;
        }
        if (Main.myPlayer == this.owner)
        {
          int num18 = Main.player[this.owner].FishingLevel();
          if (num18 < 0 && num18 == -1)
            Main.player[this.owner].displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning");
        }
        if ((double) this.ai[1] != 0.0)
          flag = true;
        if (!flag)
          return;
        if ((double) this.ai[1] == 0.0 && Main.myPlayer == this.owner)
        {
          int num19 = Main.player[this.owner].FishingLevel();
          if (num19 == -9000)
          {
            this.localAI[1] += 5f;
            this.localAI[1] += (float) Main.rand.Next(1, 3);
            if ((double) this.localAI[1] <= 660.0)
              return;
            this.localAI[1] = 0.0f;
            this.FishingCheck();
          }
          else
          {
            if (Main.rand.Next(300) < num19)
              this.localAI[1] += (float) Main.rand.Next(1, 3);
            this.localAI[1] += (float) (num19 / 30);
            this.localAI[1] += (float) Main.rand.Next(1, 3);
            if (Main.rand.Next(60) == 0)
              this.localAI[1] += 60f;
            if ((double) this.localAI[1] <= 660.0)
              return;
            this.localAI[1] = 0.0f;
            this.FishingCheck();
          }
        }
        else
        {
          if ((double) this.ai[1] >= 0.0)
            return;
          if ((double) this.velocity.Y == 0.0 || this.honeyWet && (double) this.velocity.Y >= -0.01 && (double) this.velocity.Y <= 0.01)
          {
            this.velocity.Y = (float) Main.rand.Next(100, 500) * 0.015f;
            this.velocity.X = (float) Main.rand.Next(-100, 101) * 0.015f;
            this.wet = false;
            this.lavaWet = false;
            this.honeyWet = false;
          }
          this.ai[1] += (float) Main.rand.Next(1, 5);
          if ((double) this.ai[1] < 0.0)
            return;
          this.ai[1] = 0.0f;
          this.localAI[1] = 0.0f;
          this.netUpdate = true;
        }
      }
    }

    private void AI_146_DD2Victory()
    {
    }

    private void BetsySharpnel(int npcIndex)
    {
      if ((double) this.ai[1] == -1.0 || this.owner != Main.myPlayer)
        return;
      Vector2 spinningpoint = new Vector2(0.0f, 6f);
      Vector2 center = this.Center;
      float num1 = 0.7853982f;
      int num2 = 5;
      float num3 = (float) -((double) num1 * 2.0) / (float) (num2 - 1);
      for (int index1 = 0; index1 < num2; ++index1)
      {
        int index2 = Projectile.NewProjectile(center, spinningpoint.RotatedBy((double) num1 + (double) num3 * (double) index1), 710, this.damage, this.knockBack, this.owner, ai1: -1f);
        Projectile projectile = Main.projectile[index2];
        for (int index3 = 0; index3 < this.localNPCImmunity.Length; ++index3)
          projectile.localNPCImmunity[index3] = this.localNPCImmunity[index3];
      }
    }

    private void AI_001()
    {
      if (this.type == 469 && this.wet && !this.honeyWet)
        this.Kill();
      if (this.type == 601)
      {
        Color portalColor = PortalHelper.GetPortalColor(this.owner, (int) this.ai[0]);
        Lighting.AddLight(this.Center + this.velocity * 3f, portalColor.ToVector3() * 0.5f);
        if (this.alpha > 0 && this.alpha <= 15)
        {
          Color color = portalColor;
          color.A = byte.MaxValue;
          for (int index = 0; index < 4; ++index)
          {
            Dust dust = Main.dust[Dust.NewDust(this.Center, 0, 0, 264)];
            dust.position = this.Center;
            dust.velocity = this.velocity * 2f + Utils.RandomVector2(Main.rand, -1f, 1f);
            dust.color = color;
            dust.scale = 1.2f;
            dust.noLight = true;
            dust.noGravity = true;
            dust.customData = (object) Main.player[this.owner];
          }
        }
        this.alpha -= 15;
        if (this.alpha < 0)
          this.alpha = 0;
        if (++this.frameCounter >= 4)
        {
          this.frameCounter = 0;
          if (++this.frame >= Main.projFrames[this.type])
            this.frame = 0;
        }
        if (this.alpha == 0)
        {
          Color color = portalColor;
          color.A = byte.MaxValue;
          Dust dust = Main.dust[Dust.NewDust(this.Center, 0, 0, 263)];
          dust.position = this.Center;
          dust.velocity = this.velocity / 4f;
          dust.color = color;
          dust.noGravity = true;
          dust.scale = 0.6f;
        }
      }
      if (this.type == 472)
      {
        int index1 = Dust.NewDust(this.position, this.width, this.height, 30);
        Main.dust[index1].noGravity = true;
        Main.dust[index1].velocity *= 0.25f;
        Main.dust[index1].velocity += this.velocity * 0.75f;
        if ((double) this.localAI[0] == 0.0)
        {
          this.localAI[0] = 1f;
          Main.PlaySound(SoundID.Item17, this.position);
          for (int index2 = 0; index2 < 20; ++index2)
          {
            int index3 = Dust.NewDust(this.position, this.width, this.height, 30);
            Main.dust[index3].noGravity = true;
            Main.dust[index3].velocity *= 0.25f;
            Main.dust[index3].velocity += this.velocity;
            Main.dust[index3].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
            Main.dust[index3].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
          }
        }
      }
      if (this.type == 323)
      {
        this.alpha -= 50;
        if (this.alpha < 0)
          this.alpha = 0;
      }
      if (this.type == 436)
      {
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          Main.PlaySound(SoundID.Item12, this.position);
        }
        this.alpha -= 40;
        if (this.alpha < 0)
          this.alpha = 0;
        this.spriteDirection = this.direction;
        ++this.frameCounter;
        if (this.frameCounter >= 3)
        {
          ++this.frame;
          this.frameCounter = 0;
          if (this.frame >= 4)
            this.frame = 0;
        }
        Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.3f, 1.1f, 0.5f);
      }
      if (this.type == 467)
      {
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          Main.PlaySound(SoundID.Item34, this.position);
        }
        else if ((double) this.ai[1] == 1.0 && Main.netMode != 1)
        {
          int num1 = -1;
          float num2 = 2000f;
          for (int index = 0; index < (int) byte.MaxValue; ++index)
          {
            if (Main.player[index].active && !Main.player[index].dead)
            {
              Vector2 center = Main.player[index].Center;
              float num3 = Vector2.Distance(center, this.Center);
              if (((double) num3 < (double) num2 || num1 == -1) && Collision.CanHit(this.Center, 1, 1, center, 1, 1))
              {
                num2 = num3;
                num1 = index;
              }
            }
          }
          if ((double) num2 < 20.0)
          {
            this.Kill();
            return;
          }
          if (num1 != -1)
          {
            this.ai[1] = 21f;
            this.ai[0] = (float) num1;
            this.netUpdate = true;
          }
        }
        else if ((double) this.ai[1] > 20.0 && (double) this.ai[1] < 200.0)
        {
          ++this.ai[1];
          int index = (int) this.ai[0];
          if (!Main.player[index].active || Main.player[index].dead)
          {
            this.ai[1] = 1f;
            this.ai[0] = 0.0f;
            this.netUpdate = true;
          }
          else
          {
            float rotation = this.velocity.ToRotation();
            Vector2 v = Main.player[index].Center - this.Center;
            if ((double) v.Length() < 20.0)
            {
              this.Kill();
              return;
            }
            float targetAngle = v.ToRotation();
            if (v == Vector2.Zero)
              targetAngle = rotation;
            float num = rotation.AngleLerp(targetAngle, 0.008f);
            this.velocity = new Vector2(this.velocity.Length(), 0.0f).RotatedBy((double) num);
          }
        }
        if ((double) this.ai[1] >= 1.0 && (double) this.ai[1] < 20.0)
        {
          ++this.ai[1];
          if ((double) this.ai[1] == 20.0)
            this.ai[1] = 1f;
        }
        this.alpha -= 40;
        if (this.alpha < 0)
          this.alpha = 0;
        this.spriteDirection = this.direction;
        ++this.frameCounter;
        if (this.frameCounter >= 3)
        {
          ++this.frame;
          this.frameCounter = 0;
          if (this.frame >= 4)
            this.frame = 0;
        }
        Lighting.AddLight(this.Center, 1.1f, 0.9f, 0.4f);
        ++this.localAI[0];
        if ((double) this.localAI[0] == 12.0)
        {
          this.localAI[0] = 0.0f;
          for (int index4 = 0; index4 < 12; ++index4)
          {
            Vector2 vector2 = (Vector2.UnitX * (float) -this.width / 2f + -Vector2.UnitY.RotatedBy((double) index4 * 3.14159274101257 / 6.0) * new Vector2(8f, 16f)).RotatedBy((double) this.rotation - 1.57079637050629);
            int index5 = Dust.NewDust(this.Center, 0, 0, 6, Alpha: 160);
            Main.dust[index5].scale = 1.1f;
            Main.dust[index5].noGravity = true;
            Main.dust[index5].position = this.Center + vector2;
            Main.dust[index5].velocity = this.velocity * 0.1f;
            Main.dust[index5].velocity = Vector2.Normalize(this.Center - this.velocity * 3f - Main.dust[index5].position) * 1.25f;
          }
        }
        if (Main.rand.Next(4) == 0)
        {
          for (int index6 = 0; index6 < 1; ++index6)
          {
            Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double) this.velocity.ToRotation());
            int index7 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 100);
            Main.dust[index7].velocity *= 0.1f;
            Main.dust[index7].position = this.Center + vector2 * (float) this.width / 2f;
            Main.dust[index7].fadeIn = 0.9f;
          }
        }
        if (Main.rand.Next(32) == 0)
        {
          for (int index8 = 0; index8 < 1; ++index8)
          {
            Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.392699092626572).RotatedBy((double) this.velocity.ToRotation());
            int index9 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 155, Scale: 0.8f);
            Main.dust[index9].velocity *= 0.3f;
            Main.dust[index9].position = this.Center + vector2 * (float) this.width / 2f;
            if (Main.rand.Next(2) == 0)
              Main.dust[index9].fadeIn = 1.4f;
          }
        }
        if (Main.rand.Next(2) == 0)
        {
          for (int index10 = 0; index10 < 2; ++index10)
          {
            Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.785398185253143).RotatedBy((double) this.velocity.ToRotation());
            int index11 = Dust.NewDust(this.position, this.width, this.height, 6, Scale: 1.2f);
            Main.dust[index11].velocity *= 0.3f;
            Main.dust[index11].noGravity = true;
            Main.dust[index11].position = this.Center + vector2 * (float) this.width / 2f;
            if (Main.rand.Next(2) == 0)
              Main.dust[index11].fadeIn = 1.4f;
          }
        }
      }
      if (this.type == 468)
      {
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          Main.PlaySound(SoundID.Item34, this.position);
        }
        else if ((double) this.ai[1] == 1.0 && Main.netMode != 1)
        {
          int num4 = -1;
          float num5 = 2000f;
          for (int index = 0; index < (int) byte.MaxValue; ++index)
          {
            if (Main.player[index].active && !Main.player[index].dead)
            {
              Vector2 center = Main.player[index].Center;
              float num6 = Vector2.Distance(center, this.Center);
              if (((double) num6 < (double) num5 || num4 == -1) && Collision.CanHit(this.Center, 1, 1, center, 1, 1))
              {
                num5 = num6;
                num4 = index;
              }
            }
          }
          if ((double) num5 < 20.0)
          {
            this.Kill();
            return;
          }
          if (num4 != -1)
          {
            this.ai[1] = 21f;
            this.ai[0] = (float) num4;
            this.netUpdate = true;
          }
        }
        else if ((double) this.ai[1] > 20.0 && (double) this.ai[1] < 200.0)
        {
          ++this.ai[1];
          int index = (int) this.ai[0];
          if (!Main.player[index].active || Main.player[index].dead)
          {
            this.ai[1] = 1f;
            this.ai[0] = 0.0f;
            this.netUpdate = true;
          }
          else
          {
            float rotation = this.velocity.ToRotation();
            Vector2 v = Main.player[index].Center - this.Center;
            if ((double) v.Length() < 20.0)
            {
              this.Kill();
              return;
            }
            float targetAngle = v.ToRotation();
            if (v == Vector2.Zero)
              targetAngle = rotation;
            float num = rotation.AngleLerp(targetAngle, 0.01f);
            this.velocity = new Vector2(this.velocity.Length(), 0.0f).RotatedBy((double) num);
          }
        }
        if ((double) this.ai[1] >= 1.0 && (double) this.ai[1] < 20.0)
        {
          ++this.ai[1];
          if ((double) this.ai[1] == 20.0)
            this.ai[1] = 1f;
        }
        this.alpha -= 40;
        if (this.alpha < 0)
          this.alpha = 0;
        this.spriteDirection = this.direction;
        ++this.frameCounter;
        if (this.frameCounter >= 3)
        {
          ++this.frame;
          this.frameCounter = 0;
          if (this.frame >= 4)
            this.frame = 0;
        }
        Lighting.AddLight(this.Center, 0.2f, 0.1f, 0.6f);
        ++this.localAI[0];
        if ((double) this.localAI[0] == 12.0)
        {
          this.localAI[0] = 0.0f;
          for (int index12 = 0; index12 < 12; ++index12)
          {
            Vector2 vector2 = (Vector2.UnitX * (float) -this.width / 2f + -Vector2.UnitY.RotatedBy((double) index12 * 3.14159274101257 / 6.0) * new Vector2(8f, 16f)).RotatedBy((double) this.rotation - 1.57079637050629);
            int index13 = Dust.NewDust(this.Center, 0, 0, 27, Alpha: 160);
            Main.dust[index13].scale = 1.1f;
            Main.dust[index13].noGravity = true;
            Main.dust[index13].position = this.Center + vector2;
            Main.dust[index13].velocity = this.velocity * 0.1f;
            Main.dust[index13].velocity = Vector2.Normalize(this.Center - this.velocity * 3f - Main.dust[index13].position) * 1.25f;
          }
        }
        if (Main.rand.Next(4) == 0)
        {
          for (int index14 = 0; index14 < 1; ++index14)
          {
            Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double) this.velocity.ToRotation());
            int index15 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 100);
            Main.dust[index15].velocity *= 0.1f;
            Main.dust[index15].position = this.Center + vector2 * (float) this.width / 2f;
            Main.dust[index15].fadeIn = 0.9f;
          }
        }
        if (Main.rand.Next(32) == 0)
        {
          for (int index16 = 0; index16 < 1; ++index16)
          {
            Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.392699092626572).RotatedBy((double) this.velocity.ToRotation());
            int index17 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 155, Scale: 0.8f);
            Main.dust[index17].velocity *= 0.3f;
            Main.dust[index17].position = this.Center + vector2 * (float) this.width / 2f;
            if (Main.rand.Next(2) == 0)
              Main.dust[index17].fadeIn = 1.4f;
          }
        }
        if (Main.rand.Next(2) == 0)
        {
          for (int index18 = 0; index18 < 2; ++index18)
          {
            Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.785398185253143).RotatedBy((double) this.velocity.ToRotation());
            int index19 = Dust.NewDust(this.position, this.width, this.height, 27, Scale: 1.2f);
            Main.dust[index19].velocity *= 0.3f;
            Main.dust[index19].noGravity = true;
            Main.dust[index19].position = this.Center + vector2 * (float) this.width / 2f;
            if (Main.rand.Next(2) == 0)
              Main.dust[index19].fadeIn = 1.4f;
          }
        }
      }
      if (this.type == 634 || this.type == 635)
      {
        float num7 = 5f;
        float num8 = 250f;
        float num9 = 6f;
        Vector2 vector2_1 = new Vector2(8f, 10f);
        float num10 = 1.2f;
        Vector3 rgb = new Vector3(0.7f, 0.1f, 0.5f);
        int num11 = 4 * this.MaxUpdates;
        int Type1 = Utils.SelectRandom<int>(Main.rand, 242, 73, 72, 71, (int) byte.MaxValue);
        int Type2 = (int) byte.MaxValue;
        if (this.type == 635)
        {
          vector2_1 = new Vector2(10f, 20f);
          num10 = 1f;
          num8 = 500f;
          Type2 = 88;
          num11 = 3 * this.MaxUpdates;
          rgb = new Vector3(0.4f, 0.6f, 0.9f);
          Type1 = Utils.SelectRandom<int>(Main.rand, 242, 59, 88);
        }
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          this.localAI[0] = (float) -Main.rand.Next(48);
          Main.PlaySound(SoundID.Item34, this.position);
        }
        else if ((double) this.ai[1] == 1.0 && this.owner == Main.myPlayer)
        {
          int num12 = -1;
          float num13 = num8;
          for (int index = 0; index < 200; ++index)
          {
            if (Main.npc[index].active && Main.npc[index].CanBeChasedBy((object) this))
            {
              Vector2 center = Main.npc[index].Center;
              float num14 = Vector2.Distance(center, this.Center);
              if ((double) num14 < (double) num13 && num12 == -1 && Collision.CanHitLine(this.Center, 1, 1, center, 1, 1))
              {
                num13 = num14;
                num12 = index;
              }
            }
          }
          if ((double) num13 < 20.0)
          {
            this.Kill();
            return;
          }
          if (num12 != -1)
          {
            this.ai[1] = num7 + 1f;
            this.ai[0] = (float) num12;
            this.netUpdate = true;
          }
        }
        else if ((double) this.ai[1] > (double) num7)
        {
          ++this.ai[1];
          int index = (int) this.ai[0];
          if (!Main.npc[index].active || !Main.npc[index].CanBeChasedBy((object) this))
          {
            this.ai[1] = 1f;
            this.ai[0] = 0.0f;
            this.netUpdate = true;
          }
          else
          {
            double rotation = (double) this.velocity.ToRotation();
            Vector2 vector2_2 = Main.npc[index].Center - this.Center;
            if ((double) vector2_2.Length() < 20.0)
            {
              this.Kill();
              return;
            }
            if (vector2_2 != Vector2.Zero)
            {
              vector2_2.Normalize();
              vector2_2 *= num9;
            }
            float num15 = 30f;
            this.velocity = (this.velocity * (num15 - 1f) + vector2_2) / num15;
          }
        }
        if ((double) this.ai[1] >= 1.0 && (double) this.ai[1] < (double) num7)
        {
          ++this.ai[1];
          if ((double) this.ai[1] == (double) num7)
            this.ai[1] = 1f;
        }
        this.alpha -= 40;
        if (this.alpha < 0)
          this.alpha = 0;
        this.spriteDirection = this.direction;
        ++this.frameCounter;
        if (this.frameCounter >= num11)
        {
          ++this.frame;
          this.frameCounter = 0;
          if (this.frame >= 4)
            this.frame = 0;
        }
        Lighting.AddLight(this.Center, rgb);
        this.rotation = this.velocity.ToRotation();
        ++this.localAI[0];
        if ((double) this.localAI[0] == 48.0)
          this.localAI[0] = 0.0f;
        else if (this.alpha == 0)
        {
          for (int index20 = 0; index20 < 2; ++index20)
          {
            Vector2 vector2_3 = Vector2.UnitX * -30f;
            Vector2 vector2_4 = -Vector2.UnitY.RotatedBy((double) this.localAI[0] * 0.130899697542191 + (double) index20 * 3.14159274101257) * vector2_1 - this.rotation.ToRotationVector2() * 10f;
            int index21 = Dust.NewDust(this.Center, 0, 0, Type2, Alpha: 160);
            Main.dust[index21].scale = num10;
            Main.dust[index21].noGravity = true;
            Main.dust[index21].position = this.Center + vector2_4 + this.velocity * 2f;
            Main.dust[index21].velocity = Vector2.Normalize(this.Center + this.velocity * 2f * 8f - Main.dust[index21].position) * 2f + this.velocity * 2f;
          }
        }
        if (Main.rand.Next(12) == 0)
        {
          for (int index22 = 0; index22 < 1; ++index22)
          {
            Vector2 vector2_5 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double) this.velocity.ToRotation());
            int index23 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 100);
            Main.dust[index23].velocity *= 0.1f;
            Main.dust[index23].position = this.Center + vector2_5 * (float) this.width / 2f + this.velocity * 2f;
            Main.dust[index23].fadeIn = 0.9f;
          }
        }
        if (Main.rand.Next(64) == 0)
        {
          for (int index24 = 0; index24 < 1; ++index24)
          {
            Vector2 vector2_6 = -Vector2.UnitX.RotatedByRandom(0.392699092626572).RotatedBy((double) this.velocity.ToRotation());
            int index25 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 155, Scale: 0.8f);
            Main.dust[index25].velocity *= 0.3f;
            Main.dust[index25].position = this.Center + vector2_6 * (float) this.width / 2f;
            if (Main.rand.Next(2) == 0)
              Main.dust[index25].fadeIn = 1.4f;
          }
        }
        if (Main.rand.Next(4) == 0)
        {
          for (int index26 = 0; index26 < 2; ++index26)
          {
            Vector2 vector2_7 = -Vector2.UnitX.RotatedByRandom(0.785398185253143).RotatedBy((double) this.velocity.ToRotation());
            int index27 = Dust.NewDust(this.position, this.width, this.height, Type1, Scale: 1.2f);
            Main.dust[index27].velocity *= 0.3f;
            Main.dust[index27].noGravity = true;
            Main.dust[index27].position = this.Center + vector2_7 * (float) this.width / 2f;
            if (Main.rand.Next(2) == 0)
              Main.dust[index27].fadeIn = 1.4f;
          }
        }
        if (Main.rand.Next(12) == 0 && this.type == 634)
        {
          Vector2 vector2_8 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double) this.velocity.ToRotation());
          int index = Dust.NewDust(this.position, this.width, this.height, Type2, Alpha: 100);
          Main.dust[index].velocity *= 0.3f;
          Main.dust[index].position = this.Center + vector2_8 * (float) this.width / 2f;
          Main.dust[index].fadeIn = 0.9f;
          Main.dust[index].noGravity = true;
        }
        if (Main.rand.Next(3) == 0 && this.type == 635)
        {
          Vector2 vector2_9 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double) this.velocity.ToRotation());
          int index = Dust.NewDust(this.position, this.width, this.height, Type2, Alpha: 100);
          Main.dust[index].velocity *= 0.3f;
          Main.dust[index].position = this.Center + vector2_9 * (float) this.width / 2f;
          Main.dust[index].fadeIn = 1.2f;
          Main.dust[index].scale = 1.5f;
          Main.dust[index].noGravity = true;
        }
      }
      if (this.type == 459)
      {
        this.alpha -= 30;
        if (this.alpha < 0)
          this.alpha = 0;
        this.spriteDirection = this.direction;
        ++this.frameCounter;
        if (this.frameCounter >= 3)
        {
          ++this.frame;
          this.frameCounter = 0;
          if (this.frame >= 3)
            this.frame = 0;
        }
        this.position = this.Center;
        this.scale = this.ai[1];
        this.width = this.height = (int) (22.0 * (double) this.scale);
        this.Center = this.position;
        Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.4f, 0.85f, 0.9f);
        int num;
        if ((double) this.scale < 0.85)
        {
          num = Main.rand.Next(3) == 0 ? 1 : 0;
        }
        else
        {
          num = 1;
          this.penetrate = -1;
          this.maxPenetrate = -1;
        }
        for (int index28 = 0; index28 < num; ++index28)
        {
          int index29 = Dust.NewDust(this.position, this.width, this.height, 226, this.velocity.X);
          Main.dust[index29].position -= Vector2.One * 3f;
          Main.dust[index29].scale = 0.5f;
          Main.dust[index29].noGravity = true;
          Main.dust[index29].velocity = this.velocity / 3f;
          Main.dust[index29].alpha = (int) byte.MaxValue - (int) ((double) byte.MaxValue * (double) this.scale);
        }
      }
      if (this.type == 709)
      {
        this.alpha -= 30;
        if (this.alpha < 0)
          this.alpha = 0;
        this.spriteDirection = this.direction;
        ++this.frameCounter;
        if (this.frameCounter >= 3)
        {
          ++this.frame;
          this.frameCounter = 0;
          if (this.frame >= 3)
            this.frame = 0;
        }
        Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.4f, 0.85f, 0.9f);
        if ((double) this.ai[1] == 0.0)
          Main.PlayTrackedSound((SoundStyle) SoundID.DD2_SkyDragonsFuryShot, this.Center);
        ++this.ai[1];
        if ((double) this.ai[1] >= 30.0)
        {
          this.Kill();
          return;
        }
      }
      if (this.type == 442)
      {
        this.frame = 0;
        if (this.alpha != 0)
        {
          ++this.localAI[0];
          if ((double) this.localAI[0] >= 4.0)
          {
            this.alpha -= 90;
            if (this.alpha < 0)
            {
              this.alpha = 0;
              this.localAI[0] = 2f;
            }
          }
        }
        if ((double) Vector2.Distance(this.Center, new Vector2(this.ai[0], this.ai[1]) * 16f + Vector2.One * 8f) <= 16.0)
        {
          this.Kill();
          return;
        }
        if (this.alpha == 0)
        {
          ++this.localAI[1];
          if ((double) this.localAI[1] >= 120.0)
          {
            this.Kill();
            return;
          }
          Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.3f, 0.45f, 0.8f);
          ++this.localAI[0];
          if ((double) this.localAI[0] == 3.0)
          {
            this.localAI[0] = 0.0f;
            for (int index30 = 0; index30 < 8; ++index30)
            {
              Vector2 vector2 = (Vector2.UnitX * -8f + -Vector2.UnitY.RotatedBy((double) index30 * 3.14159274101257 / 4.0) * new Vector2(2f, 4f)).RotatedBy((double) this.rotation - 1.57079637050629);
              int index31 = Dust.NewDust(this.Center, 0, 0, 135);
              Main.dust[index31].scale = 1.5f;
              Main.dust[index31].noGravity = true;
              Main.dust[index31].position = this.Center + vector2;
              Main.dust[index31].velocity = this.velocity * 0.66f;
            }
          }
        }
      }
      if (this.type == 440 || this.type == 449 || this.type == 606)
      {
        if (this.alpha > 0)
          this.alpha -= 25;
        if (this.alpha < 0)
          this.alpha = 0;
        if (this.type == 440)
          Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.25f, 0.4f, 0.7f);
        if (this.type == 449)
          Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.7f, 0.65f, 0.3f);
        if (this.type == 606)
          Lighting.AddLight(this.Center, 0.7f, 0.3f, 0.3f);
        float num16 = 100f;
        float num17 = 3f;
        if (this.type == 606)
        {
          num16 = 150f;
          num17 = 5f;
        }
        if ((double) this.ai[1] == 0.0)
        {
          this.localAI[0] += num17;
          if ((double) this.localAI[0] == (double) num17 * 1.0 && this.type == 606)
          {
            for (int index32 = 0; index32 < 4; ++index32)
            {
              int index33 = Dust.NewDust(this.Center - this.velocity / 2f, 0, 0, 182, Alpha: 100, Scale: 1.4f);
              Main.dust[index33].velocity *= 0.2f;
              Main.dust[index33].velocity += this.velocity / 10f;
              Main.dust[index33].noGravity = true;
            }
          }
          if ((double) this.localAI[0] > (double) num16)
            this.localAI[0] = num16;
        }
        else
        {
          this.localAI[0] -= num17;
          if ((double) this.localAI[0] <= 0.0)
          {
            this.Kill();
            return;
          }
        }
      }
      if (this.type == 438)
        Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.4f, 0.1f, 0.2f);
      if (this.type == 593)
      {
        Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.4f, 0.1f, 0.3f);
        if (++this.frameCounter >= 12)
        {
          if (++this.frame >= Main.projFrames[this.type])
            this.frame = 0;
          this.frameCounter = 0;
        }
        if (Main.rand.Next(2) == 0)
        {
          Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515);
          Dust dust = Main.dust[Dust.NewDust(this.Center - spinningpoint * 8f, 0, 0, 240)];
          dust.noGravity = true;
          dust.position = this.Center - spinningpoint * 8f * this.scale;
          dust.velocity = spinningpoint.RotatedBy(-1.57079637050629) * 2f;
          dust.velocity = Vector2.Zero;
          dust.scale = 0.5f + Main.rand.NextFloat();
          dust.fadeIn = 0.5f;
        }
      }
      if (this.type == 592)
        Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.15f, 0.15f, 0.4f);
      if (this.type == 462)
      {
        int index = Dust.NewDust(this.Center, 0, 0, 229, Alpha: 100);
        Main.dust[index].noLight = true;
        Main.dust[index].noGravity = true;
        Main.dust[index].velocity = this.velocity;
        Main.dust[index].position -= Vector2.One * 4f;
        Main.dust[index].scale = 0.8f;
        if (++this.frameCounter >= 9)
        {
          this.frameCounter = 0;
          if (++this.frame >= 5)
            this.frame = 0;
        }
      }
      if (this.type == 437)
      {
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          Main.PlaySound(SoundID.Item12, this.position);
        }
        if ((double) this.localAI[0] == 0.0)
        {
          this.localAI[0] = 1f;
          for (int index34 = 0; index34 < 4; ++index34)
          {
            int index35 = Dust.NewDust(this.position, this.width, this.height, 226, this.velocity.X);
            Main.dust[index35].position = Vector2.Lerp(Main.dust[index35].position, this.Center, 0.25f);
            Main.dust[index35].scale = 0.5f;
            Main.dust[index35].noGravity = true;
            Main.dust[index35].velocity /= 2f;
            Main.dust[index35].velocity += this.velocity * 0.66f;
          }
        }
        if ((double) this.ai[0] < 16.0)
        {
          for (int index36 = 0; index36 < 2; ++index36)
          {
            int index37 = Dust.NewDust(this.position, this.width, this.height, 226, this.velocity.X);
            Main.dust[index37].position = this.position + new Vector2((float) ((this.direction == 1 ? 1 : 0) * this.width), (float) (2 + (this.height - 4) * index36));
            Main.dust[index37].scale = 0.3f;
            Main.dust[index37].noGravity = true;
            Main.dust[index37].velocity = Vector2.Zero;
          }
        }
      }
      if (this.type == 435)
      {
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          Main.PlaySound(SoundID.Item12, this.position);
        }
        this.alpha -= 40;
        if (this.alpha < 0)
          this.alpha = 0;
        this.spriteDirection = this.direction;
        ++this.frameCounter;
        if (this.frameCounter >= 3)
        {
          ++this.frame;
          this.frameCounter = 0;
          if (this.frame >= 4)
            this.frame = 0;
        }
        Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.3f, 0.8f, 1.1f);
      }
      if (this.type == 682)
      {
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          Main.PlaySound(SoundID.DD2_LightningBugZap, this.position);
          for (int index = 0; index < 8; ++index)
          {
            Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 272);
            dust.velocity *= 1f;
            dust.velocity += this.velocity * 0.65f;
            dust.scale = 0.6f;
            dust.fadeIn = 0.8f;
            dust.noGravity = true;
            dust.noLight = true;
            dust.position += dust.velocity * 3f;
          }
        }
        this.alpha -= 40;
        if (this.alpha < 0)
          this.alpha = 0;
        this.spriteDirection = this.direction;
        ++this.frameCounter;
        if (this.frameCounter >= 3)
        {
          ++this.frame;
          this.frameCounter = 0;
          if (this.frame >= 4)
            this.frame = 0;
        }
        Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.5f, 0.2f, 1.1f);
      }
      if (this.type == 684)
      {
        this.alpha -= 40;
        if (this.alpha < 0)
          this.alpha = 0;
        this.spriteDirection = this.direction;
        ++this.localAI[0];
        for (int index = 0; index < 1; ++index)
        {
          Vector2 vector2 = (Utils.RandomVector2(Main.rand, -0.5f, 0.5f) * new Vector2(20f, 80f)).RotatedBy((double) this.velocity.ToRotation());
          Dust dust = Dust.NewDustDirect(this.Center, 0, 0, 60);
          dust.alpha = (int) sbyte.MaxValue;
          dust.fadeIn = 1.5f;
          dust.scale = 1.3f;
          dust.velocity *= 0.3f;
          dust.position = this.Center + vector2;
          dust.noGravity = true;
          dust.noLight = true;
          dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
        }
        Lighting.AddLight(this.Center, 1.1f, 0.3f, 0.4f);
      }
      if (this.type == 408)
      {
        this.alpha -= 40;
        if (this.alpha < 0)
          this.alpha = 0;
        this.spriteDirection = this.direction;
      }
      if (this.type == 282)
      {
        int index = Dust.NewDust(this.position, this.width, this.height, 171, Alpha: 100);
        Main.dust[index].scale = (float) Main.rand.Next(1, 10) * 0.1f;
        Main.dust[index].noGravity = true;
        Main.dust[index].fadeIn = 1.5f;
        Main.dust[index].velocity *= 0.25f;
        Main.dust[index].velocity += this.velocity * 0.25f;
      }
      if (this.type == 275 || this.type == 276)
      {
        ++this.frameCounter;
        if (this.frameCounter > 1)
        {
          this.frameCounter = 0;
          ++this.frame;
          if (this.frame > 1)
            this.frame = 0;
        }
      }
      if (this.type == 225)
      {
        int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 40);
        Main.dust[index].noGravity = true;
        Main.dust[index].scale = 1.3f;
        Main.dust[index].velocity *= 0.5f;
      }
      if (this.type == 174)
      {
        if (this.alpha == 0)
        {
          int index = Dust.NewDust(this.oldPosition - this.velocity * 3f, this.width, this.height, 76, Alpha: 50);
          Main.dust[index].noGravity = true;
          Main.dust[index].noLight = true;
          Main.dust[index].velocity *= 0.5f;
        }
        this.alpha -= 50;
        if (this.alpha < 0)
          this.alpha = 0;
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          Main.PlaySound(SoundID.Item17, this.position);
        }
      }
      else if (this.type == 605)
      {
        if (this.alpha == 0 && Main.rand.Next(3) == 0)
        {
          int index = Dust.NewDust(this.position - this.velocity * 3f, this.width, this.height, 4, Alpha: 50, newColor: new Color(78, 136, (int) byte.MaxValue, 150), Scale: 1.2f);
          Main.dust[index].velocity *= 0.3f;
          Main.dust[index].velocity += this.velocity * 0.3f;
          Main.dust[index].noGravity = true;
        }
        this.alpha -= 50;
        if (this.alpha < 0)
          this.alpha = 0;
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          Main.PlaySound(SoundID.Item17, this.position);
        }
      }
      else if (this.type == 176)
      {
        if (this.alpha == 0)
        {
          int index = Dust.NewDust(this.oldPosition, this.width, this.height, 22, Alpha: 100, Scale: 0.5f);
          Main.dust[index].noGravity = true;
          Main.dust[index].noLight = true;
          Main.dust[index].velocity *= 0.15f;
          Main.dust[index].fadeIn = 0.8f;
        }
        this.alpha -= 50;
        if (this.alpha < 0)
          this.alpha = 0;
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          Main.PlaySound(SoundID.Item17, this.position);
        }
      }
      if (this.type == 350)
      {
        this.alpha -= 100;
        if (this.alpha < 0)
          this.alpha = 0;
        Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.9f, 0.6f, 0.2f);
        if (this.alpha == 0)
        {
          int num = 2;
          if (Main.rand.Next(2) == 0)
          {
            int index = Dust.NewDust(new Vector2(this.Center.X - (float) num, (float) ((double) this.Center.Y - (double) num - 2.0)) - this.velocity * 0.5f, num * 2, num * 2, 6, Alpha: 100);
            Main.dust[index].scale *= (float) (1.79999995231628 + (double) Main.rand.Next(10) * 0.100000001490116);
            Main.dust[index].velocity *= 0.2f;
            Main.dust[index].noGravity = true;
          }
          if (Main.rand.Next(4) == 0)
          {
            int index = Dust.NewDust(new Vector2(this.Center.X - (float) num, (float) ((double) this.Center.Y - (double) num - 2.0)) - this.velocity * 0.5f, num * 2, num * 2, 31, Alpha: 100, Scale: 0.5f);
            Main.dust[index].fadeIn = (float) (1.0 + (double) Main.rand.Next(5) * 0.100000001490116);
            Main.dust[index].velocity *= 0.05f;
          }
        }
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          Main.PlaySound(SoundID.Item42, this.position);
        }
      }
      if (this.type == 325)
      {
        this.alpha -= 100;
        if (this.alpha < 0)
          this.alpha = 0;
        Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.9f, 0.6f, 0.2f);
        if (this.alpha == 0)
        {
          int num = 2;
          if (Main.rand.Next(2) == 0)
          {
            int index = Dust.NewDust(new Vector2(this.Center.X - (float) num, (float) ((double) this.Center.Y - (double) num - 2.0)) - this.velocity * 0.5f, num * 2, num * 2, 6, Alpha: 100);
            Main.dust[index].scale *= (float) (1.79999995231628 + (double) Main.rand.Next(10) * 0.100000001490116);
            Main.dust[index].velocity *= 0.2f;
            Main.dust[index].noGravity = true;
          }
          if (Main.rand.Next(4) == 0)
          {
            int index = Dust.NewDust(new Vector2(this.Center.X - (float) num, (float) ((double) this.Center.Y - (double) num - 2.0)) - this.velocity * 0.5f, num * 2, num * 2, 31, Alpha: 100, Scale: 0.5f);
            Main.dust[index].fadeIn = (float) (1.0 + (double) Main.rand.Next(5) * 0.100000001490116);
            Main.dust[index].velocity *= 0.05f;
          }
        }
        if ((double) this.ai[1] == 0.0)
        {
          this.ai[1] = 1f;
          Main.PlaySound(SoundID.Item42, this.position);
        }
      }
      if (this.type == 469)
      {
        ++this.localAI[1];
        if ((double) this.localAI[1] > 2.0)
        {
          this.alpha -= 50;
          if (this.alpha < 0)
            this.alpha = 0;
        }
      }
      else if (this.type == 83 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item33, this.position);
      }
      else if (this.type == 408 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(4, (int) this.position.X, (int) this.position.Y, 19);
      }
      else if (this.type == 259 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item33, this.position);
      }
      else if (this.type == 110 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item11, this.position);
      }
      else if (this.type == 302 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item11, this.position);
      }
      else if (this.type == 438 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item12, this.position);
      }
      else if (this.type == 593 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item11, this.position);
      }
      else if (this.type == 592 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item12, this.position);
      }
      else if (this.type == 462 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        if (Main.rand.Next(2) == 0)
          Main.PlaySound(SoundID.Item124, this.position);
        else
          Main.PlaySound(SoundID.Item125, this.position);
        Vector2 vector2 = Vector2.Normalize(this.velocity);
        int num = Main.rand.Next(5, 10);
        for (int index38 = 0; index38 < num; ++index38)
        {
          int index39 = Dust.NewDust(this.Center, 0, 0, 229, Alpha: 100);
          --Main.dust[index39].velocity.Y;
          Main.dust[index39].velocity += vector2 * 2f;
          Main.dust[index39].position -= Vector2.One * 4f;
          Main.dust[index39].noGravity = true;
        }
      }
      else if (this.type == 84 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item12, this.position);
      }
      else if (this.type == 389 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item12, this.position);
      }
      else if (this.type == 257 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item12, this.position);
      }
      else if (this.type == 100 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item33, this.position);
      }
      else if (this.type == 98 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item17, this.position);
      }
      else if (this.type == 184 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item17, this.position);
      }
      else if (this.type == 195 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item17, this.position);
      }
      else if (this.type == 275 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item17, this.position);
      }
      else if (this.type == 276 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item17, this.position);
      }
      else if ((this.type == 81 || this.type == 82) && (double) this.ai[1] == 0.0)
      {
        Main.PlaySound(SoundID.Item5, this.position);
        this.ai[1] = 1f;
      }
      else if (this.type == 180 && (double) this.ai[1] == 0.0)
      {
        Main.PlaySound(SoundID.Item11, this.position);
        this.ai[1] = 1f;
      }
      else if (this.type == 248 && (double) this.ai[1] == 0.0)
      {
        Main.PlaySound(SoundID.Item17, this.position);
        this.ai[1] = 1f;
      }
      else if (this.type == 576 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item12, this.position);
      }
      else if (this.type == 577 && (double) this.ai[1] == 0.0)
      {
        this.ai[1] = 1f;
        Main.PlaySound(SoundID.Item36, this.position);
      }
      else if (this.type == 710)
      {
        this.alpha -= 25;
        if (this.alpha < 0)
          this.alpha = 0;
        if (Main.rand.Next(4) == 0)
        {
          if (Main.rand.Next(2) == 0)
          {
            int index = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 100, Scale: 1.6f);
            Main.dust[index].noGravity = true;
          }
          int index40 = Dust.NewDust(this.position, this.width, this.height, 6, Alpha: 100, Scale: 1.2f);
          Main.dust[index40].noGravity = true;
          Main.dust[index40].velocity *= 2f;
          Main.dust[index40].velocity += this.velocity;
          Main.dust[index40].fadeIn = (double) this.ai[1] != -1.0 ? 1.22f : 1.5f;
          if (this.wet)
            this.Kill();
        }
      }
      else if (this.type == 639)
      {
        if ((double) this.localAI[0] == 0.0 && (double) this.localAI[1] == 0.0)
        {
          this.localAI[0] = this.Center.X;
          this.localAI[1] = this.Center.Y;
          this.ai[0] = this.velocity.X;
          this.ai[1] = this.velocity.Y;
        }
        this.alpha -= 25;
        if (this.alpha < 0)
          this.alpha = 0;
      }
      else if (this.type == 640)
      {
        this.alpha -= 25;
        if (this.alpha < 0)
          this.alpha = 0;
        if (this.velocity == Vector2.Zero)
        {
          this.ai[0] = 0.0f;
          bool flag = true;
          for (int index = 1; index < this.oldPos.Length; ++index)
          {
            if (this.oldPos[index] != this.oldPos[0])
              flag = false;
          }
          if (flag)
          {
            this.Kill();
            return;
          }
          if (Main.rand.Next(this.extraUpdates) == 0 && (this.velocity != Vector2.Zero || Main.rand.Next((double) this.localAI[1] == 2.0 ? 2 : 6) == 0))
          {
            for (int index41 = 0; index41 < 2; ++index41)
            {
              float num18 = this.rotation + (float) ((Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629);
              float num19 = (float) (Main.rand.NextDouble() * 0.800000011920929 + 1.0);
              Vector2 vector2 = new Vector2((float) Math.Cos((double) num18) * num19, (float) Math.Sin((double) num18) * num19);
              int index42 = Dust.NewDust(this.Center, 0, 0, 229, vector2.X, vector2.Y);
              Main.dust[index42].noGravity = true;
              Main.dust[index42].scale = 1.2f;
            }
            if (Main.rand.Next(10) == 0)
            {
              int index = Dust.NewDust(this.Center + this.velocity.RotatedBy(1.57079637050629) * ((float) Main.rand.NextDouble() - 0.5f) * (float) this.width - Vector2.One * 4f, 8, 8, 31, Alpha: 100, Scale: 1.5f);
              Main.dust[index].velocity *= 0.5f;
              Main.dust[index].velocity.Y = -Math.Abs(Main.dust[index].velocity.Y);
            }
          }
        }
        else if (this.numUpdates == 1)
        {
          float num20 = (float) ((double) this.rotation + 1.57079637050629 + (Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629);
          float num21 = (float) (Main.rand.NextDouble() * 0.25 + 0.25);
          Vector2 vector2 = new Vector2((float) Math.Cos((double) num20) * num21, (float) Math.Sin((double) num20) * num21);
          int index = Dust.NewDust(this.position, 0, 0, 229, vector2.X, vector2.Y);
          Main.dust[index].noGravity = true;
          Main.dust[index].scale = 1.2f;
        }
      }
      if (this.type == 41)
      {
        int index43 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.6f);
        Main.dust[index43].noGravity = true;
        int index44 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2f);
        Main.dust[index44].noGravity = true;
      }
      else if (this.type == 55)
      {
        int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 18, Scale: 0.9f);
        Main.dust[index].noGravity = true;
      }
      else if (this.type == 374)
      {
        if ((double) this.localAI[0] == 0.0)
        {
          Main.PlaySound(SoundID.Item17, this.position);
          this.localAI[0] = 1f;
        }
        if (Main.rand.Next(2) == 0)
        {
          int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 18, Scale: 0.9f);
          Main.dust[index].noGravity = true;
          Main.dust[index].velocity *= 0.5f;
        }
      }
      else if (this.type == 376)
      {
        if ((double) this.localAI[0] == 0.0)
          Main.PlaySound(SoundID.Item20, this.position);
        ++this.localAI[0];
        if ((double) this.localAI[0] > 3.0)
        {
          int num = 1;
          if ((double) this.localAI[0] > 5.0)
            num = 2;
          for (int index45 = 0; index45 < num; ++index45)
          {
            int index46 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 2f);
            Main.dust[index46].noGravity = true;
            Main.dust[index46].velocity.X *= 0.3f;
            Main.dust[index46].velocity.Y *= 0.3f;
            Main.dust[index46].noLight = true;
          }
          if (this.wet && !this.lavaWet)
          {
            this.Kill();
            return;
          }
        }
      }
      else if (this.type == 91 && Main.rand.Next(2) == 0)
      {
        int index = Dust.NewDust(this.position, this.width, this.height, Main.rand.Next(2) != 0 ? 58 : 15, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 150, Scale: 0.9f);
        Main.dust[index].velocity *= 0.25f;
      }
      if (this.type == 163 || this.type == 310)
      {
        if (this.alpha > 0)
          this.alpha -= 25;
        if (this.alpha < 0)
          this.alpha = 0;
      }
      switch (this.type)
      {
        case 14:
        case 20:
        case 36:
        case 83:
        case 84:
        case 89:
        case 100:
        case 104:
        case 110:
        case 158:
        case 159:
        case 160:
        case 161:
        case 180:
        case 279:
        case 283:
        case 284:
        case 285:
        case 286:
        case 287:
        case 389:
          if (this.alpha > 0)
            this.alpha -= 15;
          if (this.alpha < 0)
          {
            this.alpha = 0;
            break;
          }
          break;
        case 576:
        case 577:
          ++this.localAI[1];
          if ((double) this.localAI[1] > 2.0)
          {
            if (this.alpha > 0)
              this.alpha -= 15;
            if (this.alpha < 0)
            {
              this.alpha = 0;
              break;
            }
            break;
          }
          break;
      }
      if (this.type == 484)
      {
        int index = Dust.NewDust(this.position, this.width, this.height, 78);
        Main.dust[index].noGravity = true;
        Main.dust[index].velocity *= 0.1f;
        Main.dust[index].scale = 0.75f;
        Main.dust[index].position = (Main.dust[index].position + this.Center) / 2f;
        Main.dust[index].position += this.velocity * (float) Main.rand.Next(0, 101) * 0.01f;
      }
      if (this.type == 242 || this.type == 302 || this.type == 438 || this.type == 462 || this.type == 592)
      {
        float num = (float) Math.Sqrt((double) this.velocity.X * (double) this.velocity.X + (double) this.velocity.Y * (double) this.velocity.Y);
        if (this.alpha > 0)
          this.alpha -= (int) (byte) ((double) num * 0.9);
        if (this.alpha < 0)
          this.alpha = 0;
      }
      if (this.type == 660)
      {
        DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f;
        Utils.PlotTileLine(this.Center, this.Center + this.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
        if (this.alpha > 0)
        {
          Main.PlaySound(SoundID.Item9, this.Center);
          this.alpha = 0;
          this.scale = 1.1f;
          this.frame = Main.rand.Next(14);
          float num = 16f;
          for (int index47 = 0; (double) index47 < (double) num; ++index47)
          {
            Vector2 v = (Vector2.UnitX * 0.0f + -Vector2.UnitY.RotatedBy((double) index47 * (6.28318548202515 / (double) num)) * new Vector2(1f, 4f)).RotatedBy((double) this.velocity.ToRotation());
            int index48 = Dust.NewDust(this.Center, 0, 0, 180);
            Main.dust[index48].scale = 1.5f;
            Main.dust[index48].noGravity = true;
            Main.dust[index48].position = this.Center + v;
            Main.dust[index48].velocity = this.velocity * 0.0f + v.SafeNormalize(Vector2.UnitY) * 1f;
          }
        }
      }
      if (this.type == 712)
      {
        DelegateMethods.v3_1 = new Vector3(0.4f, 0.4f, 0.4f) * 0.7f;
        Utils.PlotTileLine(this.Center, this.Center + this.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
        if (this.alpha == (int) byte.MaxValue)
          this.frame = Main.rand.Next(2) * 4;
        if (++this.frameCounter >= 4)
        {
          this.frameCounter = 0;
          ++this.frame;
          if (this.frame == 4)
            this.frame = 0;
          if (this.frame >= 8)
            this.frame = 4;
        }
        if (this.alpha > 0)
        {
          this.alpha = 0;
          this.scale = 1.1f;
          this.frame = Main.rand.Next(14);
          float num = 4f;
          for (int index49 = 0; (double) index49 < (double) num; ++index49)
          {
            Vector2 v = (Vector2.UnitX * 0.0f + -Vector2.UnitY.RotatedBy((double) index49 * (6.28318548202515 / (double) num)) * new Vector2(1f, 4f)).RotatedBy((double) this.velocity.ToRotation());
            int index50 = Dust.NewDust(this.Center, 0, 0, 15);
            Main.dust[index50].scale = 1.7f;
            Main.dust[index50].noGravity = true;
            Main.dust[index50].position = this.Center + v + this.velocity.SafeNormalize(Vector2.Zero) * 50f;
            Main.dust[index50].velocity = Main.dust[index50].velocity * 2f + v.SafeNormalize(Vector2.UnitY) * 0.3f + this.velocity.SafeNormalize(Vector2.Zero) * 3f;
            Main.dust[index50].velocity *= 0.7f;
            Main.dust[index50].position += Main.dust[index50].velocity * 5f;
          }
        }
      }
      if (this.type == 661)
      {
        if (this.alpha <= 0)
        {
          for (int index51 = 0; index51 < 3; ++index51)
          {
            int index52 = Dust.NewDust(this.position, this.width, this.height, 240);
            Main.dust[index52].noGravity = true;
            Main.dust[index52].velocity *= 0.3f;
            Main.dust[index52].noLight = true;
          }
        }
        if (this.alpha > 0)
        {
          this.alpha -= 55;
          this.scale = 1.3f;
          if (this.alpha < 0)
          {
            this.alpha = 0;
            float num = 16f;
            for (int index53 = 0; (double) index53 < (double) num; ++index53)
            {
              Vector2 vector2 = (Vector2.UnitX * 0.0f + -Vector2.UnitY.RotatedBy((double) index53 * (6.28318548202515 / (double) num)) * new Vector2(1f, 4f)).RotatedBy((double) this.velocity.ToRotation());
              int index54 = Dust.NewDust(this.Center, 0, 0, 62);
              Main.dust[index54].scale = 1.5f;
              Main.dust[index54].noLight = true;
              Main.dust[index54].noGravity = true;
              Main.dust[index54].position = this.Center + vector2;
              Main.dust[index54].velocity = Main.dust[index54].velocity * 4f + this.velocity * 0.3f;
            }
          }
        }
      }
      if (this.type == 706)
      {
        if (this.wet)
        {
          this.Kill();
          return;
        }
        if ((double) this.localAI[1] == 0.0)
        {
          float[] localAi = this.localAI;
          SlotId slotId = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_PhantomPhoenixShot, this.Center);
          double num = (double) ((SlotId) ref slotId).ToFloat();
          localAi[0] = (float) num;
          ++this.localAI[1];
          for (int index = 0; index < 15; ++index)
          {
            if (Main.rand.Next(4) != 0)
            {
              Dust dust = Dust.NewDustDirect(this.Center - this.Size / 4f, this.width / 2, this.height / 2, Utils.SelectRandom<int>(Main.rand, 6, 31, 31));
              dust.noGravity = true;
              dust.velocity *= 2.3f;
              dust.fadeIn = 1.5f;
              dust.noLight = true;
            }
          }
        }
        ActiveSound activeSound = Main.GetActiveSound(SlotId.FromFloat(this.localAI[0]));
        if (activeSound != null)
        {
          activeSound.Position = this.Center;
        }
        else
        {
          float[] localAi = this.localAI;
          SlotId invalid = (SlotId) SlotId.Invalid;
          double num = (double) ((SlotId) ref invalid).ToFloat();
          localAi[0] = (float) num;
        }
        if (this.alpha <= 0)
        {
          for (int index = 0; index < 2; ++index)
          {
            if (Main.rand.Next(4) != 0)
            {
              Dust dust = Dust.NewDustDirect(this.Center - this.Size / 4f, this.width / 2, this.height / 2, Utils.SelectRandom<int>(Main.rand, 6, 31, 31));
              dust.noGravity = true;
              dust.velocity *= 2.3f;
              dust.fadeIn = 1.5f;
              dust.noLight = true;
            }
          }
          Vector2 vector2_10 = (new Vector2(0.0f, (float) Math.Cos((double) this.frameCounter * 6.28318548202515 / 40.0 - 1.57079637050629)) * 16f).RotatedBy((double) this.rotation);
          Vector2 vector2_11 = this.velocity.SafeNormalize(Vector2.Zero);
          for (int index = 0; index < 1; ++index)
          {
            Dust dust1 = Dust.NewDustDirect(this.Center - this.Size / 4f, this.width / 2, this.height / 2, 6);
            dust1.noGravity = true;
            dust1.position = this.Center + vector2_10;
            dust1.velocity *= 0.0f;
            dust1.fadeIn = 1.4f;
            dust1.scale = 1.15f;
            dust1.noLight = true;
            dust1.position += this.velocity * 1.2f;
            dust1.velocity += vector2_11 * 2f;
            Dust dust2 = Dust.NewDustDirect(this.Center - this.Size / 4f, this.width / 2, this.height / 2, 6);
            dust2.noGravity = true;
            dust2.position = this.Center + vector2_10;
            dust2.velocity *= 0.0f;
            dust2.fadeIn = 1.4f;
            dust2.scale = 1.15f;
            dust2.noLight = true;
            dust2.position += this.velocity * 0.5f;
            dust2.position += this.velocity * 1.2f;
            dust2.velocity += vector2_11 * 2f;
          }
        }
        if (++this.frameCounter >= 40)
          this.frameCounter = 0;
        this.frame = this.frameCounter / 5;
        if (this.alpha > 0)
        {
          this.alpha -= 55;
          if (this.alpha < 0)
          {
            this.alpha = 0;
            float num = 16f;
            for (int index55 = 0; (double) index55 < (double) num; ++index55)
            {
              Vector2 vector2 = (Vector2.UnitX * 0.0f + -Vector2.UnitY.RotatedBy((double) index55 * (6.28318548202515 / (double) num)) * new Vector2(1f, 4f)).RotatedBy((double) this.velocity.ToRotation());
              int index56 = Dust.NewDust(this.Center, 0, 0, 6);
              Main.dust[index56].scale = 1.5f;
              Main.dust[index56].noLight = true;
              Main.dust[index56].noGravity = true;
              Main.dust[index56].position = this.Center + vector2;
              Main.dust[index56].velocity = Main.dust[index56].velocity * 4f + this.velocity * 0.3f;
            }
          }
        }
        DelegateMethods.v3_1 = new Vector3(1f, 0.6f, 0.2f);
        Utils.PlotTileLine(this.Center, this.Center + this.velocity * 4f, 40f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
      }
      if (this.type == 638)
      {
        float num22 = this.velocity.Length();
        if (this.alpha > 0)
          this.alpha -= (int) (byte) ((double) num22 * 0.3);
        if (this.alpha < 0)
          this.alpha = 0;
        Microsoft.Xna.Framework.Rectangle hitbox = this.Hitbox;
        hitbox.Offset((int) this.velocity.X, (int) this.velocity.Y);
        bool flag = false;
        for (int index = 0; index < 200; ++index)
        {
          NPC npc = Main.npc[index];
          if (npc.active && !npc.dontTakeDamage && npc.immune[this.owner] == 0 && this.localNPCImmunity[index] == 0 && npc.Hitbox.Intersects(hitbox) && !npc.friendly)
          {
            flag = true;
            break;
          }
        }
        if (flag)
        {
          int num23 = Main.rand.Next(15, 31);
          for (int index57 = 0; index57 < num23; ++index57)
          {
            int index58 = Dust.NewDust(this.Center, 0, 0, 229, Alpha: 100, Scale: 0.8f);
            Main.dust[index58].velocity *= 1.6f;
            --Main.dust[index58].velocity.Y;
            Main.dust[index58].velocity += this.velocity;
            Main.dust[index58].noGravity = true;
          }
        }
      }
      if (this.type == 257 || this.type == 593)
      {
        if (this.alpha > 0)
          this.alpha -= 10;
        if (this.alpha < 0)
          this.alpha = 0;
      }
      if (this.type == 88)
      {
        if (this.alpha > 0)
          this.alpha -= 10;
        if (this.alpha < 0)
          this.alpha = 0;
      }
      if (this.type == 532)
        ++this.ai[0];
      bool flag1 = true;
      int type = this.type;
      if (type <= 323)
      {
        if (type <= 161)
        {
          if (type <= 55)
          {
            if (type <= 20)
            {
              if (type != 5 && type != 14 && type != 20)
                goto label_608;
            }
            else if (type != 36 && type != 38 && type != 55)
              goto label_608;
          }
          else if (type <= 98)
          {
            if ((uint) (type - 83) > 1U && (uint) (type - 88) > 1U && type != 98)
              goto label_608;
          }
          else if (type <= 104)
          {
            if (type != 100 && type != 104)
              goto label_608;
          }
          else if (type != 110 && (uint) (type - 158) > 3U)
            goto label_608;
        }
        else if (type <= 259)
        {
          if (type <= 242)
          {
            if (type != 180 && type != 184 && type != 242)
              goto label_608;
          }
          else if (type != 248 && type != 257 && type != 259)
            goto label_608;
        }
        else if (type <= 279)
        {
          if (type != 265 && type != 270 && type != 279)
            goto label_608;
        }
        else if (type <= 299)
        {
          if ((uint) (type - 283) > 4U && type != 299)
            goto label_608;
        }
        else if (type != 302 && type != 323)
          goto label_608;
      }
      else if (type <= 485)
      {
        if (type <= 389)
        {
          if (type <= 355)
          {
            if (type != 325 && (uint) (type - 348) > 2U && type != 355)
              goto label_608;
          }
          else if (type != 374 && type != 376 && type != 389)
            goto label_608;
        }
        else if (type <= 459)
        {
          switch (type - 435)
          {
            case 0:
            case 1:
            case 3:
            case 5:
            case 7:
              break;
            case 2:
            case 4:
            case 6:
              goto label_608;
            default:
              if (type == 449 || type == 459)
                break;
              goto label_608;
          }
        }
        else if (type <= 469)
        {
          if (type != 462 && (uint) (type - 467) > 2U)
            goto label_608;
        }
        else if (type != 472 && (uint) (type - 483) > 2U)
          goto label_608;
      }
      else if (type <= 606)
      {
        if (type <= 585)
        {
          if (type != 498 && (uint) (type - 576) > 1U && type != 585)
            goto label_608;
        }
        else if ((uint) (type - 592) > 1U && type != 601 && type != 606)
          goto label_608;
      }
      else if (type <= 639)
      {
        if (type != 616 && (uint) (type - 634) > 1U && (uint) (type - 638) > 1U)
          goto label_608;
      }
      else if (type <= 682)
      {
        if ((uint) (type - 660) > 1U && type != 682)
          goto label_608;
      }
      else if (type != 684)
      {
        switch (type - 706)
        {
          case 0:
          case 3:
          case 4:
          case 6:
            break;
          default:
            goto label_608;
        }
      }
      flag1 = false;
label_608:
      if (flag1)
        ++this.ai[0];
      if (this.type == 270)
      {
        int closest = (int) Player.FindClosest(this.Center, 1, 1);
        ++this.ai[1];
        if ((double) this.ai[1] < 110.0 && (double) this.ai[1] > 30.0)
        {
          float num = this.velocity.Length();
          Vector2 vector2 = Main.player[closest].Center - this.Center;
          vector2.Normalize();
          this.velocity = (this.velocity * 24f + vector2 * num) / 25f;
          this.velocity.Normalize();
          this.velocity = this.velocity * num;
        }
        if ((double) this.ai[0] < 0.0)
        {
          if ((double) this.velocity.Length() < 18.0)
            this.velocity = this.velocity * 1.02f;
          if ((double) this.localAI[0] == 0.0)
          {
            this.localAI[0] = 1f;
            Main.PlaySound(SoundID.Item8, this.position);
            for (int index59 = 0; index59 < 10; ++index59)
            {
              int index60 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 5, this.velocity.X, this.velocity.Y, Scale: 2f);
              Main.dust[index60].noGravity = true;
              Main.dust[index60].velocity = this.Center - Main.dust[index60].position;
              Main.dust[index60].velocity.Normalize();
              Main.dust[index60].velocity *= -5f;
              Main.dust[index60].velocity += this.velocity / 2f;
            }
          }
          this.friendly = false;
          this.hostile = true;
        }
      }
      if (this.type == 585)
      {
        if ((double) this.localAI[0] == 0.0)
        {
          this.localAI[0] = 1f;
          Main.PlaySound(SoundID.Item8, this.position);
          for (int index61 = 0; index61 < 3; ++index61)
          {
            int index62 = Dust.NewDust(this.position, this.width, this.height, 27, this.velocity.X, this.velocity.Y, Scale: 2f);
            Main.dust[index62].noGravity = true;
            Main.dust[index62].velocity = this.Center - Main.dust[index62].position;
            Main.dust[index62].velocity.Normalize();
            Main.dust[index62].velocity *= -5f;
            Main.dust[index62].velocity += this.velocity / 2f;
            Main.dust[index62].noLight = true;
          }
        }
        if (this.alpha > 0)
          this.alpha -= 50;
        if (this.alpha < 0)
          this.alpha = 0;
        ++this.frameCounter;
        if (this.frameCounter >= 12)
          this.frameCounter = 0;
        this.frame = this.frameCounter / 2;
        if (this.frame > 3)
          this.frame = 6 - this.frame;
        Vector3 vector3 = NPCID.Sets.MagicAuraColor[54].ToVector3();
        Lighting.AddLight(this.Center, vector3.X, vector3.Y, vector3.Z);
        if (Main.rand.Next(3) == 0)
        {
          int index = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 27, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 2f);
          Main.dust[index].position -= this.velocity * 2f;
          Main.dust[index].noLight = true;
          Main.dust[index].noGravity = true;
          Main.dust[index].velocity.X *= 0.3f;
          Main.dust[index].velocity.Y *= 0.3f;
        }
      }
      if (this.type == 594)
      {
        int num = (int) (43.0 - (double) this.ai[1]) / 13;
        if (num < 1)
          num = 1;
        int Type = (double) this.ai[1] < 20.0 ? 6 : 31;
        for (int index63 = 0; index63 < num; ++index63)
        {
          int index64 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, Type, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, Scale: 2f);
          Main.dust[index64].position -= this.velocity * 2f;
          Main.dust[index64].noLight = true;
          Main.dust[index64].noGravity = true;
          Main.dust[index64].velocity.X *= 0.3f;
          Main.dust[index64].velocity.Y *= 0.3f;
          if (Type == 6)
            Main.dust[index64].fadeIn = Main.rand.NextFloat() * 2f;
        }
        ++this.ai[1];
        if ((double) this.ai[1] > (double) (43 * this.MaxUpdates))
        {
          this.Kill();
          return;
        }
      }
      if (this.type == 622)
      {
        int Type = 229;
        if (Main.rand.Next(3) != 0)
        {
          int index = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, Type, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, Scale: 1.2f);
          Main.dust[index].position -= this.velocity * 2f;
          Main.dust[index].noLight = true;
          Main.dust[index].noGravity = true;
          Main.dust[index].velocity.X *= 0.3f;
          Main.dust[index].velocity.Y *= 0.3f;
        }
        ++this.ai[1];
        if ((double) this.ai[1] > (double) (23 * this.MaxUpdates))
        {
          this.Kill();
          return;
        }
      }
      if (this.type == 587)
      {
        Color rgb = Main.hslToRgb(this.ai[1], 1f, 0.5f);
        rgb.A = (byte) 200;
        ++this.localAI[0];
        if ((double) this.localAI[0] >= 2.0)
        {
          if ((double) this.localAI[0] == 2.0)
          {
            Main.PlaySound(SoundID.Item5, this.position);
            for (int index65 = 0; index65 < 4; ++index65)
            {
              int index66 = Dust.NewDust(this.position, this.width, this.height, 76, this.velocity.X, this.velocity.Y, newColor: rgb, Scale: 1.1f);
              Main.dust[index66].noGravity = true;
              Main.dust[index66].velocity = this.Center - Main.dust[index66].position;
              Main.dust[index66].velocity.Normalize();
              Main.dust[index66].velocity *= -3f;
              Main.dust[index66].velocity += this.velocity / 2f;
            }
          }
          else
          {
            ++this.frame;
            if (this.frame > 2)
              this.frame = 0;
            for (int index67 = 0; index67 < 1; ++index67)
            {
              int index68 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 76, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, newColor: rgb, Scale: 0.9f);
              Main.dust[index68].position = this.Center;
              Main.dust[index68].noGravity = true;
              Main.dust[index68].velocity = this.velocity * 0.5f;
            }
          }
        }
      }
      if (this.type == 349)
      {
        this.frame = (int) this.ai[0];
        this.velocity.Y += 0.2f;
        if ((double) this.localAI[0] == 0.0 || (double) this.localAI[0] == 2.0)
        {
          this.scale += 0.01f;
          this.alpha -= 50;
          if (this.alpha <= 0)
          {
            this.localAI[0] = 1f;
            this.alpha = 0;
          }
        }
        else if ((double) this.localAI[0] == 1.0)
        {
          this.scale -= 0.01f;
          this.alpha += 50;
          if (this.alpha >= (int) byte.MaxValue)
          {
            this.localAI[0] = 2f;
            this.alpha = (int) byte.MaxValue;
          }
        }
      }
      if (this.type == 348)
      {
        if ((double) this.localAI[1] == 0.0)
        {
          this.localAI[1] = 1f;
          Main.PlaySound(SoundID.Item8, this.position);
        }
        if ((double) this.ai[0] == 0.0 || (double) this.ai[0] == 2.0)
        {
          this.scale += 0.01f;
          this.alpha -= 50;
          if (this.alpha <= 0)
          {
            this.ai[0] = 1f;
            this.alpha = 0;
          }
        }
        else if ((double) this.ai[0] == 1.0)
        {
          this.scale -= 0.01f;
          this.alpha += 50;
          if (this.alpha >= (int) byte.MaxValue)
          {
            this.ai[0] = 2f;
            this.alpha = (int) byte.MaxValue;
          }
        }
      }
      if (this.type == 572)
      {
        if ((double) this.localAI[0] == 0.0)
        {
          this.localAI[0] = 1f;
          Main.PlaySound(SoundID.Item17, this.position);
        }
        for (int index69 = 0; index69 < 2; ++index69)
        {
          int index70 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 40, this.velocity.X, this.velocity.Y, 100);
          Main.dust[index70].velocity *= 0.5f;
          Main.dust[index70].velocity += this.velocity;
          Main.dust[index70].velocity *= 0.5f;
          Main.dust[index70].noGravity = true;
          Main.dust[index70].scale = 1.2f;
          Main.dust[index70].position = (this.Center + this.position) / 2f;
        }
      }
      if (this.type == 577)
        Lighting.AddLight(this.Center, 0.1f, 0.3f, 0.4f);
      else if (this.type == 576)
      {
        Lighting.AddLight(this.Center, 0.4f, 0.2f, 0.4f);
        for (int index = 0; index < 5; ++index)
        {
          Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 242, this.velocity.X, this.velocity.Y, 100)];
          dust.velocity = Vector2.Zero;
          dust.position -= this.velocity / 5f * (float) index;
          dust.noGravity = true;
          dust.scale = 0.8f;
          dust.noLight = true;
        }
      }
      else if (this.type == 581)
      {
        if ((double) this.localAI[0] == 0.0)
        {
          this.localAI[0] = 1f;
          Main.PlaySound(SoundID.Item17, this.Center);
        }
        for (int index = 0; index < 2; ++index)
        {
          int Type = Utils.SelectRandom<int>(Main.rand, 229, 161, 161);
          Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X, this.velocity.Y, 100)];
          dust.velocity = dust.velocity / 4f + this.velocity / 2f;
          dust.noGravity = true;
          dust.scale = 1.2f;
          dust.position = this.Center;
          dust.noLight = true;
        }
      }
      else if (this.type == 671)
      {
        if ((double) this.localAI[0] == 0.0)
        {
          this.localAI[0] = 1f;
          for (int index = 0; index < 8; ++index)
          {
            int Type = Utils.SelectRandom<int>(Main.rand, 27, 62);
            Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X, this.velocity.Y, 100)];
            dust.velocity = (Main.rand.NextFloatDirection() * 3.141593f).ToRotationVector2() * 2f + this.velocity.SafeNormalize(Vector2.Zero) * 3f;
            dust.noGravity = true;
            dust.scale = 1.5f;
            dust.fadeIn = 1.2f;
            dust.position = this.Center;
            dust.noLight = true;
          }
        }
        this.alpha -= 20;
        if (this.alpha < 0)
          this.alpha = 0;
        for (int index = 0; index < 2; ++index)
        {
          int Type = Utils.SelectRandom<int>(Main.rand, 27, 27, 62);
          Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X, this.velocity.Y, 100)];
          dust.velocity = dust.velocity / 4f + this.velocity / 2f;
          dust.noGravity = true;
          dust.scale = 1.2f;
          dust.position = this.Center;
          dust.noLight = true;
        }
      }
      else if (this.type == 675)
      {
        if ((double) this.localAI[0] == 0.0)
        {
          this.localAI[0] = 1f;
          Main.PlayTrackedSound((SoundStyle) SoundID.DD2_DarkMageAttack, this.Center);
        }
        this.alpha -= 20;
        if (this.alpha < 0)
          this.alpha = 0;
      }
      else if (this.type == 676)
      {
        if ((double) this.localAI[0] == 0.0)
        {
          this.localAI[0] = 1f;
          Main.PlaySound(SoundID.Item17, this.Center);
        }
        this.alpha -= 20;
        if (this.alpha < 0)
          this.alpha = 0;
        for (int index = 0; index < 2; ++index)
        {
          if (Main.rand.Next(5) != 0)
          {
            int Type = Utils.SelectRandom<int>(Main.rand, 4, 256);
            Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X, this.velocity.Y, 100)];
            dust.velocity = dust.velocity / 4f + this.velocity / 2f;
            dust.scale = (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.400000005960464);
            dust.position = this.Center;
            dust.position += new Vector2((float) (this.width * 2), 0.0f).RotatedBy(6.28318548202515 * (double) Main.rand.NextFloat()) * Main.rand.NextFloat();
            dust.noLight = true;
            if (dust.type == 4)
              dust.color = new Color(80, 170, 40, 120);
          }
        }
      }
      else if (this.type == 686)
      {
        if ((double) this.localAI[0] == 0.0)
        {
          this.localAI[0] = 1f;
          Main.PlayTrackedSound((SoundStyle) SoundID.DD2_BetsyFireballShot, this.Center);
        }
        if ((double) this.ai[0] >= 2.0)
        {
          this.alpha -= 25;
          if (this.alpha < 0)
            this.alpha = 0;
        }
        if (Main.rand.Next(4) == 0)
        {
          Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 55, Alpha: 200);
          dust.scale *= 0.7f;
          dust.velocity += this.velocity * 1f;
        }
        if (Main.rand.Next(3) == 0 && this.oldPos[9] != Vector2.Zero)
        {
          Dust dust = Dust.NewDustDirect(this.oldPos[9], this.width, this.height, 55, Alpha: 50);
          dust.scale *= 0.85f;
          dust.velocity += this.velocity * 0.85f;
          dust.color = Color.Purple;
        }
      }
      else if (this.type == 711)
      {
        if ((double) this.localAI[0] == 0.0)
        {
          this.localAI[0] = 1f;
          for (int index = 0; index < 10; ++index)
          {
            Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 55, Alpha: 200);
            dust.scale *= 0.65f;
            dust.velocity *= 1.5f;
            dust.velocity += this.velocity * 0.3f;
            dust.fadeIn = 0.7f;
          }
        }
        if ((double) this.ai[0] >= 2.0)
        {
          this.alpha -= 25;
          if (this.alpha < 0)
            this.alpha = 0;
        }
        if (Main.rand.Next(4) == 0)
        {
          Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 55, Alpha: 200);
          dust.scale *= 0.7f;
          dust.velocity += this.velocity * 1f;
        }
        if (Main.rand.Next(3) == 0 && this.oldPos[9] != Vector2.Zero)
        {
          Dust dust = Dust.NewDustDirect(this.oldPos[9], this.width, this.height, 55, Alpha: 50);
          dust.scale *= 0.85f;
          dust.velocity += this.velocity * 0.85f;
          dust.color = Color.Purple;
        }
      }
      if (this.type == 299)
      {
        if ((double) this.localAI[0] == 6.0)
        {
          Main.PlaySound(SoundID.Item8, this.position);
          for (int index71 = 0; index71 < 40; ++index71)
          {
            int index72 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 181, Alpha: 100);
            Main.dust[index72].velocity *= 3f;
            Main.dust[index72].velocity += this.velocity * 0.75f;
            Main.dust[index72].scale *= 1.2f;
            Main.dust[index72].noGravity = true;
          }
        }
        ++this.localAI[0];
        if ((double) this.localAI[0] > 6.0)
        {
          for (int index73 = 0; index73 < 3; ++index73)
          {
            int index74 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 181, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100);
            Main.dust[index74].velocity *= 0.6f;
            Main.dust[index74].scale *= 1.4f;
            Main.dust[index74].noGravity = true;
          }
        }
      }
      else if (this.type == 270)
      {
        if ((double) this.ai[0] < 0.0)
          this.alpha = 0;
        if (this.alpha > 0)
          this.alpha -= 50;
        if (this.alpha < 0)
          this.alpha = 0;
        ++this.frame;
        if (this.frame > 2)
          this.frame = 0;
        if ((double) this.ai[0] < 0.0)
        {
          for (int index75 = 0; index75 < 2; ++index75)
          {
            int index76 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 5, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 1.5f);
            Main.dust[index76].position -= this.velocity;
            Main.dust[index76].noGravity = true;
            Main.dust[index76].velocity.X *= 0.3f;
            Main.dust[index76].velocity.Y *= 0.3f;
          }
        }
        else
        {
          for (int index77 = 0; index77 < 2; ++index77)
          {
            int index78 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 2f);
            Main.dust[index78].position -= this.velocity * 2f;
            Main.dust[index78].noGravity = true;
            Main.dust[index78].velocity.X *= 0.3f;
            Main.dust[index78].velocity.Y *= 0.3f;
          }
        }
      }
      if (this.type == 259)
      {
        if (this.alpha > 0)
          this.alpha -= 10;
        if (this.alpha < 0)
          this.alpha = 0;
      }
      if (this.type == 265)
      {
        if (this.alpha > 0)
          this.alpha -= 50;
        if (this.alpha < 0)
          this.alpha = 0;
        if (this.alpha == 0)
        {
          int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 163, this.velocity.X, this.velocity.Y, 100, Scale: 1.2f);
          Main.dust[index].noGravity = true;
          Main.dust[index].velocity *= 0.3f;
          Main.dust[index].velocity -= this.velocity * 0.4f;
        }
      }
      if (this.type == 355)
      {
        if (this.alpha > 0)
          this.alpha -= 50;
        if (this.alpha < 0)
          this.alpha = 0;
        if (this.alpha == 0)
        {
          int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 205, this.velocity.X, this.velocity.Y, 100, Scale: 1.2f);
          Main.dust[index].noGravity = true;
          Main.dust[index].velocity *= 0.3f;
          Main.dust[index].velocity -= this.velocity * 0.4f;
        }
      }
      if (this.type == 357)
      {
        if (this.alpha < 170)
        {
          for (int index79 = 0; index79 < 10; ++index79)
          {
            float x = this.position.X - this.velocity.X / 10f * (float) index79;
            float y = this.position.Y - this.velocity.Y / 10f * (float) index79;
            int index80 = Dust.NewDust(new Vector2(x, y), 1, 1, 206);
            Main.dust[index80].alpha = this.alpha;
            Main.dust[index80].position.X = x;
            Main.dust[index80].position.Y = y;
            Main.dust[index80].velocity *= 0.0f;
            Main.dust[index80].noGravity = true;
          }
        }
        if (this.alpha > 0)
          this.alpha -= 25;
        if (this.alpha < 0)
          this.alpha = 0;
      }
      else if (this.type == 207)
      {
        if (this.alpha < 170)
        {
          for (int index81 = 0; index81 < 10; ++index81)
          {
            float x = this.position.X - this.velocity.X / 10f * (float) index81;
            float y = this.position.Y - this.velocity.Y / 10f * (float) index81;
            int index82 = Dust.NewDust(new Vector2(x, y), 1, 1, 75);
            Main.dust[index82].alpha = this.alpha;
            Main.dust[index82].position.X = x;
            Main.dust[index82].position.Y = y;
            Main.dust[index82].velocity *= 0.0f;
            Main.dust[index82].noGravity = true;
          }
        }
        float num24 = (float) Math.Sqrt((double) this.velocity.X * (double) this.velocity.X + (double) this.velocity.Y * (double) this.velocity.Y);
        float num25 = this.localAI[0];
        if ((double) num25 == 0.0)
        {
          this.localAI[0] = num24;
          num25 = num24;
        }
        if (this.alpha > 0)
          this.alpha -= 25;
        if (this.alpha < 0)
          this.alpha = 0;
        float num26 = this.position.X;
        float num27 = this.position.Y;
        float num28 = 300f;
        bool flag2 = false;
        int num29 = 0;
        if ((double) this.ai[1] == 0.0)
        {
          for (int index = 0; index < 200; ++index)
          {
            if (Main.npc[index].CanBeChasedBy((object) this) && ((double) this.ai[1] == 0.0 || (double) this.ai[1] == (double) (index + 1)))
            {
              float num30 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
              float num31 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
              float num32 = Math.Abs(this.position.X + (float) (this.width / 2) - num30) + Math.Abs(this.position.Y + (float) (this.height / 2) - num31);
              if ((double) num32 < (double) num28 && Collision.CanHit(new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2)), 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
              {
                num28 = num32;
                num26 = num30;
                num27 = num31;
                flag2 = true;
                num29 = index;
              }
            }
          }
          if (flag2)
            this.ai[1] = (float) (num29 + 1);
          flag2 = false;
        }
        if ((double) this.ai[1] > 0.0)
        {
          int index = (int) ((double) this.ai[1] - 1.0);
          if (Main.npc[index].active && Main.npc[index].CanBeChasedBy((object) this, true) && !Main.npc[index].dontTakeDamage)
          {
            float num33 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
            float num34 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
            if ((double) Math.Abs(this.position.X + (float) (this.width / 2) - num33) + (double) Math.Abs(this.position.Y + (float) (this.height / 2) - num34) < 1000.0)
            {
              flag2 = true;
              num26 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
              num27 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
            }
          }
          else
            this.ai[1] = 0.0f;
        }
        if (!this.friendly)
          flag2 = false;
        if (flag2)
        {
          double num35 = (double) num25;
          Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
          float num36 = num26 - vector2.X;
          float num37 = num27 - vector2.Y;
          double num38 = Math.Sqrt((double) num36 * (double) num36 + (double) num37 * (double) num37);
          float num39 = (float) (num35 / num38);
          float num40 = num36 * num39;
          float num41 = num37 * num39;
          int num42 = 8;
          this.velocity.X = (this.velocity.X * (float) (num42 - 1) + num40) / (float) num42;
          this.velocity.Y = (this.velocity.Y * (float) (num42 - 1) + num41) / (float) num42;
        }
      }
      else if (this.type == 81 || this.type == 91)
      {
        if ((double) this.ai[0] >= 20.0)
        {
          this.ai[0] = 20f;
          this.velocity.Y += 0.07f;
        }
      }
      else if (this.type == 174 || this.type == 605)
      {
        if ((double) this.ai[0] >= 5.0)
        {
          this.ai[0] = 5f;
          this.velocity.Y += 0.15f;
        }
      }
      else if (this.type == 337)
      {
        if ((double) this.position.Y > (double) Main.player[this.owner].position.Y - 300.0)
          this.tileCollide = true;
        if ((double) this.position.Y < Main.worldSurface * 16.0)
          this.tileCollide = true;
        this.frame = (int) this.ai[1];
        if (Main.rand.Next(2) == 0)
        {
          int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 197);
          Main.dust[index].velocity *= 0.5f;
          Main.dust[index].noGravity = true;
        }
      }
      else if (this.type == 645)
      {
        if ((double) this.ai[1] != -1.0 && (double) this.position.Y > (double) this.ai[1])
          this.tileCollide = true;
        if (this.position.HasNaNs())
        {
          this.Kill();
          return;
        }
        int num43 = WorldGen.SolidTile(Framing.GetTileSafely((int) this.position.X / 16, (int) this.position.Y / 16)) ? 1 : 0;
        Dust dust = Main.dust[Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229)];
        dust.position = this.Center;
        dust.velocity = Vector2.Zero;
        dust.noGravity = true;
        if (num43 != 0)
          dust.noLight = true;
        if ((double) this.ai[1] == -1.0)
        {
          ++this.ai[0];
          this.velocity = Vector2.Zero;
          this.tileCollide = false;
          this.penetrate = -1;
          this.position = this.Center;
          this.width = this.height = 140;
          this.Center = this.position;
          this.alpha -= 10;
          if (this.alpha < 0)
            this.alpha = 0;
          if (++this.frameCounter >= this.MaxUpdates * 3)
          {
            this.frameCounter = 0;
            ++this.frame;
          }
          if ((double) this.ai[0] < (double) (Main.projFrames[this.type] * this.MaxUpdates * 3))
            return;
          this.Kill();
          return;
        }
        this.alpha = (int) byte.MaxValue;
        if (this.numUpdates == 0)
        {
          int num44 = -1;
          float num45 = 60f;
          for (int index = 0; index < 200; ++index)
          {
            NPC npc = Main.npc[index];
            if (npc.CanBeChasedBy((object) this))
            {
              float num46 = this.Distance(npc.Center);
              if ((double) num46 < (double) num45 && Collision.CanHitLine(this.Center, 0, 0, npc.Center, 0, 0))
              {
                num45 = num46;
                num44 = index;
              }
            }
          }
          if (num44 != -1)
          {
            this.ai[0] = 0.0f;
            this.ai[1] = -1f;
            this.netUpdate = true;
            return;
          }
        }
      }
      else if (this.type >= 424 && this.type <= 426)
      {
        if ((double) this.position.Y > (double) Main.player[this.owner].position.Y - 300.0)
          this.tileCollide = true;
        if ((double) this.position.Y < Main.worldSurface * 16.0)
          this.tileCollide = true;
        this.scale = this.ai[1];
        this.rotation += this.velocity.X * 2f;
        Vector2 vector2 = this.Center + Vector2.Normalize(this.velocity) * 10f;
        Dust dust3 = Main.dust[Dust.NewDust(this.position, this.width, this.height, 6)];
        dust3.position = vector2;
        dust3.velocity = this.velocity.RotatedBy(1.57079637050629) * 0.33f + this.velocity / 4f;
        dust3.position += this.velocity.RotatedBy(1.57079637050629);
        dust3.fadeIn = 0.5f;
        dust3.noGravity = true;
        Dust dust4 = Main.dust[Dust.NewDust(this.position, this.width, this.height, 6)];
        dust4.position = vector2;
        dust4.velocity = this.velocity.RotatedBy(-1.57079637050629) * 0.33f + this.velocity / 4f;
        dust4.position += this.velocity.RotatedBy(-1.57079637050629);
        dust4.fadeIn = 0.5f;
        dust4.noGravity = true;
        for (int index83 = 0; index83 < 1; ++index83)
        {
          int index84 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6);
          Main.dust[index84].velocity *= 0.5f;
          Main.dust[index84].scale *= 1.3f;
          Main.dust[index84].fadeIn = 1f;
          Main.dust[index84].noGravity = true;
        }
      }
      else if (this.type == 344)
      {
        if (WorldGen.SolidTile((int) this.position.X / 16, (int) ((double) this.position.Y + (double) this.velocity.Y) / 16 + 1) || WorldGen.SolidTile((int) ((double) this.position.X + (double) this.width) / 16, (int) ((double) this.position.Y + (double) this.velocity.Y) / 16 + 1))
        {
          this.Kill();
          return;
        }
        ++this.localAI[1];
        if ((double) this.localAI[1] > 5.0)
        {
          this.alpha -= 50;
          if (this.alpha < 0)
            this.alpha = 0;
        }
        this.frame = (int) this.ai[1];
        if ((double) this.localAI[1] > 20.0)
        {
          this.localAI[1] = 20f;
          this.velocity.Y += 0.15f;
        }
        this.rotation += Main.windSpeed * 0.2f;
        this.velocity.X += Main.windSpeed * 0.1f;
      }
      else if (this.type == 336 || this.type == 345)
      {
        if (this.type == 345 && (double) this.localAI[0] == 0.0)
        {
          this.localAI[0] = 1f;
          Main.PlaySound(SoundID.Item1, this.position);
        }
        if ((double) this.ai[0] >= 50.0)
        {
          this.ai[0] = 50f;
          this.velocity.Y += 0.5f;
        }
      }
      else if (this.type == 246)
      {
        this.alpha -= 20;
        if (this.alpha < 0)
          this.alpha = 0;
        if ((double) this.ai[0] >= 60.0)
        {
          this.ai[0] = 60f;
          this.velocity.Y += 0.15f;
        }
      }
      else if (this.type == 311)
      {
        if (this.alpha > 0)
          this.alpha -= 50;
        if (this.alpha < 0)
          this.alpha = 0;
        if ((double) this.ai[0] >= 30.0)
        {
          this.ai[0] = 30f;
          if ((double) this.ai[1] == 0.0)
            this.ai[1] = 1f;
          this.velocity.Y += 0.5f;
        }
      }
      else if (this.type == 312)
      {
        if ((double) this.ai[0] >= 5.0)
          this.alpha = 0;
        if ((double) this.ai[0] >= 20.0)
        {
          this.ai[0] = 30f;
          this.velocity.Y += 0.5f;
        }
      }
      else if (this.type != 239 && this.type != 264)
      {
        if (this.type == 176)
        {
          if ((double) this.ai[0] >= 15.0)
          {
            this.ai[0] = 15f;
            this.velocity.Y += 0.05f;
          }
        }
        else if (this.type == 275 || this.type == 276)
        {
          if (this.alpha > 0)
            this.alpha -= 30;
          if (this.alpha < 0)
            this.alpha = 0;
          if ((double) this.ai[0] >= 35.0)
          {
            this.ai[0] = 35f;
            this.velocity.Y += 0.025f;
          }
          if (Main.expertMode)
          {
            float num47 = 18f;
            int closest = (int) Player.FindClosest(this.Center, 1, 1);
            Vector2 vector2 = Main.player[closest].Center - this.Center;
            vector2.Normalize();
            vector2 *= num47;
            int num48 = 70;
            this.velocity = (this.velocity * (float) (num48 - 1) + vector2) / (float) num48;
            if ((double) this.velocity.Length() < 14.0)
            {
              this.velocity.Normalize();
              this.velocity = this.velocity * 14f;
            }
            this.tileCollide = false;
            if (this.timeLeft > 180)
              this.timeLeft = 180;
          }
        }
        else if (this.type == 172)
        {
          if ((double) this.ai[0] >= 17.0)
          {
            this.ai[0] = 17f;
            this.velocity.Y += 0.085f;
          }
        }
        else if (this.type == 117)
        {
          if ((double) this.ai[0] >= 35.0)
          {
            this.ai[0] = 35f;
            this.velocity.Y += 0.06f;
          }
        }
        else if (this.type == 120)
        {
          int index = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 67, this.velocity.X, this.velocity.Y, 100, Scale: 1.2f);
          Main.dust[index].noGravity = true;
          Main.dust[index].velocity *= 0.3f;
          if ((double) this.ai[0] >= 30.0)
          {
            this.ai[0] = 30f;
            this.velocity.Y += 0.05f;
          }
        }
        else if (this.type == 195)
        {
          if ((double) this.ai[0] >= 20.0)
          {
            this.ai[0] = 20f;
            this.velocity.Y += 0.075f;
            this.tileCollide = true;
          }
          else
            this.tileCollide = false;
        }
        else if (this.type == 267 || this.type == 477 || this.type == 478 || this.type == 479)
        {
          ++this.localAI[0];
          if ((double) this.localAI[0] > 3.0)
            this.alpha = 0;
          if ((double) this.ai[0] >= 20.0)
          {
            this.ai[0] = 20f;
            if (this.type != 477)
              this.velocity.Y += 0.075f;
          }
          if (this.type == 479 && Main.myPlayer == this.owner)
          {
            if ((double) this.ai[1] >= 0.0)
              this.penetrate = -1;
            else if (this.penetrate < 0)
              this.penetrate = 1;
            if ((double) this.ai[1] >= 0.0)
              ++this.ai[1];
            if ((double) this.ai[1] > (double) Main.rand.Next(5, 30))
            {
              this.ai[1] = -1000f;
              float num49 = this.velocity.Length();
              Vector2 velocity = this.velocity;
              velocity.Normalize();
              int num50 = Main.rand.Next(2, 4);
              if (Main.rand.Next(4) == 0)
                ++num50;
              for (int index = 0; index < num50; ++index)
              {
                Vector2 vector2_12 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
                vector2_12.Normalize();
                Vector2 vector2_13 = vector2_12 + velocity * 2f;
                vector2_13.Normalize();
                vector2_12 = vector2_13 * num49;
                Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_12.X, vector2_12.Y, this.type, this.damage, this.knockBack, this.owner, ai1: -1000f);
              }
            }
          }
          if (this.type == 478 && Main.myPlayer == this.owner)
          {
            ++this.ai[1];
            if ((double) this.ai[1] > (double) Main.rand.Next(5, 20))
            {
              if (this.timeLeft > 40)
                this.timeLeft -= 20;
              this.ai[1] = 0.0f;
              Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 480, (int) ((double) this.damage * 0.8), this.knockBack * 0.5f, this.owner);
            }
          }
        }
        else if (this.type == 408)
        {
          if ((double) this.ai[0] >= 45.0)
          {
            this.ai[0] = 45f;
            this.velocity.Y += 0.05f;
          }
        }
        else if (this.type == 616)
        {
          if (this.alpha < 170)
          {
            float num = 3f;
            for (int index85 = 0; (double) index85 < (double) num; ++index85)
            {
              int index86 = Dust.NewDust(this.position, 1, 1, 229);
              Main.dust[index86].position = this.Center - this.velocity / num * (float) index85;
              Main.dust[index86].velocity *= 0.0f;
              Main.dust[index86].noGravity = true;
              Main.dust[index86].alpha = 200;
              Main.dust[index86].scale = 0.5f;
            }
          }
          float num51 = (float) Math.Sqrt((double) this.velocity.X * (double) this.velocity.X + (double) this.velocity.Y * (double) this.velocity.Y);
          float num52 = this.localAI[0];
          if ((double) num52 == 0.0)
          {
            this.localAI[0] = num51;
            num52 = num51;
          }
          if (this.alpha > 0)
            this.alpha -= 25;
          if (this.alpha < 0)
            this.alpha = 0;
          float num53 = this.position.X;
          float num54 = this.position.Y;
          float num55 = 800f;
          bool flag3 = false;
          int num56 = 0;
          ++this.ai[0];
          if ((double) this.ai[0] > 20.0)
          {
            --this.ai[0];
            if ((double) this.ai[1] == 0.0)
            {
              for (int index = 0; index < 200; ++index)
              {
                if (Main.npc[index].CanBeChasedBy((object) this) && ((double) this.ai[1] == 0.0 || (double) this.ai[1] == (double) (index + 1)))
                {
                  float num57 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
                  float num58 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
                  float num59 = Math.Abs(this.position.X + (float) (this.width / 2) - num57) + Math.Abs(this.position.Y + (float) (this.height / 2) - num58);
                  if ((double) num59 < (double) num55 && Collision.CanHit(new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2)), 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
                  {
                    num55 = num59;
                    num53 = num57;
                    num54 = num58;
                    flag3 = true;
                    num56 = index;
                  }
                }
              }
              if (flag3)
                this.ai[1] = (float) (num56 + 1);
              flag3 = false;
            }
            if ((double) this.ai[1] != 0.0)
            {
              int index = (int) ((double) this.ai[1] - 1.0);
              if (Main.npc[index].active && Main.npc[index].CanBeChasedBy((object) this, true))
              {
                float num60 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
                float num61 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
                if ((double) Math.Abs(this.position.X + (float) (this.width / 2) - num60) + (double) Math.Abs(this.position.Y + (float) (this.height / 2) - num61) < 1000.0)
                {
                  flag3 = true;
                  num53 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
                  num54 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
                }
              }
            }
            if (!this.friendly)
              flag3 = false;
            if (flag3)
            {
              double num62 = (double) num52;
              Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
              float num63 = num53 - vector2.X;
              float num64 = num54 - vector2.Y;
              double num65 = Math.Sqrt((double) num63 * (double) num63 + (double) num64 * (double) num64);
              float num66 = (float) (num62 / num65);
              float num67 = num63 * num66;
              float num68 = num64 * num66;
              int num69 = 8;
              this.velocity.X = (this.velocity.X * (float) (num69 - 1) + num67) / (float) num69;
              this.velocity.Y = (this.velocity.Y * (float) (num69 - 1) + num68) / (float) num69;
            }
          }
        }
        else if (this.type == 507 || this.type == 508 || this.type == 662 || this.type == 680 || this.type == 685)
        {
          if ((double) this.ai[0] > 45.0)
          {
            this.velocity.X *= 0.98f;
            this.velocity.Y += 0.3f;
          }
        }
        else if (this.type == 495)
        {
          int index = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 27, this.velocity.X, this.velocity.Y, 100, Scale: 1.2f);
          Main.dust[index].noGravity = true;
          Main.dust[index].velocity *= 0.3f;
          if ((double) this.ai[0] >= 30.0)
          {
            this.ai[0] = 30f;
            this.velocity.Y += 0.04f;
          }
        }
        else if (this.type == 498)
        {
          if ((double) this.localAI[0] == 0.0)
          {
            ++this.localAI[0];
            Main.PlaySound(SoundID.Item17, this.position);
          }
          ++this.ai[0];
          if ((double) this.ai[0] >= 50.0)
          {
            this.velocity.X *= 0.98f;
            this.velocity.Y += 0.15f;
            this.rotation += (float) this.direction * 0.5f;
          }
          else
            this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
        }
        else if (this.type == 437)
        {
          if ((double) this.ai[0] >= 12.0)
          {
            if ((double) this.ai[0] >= 20.0)
              this.Kill();
            this.alpha += 30;
          }
        }
        else if (this.type != 442 && this.type != 634 && this.type != 635 && this.type != 675)
        {
          if (this.type == 686 || this.type == 711)
          {
            if ((double) this.ai[0] >= 10.0)
              this.velocity.Y += 0.1f;
            if ((double) this.ai[0] >= 20.0)
              this.velocity.Y += 0.1f;
            if ((double) this.ai[0] > 20.0)
              this.ai[0] = 20f;
            this.velocity.X *= 0.99f;
            if ((double) this.velocity.Y > 32.0)
              this.velocity.Y = 32f;
          }
          else if (this.type == 639)
          {
            if (this.timeLeft <= this.MaxUpdates * 45 - 14)
              this.velocity.Y += 0.1f;
          }
          else if (this.type == 710)
          {
            if ((double) this.ai[0] >= 0.0)
            {
              ++this.ai[0];
              if ((double) this.ai[0] >= 20.0)
              {
                this.velocity.Y += 0.2f;
                if ((double) this.velocity.Y > 0.0)
                  this.velocity.X *= 0.98f;
                if ((double) this.velocity.Y > 12.0)
                  this.velocity.Y = 12f;
              }
            }
          }
          else if ((double) this.ai[0] >= 15.0)
          {
            this.ai[0] = 15f;
            this.velocity.Y += 0.1f;
          }
        }
      }
      if (this.type == 248)
      {
        if ((double) this.velocity.X < 0.0)
          this.rotation -= (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.0500000007450581);
        else
          this.rotation += (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.0500000007450581);
      }
      else if (this.type == 270 || this.type == 585 || this.type == 601 || this.type == 706)
      {
        this.spriteDirection = this.direction;
        this.rotation = this.direction >= 0 ? (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) : (float) Math.Atan2(-(double) this.velocity.Y, -(double) this.velocity.X);
      }
      else if (this.type == 311)
      {
        if ((double) this.ai[1] != 0.0)
          this.rotation += (float) ((double) this.velocity.X * 0.100000001490116 + (double) Main.rand.Next(-10, 11) * 0.025000000372529);
        else
          this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
      }
      else if (this.type == 312)
        this.rotation += this.velocity.X * 0.02f;
      else if (this.type == 675)
        this.rotation += this.velocity.X * 0.03f;
      else if (this.type != 676)
      {
        if (this.type == 408)
        {
          this.rotation = this.velocity.ToRotation();
          if (this.direction == -1)
            this.rotation += 3.141593f;
        }
        else if (this.type == 435 || this.type == 459 || this.type == 682 || this.type == 709)
        {
          this.rotation = this.velocity.ToRotation();
          if (this.direction == -1)
            this.rotation += 3.141593f;
        }
        else if (this.type == 660)
          this.rotation = this.velocity.ToRotation() + 0.7853982f;
        else if (this.type == 662 || this.type == 685)
          this.rotation = (float) ((double) this.velocity.ToRotation() - 3.14159274101257 - 0.785398185253143);
        else if (this.type == 680 || this.type == 684 || this.type == 686 || this.type == 711 || this.type == 712)
          this.rotation = this.velocity.ToRotation() + 1.570796f;
        else if (this.type == 436)
        {
          this.rotation = this.velocity.ToRotation();
          this.rotation += 3.141593f;
          if (this.direction == -1)
            this.rotation += 3.141593f;
        }
        else if (this.type == 469)
        {
          if ((double) this.velocity.X > 0.0)
          {
            this.spriteDirection = -1;
            this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
          }
          else
          {
            this.spriteDirection = 1;
            this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
          }
        }
        else if (this.type == 477)
        {
          if ((double) this.localAI[1] < 5.0)
          {
            this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
            ++this.localAI[1];
          }
          else
            this.rotation = (float) (((double) this.rotation * 2.0 + Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57000005245209) / 3.0);
        }
        else if (this.type == 532)
          this.rotation += (float) (0.200000002980232 + (double) Math.Abs(this.velocity.X) * 0.100000001490116);
        else if (this.type == 483)
          this.rotation += this.velocity.X * 0.05f;
        else if (this.type == 485)
        {
          this.velocity = (this.velocity * 39f + new Vector2(this.ai[0], this.ai[1])) / 40f;
          int index = Dust.NewDust(this.position, this.width, this.height, 6);
          Main.dust[index].noGravity = true;
          Main.dust[index].velocity *= 0.2f;
          Main.dust[index].position = (Main.dust[index].position + this.Center) / 2f;
          ++this.frameCounter;
          if (this.frameCounter >= 2)
          {
            this.frameCounter = 0;
            ++this.frame;
            if (this.frame >= 5)
              this.frame = 0;
          }
          if ((double) this.velocity.X < 0.0)
          {
            this.spriteDirection = -1;
            this.rotation = (float) Math.Atan2(-(double) this.velocity.Y, -(double) this.velocity.X);
          }
          else
          {
            this.spriteDirection = 1;
            this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X);
          }
        }
        else if (this.type == 640)
        {
          if (this.velocity != Vector2.Zero)
            this.rotation = this.velocity.ToRotation() + 1.570796f;
        }
        else if (this.type != 344 && this.type != 498)
          this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
      }
      if ((double) this.velocity.Y <= 16.0)
        return;
      this.velocity.Y = 16f;
    }

    private void AI_026()
    {
      if (!Main.player[this.owner].active)
      {
        this.active = false;
      }
      else
      {
        bool flag1 = false;
        bool flag2 = false;
        bool flag3 = false;
        bool flag4 = false;
        int num1 = 85;
        bool flag5 = this.type >= 191 && this.type <= 194;
        if (this.type == 324)
          num1 = 120;
        if (this.type == 112)
          num1 = 100;
        if (this.type == (int) sbyte.MaxValue)
          num1 = 50;
        if (flag5)
        {
          if (this.lavaWet)
          {
            this.ai[0] = 1f;
            this.ai[1] = 0.0f;
          }
          num1 = 60 + 30 * this.minionPos;
        }
        else if (this.type == 266)
          num1 = 60 + 30 * this.minionPos;
        if (this.type == 111)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].bunny = false;
          if (Main.player[this.owner].bunny)
            this.timeLeft = 2;
        }
        if (this.type == 112)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].penguin = false;
          if (Main.player[this.owner].penguin)
            this.timeLeft = 2;
        }
        if (this.type == 334)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].puppy = false;
          if (Main.player[this.owner].puppy)
            this.timeLeft = 2;
        }
        if (this.type == 353)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].grinch = false;
          if (Main.player[this.owner].grinch)
            this.timeLeft = 2;
        }
        if (this.type == (int) sbyte.MaxValue)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].turtle = false;
          if (Main.player[this.owner].turtle)
            this.timeLeft = 2;
        }
        if (this.type == 175)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].eater = false;
          if (Main.player[this.owner].eater)
            this.timeLeft = 2;
        }
        if (this.type == 197)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].skeletron = false;
          if (Main.player[this.owner].skeletron)
            this.timeLeft = 2;
        }
        if (this.type == 198)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].hornet = false;
          if (Main.player[this.owner].hornet)
            this.timeLeft = 2;
        }
        if (this.type == 199)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].tiki = false;
          if (Main.player[this.owner].tiki)
            this.timeLeft = 2;
        }
        if (this.type == 200)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].lizard = false;
          if (Main.player[this.owner].lizard)
            this.timeLeft = 2;
        }
        if (this.type == 208)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].parrot = false;
          if (Main.player[this.owner].parrot)
            this.timeLeft = 2;
        }
        if (this.type == 209)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].truffle = false;
          if (Main.player[this.owner].truffle)
            this.timeLeft = 2;
        }
        if (this.type == 210)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].sapling = false;
          if (Main.player[this.owner].sapling)
            this.timeLeft = 2;
        }
        if (this.type == 324)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].cSapling = false;
          if (Main.player[this.owner].cSapling)
            this.timeLeft = 2;
        }
        if (this.type == 313)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].spider = false;
          if (Main.player[this.owner].spider)
            this.timeLeft = 2;
        }
        if (this.type == 314)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].squashling = false;
          if (Main.player[this.owner].squashling)
            this.timeLeft = 2;
        }
        if (this.type == 211)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].wisp = false;
          if (Main.player[this.owner].wisp)
            this.timeLeft = 2;
        }
        if (this.type == 236)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].dino = false;
          if (Main.player[this.owner].dino)
            this.timeLeft = 2;
        }
        if (this.type == 499)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].babyFaceMonster = false;
          if (Main.player[this.owner].babyFaceMonster)
            this.timeLeft = 2;
        }
        if (this.type == 266)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].slime = false;
          if (Main.player[this.owner].slime)
            this.timeLeft = 2;
        }
        if (this.type == 268)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].eyeSpring = false;
          if (Main.player[this.owner].eyeSpring)
            this.timeLeft = 2;
        }
        if (this.type == 269)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].snowman = false;
          if (Main.player[this.owner].snowman)
            this.timeLeft = 2;
        }
        if (this.type == 319)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].blackCat = false;
          if (Main.player[this.owner].blackCat)
            this.timeLeft = 2;
        }
        if (this.type == 380)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].zephyrfish = false;
          if (Main.player[this.owner].zephyrfish)
            this.timeLeft = 2;
        }
        if (flag5)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].pygmy = false;
          if (Main.player[this.owner].pygmy)
            this.timeLeft = Main.rand.Next(2, 10);
        }
        if (this.type >= 390 && this.type <= 392)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].spiderMinion = false;
          if (Main.player[this.owner].spiderMinion)
            this.timeLeft = 2;
        }
        if (this.type == 398)
        {
          if (Main.player[this.owner].dead)
            Main.player[this.owner].miniMinotaur = false;
          if (Main.player[this.owner].miniMinotaur)
            this.timeLeft = 2;
        }
        if (flag5 || this.type == 266 || this.type >= 390 && this.type <= 392)
        {
          int num2 = 10;
          int num3 = 40 * (this.minionPos + 1) * Main.player[this.owner].direction;
          if ((double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2) < (double) this.position.X + (double) (this.width / 2) - (double) num2 + (double) num3)
            flag1 = true;
          else if ((double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2) > (double) this.position.X + (double) (this.width / 2) + (double) num2 + (double) num3)
            flag2 = true;
        }
        else if ((double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2) < (double) this.position.X + (double) (this.width / 2) - (double) num1)
          flag1 = true;
        else if ((double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2) > (double) this.position.X + (double) (this.width / 2) + (double) num1)
          flag2 = true;
        if (this.type == 175)
        {
          float num4 = 0.1f;
          this.tileCollide = false;
          int num5 = 300;
          Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
          float num6 = Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2) - vector2.X;
          float num7 = Main.player[this.owner].position.Y + (float) (Main.player[this.owner].height / 2) - vector2.Y;
          if (this.type == (int) sbyte.MaxValue)
            num7 = Main.player[this.owner].position.Y - vector2.Y;
          float num8 = (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7);
          float num9 = 7f;
          if ((double) num8 < (double) num5 && (double) Main.player[this.owner].velocity.Y == 0.0 && (double) this.position.Y + (double) this.height <= (double) Main.player[this.owner].position.Y + (double) Main.player[this.owner].height && !Collision.SolidCollision(this.position, this.width, this.height))
          {
            this.ai[0] = 0.0f;
            if ((double) this.velocity.Y < -6.0)
              this.velocity.Y = -6f;
          }
          if ((double) num8 < 150.0)
          {
            if ((double) Math.Abs(this.velocity.X) > 2.0 || (double) Math.Abs(this.velocity.Y) > 2.0)
              this.velocity = this.velocity * 0.99f;
            num4 = 0.01f;
            if ((double) num6 < -2.0)
              num6 = -2f;
            if ((double) num6 > 2.0)
              num6 = 2f;
            if ((double) num7 < -2.0)
              num7 = -2f;
            if ((double) num7 > 2.0)
              num7 = 2f;
          }
          else
          {
            if ((double) num8 > 300.0)
              num4 = 0.2f;
            float num10 = num9 / num8;
            num6 *= num10;
            num7 *= num10;
          }
          if ((double) Math.Abs(num6) > (double) Math.Abs(num7) || (double) num4 == 0.0500000007450581)
          {
            if ((double) this.velocity.X < (double) num6)
            {
              this.velocity.X += num4;
              if ((double) num4 > 0.0500000007450581 && (double) this.velocity.X < 0.0)
                this.velocity.X += num4;
            }
            if ((double) this.velocity.X > (double) num6)
            {
              this.velocity.X -= num4;
              if ((double) num4 > 0.0500000007450581 && (double) this.velocity.X > 0.0)
                this.velocity.X -= num4;
            }
          }
          if ((double) Math.Abs(num6) <= (double) Math.Abs(num7) || (double) num4 == 0.0500000007450581)
          {
            if ((double) this.velocity.Y < (double) num7)
            {
              this.velocity.Y += num4;
              if ((double) num4 > 0.0500000007450581 && (double) this.velocity.Y < 0.0)
                this.velocity.Y += num4;
            }
            if ((double) this.velocity.Y > (double) num7)
            {
              this.velocity.Y -= num4;
              if ((double) num4 > 0.0500000007450581 && (double) this.velocity.Y > 0.0)
                this.velocity.Y -= num4;
            }
          }
          this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) - 1.57f;
          ++this.frameCounter;
          if (this.frameCounter > 6)
          {
            ++this.frame;
            this.frameCounter = 0;
          }
          if (this.frame <= 1)
            return;
          this.frame = 0;
        }
        else if (this.type == 197)
        {
          float num11 = 0.1f;
          this.tileCollide = false;
          int num12 = 300;
          Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
          float num13 = Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2) - vector2.X;
          float num14 = Main.player[this.owner].position.Y + (float) (Main.player[this.owner].height / 2) - vector2.Y;
          if (this.type == (int) sbyte.MaxValue)
            num14 = Main.player[this.owner].position.Y - vector2.Y;
          float num15 = (float) Math.Sqrt((double) num13 * (double) num13 + (double) num14 * (double) num14);
          float num16 = 3f;
          if ((double) num15 > 500.0)
            this.localAI[0] = 10000f;
          if ((double) this.localAI[0] >= 10000.0)
            num16 = 14f;
          if ((double) num15 < (double) num12 && (double) Main.player[this.owner].velocity.Y == 0.0 && (double) this.position.Y + (double) this.height <= (double) Main.player[this.owner].position.Y + (double) Main.player[this.owner].height && !Collision.SolidCollision(this.position, this.width, this.height))
          {
            this.ai[0] = 0.0f;
            if ((double) this.velocity.Y < -6.0)
              this.velocity.Y = -6f;
          }
          if ((double) num15 < 150.0)
          {
            if ((double) Math.Abs(this.velocity.X) > 2.0 || (double) Math.Abs(this.velocity.Y) > 2.0)
              this.velocity = this.velocity * 0.99f;
            num11 = 0.01f;
            if ((double) num13 < -2.0)
              num13 = -2f;
            if ((double) num13 > 2.0)
              num13 = 2f;
            if ((double) num14 < -2.0)
              num14 = -2f;
            if ((double) num14 > 2.0)
              num14 = 2f;
          }
          else
          {
            if ((double) num15 > 300.0)
              num11 = 0.2f;
            float num17 = num16 / num15;
            num13 *= num17;
            num14 *= num17;
          }
          if ((double) this.velocity.X < (double) num13)
          {
            this.velocity.X += num11;
            if ((double) num11 > 0.0500000007450581 && (double) this.velocity.X < 0.0)
              this.velocity.X += num11;
          }
          if ((double) this.velocity.X > (double) num13)
          {
            this.velocity.X -= num11;
            if ((double) num11 > 0.0500000007450581 && (double) this.velocity.X > 0.0)
              this.velocity.X -= num11;
          }
          if ((double) this.velocity.Y < (double) num14)
          {
            this.velocity.Y += num11;
            if ((double) num11 > 0.0500000007450581 && (double) this.velocity.Y < 0.0)
              this.velocity.Y += num11;
          }
          if ((double) this.velocity.Y > (double) num14)
          {
            this.velocity.Y -= num11;
            if ((double) num11 > 0.0500000007450581 && (double) this.velocity.Y > 0.0)
              this.velocity.Y -= num11;
          }
          this.localAI[0] += (float) Main.rand.Next(10);
          if ((double) this.localAI[0] > 10000.0)
          {
            if ((double) this.localAI[1] == 0.0)
              this.localAI[1] = (double) this.velocity.X >= 0.0 ? 1f : -1f;
            this.rotation += 0.25f * this.localAI[1];
            if ((double) this.localAI[0] > 12000.0)
              this.localAI[0] = 0.0f;
          }
          else
          {
            this.localAI[1] = 0.0f;
            float num18 = this.velocity.X * 0.1f;
            if ((double) this.rotation > (double) num18)
            {
              this.rotation -= (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.00999999977648258);
              if ((double) this.rotation < (double) num18)
                this.rotation = num18;
            }
            if ((double) this.rotation < (double) num18)
            {
              this.rotation += (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.00999999977648258);
              if ((double) this.rotation > (double) num18)
                this.rotation = num18;
            }
          }
          if ((double) this.rotation > 6.28)
            this.rotation -= 6.28f;
          if ((double) this.rotation >= -6.28)
            return;
          this.rotation += 6.28f;
        }
        else if (this.type == 198 || this.type == 380)
        {
          float num19 = 0.4f;
          if (this.type == 380)
            num19 = 0.3f;
          this.tileCollide = false;
          int num20 = 100;
          Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
          float num21 = Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2) - vector2.X;
          float num22 = Main.player[this.owner].position.Y + (float) (Main.player[this.owner].height / 2) - vector2.Y + (float) Main.rand.Next(-10, 21);
          float num23 = num21 + (float) Main.rand.Next(-10, 21) + (float) (60 * -Main.player[this.owner].direction);
          float num24 = num22 - 60f;
          if (this.type == (int) sbyte.MaxValue)
            num24 = Main.player[this.owner].position.Y - vector2.Y;
          float num25 = (float) Math.Sqrt((double) num23 * (double) num23 + (double) num24 * (double) num24);
          float num26 = 14f;
          if (this.type == 380)
            num26 = 6f;
          if ((double) num25 < (double) num20 && (double) Main.player[this.owner].velocity.Y == 0.0 && (double) this.position.Y + (double) this.height <= (double) Main.player[this.owner].position.Y + (double) Main.player[this.owner].height && !Collision.SolidCollision(this.position, this.width, this.height))
          {
            this.ai[0] = 0.0f;
            if ((double) this.velocity.Y < -6.0)
              this.velocity.Y = -6f;
          }
          if ((double) num25 < 50.0)
          {
            if ((double) Math.Abs(this.velocity.X) > 2.0 || (double) Math.Abs(this.velocity.Y) > 2.0)
              this.velocity = this.velocity * 0.99f;
            num19 = 0.01f;
          }
          else
          {
            if (this.type == 380)
            {
              if ((double) num25 < 100.0)
                num19 = 0.1f;
              if ((double) num25 > 300.0)
                num19 = 0.4f;
            }
            else if (this.type == 198)
            {
              if ((double) num25 < 100.0)
                num19 = 0.1f;
              if ((double) num25 > 300.0)
                num19 = 0.6f;
            }
            float num27 = num26 / num25;
            num23 *= num27;
            num24 *= num27;
          }
          if ((double) this.velocity.X < (double) num23)
          {
            this.velocity.X += num19;
            if ((double) num19 > 0.0500000007450581 && (double) this.velocity.X < 0.0)
              this.velocity.X += num19;
          }
          if ((double) this.velocity.X > (double) num23)
          {
            this.velocity.X -= num19;
            if ((double) num19 > 0.0500000007450581 && (double) this.velocity.X > 0.0)
              this.velocity.X -= num19;
          }
          if ((double) this.velocity.Y < (double) num24)
          {
            this.velocity.Y += num19;
            if ((double) num19 > 0.0500000007450581 && (double) this.velocity.Y < 0.0)
              this.velocity.Y += num19 * 2f;
          }
          if ((double) this.velocity.Y > (double) num24)
          {
            this.velocity.Y -= num19;
            if ((double) num19 > 0.0500000007450581 && (double) this.velocity.Y > 0.0)
              this.velocity.Y -= num19 * 2f;
          }
          if ((double) this.velocity.X > 0.25)
            this.direction = -1;
          else if ((double) this.velocity.X < -0.25)
            this.direction = 1;
          this.spriteDirection = this.direction;
          this.rotation = this.velocity.X * 0.05f;
          ++this.frameCounter;
          int num28 = 2;
          if (this.type == 380)
            num28 = 5;
          if (this.frameCounter > num28)
          {
            ++this.frame;
            this.frameCounter = 0;
          }
          if (this.frame <= 3)
            return;
          this.frame = 0;
        }
        else if (this.type == 211)
        {
          float num29 = 0.2f;
          float num30 = 5f;
          this.tileCollide = false;
          Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
          float num31 = Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2) - vector2.X;
          float num32 = Main.player[this.owner].position.Y + Main.player[this.owner].gfxOffY + (float) (Main.player[this.owner].height / 2) - vector2.Y;
          if (Main.player[this.owner].controlLeft)
            num31 -= 120f;
          else if (Main.player[this.owner].controlRight)
            num31 += 120f;
          float num33;
          if (Main.player[this.owner].controlDown)
          {
            num33 = num32 + 120f;
          }
          else
          {
            if (Main.player[this.owner].controlUp)
              num32 -= 120f;
            num33 = num32 - 60f;
          }
          float num34 = (float) Math.Sqrt((double) num31 * (double) num31 + (double) num33 * (double) num33);
          if ((double) num34 > 1000.0)
          {
            this.position.X += num31;
            this.position.Y += num33;
          }
          if ((double) this.localAI[0] == 1.0)
          {
            if ((double) num34 < 10.0 && (double) Math.Abs(Main.player[this.owner].velocity.X) + (double) Math.Abs(Main.player[this.owner].velocity.Y) < (double) num30 && (double) Main.player[this.owner].velocity.Y == 0.0)
              this.localAI[0] = 0.0f;
            float num35 = 12f;
            if ((double) num34 < (double) num35)
            {
              this.velocity.X = num31;
              this.velocity.Y = num33;
            }
            else
            {
              float num36 = num35 / num34;
              this.velocity.X = num31 * num36;
              this.velocity.Y = num33 * num36;
            }
            if ((double) this.velocity.X > 0.5)
              this.direction = -1;
            else if ((double) this.velocity.X < -0.5)
              this.direction = 1;
            this.spriteDirection = this.direction;
            this.rotation -= (float) (0.200000002980232 + (double) Math.Abs(this.velocity.X) * 0.025000000372529) * (float) this.direction;
            ++this.frameCounter;
            if (this.frameCounter > 3)
            {
              ++this.frame;
              this.frameCounter = 0;
            }
            if (this.frame < 5)
              this.frame = 5;
            if (this.frame > 9)
              this.frame = 5;
            for (int index1 = 0; index1 < 2; ++index1)
            {
              int index2 = Dust.NewDust(new Vector2(this.position.X + 3f, this.position.Y + 4f), 14, 14, 156);
              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[this.owner].cLight, Main.player[this.owner]);
            }
          }
          else
          {
            if ((double) num34 > 200.0)
              this.localAI[0] = 1f;
            if ((double) this.velocity.X > 0.5)
              this.direction = -1;
            else if ((double) this.velocity.X < -0.5)
              this.direction = 1;
            this.spriteDirection = this.direction;
            if ((double) num34 < 10.0)
            {
              this.velocity.X = num31;
              this.velocity.Y = num33;
              this.rotation = this.velocity.X * 0.05f;
              if ((double) num34 < (double) num30)
              {
                this.position = this.position + this.velocity;
                this.velocity = this.velocity * 0.0f;
                num29 = 0.0f;
              }
              this.direction = -Main.player[this.owner].direction;
            }
            float num37 = num30 / num34;
            float num38 = num31 * num37;
            float num39 = num33 * num37;
            if ((double) this.velocity.X < (double) num38)
            {
              this.velocity.X += num29;
              if ((double) this.velocity.X < 0.0)
                this.velocity.X *= 0.99f;
            }
            if ((double) this.velocity.X > (double) num38)
            {
              this.velocity.X -= num29;
              if ((double) this.velocity.X > 0.0)
                this.velocity.X *= 0.99f;
            }
            if ((double) this.velocity.Y < (double) num39)
            {
              this.velocity.Y += num29;
              if ((double) this.velocity.Y < 0.0)
                this.velocity.Y *= 0.99f;
            }
            if ((double) this.velocity.Y > (double) num39)
            {
              this.velocity.Y -= num29;
              if ((double) this.velocity.Y > 0.0)
                this.velocity.Y *= 0.99f;
            }
            if ((double) this.velocity.X != 0.0 || (double) this.velocity.Y != 0.0)
              this.rotation = this.velocity.X * 0.05f;
            ++this.frameCounter;
            if (this.frameCounter > 3)
            {
              ++this.frame;
              this.frameCounter = 0;
            }
            if (this.frame <= 4)
              return;
            this.frame = 0;
          }
        }
        else if (this.type == 199)
        {
          float num40 = 0.1f;
          this.tileCollide = false;
          int num41 = 200;
          Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
          float num42 = Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2) - vector2.X;
          float num43 = Main.player[this.owner].position.Y + (float) (Main.player[this.owner].height / 2) - vector2.Y - 60f;
          float num44 = num42 - 2f;
          if (this.type == (int) sbyte.MaxValue)
            num43 = Main.player[this.owner].position.Y - vector2.Y;
          float num45 = (float) Math.Sqrt((double) num44 * (double) num44 + (double) num43 * (double) num43);
          float num46 = 4f;
          double num47 = (double) num45;
          if ((double) num45 < (double) num41 && (double) Main.player[this.owner].velocity.Y == 0.0 && (double) this.position.Y + (double) this.height <= (double) Main.player[this.owner].position.Y + (double) Main.player[this.owner].height && !Collision.SolidCollision(this.position, this.width, this.height))
          {
            this.ai[0] = 0.0f;
            if ((double) this.velocity.Y < -6.0)
              this.velocity.Y = -6f;
          }
          if ((double) num45 < 4.0)
          {
            this.velocity.X = num44;
            this.velocity.Y = num43;
            num40 = 0.0f;
          }
          else
          {
            if ((double) num45 > 350.0)
            {
              num40 = 0.2f;
              num46 = 10f;
            }
            float num48 = num46 / num45;
            num44 *= num48;
            num43 *= num48;
          }
          if ((double) this.velocity.X < (double) num44)
          {
            this.velocity.X += num40;
            if ((double) this.velocity.X < 0.0)
              this.velocity.X += num40;
          }
          if ((double) this.velocity.X > (double) num44)
          {
            this.velocity.X -= num40;
            if ((double) this.velocity.X > 0.0)
              this.velocity.X -= num40;
          }
          if ((double) this.velocity.Y < (double) num43)
          {
            this.velocity.Y += num40;
            if ((double) this.velocity.Y < 0.0)
              this.velocity.Y += num40;
          }
          if ((double) this.velocity.Y > (double) num43)
          {
            this.velocity.Y -= num40;
            if ((double) this.velocity.Y > 0.0)
              this.velocity.Y -= num40;
          }
          this.direction = -Main.player[this.owner].direction;
          this.spriteDirection = 1;
          this.rotation = this.velocity.Y * 0.05f * (float) -this.direction;
          if (num47 >= 50.0)
          {
            ++this.frameCounter;
            if (this.frameCounter <= 6)
              return;
            this.frameCounter = 0;
            if ((double) this.velocity.X < 0.0)
            {
              if (this.frame < 2)
                ++this.frame;
              if (this.frame <= 2)
                return;
              --this.frame;
            }
            else
            {
              if (this.frame < 6)
                ++this.frame;
              if (this.frame <= 6)
                return;
              --this.frame;
            }
          }
          else
          {
            ++this.frameCounter;
            if (this.frameCounter > 6)
            {
              this.frame += this.direction;
              this.frameCounter = 0;
            }
            if (this.frame > 7)
              this.frame = 0;
            if (this.frame >= 0)
              return;
            this.frame = 7;
          }
        }
        else
        {
          if ((double) this.ai[1] == 0.0)
          {
            int num49 = 500;
            if (this.type == (int) sbyte.MaxValue)
              num49 = 200;
            if (this.type == 208)
              num49 = 300;
            if (flag5 || this.type == 266 || this.type >= 390 && this.type <= 392)
            {
              num49 += 40 * this.minionPos;
              if ((double) this.localAI[0] > 0.0)
                num49 += 500;
              if (this.type == 266 && (double) this.localAI[0] > 0.0)
                num49 += 100;
              if (this.type >= 390 && this.type <= 392 && (double) this.localAI[0] > 0.0)
                num49 += 400;
            }
            if (Main.player[this.owner].rocketDelay2 > 0)
              this.ai[0] = 1f;
            Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
            double num50 = (double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2) - (double) vector2.X;
            float num51 = Main.player[this.owner].position.Y + (float) (Main.player[this.owner].height / 2) - vector2.Y;
            float num52 = (float) Math.Sqrt(num50 * num50 + (double) num51 * (double) num51);
            if ((double) num52 > 2000.0)
            {
              this.position.X = Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2) - (float) (this.width / 2);
              this.position.Y = Main.player[this.owner].position.Y + (float) (Main.player[this.owner].height / 2) - (float) (this.height / 2);
            }
            else if ((double) num52 > (double) num49 || (double) Math.Abs(num51) > 300.0 && (!flag5 && this.type != 266 && (this.type < 390 || this.type > 392) || (double) this.localAI[0] <= 0.0))
            {
              if (this.type != 324)
              {
                if ((double) num51 > 0.0 && (double) this.velocity.Y < 0.0)
                  this.velocity.Y = 0.0f;
                if ((double) num51 < 0.0 && (double) this.velocity.Y > 0.0)
                  this.velocity.Y = 0.0f;
              }
              this.ai[0] = 1f;
            }
          }
          if (this.type == 209 && (double) this.ai[0] != 0.0)
          {
            if ((double) Main.player[this.owner].velocity.Y == 0.0 && this.alpha >= 100)
            {
              this.position.X = Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2) - (float) (this.width / 2);
              this.position.Y = Main.player[this.owner].position.Y + (float) Main.player[this.owner].height - (float) this.height;
              this.ai[0] = 0.0f;
            }
            else
            {
              this.velocity.X = 0.0f;
              this.velocity.Y = 0.0f;
              this.alpha += 5;
              if (this.alpha <= (int) byte.MaxValue)
                return;
              this.alpha = (int) byte.MaxValue;
            }
          }
          else if ((double) this.ai[0] != 0.0)
          {
            float num53 = 0.2f;
            int num54 = 200;
            if (this.type == (int) sbyte.MaxValue)
              num54 = 100;
            if (flag5)
            {
              num53 = 0.5f;
              num54 = 100;
            }
            this.tileCollide = false;
            Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
            float num55 = Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2) - vector2.X;
            if (flag5 || this.type == 266 || this.type >= 390 && this.type <= 392)
            {
              num55 -= (float) (40 * Main.player[this.owner].direction);
              float num56 = 700f;
              if (flag5)
                num56 += 100f;
              bool flag6 = false;
              int num57 = -1;
              for (int index = 0; index < 200; ++index)
              {
                if (Main.npc[index].CanBeChasedBy((object) this))
                {
                  float num58 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
                  float num59 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
                  if ((double) Math.Abs(Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2) - num58) + (double) Math.Abs(Main.player[this.owner].position.Y + (float) (Main.player[this.owner].height / 2) - num59) < (double) num56)
                  {
                    if (Collision.CanHit(this.position, this.width, this.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
                      num57 = index;
                    flag6 = true;
                    break;
                  }
                }
              }
              if (!flag6)
                num55 -= (float) (40 * this.minionPos * Main.player[this.owner].direction);
              if (flag6 && num57 >= 0)
                this.ai[0] = 0.0f;
            }
            float num60 = Main.player[this.owner].position.Y + (float) (Main.player[this.owner].height / 2) - vector2.Y;
            if (this.type == (int) sbyte.MaxValue)
              num60 = Main.player[this.owner].position.Y - vector2.Y;
            float num61 = (float) Math.Sqrt((double) num55 * (double) num55 + (double) num60 * (double) num60);
            float num62 = 10f;
            float num63 = num61;
            if (this.type == 111)
              num62 = 11f;
            if (this.type == (int) sbyte.MaxValue)
              num62 = 9f;
            if (this.type == 324)
              num62 = 20f;
            if (flag5)
            {
              num53 = 0.4f;
              num62 = 12f;
              if ((double) num62 < (double) Math.Abs(Main.player[this.owner].velocity.X) + (double) Math.Abs(Main.player[this.owner].velocity.Y))
                num62 = Math.Abs(Main.player[this.owner].velocity.X) + Math.Abs(Main.player[this.owner].velocity.Y);
            }
            if (this.type == 208 && (double) Math.Abs(Main.player[this.owner].velocity.X) + (double) Math.Abs(Main.player[this.owner].velocity.Y) > 4.0)
              num54 = -1;
            if ((double) num61 < (double) num54 && (double) Main.player[this.owner].velocity.Y == 0.0 && (double) this.position.Y + (double) this.height <= (double) Main.player[this.owner].position.Y + (double) Main.player[this.owner].height && !Collision.SolidCollision(this.position, this.width, this.height))
            {
              this.ai[0] = 0.0f;
              if ((double) this.velocity.Y < -6.0)
                this.velocity.Y = -6f;
            }
            float num64;
            float num65;
            if ((double) num61 < 60.0)
            {
              num64 = this.velocity.X;
              num65 = this.velocity.Y;
            }
            else
            {
              float num66 = num62 / num61;
              num64 = num55 * num66;
              num65 = num60 * num66;
            }
            if (this.type == 324)
            {
              if ((double) num63 > 1000.0)
              {
                if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num62 - 1.25)
                  this.velocity = this.velocity * 1.025f;
                if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > (double) num62 + 1.25)
                  this.velocity = this.velocity * 0.975f;
              }
              else if ((double) num63 > 600.0)
              {
                if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num62 - 1.0)
                  this.velocity = this.velocity * 1.05f;
                if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > (double) num62 + 1.0)
                  this.velocity = this.velocity * 0.95f;
              }
              else if ((double) num63 > 400.0)
              {
                if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num62 - 0.5)
                  this.velocity = this.velocity * 1.075f;
                if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > (double) num62 + 0.5)
                  this.velocity = this.velocity * 0.925f;
              }
              else
              {
                if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num62 - 0.25)
                  this.velocity = this.velocity * 1.1f;
                if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > (double) num62 + 0.25)
                  this.velocity = this.velocity * 0.9f;
              }
              this.velocity.X = (float) (((double) this.velocity.X * 34.0 + (double) num64) / 35.0);
              this.velocity.Y = (float) (((double) this.velocity.Y * 34.0 + (double) num65) / 35.0);
            }
            else
            {
              if ((double) this.velocity.X < (double) num64)
              {
                this.velocity.X += num53;
                if ((double) this.velocity.X < 0.0)
                  this.velocity.X += num53 * 1.5f;
              }
              if ((double) this.velocity.X > (double) num64)
              {
                this.velocity.X -= num53;
                if ((double) this.velocity.X > 0.0)
                  this.velocity.X -= num53 * 1.5f;
              }
              if ((double) this.velocity.Y < (double) num65)
              {
                this.velocity.Y += num53;
                if ((double) this.velocity.Y < 0.0)
                  this.velocity.Y += num53 * 1.5f;
              }
              if ((double) this.velocity.Y > (double) num65)
              {
                this.velocity.Y -= num53;
                if ((double) this.velocity.Y > 0.0)
                  this.velocity.Y -= num53 * 1.5f;
              }
            }
            if (this.type == 111)
              this.frame = 7;
            if (this.type == 112)
              this.frame = 2;
            if (flag5 && this.frame < 12)
            {
              this.frame = Main.rand.Next(12, 18);
              this.frameCounter = 0;
            }
            if (this.type != 313)
            {
              if ((double) this.velocity.X > 0.5)
                this.spriteDirection = -1;
              else if ((double) this.velocity.X < -0.5)
                this.spriteDirection = 1;
            }
            if (this.type == 398)
            {
              if ((double) this.velocity.X > 0.5)
                this.spriteDirection = 1;
              else if ((double) this.velocity.X < -0.5)
                this.spriteDirection = -1;
            }
            if (this.type == 112)
              this.rotation = this.spriteDirection != -1 ? (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f : (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
            else if (this.type >= 390 && this.type <= 392)
            {
              int index3 = (int) ((double) this.Center.X / 16.0);
              int index4 = (int) ((double) this.Center.Y / 16.0);
              if (Main.tile[index3, index4] != null && Main.tile[index3, index4].wall > (byte) 0)
              {
                this.rotation = this.velocity.ToRotation() + 1.570796f;
                this.frameCounter += (int) ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y));
                if (this.frameCounter > 5)
                {
                  ++this.frame;
                  this.frameCounter = 0;
                }
                if (this.frame > 7)
                  this.frame = 4;
                if (this.frame < 4)
                  this.frame = 7;
              }
              else
              {
                ++this.frameCounter;
                if (this.frameCounter > 2)
                {
                  ++this.frame;
                  this.frameCounter = 0;
                }
                if (this.frame < 8 || this.frame > 10)
                  this.frame = 8;
                this.rotation = this.velocity.X * 0.1f;
              }
            }
            else if (this.type == 334)
            {
              ++this.frameCounter;
              if (this.frameCounter > 1)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame < 7 || this.frame > 10)
                this.frame = 7;
              this.rotation = this.velocity.X * 0.1f;
            }
            else if (this.type == 353)
            {
              ++this.frameCounter;
              if (this.frameCounter > 6)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame < 10 || this.frame > 13)
                this.frame = 10;
              this.rotation = this.velocity.X * 0.05f;
            }
            else if (this.type == (int) sbyte.MaxValue)
            {
              this.frameCounter += 3;
              if (this.frameCounter > 6)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame <= 5 || this.frame > 15)
                this.frame = 6;
              this.rotation = this.velocity.X * 0.1f;
            }
            else if (this.type == 269)
            {
              if (this.frame == 6)
                this.frameCounter = 0;
              else if (this.frame < 4 || this.frame > 6)
              {
                this.frameCounter = 0;
                this.frame = 4;
              }
              else
              {
                ++this.frameCounter;
                if (this.frameCounter > 6)
                {
                  ++this.frame;
                  this.frameCounter = 0;
                }
              }
              this.rotation = this.velocity.X * 0.05f;
            }
            else if (this.type == 266)
            {
              ++this.frameCounter;
              if (this.frameCounter > 6)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame < 2 || this.frame > 5)
                this.frame = 2;
              this.rotation = this.velocity.X * 0.1f;
            }
            else if (this.type == 324)
            {
              ++this.frameCounter;
              if (this.frameCounter > 1)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame < 6 || this.frame > 9)
                this.frame = 6;
              this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.58f;
              Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.9f, 0.6f, 0.2f);
              for (int index5 = 0; index5 < 2; ++index5)
              {
                int num67 = 4;
                int index6 = Dust.NewDust(new Vector2(this.Center.X - (float) num67, this.Center.Y - (float) num67) - this.velocity * 0.0f, num67 * 2, num67 * 2, 6, Alpha: 100);
                Main.dust[index6].scale *= (float) (1.79999995231628 + (double) Main.rand.Next(10) * 0.100000001490116);
                Main.dust[index6].velocity *= 0.2f;
                if (index5 == 1)
                  Main.dust[index6].position -= this.velocity * 0.5f;
                Main.dust[index6].noGravity = true;
                int index7 = Dust.NewDust(new Vector2(this.Center.X - (float) num67, this.Center.Y - (float) num67) - this.velocity * 0.0f, num67 * 2, num67 * 2, 31, Alpha: 100, Scale: 0.5f);
                Main.dust[index7].fadeIn = (float) (1.0 + (double) Main.rand.Next(5) * 0.100000001490116);
                Main.dust[index7].velocity *= 0.05f;
                if (index5 == 1)
                  Main.dust[index7].position -= this.velocity * 0.5f;
              }
            }
            else if (this.type == 268)
            {
              ++this.frameCounter;
              if (this.frameCounter > 4)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame < 6 || this.frame > 7)
                this.frame = 6;
              this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.58f;
            }
            else if (this.type == 200)
            {
              this.frameCounter += 3;
              if (this.frameCounter > 6)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame <= 5 || this.frame > 9)
                this.frame = 6;
              this.rotation = this.velocity.X * 0.1f;
            }
            else if (this.type == 208)
            {
              this.rotation = this.velocity.X * 0.075f;
              ++this.frameCounter;
              if (this.frameCounter > 6)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame > 4)
                this.frame = 1;
              if (this.frame < 1)
                this.frame = 1;
            }
            else if (this.type == 236)
            {
              this.rotation = this.velocity.Y * 0.05f * (float) this.direction;
              if ((double) this.velocity.Y < 0.0)
                this.frameCounter += 2;
              else
                ++this.frameCounter;
              if (this.frameCounter >= 6)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame > 12)
                this.frame = 9;
              if (this.frame < 9)
                this.frame = 9;
            }
            else if (this.type == 499)
            {
              this.rotation = this.velocity.Y * 0.05f * (float) this.direction;
              if ((double) this.velocity.Y < 0.0)
                this.frameCounter += 2;
              else
                ++this.frameCounter;
              if (this.frameCounter >= 6)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame >= 12)
                this.frame = 8;
              if (this.frame < 8)
                this.frame = 8;
            }
            else if (this.type == 314)
            {
              this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.58f;
              ++this.frameCounter;
              if (this.frameCounter >= 3)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame > 12)
                this.frame = 7;
              if (this.frame < 7)
                this.frame = 7;
            }
            else if (this.type == 319)
            {
              this.rotation = this.velocity.X * 0.05f;
              ++this.frameCounter;
              if (this.frameCounter >= 6)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame > 10)
                this.frame = 6;
              if (this.frame < 6)
                this.frame = 6;
            }
            else if (this.type == 210)
            {
              this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.58f;
              this.frameCounter += 3;
              if (this.frameCounter > 6)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame > 11)
                this.frame = 7;
              if (this.frame < 7)
                this.frame = 7;
            }
            else if (this.type == 313)
            {
              this.position.Y += (float) this.height;
              this.height = 54;
              this.position.Y -= (float) this.height;
              this.position.X += (float) (this.width / 2);
              this.width = 54;
              this.position.X -= (float) (this.width / 2);
              this.rotation += this.velocity.X * 0.01f;
              this.frameCounter = 0;
              this.frame = 11;
            }
            else if (this.type == 398)
            {
              ++this.frameCounter;
              if (this.frameCounter > 1)
              {
                ++this.frame;
                this.frameCounter = 0;
              }
              if (this.frame < 6 || this.frame > 9)
                this.frame = 6;
              this.rotation = this.velocity.X * 0.1f;
            }
            else
              this.rotation = this.spriteDirection != -1 ? (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 3.14f : (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X);
            if (flag5 || this.type == 499 || this.type == 398 || this.type == 390 || this.type == 391 || this.type == 392 || this.type == (int) sbyte.MaxValue || this.type == 200 || this.type == 208 || this.type == 210 || this.type == 236 || this.type == 266 || this.type == 268 || this.type == 269 || this.type == 313 || this.type == 314 || this.type == 319 || this.type == 324 || this.type == 334 || this.type == 353)
              return;
            int index8 = Dust.NewDust(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 4.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 4.0)) - this.velocity, 8, 8, 16, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 50, Scale: 1.7f);
            Main.dust[index8].velocity.X *= 0.2f;
            Main.dust[index8].velocity.Y *= 0.2f;
            Main.dust[index8].noGravity = true;
          }
          else
          {
            if (flag5)
            {
              float num68 = (float) (40 * this.minionPos);
              int num69 = 30;
              int num70 = 60;
              --this.localAI[0];
              if ((double) this.localAI[0] < 0.0)
                this.localAI[0] = 0.0f;
              if ((double) this.ai[1] > 0.0)
              {
                --this.ai[1];
              }
              else
              {
                float num71 = this.position.X;
                float num72 = this.position.Y;
                float num73 = 100000f;
                float num74 = num73;
                int num75 = -1;
                NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
                if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this))
                {
                  float num76 = minionAttackTargetNpc.position.X + (float) (minionAttackTargetNpc.width / 2);
                  float num77 = minionAttackTargetNpc.position.Y + (float) (minionAttackTargetNpc.height / 2);
                  float num78 = Math.Abs(this.position.X + (float) (this.width / 2) - num76) + Math.Abs(this.position.Y + (float) (this.height / 2) - num77);
                  if ((double) num78 < (double) num73)
                  {
                    if (num75 == -1 && (double) num78 <= (double) num74)
                    {
                      num74 = num78;
                      num71 = num76;
                      num72 = num77;
                    }
                    if (Collision.CanHit(this.position, this.width, this.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height))
                    {
                      num73 = num78;
                      num71 = num76;
                      num72 = num77;
                      num75 = minionAttackTargetNpc.whoAmI;
                    }
                  }
                }
                if (num75 == -1)
                {
                  for (int index = 0; index < 200; ++index)
                  {
                    if (Main.npc[index].CanBeChasedBy((object) this))
                    {
                      float num79 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
                      float num80 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
                      float num81 = Math.Abs(this.position.X + (float) (this.width / 2) - num79) + Math.Abs(this.position.Y + (float) (this.height / 2) - num80);
                      if ((double) num81 < (double) num73)
                      {
                        if (num75 == -1 && (double) num81 <= (double) num74)
                        {
                          num74 = num81;
                          num71 = num79;
                          num72 = num80;
                        }
                        if (Collision.CanHit(this.position, this.width, this.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
                        {
                          num73 = num81;
                          num71 = num79;
                          num72 = num80;
                          num75 = index;
                        }
                      }
                    }
                  }
                }
                if (num75 == -1 && (double) num74 < (double) num73)
                  num73 = num74;
                float num82 = 400f;
                if ((double) this.position.Y > Main.worldSurface * 16.0)
                  num82 = 200f;
                if ((double) num73 < (double) num82 + (double) num68 && num75 == -1)
                {
                  float num83 = num71 - (this.position.X + (float) (this.width / 2));
                  if ((double) num83 < -5.0)
                  {
                    flag1 = true;
                    flag2 = false;
                  }
                  else if ((double) num83 > 5.0)
                  {
                    flag2 = true;
                    flag1 = false;
                  }
                }
                else if (num75 >= 0 && (double) num73 < 800.0 + (double) num68)
                {
                  this.localAI[0] = (float) num70;
                  float num84 = num71 - (this.position.X + (float) (this.width / 2));
                  if ((double) num84 > 300.0 || (double) num84 < -300.0)
                  {
                    if ((double) num84 < -50.0)
                    {
                      flag1 = true;
                      flag2 = false;
                    }
                    else if ((double) num84 > 50.0)
                    {
                      flag2 = true;
                      flag1 = false;
                    }
                  }
                  else if (this.owner == Main.myPlayer)
                  {
                    this.ai[1] = (float) num69;
                    Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0));
                    float num85 = num71 - vector2.X + (float) Main.rand.Next(-20, 21);
                    float num86 = (float) ((double) (Math.Abs(num85) * 0.1f) * (double) Main.rand.Next(0, 100) * (1.0 / 1000.0));
                    float num87 = num72 - vector2.Y + (float) Main.rand.Next(-20, 21) - num86;
                    float num88 = (float) (12.0 / Math.Sqrt((double) num85 * (double) num85 + (double) num87 * (double) num87));
                    float SpeedX = num85 * num88;
                    float SpeedY = num87 * num88;
                    int damage = this.damage;
                    int Type = 195;
                    int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, damage, this.knockBack, Main.myPlayer);
                    Main.projectile[index].timeLeft = 300;
                    if ((double) SpeedX < 0.0)
                      this.direction = -1;
                    if ((double) SpeedX > 0.0)
                      this.direction = 1;
                    this.netUpdate = true;
                  }
                }
              }
            }
            bool flag7 = false;
            Vector2 vector2_1 = Vector2.Zero;
            bool flag8 = false;
            if (this.type == 266 || this.type >= 390 && this.type <= 392)
            {
              float num89 = (float) (40 * this.minionPos);
              int num90 = 60;
              --this.localAI[0];
              if ((double) this.localAI[0] < 0.0)
                this.localAI[0] = 0.0f;
              if ((double) this.ai[1] > 0.0)
              {
                --this.ai[1];
              }
              else
              {
                float x1 = this.position.X;
                float y1 = this.position.Y;
                float num91 = 100000f;
                float num92 = num91;
                int index9 = -1;
                NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
                if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this))
                {
                  float x2 = minionAttackTargetNpc.Center.X;
                  float y2 = minionAttackTargetNpc.Center.Y;
                  float num93 = Math.Abs(this.position.X + (float) (this.width / 2) - x2) + Math.Abs(this.position.Y + (float) (this.height / 2) - y2);
                  if ((double) num93 < (double) num91)
                  {
                    if (index9 == -1 && (double) num93 <= (double) num92)
                    {
                      num92 = num93;
                      x1 = x2;
                      y1 = y2;
                    }
                    if (Collision.CanHit(this.position, this.width, this.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height))
                    {
                      num91 = num93;
                      x1 = x2;
                      y1 = y2;
                      index9 = minionAttackTargetNpc.whoAmI;
                    }
                  }
                }
                if (index9 == -1)
                {
                  for (int index10 = 0; index10 < 200; ++index10)
                  {
                    if (Main.npc[index10].CanBeChasedBy((object) this))
                    {
                      float num94 = Main.npc[index10].position.X + (float) (Main.npc[index10].width / 2);
                      float num95 = Main.npc[index10].position.Y + (float) (Main.npc[index10].height / 2);
                      float num96 = Math.Abs(this.position.X + (float) (this.width / 2) - num94) + Math.Abs(this.position.Y + (float) (this.height / 2) - num95);
                      if ((double) num96 < (double) num91)
                      {
                        if (index9 == -1 && (double) num96 <= (double) num92)
                        {
                          num92 = num96;
                          x1 = num94;
                          y1 = num95;
                        }
                        if (Collision.CanHit(this.position, this.width, this.height, Main.npc[index10].position, Main.npc[index10].width, Main.npc[index10].height))
                        {
                          num91 = num96;
                          x1 = num94;
                          y1 = num95;
                          index9 = index10;
                        }
                      }
                    }
                  }
                }
                if (this.type >= 390 && this.type <= 392 && !Collision.SolidCollision(this.position, this.width, this.height))
                  this.tileCollide = true;
                if (index9 == -1 && (double) num92 < (double) num91)
                  num91 = num92;
                else if (index9 >= 0)
                {
                  flag7 = true;
                  vector2_1 = new Vector2(x1, y1) - this.Center;
                  if (this.type >= 390 && this.type <= 392)
                  {
                    if ((double) Main.npc[index9].position.Y > (double) this.position.Y + (double) this.height)
                    {
                      int index11 = (int) ((double) this.Center.X / 16.0);
                      int index12 = (int) (((double) this.position.Y + (double) this.height + 1.0) / 16.0);
                      if (Main.tile[index11, index12] != null && Main.tile[index11, index12].active() && TileID.Sets.Platforms[(int) Main.tile[index11, index12].type])
                        this.tileCollide = false;
                    }
                    Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height);
                    Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index9].position.X, (int) Main.npc[index9].position.Y, Main.npc[index9].width, Main.npc[index9].height);
                    int num97 = 10;
                    rectangle2.X -= num97;
                    rectangle2.Y -= num97;
                    rectangle2.Width += num97 * 2;
                    rectangle2.Height += num97 * 2;
                    if (rectangle1.Intersects(rectangle2))
                    {
                      flag8 = true;
                      Vector2 v = Main.npc[index9].Center - this.Center;
                      if ((double) this.velocity.Y > 0.0 && (double) v.Y < 0.0)
                        this.velocity.Y *= 0.5f;
                      if ((double) this.velocity.Y < 0.0 && (double) v.Y > 0.0)
                        this.velocity.Y *= 0.5f;
                      if ((double) this.velocity.X > 0.0 && (double) v.X < 0.0)
                        this.velocity.X *= 0.5f;
                      if ((double) this.velocity.X < 0.0 && (double) v.X > 0.0)
                        this.velocity.X *= 0.5f;
                      if ((double) v.Length() > 14.0)
                      {
                        v.Normalize();
                        v *= 14f;
                      }
                      this.rotation = (float) (((double) this.rotation * 5.0 + (double) v.ToRotation() + 1.57079637050629) / 6.0);
                      this.velocity = (this.velocity * 9f + v) / 10f;
                      for (int index13 = 0; index13 < 1000; ++index13)
                      {
                        if (this.whoAmI != index13 && this.owner == Main.projectile[index13].owner && Main.projectile[index13].type >= 390 && Main.projectile[index13].type <= 392 && (double) (Main.projectile[index13].Center - this.Center).Length() < 15.0)
                        {
                          float num98 = 0.5f;
                          if ((double) this.Center.Y > (double) Main.projectile[index13].Center.Y)
                          {
                            Main.projectile[index13].velocity.Y -= num98;
                            this.velocity.Y += num98;
                          }
                          else
                          {
                            Main.projectile[index13].velocity.Y += num98;
                            this.velocity.Y -= num98;
                          }
                          if ((double) this.Center.X > (double) Main.projectile[index13].Center.X)
                          {
                            this.velocity.X += num98;
                            Main.projectile[index13].velocity.X -= num98;
                          }
                          else
                          {
                            this.velocity.X -= num98;
                            Main.projectile[index13].velocity.Y += num98;
                          }
                        }
                      }
                    }
                  }
                }
                float num99 = 300f;
                if ((double) this.position.Y > Main.worldSurface * 16.0)
                  num99 = 150f;
                if (this.type >= 390 && this.type <= 392)
                {
                  num99 = 500f;
                  if ((double) this.position.Y > Main.worldSurface * 16.0)
                    num99 = 250f;
                }
                if ((double) num91 < (double) num99 + (double) num89 && index9 == -1)
                {
                  float num100 = x1 - (this.position.X + (float) (this.width / 2));
                  if ((double) num100 < -5.0)
                  {
                    flag1 = true;
                    flag2 = false;
                  }
                  else if ((double) num100 > 5.0)
                  {
                    flag2 = true;
                    flag1 = false;
                  }
                }
                bool flag9 = false;
                if (this.type >= 390 && this.type <= 392 && (double) this.localAI[1] > 0.0)
                {
                  flag9 = true;
                  --this.localAI[1];
                }
                if (index9 >= 0 && (double) num91 < 800.0 + (double) num89)
                {
                  this.friendly = true;
                  this.localAI[0] = (float) num90;
                  float num101 = x1 - (this.position.X + (float) (this.width / 2));
                  if ((double) num101 < -10.0)
                  {
                    flag1 = true;
                    flag2 = false;
                  }
                  else if ((double) num101 > 10.0)
                  {
                    flag2 = true;
                    flag1 = false;
                  }
                  if ((double) y1 < (double) this.Center.Y - 100.0 && (double) num101 > -50.0 && (double) num101 < 50.0 && (double) this.velocity.Y == 0.0)
                  {
                    float num102 = Math.Abs(y1 - this.Center.Y);
                    if ((double) num102 < 120.0)
                      this.velocity.Y = -10f;
                    else if ((double) num102 < 210.0)
                      this.velocity.Y = -13f;
                    else if ((double) num102 < 270.0)
                      this.velocity.Y = -15f;
                    else if ((double) num102 < 310.0)
                      this.velocity.Y = -17f;
                    else if ((double) num102 < 380.0)
                      this.velocity.Y = -18f;
                  }
                  if (flag9)
                  {
                    this.friendly = false;
                    if ((double) this.velocity.X < 0.0)
                      flag1 = true;
                    else if ((double) this.velocity.X > 0.0)
                      flag2 = true;
                  }
                }
                else
                  this.friendly = false;
              }
            }
            if ((double) this.ai[1] != 0.0)
            {
              flag1 = false;
              flag2 = false;
            }
            else if (flag5 && (double) this.localAI[0] == 0.0)
              this.direction = Main.player[this.owner].direction;
            else if (this.type >= 390 && this.type <= 392)
            {
              int index14 = (int) ((double) this.Center.X / 16.0);
              int index15 = (int) ((double) this.Center.Y / 16.0);
              if (Main.tile[index14, index15] != null && Main.tile[index14, index15].wall > (byte) 0)
                flag1 = flag2 = false;
            }
            if (this.type == (int) sbyte.MaxValue)
            {
              if ((double) this.rotation > -0.1 && (double) this.rotation < 0.1)
                this.rotation = 0.0f;
              else if ((double) this.rotation < 0.0)
                this.rotation += 0.1f;
              else
                this.rotation -= 0.1f;
            }
            else if (this.type != 313 && !flag8)
              this.rotation = 0.0f;
            if (this.type < 390 || this.type > 392)
              this.tileCollide = true;
            float num103 = 0.08f;
            float num104 = 6.5f;
            if (this.type == (int) sbyte.MaxValue)
            {
              num104 = 2f;
              num103 = 0.04f;
            }
            if (this.type == 112)
            {
              num104 = 6f;
              num103 = 0.06f;
            }
            if (this.type == 334)
            {
              num104 = 8f;
              num103 = 0.08f;
            }
            if (this.type == 268)
            {
              num104 = 8f;
              num103 = 0.4f;
            }
            if (this.type == 324)
            {
              num103 = 0.1f;
              num104 = 3f;
            }
            if (flag5 || this.type == 266 || this.type >= 390 && this.type <= 392)
            {
              num104 = 6f;
              num103 = 0.2f;
              if ((double) num104 < (double) Math.Abs(Main.player[this.owner].velocity.X) + (double) Math.Abs(Main.player[this.owner].velocity.Y))
              {
                num104 = Math.Abs(Main.player[this.owner].velocity.X) + Math.Abs(Main.player[this.owner].velocity.Y);
                num103 = 0.3f;
              }
            }
            if (this.type >= 390 && this.type <= 392)
              num103 *= 2f;
            if (flag1)
            {
              if ((double) this.velocity.X > -3.5)
                this.velocity.X -= num103;
              else
                this.velocity.X -= num103 * 0.25f;
            }
            else if (flag2)
            {
              if ((double) this.velocity.X < 3.5)
                this.velocity.X += num103;
              else
                this.velocity.X += num103 * 0.25f;
            }
            else
            {
              this.velocity.X *= 0.9f;
              if ((double) this.velocity.X >= -(double) num103 && (double) this.velocity.X <= (double) num103)
                this.velocity.X = 0.0f;
            }
            if (this.type == 208)
            {
              this.velocity.X *= 0.95f;
              if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1)
                this.velocity.X = 0.0f;
              flag1 = false;
              flag2 = false;
            }
            if (flag1 | flag2)
            {
              int num105 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
              int j = (int) ((double) this.position.Y + (double) (this.height / 2)) / 16;
              if (this.type == 236)
                num105 += this.direction;
              if (flag1)
                --num105;
              if (flag2)
                ++num105;
              if (WorldGen.SolidTile(num105 + (int) this.velocity.X, j))
                flag4 = true;
            }
            if ((double) Main.player[this.owner].position.Y + (double) Main.player[this.owner].height - 8.0 > (double) this.position.Y + (double) this.height)
              flag3 = true;
            if (this.type == 268 && this.frameCounter < 10)
              flag4 = false;
            Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY);
            if ((double) this.velocity.Y == 0.0 || this.type == 200)
            {
              if (!flag3 && ((double) this.velocity.X < 0.0 || (double) this.velocity.X > 0.0))
              {
                int i = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
                int j = (int) ((double) this.position.Y + (double) (this.height / 2)) / 16 + 1;
                if (flag1)
                  --i;
                if (flag2)
                  ++i;
                WorldGen.SolidTile(i, j);
              }
              if (flag4)
              {
                int i1 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
                int j = (int) ((double) this.position.Y + (double) this.height) / 16 + 1;
                if (WorldGen.SolidTile(i1, j) || Main.tile[i1, j].halfBrick() || Main.tile[i1, j].slope() > (byte) 0 || this.type == 200)
                {
                  if (this.type == 200)
                  {
                    this.velocity.Y = -3.1f;
                  }
                  else
                  {
                    try
                    {
                      int num106 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
                      int num107 = (int) ((double) this.position.Y + (double) (this.height / 2)) / 16;
                      if (flag1)
                        --num106;
                      if (flag2)
                        ++num106;
                      int i2 = num106 + (int) this.velocity.X;
                      if (!WorldGen.SolidTile(i2, num107 - 1) && !WorldGen.SolidTile(i2, num107 - 2))
                        this.velocity.Y = -5.1f;
                      else if (!WorldGen.SolidTile(i2, num107 - 2))
                        this.velocity.Y = -7.1f;
                      else if (WorldGen.SolidTile(i2, num107 - 5))
                        this.velocity.Y = -11.1f;
                      else if (WorldGen.SolidTile(i2, num107 - 4))
                        this.velocity.Y = -10.1f;
                      else
                        this.velocity.Y = -9.1f;
                    }
                    catch
                    {
                      this.velocity.Y = -9.1f;
                    }
                  }
                  if (this.type == (int) sbyte.MaxValue)
                    this.ai[0] = 1f;
                }
              }
              else if (this.type == 266 && flag1 | flag2)
                this.velocity.Y -= 6f;
            }
            if ((double) this.velocity.X > (double) num104)
              this.velocity.X = num104;
            if ((double) this.velocity.X < -(double) num104)
              this.velocity.X = -num104;
            if ((double) this.velocity.X < 0.0)
              this.direction = -1;
            if ((double) this.velocity.X > 0.0)
              this.direction = 1;
            if ((double) this.velocity.X > (double) num103 & flag2)
              this.direction = 1;
            if ((double) this.velocity.X < -(double) num103 & flag1)
              this.direction = -1;
            if (this.type != 313)
            {
              if (this.direction == -1)
                this.spriteDirection = 1;
              if (this.direction == 1)
                this.spriteDirection = -1;
            }
            if (this.type == 398)
              this.spriteDirection = this.direction;
            if (flag5)
            {
              if ((double) this.ai[1] > 0.0)
              {
                if ((double) this.localAI[1] == 0.0)
                {
                  this.localAI[1] = 1f;
                  this.frame = 1;
                }
                if (this.frame != 0)
                {
                  ++this.frameCounter;
                  if (this.frameCounter > 4)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame == 4)
                    this.frame = 0;
                }
              }
              else if ((double) this.velocity.Y == 0.0)
              {
                this.localAI[1] = 0.0f;
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame < 5)
                    this.frame = 5;
                  if (this.frame >= 11)
                    this.frame = 5;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else if ((double) this.velocity.Y < 0.0)
              {
                this.frameCounter = 0;
                this.frame = 4;
              }
              else if ((double) this.velocity.Y > 0.0)
              {
                this.frameCounter = 0;
                this.frame = 4;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y > 10.0)
                this.velocity.Y = 10f;
              Vector2 velocity = this.velocity;
            }
            else if (this.type == 268)
            {
              if ((double) this.velocity.Y == 0.0)
              {
                if (this.frame > 5)
                  this.frameCounter = 0;
                if ((double) this.velocity.X == 0.0)
                {
                  int num108 = 3;
                  ++this.frameCounter;
                  if (this.frameCounter < num108)
                    this.frame = 0;
                  else if (this.frameCounter < num108 * 2)
                    this.frame = 1;
                  else if (this.frameCounter < num108 * 3)
                    this.frame = 2;
                  else if (this.frameCounter < num108 * 4)
                    this.frame = 3;
                  else
                    this.frameCounter = num108 * 4;
                }
                else
                {
                  this.velocity.X *= 0.8f;
                  ++this.frameCounter;
                  int num109 = 3;
                  if (this.frameCounter < num109)
                    this.frame = 0;
                  else if (this.frameCounter < num109 * 2)
                    this.frame = 1;
                  else if (this.frameCounter < num109 * 3)
                    this.frame = 2;
                  else if (this.frameCounter < num109 * 4)
                    this.frame = 3;
                  else if (flag1 | flag2)
                  {
                    this.velocity.X *= 2f;
                    this.frame = 4;
                    this.velocity.Y = -6.1f;
                    this.frameCounter = 0;
                    for (int index16 = 0; index16 < 4; ++index16)
                    {
                      int index17 = Dust.NewDust(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 2.0)), this.width, 4, 5);
                      Main.dust[index17].velocity += this.velocity;
                      Main.dust[index17].velocity *= 0.4f;
                    }
                  }
                  else
                    this.frameCounter = num109 * 4;
                }
              }
              else if ((double) this.velocity.Y < 0.0)
              {
                this.frameCounter = 0;
                this.frame = 5;
              }
              else
              {
                this.frame = 4;
                this.frameCounter = 3;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 269)
            {
              if ((double) this.velocity.Y >= 0.0 && (double) this.velocity.Y <= 0.8)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                {
                  int index = Dust.NewDust(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 2.0)), this.width, 6, 76);
                  Main.dust[index].noGravity = true;
                  Main.dust[index].velocity *= 0.3f;
                  Main.dust[index].noLight = true;
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame > 3)
                    this.frame = 0;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else
              {
                this.frameCounter = 0;
                this.frame = 2;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 313)
            {
              int index18 = (int) ((double) this.Center.X / 16.0);
              int index19 = (int) ((double) this.Center.Y / 16.0);
              if (Main.tile[index18, index19] != null && Main.tile[index18, index19].wall > (byte) 0)
              {
                this.position.Y += (float) this.height;
                this.height = 34;
                this.position.Y -= (float) this.height;
                this.position.X += (float) (this.width / 2);
                this.width = 34;
                this.position.X -= (float) (this.width / 2);
                Vector2 vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
                float num110 = Main.player[this.owner].Center.X - vector2_2.X;
                float num111 = Main.player[this.owner].Center.Y - vector2_2.Y;
                float num112 = (float) Math.Sqrt((double) num110 * (double) num110 + (double) num111 * (double) num111);
                float num113 = (float) (4.0 / (double) num112);
                float num114 = num110 * num113;
                float num115 = num111 * num113;
                if ((double) num112 < 120.0)
                {
                  this.velocity.X *= 0.9f;
                  this.velocity.Y *= 0.9f;
                  if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < 0.1)
                    this.velocity = this.velocity * 0.0f;
                }
                else
                {
                  this.velocity.X = (float) (((double) this.velocity.X * 9.0 + (double) num114) / 10.0);
                  this.velocity.Y = (float) (((double) this.velocity.Y * 9.0 + (double) num115) / 10.0);
                }
                if ((double) num112 >= 120.0)
                {
                  this.spriteDirection = this.direction;
                  this.rotation = (float) Math.Atan2((double) this.velocity.Y * (double) -this.direction, (double) this.velocity.X * (double) -this.direction);
                }
                this.frameCounter += (int) ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y));
                if (this.frameCounter > 6)
                {
                  ++this.frame;
                  this.frameCounter = 0;
                }
                if (this.frame > 10)
                  this.frame = 5;
                if (this.frame >= 5)
                  return;
                this.frame = 10;
              }
              else
              {
                this.rotation = 0.0f;
                if (this.direction == -1)
                  this.spriteDirection = 1;
                if (this.direction == 1)
                  this.spriteDirection = -1;
                this.position.Y += (float) this.height;
                this.height = 30;
                this.position.Y -= (float) this.height;
                this.position.X += (float) (this.width / 2);
                this.width = 30;
                this.position.X -= (float) (this.width / 2);
                if ((double) this.velocity.Y >= 0.0 && (double) this.velocity.Y <= 0.8)
                {
                  if ((double) this.velocity.X == 0.0)
                  {
                    this.frame = 0;
                    this.frameCounter = 0;
                  }
                  else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                  {
                    this.frameCounter += (int) Math.Abs(this.velocity.X);
                    ++this.frameCounter;
                    if (this.frameCounter > 6)
                    {
                      ++this.frame;
                      this.frameCounter = 0;
                    }
                    if (this.frame > 3)
                      this.frame = 0;
                  }
                  else
                  {
                    this.frame = 0;
                    this.frameCounter = 0;
                  }
                }
                else
                {
                  this.frameCounter = 0;
                  this.frame = 4;
                }
                this.velocity.Y += 0.4f;
                if ((double) this.velocity.Y <= 10.0)
                  return;
                this.velocity.Y = 10f;
              }
            }
            else if (this.type >= 390 && this.type <= 392)
            {
              int index20 = (int) ((double) this.Center.X / 16.0);
              int index21 = (int) ((double) this.Center.Y / 16.0);
              if (Main.tile[index20, index21] != null && Main.tile[index20, index21].wall > (byte) 0)
              {
                this.position.Y += (float) this.height;
                this.height = 34;
                this.position.Y -= (float) this.height;
                this.position.X += (float) (this.width / 2);
                this.width = 34;
                this.position.X -= (float) (this.width / 2);
                float num116 = 9f;
                float num117 = (float) (40 * (this.minionPos + 1));
                Vector2 v = Main.player[this.owner].Center - this.Center;
                if (flag7)
                {
                  v = vector2_1;
                  num117 = 10f;
                }
                else if (!Collision.CanHitLine(this.Center, 1, 1, Main.player[this.owner].Center, 1, 1))
                  this.ai[0] = 1f;
                if ((double) v.Length() < (double) num117)
                {
                  this.velocity = this.velocity * 0.9f;
                  if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < 0.1)
                    this.velocity = this.velocity * 0.0f;
                }
                else if ((double) v.Length() < 800.0 || !flag7)
                  this.velocity = (this.velocity * 9f + Vector2.Normalize(v) * num116) / 10f;
                if ((double) v.Length() >= (double) num117)
                {
                  this.spriteDirection = this.direction;
                  this.rotation = this.velocity.ToRotation() + 1.570796f;
                }
                else
                  this.rotation = v.ToRotation() + 1.570796f;
                this.frameCounter += (int) ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y));
                if (this.frameCounter > 5)
                {
                  ++this.frame;
                  this.frameCounter = 0;
                }
                if (this.frame > 7)
                  this.frame = 4;
                if (this.frame >= 4)
                  return;
                this.frame = 7;
              }
              else
              {
                if (!flag8)
                  this.rotation = 0.0f;
                if (this.direction == -1)
                  this.spriteDirection = 1;
                if (this.direction == 1)
                  this.spriteDirection = -1;
                this.position.Y += (float) this.height;
                this.height = 30;
                this.position.Y -= (float) this.height;
                this.position.X += (float) (this.width / 2);
                this.width = 30;
                this.position.X -= (float) (this.width / 2);
                if (!flag7 && !Collision.CanHitLine(this.Center, 1, 1, Main.player[this.owner].Center, 1, 1))
                  this.ai[0] = 1f;
                if (!flag8 && this.frame >= 4 && this.frame <= 7)
                {
                  Vector2 vector2_3 = Main.player[this.owner].Center - this.Center;
                  if (flag7)
                    vector2_3 = vector2_1;
                  float num118 = -vector2_3.Y;
                  if ((double) vector2_3.Y <= 0.0)
                  {
                    if ((double) num118 < 120.0)
                      this.velocity.Y = -10f;
                    else if ((double) num118 < 210.0)
                      this.velocity.Y = -13f;
                    else if ((double) num118 < 270.0)
                      this.velocity.Y = -15f;
                    else if ((double) num118 < 310.0)
                      this.velocity.Y = -17f;
                    else if ((double) num118 < 380.0)
                      this.velocity.Y = -18f;
                  }
                }
                if (flag8)
                {
                  ++this.frameCounter;
                  if (this.frameCounter > 3)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame >= 8)
                    this.frame = 4;
                  if (this.frame <= 3)
                    this.frame = 7;
                }
                else if ((double) this.velocity.Y >= 0.0 && (double) this.velocity.Y <= 0.8)
                {
                  if ((double) this.velocity.X == 0.0)
                  {
                    this.frame = 0;
                    this.frameCounter = 0;
                  }
                  else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                  {
                    this.frameCounter += (int) Math.Abs(this.velocity.X);
                    ++this.frameCounter;
                    if (this.frameCounter > 5)
                    {
                      ++this.frame;
                      this.frameCounter = 0;
                    }
                    if (this.frame > 2)
                      this.frame = 0;
                  }
                  else
                  {
                    this.frame = 0;
                    this.frameCounter = 0;
                  }
                }
                else
                {
                  this.frameCounter = 0;
                  this.frame = 3;
                }
                this.velocity.Y += 0.4f;
                if ((double) this.velocity.Y <= 10.0)
                  return;
                this.velocity.Y = 10f;
              }
            }
            else if (this.type == 314)
            {
              if ((double) this.velocity.Y >= 0.0 && (double) this.velocity.Y <= 0.8)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame > 6)
                    this.frame = 1;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else
              {
                this.frameCounter = 0;
                this.frame = 7;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 319)
            {
              if ((double) this.velocity.Y >= 0.0 && (double) this.velocity.Y <= 0.8)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 8)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame > 5)
                    this.frame = 2;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else
              {
                this.frameCounter = 0;
                this.frame = 1;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 236)
            {
              if ((double) this.velocity.Y >= 0.0 && (double) this.velocity.Y <= 0.8)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                {
                  if (this.frame < 2)
                    this.frame = 2;
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame > 8)
                    this.frame = 2;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else
              {
                this.frameCounter = 0;
                this.frame = 1;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 499)
            {
              if ((double) this.velocity.Y >= 0.0 && (double) this.velocity.Y <= 0.8)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                {
                  if (this.frame < 2)
                    this.frame = 2;
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame >= 8)
                    this.frame = 2;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else
              {
                this.frameCounter = 0;
                this.frame = 1;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 266)
            {
              if ((double) this.velocity.Y >= 0.0 && (double) this.velocity.Y <= 0.8)
              {
                if ((double) this.velocity.X == 0.0)
                  ++this.frameCounter;
                else
                  this.frameCounter += 3;
              }
              else
                this.frameCounter += 5;
              if (this.frameCounter >= 20)
              {
                this.frameCounter -= 20;
                ++this.frame;
              }
              if (this.frame > 1)
                this.frame = 0;
              if (this.wet && (double) Main.player[this.owner].position.Y + (double) Main.player[this.owner].height < (double) this.position.Y + (double) this.height && (double) this.localAI[0] == 0.0)
              {
                if ((double) this.velocity.Y > -4.0)
                  this.velocity.Y -= 0.2f;
                if ((double) this.velocity.Y > 0.0)
                  this.velocity.Y *= 0.95f;
              }
              else
                this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 334)
            {
              if ((double) this.velocity.Y == 0.0)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  if (this.frame > 0)
                  {
                    this.frameCounter += 2;
                    if (this.frameCounter > 6)
                    {
                      ++this.frame;
                      this.frameCounter = 0;
                    }
                    if (this.frame >= 7)
                      this.frame = 0;
                  }
                  else
                  {
                    this.frame = 0;
                    this.frameCounter = 0;
                  }
                }
                else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                {
                  this.frameCounter += (int) Math.Abs((double) this.velocity.X * 0.75);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame >= 7 || this.frame < 1)
                    this.frame = 1;
                }
                else if (this.frame > 0)
                {
                  this.frameCounter += 2;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame >= 7)
                    this.frame = 0;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else if ((double) this.velocity.Y < 0.0)
              {
                this.frameCounter = 0;
                this.frame = 2;
              }
              else if ((double) this.velocity.Y > 0.0)
              {
                this.frameCounter = 0;
                this.frame = 4;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 353)
            {
              if ((double) this.velocity.Y == 0.0)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame > 9)
                    this.frame = 2;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else if ((double) this.velocity.Y < 0.0)
              {
                this.frameCounter = 0;
                this.frame = 1;
              }
              else if ((double) this.velocity.Y > 0.0)
              {
                this.frameCounter = 0;
                this.frame = 1;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 111)
            {
              if ((double) this.velocity.Y == 0.0)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame >= 7)
                    this.frame = 0;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else if ((double) this.velocity.Y < 0.0)
              {
                this.frameCounter = 0;
                this.frame = 4;
              }
              else if ((double) this.velocity.Y > 0.0)
              {
                this.frameCounter = 0;
                this.frame = 6;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 112)
            {
              if ((double) this.velocity.Y == 0.0)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame >= 3)
                    this.frame = 0;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else if ((double) this.velocity.Y < 0.0)
              {
                this.frameCounter = 0;
                this.frame = 2;
              }
              else if ((double) this.velocity.Y > 0.0)
              {
                this.frameCounter = 0;
                this.frame = 2;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == (int) sbyte.MaxValue)
            {
              if ((double) this.velocity.Y == 0.0)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.1 || (double) this.velocity.X > 0.1)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame > 5)
                    this.frame = 0;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else
              {
                this.frame = 0;
                this.frameCounter = 0;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 200)
            {
              if ((double) this.velocity.Y == 0.0)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.1 || (double) this.velocity.X > 0.1)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame > 5)
                    this.frame = 0;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else
              {
                this.rotation = this.velocity.X * 0.1f;
                ++this.frameCounter;
                if ((double) this.velocity.Y < 0.0)
                  this.frameCounter += 2;
                if (this.frameCounter > 6)
                {
                  ++this.frame;
                  this.frameCounter = 0;
                }
                if (this.frame > 9)
                  this.frame = 6;
                if (this.frame < 6)
                  this.frame = 6;
              }
              this.velocity.Y += 0.1f;
              if ((double) this.velocity.Y <= 4.0)
                return;
              this.velocity.Y = 4f;
            }
            else if (this.type == 208)
            {
              if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X == 0.0)
              {
                if ((double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2) < (double) this.position.X + (double) (this.width / 2))
                  this.direction = -1;
                else if ((double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2) > (double) this.position.X + (double) (this.width / 2))
                  this.direction = 1;
                this.rotation = 0.0f;
                this.frame = 0;
              }
              else
              {
                this.rotation = this.velocity.X * 0.075f;
                ++this.frameCounter;
                if (this.frameCounter > 6)
                {
                  ++this.frame;
                  this.frameCounter = 0;
                }
                if (this.frame > 4)
                  this.frame = 1;
                if (this.frame < 1)
                  this.frame = 1;
              }
              this.velocity.Y += 0.1f;
              if ((double) this.velocity.Y <= 4.0)
                return;
              this.velocity.Y = 4f;
            }
            else if (this.type == 209)
            {
              if (this.alpha > 0)
              {
                this.alpha -= 5;
                if (this.alpha < 0)
                  this.alpha = 0;
              }
              if ((double) this.velocity.Y == 0.0)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.1 || (double) this.velocity.X > 0.1)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame > 11)
                    this.frame = 2;
                  if (this.frame < 2)
                    this.frame = 2;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else
              {
                this.frame = 1;
                this.frameCounter = 0;
                this.rotation = 0.0f;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else if (this.type == 324)
            {
              if ((double) this.velocity.Y == 0.0)
              {
                if ((double) this.velocity.X < -0.1 || (double) this.velocity.X > 0.1)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame > 5)
                    this.frame = 2;
                  if (this.frame < 2)
                    this.frame = 2;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else
              {
                this.frameCounter = 0;
                this.frame = 1;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 14.0)
                return;
              this.velocity.Y = 14f;
            }
            else if (this.type == 210)
            {
              if ((double) this.velocity.Y == 0.0)
              {
                if ((double) this.velocity.X < -0.1 || (double) this.velocity.X > 0.1)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame > 6)
                    this.frame = 0;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else
              {
                this.rotation = this.velocity.X * 0.05f;
                ++this.frameCounter;
                if (this.frameCounter > 6)
                {
                  ++this.frame;
                  this.frameCounter = 0;
                }
                if (this.frame > 11)
                  this.frame = 7;
                if (this.frame < 7)
                  this.frame = 7;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
            else
            {
              if (this.type != 398)
                return;
              if ((double) this.velocity.Y == 0.0)
              {
                if ((double) this.velocity.X == 0.0)
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
                else if ((double) this.velocity.X < -0.8 || (double) this.velocity.X > 0.8)
                {
                  this.frameCounter += (int) Math.Abs(this.velocity.X);
                  ++this.frameCounter;
                  if (this.frameCounter > 6)
                  {
                    ++this.frame;
                    this.frameCounter = 0;
                  }
                  if (this.frame >= 5)
                    this.frame = 0;
                }
                else
                {
                  this.frame = 0;
                  this.frameCounter = 0;
                }
              }
              else if ((double) this.velocity.Y != 0.0)
              {
                this.frameCounter = 0;
                this.frame = 5;
              }
              this.velocity.Y += 0.4f;
              if ((double) this.velocity.Y <= 10.0)
                return;
              this.velocity.Y = 10f;
            }
          }
        }
      }
    }

    private void AI_062()
    {
      if (this.type == 373)
      {
        if (Main.player[this.owner].dead)
          Main.player[this.owner].hornetMinion = false;
        if (Main.player[this.owner].hornetMinion)
          this.timeLeft = 2;
      }
      if (this.type == 375)
      {
        if (Main.player[this.owner].dead)
          Main.player[this.owner].impMinion = false;
        if (Main.player[this.owner].impMinion)
          this.timeLeft = 2;
      }
      if (this.type == 407)
      {
        if (Main.player[this.owner].dead)
          Main.player[this.owner].sharknadoMinion = false;
        if (Main.player[this.owner].sharknadoMinion)
          this.timeLeft = 2;
      }
      if (this.type == 423)
      {
        if (Main.player[this.owner].dead)
          Main.player[this.owner].UFOMinion = false;
        if (Main.player[this.owner].UFOMinion)
          this.timeLeft = 2;
      }
      if (this.type == 613)
      {
        if (Main.player[this.owner].dead)
          Main.player[this.owner].stardustMinion = false;
        if (Main.player[this.owner].stardustMinion)
          this.timeLeft = 2;
        Lighting.AddLight(this.Center, 0.2f, 0.6f, 0.7f);
        if ((double) this.localAI[1] > 0.0)
          --this.localAI[1];
      }
      if (this.type == 423)
      {
        if ((double) this.ai[0] == 2.0)
        {
          --this.ai[1];
          this.tileCollide = false;
          if ((double) this.ai[1] > 3.0)
          {
            int index = Dust.NewDust(this.Center, 0, 0, 220 + Main.rand.Next(2), this.velocity.X, this.velocity.Y, 100);
            Main.dust[index].scale = (float) (0.5 + Main.rand.NextDouble() * 0.300000011920929);
            Main.dust[index].velocity /= 2.5f;
            Main.dust[index].noGravity = true;
            Main.dust[index].noLight = true;
            Main.dust[index].frame.Y = 80;
          }
          if ((double) this.ai[1] != 0.0)
            return;
          this.ai[1] = 30f;
          this.ai[0] = 0.0f;
          this.velocity = this.velocity / 5f;
          this.velocity.Y = 0.0f;
          this.extraUpdates = 0;
          this.numUpdates = 0;
          this.netUpdate = true;
          this.extraUpdates = 0;
          this.numUpdates = 0;
        }
        if (this.extraUpdates > 1)
          this.extraUpdates = 0;
        if (this.numUpdates > 1)
          this.numUpdates = 0;
      }
      if (this.type == 613)
      {
        if ((double) this.ai[0] == 2.0)
        {
          --this.ai[1];
          this.tileCollide = false;
          if ((double) this.ai[1] > 3.0)
          {
            if (this.numUpdates < 20)
            {
              for (int index = 0; index < 3; ++index)
              {
                Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
                dust.noGravity = true;
                dust.position = this.Center;
                dust.velocity *= 3f;
                dust.velocity += this.velocity * 3f;
                dust.fadeIn = 1f;
              }
            }
            float num1 = (float) (2.0 - (double) this.numUpdates / 30.0);
            if ((double) this.scale > 0.0)
            {
              float num2 = 2f;
              for (int index = 0; (double) index < (double) num2; ++index)
              {
                Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
                dust.noGravity = true;
                dust.position = this.Center + Vector2.UnitY.RotatedBy((double) this.numUpdates * 0.104719758033752 + (double) this.whoAmI * 0.785398185253143 + 1.57079637050629) * (float) (this.height / 2) - this.velocity * ((float) index / num2);
                dust.velocity = this.velocity / 3f;
                dust.fadeIn = num1 / 2f;
                dust.scale = num1;
              }
            }
          }
          if ((double) this.ai[1] != 0.0)
            return;
          this.ai[1] = 30f;
          this.ai[0] = 0.0f;
          this.velocity = this.velocity / 5f;
          this.velocity.Y = 0.0f;
          this.extraUpdates = 0;
          this.numUpdates = 0;
          this.netUpdate = true;
          float num = 15f;
          for (int index = 0; (double) index < (double) num; ++index)
          {
            Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
            dust.noGravity = true;
            dust.position = this.Center - this.velocity * 5f;
            dust.velocity *= 3f;
            dust.velocity += this.velocity * 3f;
            dust.fadeIn = 1f;
            if (Main.rand.Next(3) != 0)
            {
              dust.fadeIn = 2f;
              dust.scale = 2f;
              dust.velocity /= 8f;
            }
          }
          for (int index = 0; (double) index < (double) num; ++index)
          {
            Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
            dust.noGravity = true;
            dust.position = this.Center;
            dust.velocity *= 3f;
            dust.velocity += this.velocity * 3f;
            dust.fadeIn = 1f;
            if (Main.rand.Next(3) != 0)
            {
              dust.fadeIn = 2f;
              dust.scale = 2f;
              dust.velocity /= 8f;
            }
          }
          this.extraUpdates = 0;
          this.numUpdates = 0;
        }
        if (this.extraUpdates > 1)
          this.extraUpdates = 0;
        if (this.numUpdates > 1)
          this.numUpdates = 0;
      }
      if (this.type == 423 && (double) this.localAI[0] > 0.0)
        --this.localAI[0];
      if (this.type == 613 && (double) this.localAI[0] > 0.0)
        --this.localAI[0];
      float num3 = 0.05f;
      float width = (float) this.width;
      if (this.type == 407)
      {
        num3 = 0.1f;
        width *= 2f;
      }
      for (int index = 0; index < 1000; ++index)
      {
        if (index != this.whoAmI && Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == this.type && (double) Math.Abs(this.position.X - Main.projectile[index].position.X) + (double) Math.Abs(this.position.Y - Main.projectile[index].position.Y) < (double) width)
        {
          if ((double) this.position.X < (double) Main.projectile[index].position.X)
            this.velocity.X -= num3;
          else
            this.velocity.X += num3;
          if ((double) this.position.Y < (double) Main.projectile[index].position.Y)
            this.velocity.Y -= num3;
          else
            this.velocity.Y += num3;
        }
      }
      Vector2 vector2_1 = this.position;
      float num4 = 400f;
      if (this.type == 423)
        num4 = 300f;
      if (this.type == 613)
        num4 = 300f;
      bool flag = false;
      int num5 = -1;
      this.tileCollide = true;
      if (this.type == 407)
      {
        this.tileCollide = false;
        if (Collision.SolidCollision(this.position, this.width, this.height))
        {
          this.alpha += 20;
          if (this.alpha > 150)
            this.alpha = 150;
        }
        else
        {
          this.alpha -= 50;
          if (this.alpha < 60)
            this.alpha = 60;
        }
      }
      if (this.type == 407 || this.type == 613 || this.type == 423)
      {
        Vector2 center = Main.player[this.owner].Center;
        Vector2 vector2_2 = new Vector2(0.5f);
        if (this.type == 423)
          vector2_2.Y = 0.0f;
        NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
        if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this))
        {
          Vector2 vector2_3 = minionAttackTargetNpc.position + minionAttackTargetNpc.Size * vector2_2;
          float num6 = Vector2.Distance(vector2_3, center);
          if (((double) Vector2.Distance(center, vector2_1) > (double) num6 && (double) num6 < (double) num4 || !flag) && Collision.CanHitLine(this.position, this.width, this.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height))
          {
            num4 = num6;
            vector2_1 = vector2_3;
            flag = true;
            num5 = minionAttackTargetNpc.whoAmI;
          }
        }
        if (!flag)
        {
          for (int index = 0; index < 200; ++index)
          {
            NPC npc = Main.npc[index];
            if (npc.CanBeChasedBy((object) this))
            {
              Vector2 vector2_4 = npc.position + npc.Size * vector2_2;
              float num7 = Vector2.Distance(vector2_4, center);
              if (((double) Vector2.Distance(center, vector2_1) > (double) num7 && (double) num7 < (double) num4 || !flag) && Collision.CanHitLine(this.position, this.width, this.height, npc.position, npc.width, npc.height))
              {
                num4 = num7;
                vector2_1 = vector2_4;
                flag = true;
                num5 = index;
              }
            }
          }
        }
      }
      else
      {
        NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
        if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this))
        {
          float num8 = Vector2.Distance(minionAttackTargetNpc.Center, this.Center);
          if (((double) Vector2.Distance(this.Center, vector2_1) > (double) num8 && (double) num8 < (double) num4 || !flag) && Collision.CanHitLine(this.position, this.width, this.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height))
          {
            num4 = num8;
            vector2_1 = minionAttackTargetNpc.Center;
            flag = true;
            num5 = minionAttackTargetNpc.whoAmI;
          }
        }
        if (!flag)
        {
          for (int index = 0; index < 200; ++index)
          {
            NPC npc = Main.npc[index];
            if (npc.CanBeChasedBy((object) this))
            {
              float num9 = Vector2.Distance(npc.Center, this.Center);
              if (((double) Vector2.Distance(this.Center, vector2_1) > (double) num9 && (double) num9 < (double) num4 || !flag) && Collision.CanHitLine(this.position, this.width, this.height, npc.position, npc.width, npc.height))
              {
                num4 = num9;
                vector2_1 = npc.Center;
                flag = true;
                num5 = index;
              }
            }
          }
        }
      }
      int num10 = 500;
      if (flag)
        num10 = 1000;
      if (flag && this.type == 423)
        num10 = 1200;
      if (flag && this.type == 613)
        num10 = 1350;
      Player player = Main.player[this.owner];
      if ((double) Vector2.Distance(player.Center, this.Center) > (double) num10)
      {
        this.ai[0] = 1f;
        this.netUpdate = true;
      }
      if ((double) this.ai[0] == 1.0)
        this.tileCollide = false;
      if (flag && (double) this.ai[0] == 0.0)
      {
        Vector2 vector2_5 = vector2_1 - this.Center;
        float num11 = vector2_5.Length();
        vector2_5.Normalize();
        if (this.type == 423)
        {
          Vector2 vector2_6 = vector2_1 - Vector2.UnitY * 80f;
          int index = (int) vector2_6.Y / 16;
          if (index < 0)
            index = 0;
          Tile tile1 = Main.tile[(int) vector2_6.X / 16, index];
          if (tile1 != null && tile1.active() && Main.tileSolid[(int) tile1.type] && !Main.tileSolidTop[(int) tile1.type])
          {
            vector2_6 += Vector2.UnitY * 16f;
            Tile tile2 = Main.tile[(int) vector2_6.X / 16, (int) vector2_6.Y / 16];
            if (tile2 != null && tile2.active() && Main.tileSolid[(int) tile2.type] && !Main.tileSolidTop[(int) tile2.type])
              vector2_6 += Vector2.UnitY * 16f;
          }
          vector2_5 = vector2_6 - this.Center;
          num11 = vector2_5.Length();
          vector2_5.Normalize();
          if ((double) num11 > 300.0 && (double) num11 <= 800.0 && (double) this.localAI[0] == 0.0)
          {
            this.ai[0] = 2f;
            this.ai[1] = (float) (int) ((double) num11 / 10.0);
            this.extraUpdates = (int) this.ai[1];
            this.velocity = vector2_5 * 10f;
            this.localAI[0] = 60f;
            return;
          }
        }
        if (this.type == 613)
        {
          Vector2 vector2_7 = vector2_1;
          Vector2 vector2_8 = this.Center - vector2_7;
          if (vector2_8 == Vector2.Zero)
            vector2_8 = -Vector2.UnitY;
          vector2_8.Normalize();
          Vector2 vector2_9 = vector2_7 + vector2_8 * 60f;
          int index = (int) vector2_9.Y / 16;
          if (index < 0)
            index = 0;
          Tile tile3 = Main.tile[(int) vector2_9.X / 16, index];
          if (tile3 != null && tile3.active() && Main.tileSolid[(int) tile3.type] && !Main.tileSolidTop[(int) tile3.type])
          {
            vector2_9 += Vector2.UnitY * 16f;
            Tile tile4 = Main.tile[(int) vector2_9.X / 16, (int) vector2_9.Y / 16];
            if (tile4 != null && tile4.active() && Main.tileSolid[(int) tile4.type] && !Main.tileSolidTop[(int) tile4.type])
              vector2_9 += Vector2.UnitY * 16f;
          }
          vector2_5 = vector2_9 - this.Center;
          num11 = vector2_5.Length();
          vector2_5.Normalize();
          if ((double) num11 > 400.0 && (double) num11 <= 800.0 && (double) this.localAI[0] == 0.0)
          {
            this.ai[0] = 2f;
            this.ai[1] = (float) (int) ((double) num11 / 10.0);
            this.extraUpdates = (int) this.ai[1];
            this.velocity = vector2_5 * 10f;
            this.localAI[0] = 60f;
            return;
          }
        }
        if (this.type == 407)
        {
          if ((double) num11 > 400.0)
          {
            float num12 = 2f;
            vector2_5 *= num12;
            this.velocity = (this.velocity * 20f + vector2_5) / 21f;
          }
          else
            this.velocity = this.velocity * 0.96f;
        }
        if ((double) num11 > 200.0)
        {
          float num13 = 6f;
          Vector2 vector2_10 = vector2_5 * num13;
          this.velocity.X = (float) (((double) this.velocity.X * 40.0 + (double) vector2_10.X) / 41.0);
          this.velocity.Y = (float) (((double) this.velocity.Y * 40.0 + (double) vector2_10.Y) / 41.0);
        }
        else if (this.type == 423 || this.type == 613)
        {
          if ((double) num11 > 70.0 && (double) num11 < 130.0)
          {
            float num14 = 7f;
            if ((double) num11 < 100.0)
              num14 = -3f;
            Vector2 vector2_11 = vector2_5 * num14;
            this.velocity = (this.velocity * 20f + vector2_11) / 21f;
            if ((double) Math.Abs(vector2_11.X) > (double) Math.Abs(vector2_11.Y))
              this.velocity.X = (float) (((double) this.velocity.X * 10.0 + (double) vector2_11.X) / 11.0);
          }
          else
            this.velocity = this.velocity * 0.97f;
        }
        else if (this.type == 375)
        {
          if ((double) num11 < 150.0)
          {
            float num15 = 4f;
            Vector2 vector2_12 = vector2_5 * -num15;
            this.velocity.X = (float) (((double) this.velocity.X * 40.0 + (double) vector2_12.X) / 41.0);
            this.velocity.Y = (float) (((double) this.velocity.Y * 40.0 + (double) vector2_12.Y) / 41.0);
          }
          else
            this.velocity = this.velocity * 0.97f;
        }
        else if ((double) this.velocity.Y > -1.0)
          this.velocity.Y -= 0.1f;
      }
      else
      {
        if (!Collision.CanHitLine(this.Center, 1, 1, Main.player[this.owner].Center, 1, 1))
          this.ai[0] = 1f;
        float num16 = 6f;
        if ((double) this.ai[0] == 1.0)
          num16 = 15f;
        if (this.type == 407)
          num16 = 9f;
        Vector2 center = this.Center;
        Vector2 vector2_13 = player.Center - center + new Vector2(0.0f, -60f);
        if (this.type == 407)
          vector2_13 += new Vector2(0.0f, 40f);
        if (this.type == 375)
        {
          this.ai[1] = 3600f;
          this.netUpdate = true;
          vector2_13 = player.Center - center;
          int num17 = 1;
          for (int index = 0; index < this.whoAmI; ++index)
          {
            if (Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == this.type)
              ++num17;
          }
          vector2_13.X -= (float) (10 * Main.player[this.owner].direction);
          vector2_13.X -= (float) (num17 * 40 * Main.player[this.owner].direction);
          vector2_13.Y -= 10f;
        }
        float num18 = vector2_13.Length();
        if ((double) num18 > 200.0 && (double) num16 < 9.0)
          num16 = 9f;
        if (this.type == 375)
          num16 = (float) (int) ((double) num16 * 0.75);
        if ((double) num18 < 100.0 && (double) this.ai[0] == 1.0 && !Collision.SolidCollision(this.position, this.width, this.height))
        {
          this.ai[0] = 0.0f;
          this.netUpdate = true;
        }
        if ((double) num18 > 2000.0)
        {
          this.position.X = Main.player[this.owner].Center.X - (float) (this.width / 2);
          this.position.Y = Main.player[this.owner].Center.Y - (float) (this.width / 2);
        }
        if (this.type == 375)
        {
          if ((double) num18 > 10.0)
          {
            vector2_13.Normalize();
            if ((double) num18 < 50.0)
              num16 /= 2f;
            this.velocity = (this.velocity * 20f + vector2_13 * num16) / 21f;
          }
          else
          {
            this.direction = Main.player[this.owner].direction;
            this.velocity = this.velocity * 0.9f;
          }
        }
        else if (this.type == 407)
        {
          if ((double) Math.Abs(vector2_13.X) > 40.0 || (double) Math.Abs(vector2_13.Y) > 10.0)
          {
            vector2_13.Normalize();
            this.velocity = (this.velocity * 20f + vector2_13 * num16 * new Vector2(1.25f, 0.65f)) / 21f;
          }
          else
          {
            if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
            {
              this.velocity.X = -0.15f;
              this.velocity.Y = -0.05f;
            }
            this.velocity = this.velocity * 1.01f;
          }
        }
        else if ((double) num18 > 70.0)
        {
          vector2_13.Normalize();
          this.velocity = (this.velocity * 20f + vector2_13 * num16) / 21f;
        }
        else
        {
          if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
          {
            this.velocity.X = -0.15f;
            this.velocity.Y = -0.05f;
          }
          this.velocity = this.velocity * 1.01f;
        }
      }
      this.rotation = this.velocity.X * 0.05f;
      ++this.frameCounter;
      if (this.type == 373)
      {
        if (this.frameCounter > 1)
        {
          ++this.frame;
          this.frameCounter = 0;
        }
        if (this.frame > 2)
          this.frame = 0;
      }
      if (this.type == 375)
      {
        if (this.frameCounter >= 16)
          this.frameCounter = 0;
        this.frame = this.frameCounter / 4;
        if ((double) this.ai[1] > 0.0 && (double) this.ai[1] < 16.0)
          this.frame += 4;
        if (Main.rand.Next(6) == 0)
        {
          int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2f);
          Main.dust[index].velocity *= 0.3f;
          Main.dust[index].noGravity = true;
          Main.dust[index].noLight = true;
        }
      }
      if (this.type == 407)
      {
        int num19 = 2;
        if (this.frameCounter >= 6 * num19)
          this.frameCounter = 0;
        this.frame = this.frameCounter / num19;
        if (Main.rand.Next(5) == 0)
        {
          int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 217, Alpha: 100, Scale: 2f);
          Main.dust[index].velocity *= 0.3f;
          Main.dust[index].noGravity = true;
          Main.dust[index].noLight = true;
        }
      }
      if (this.type == 423 || this.type == 613)
      {
        int num20 = 3;
        if (this.frameCounter >= 4 * num20)
          this.frameCounter = 0;
        this.frame = this.frameCounter / num20;
      }
      if ((double) this.velocity.X > 0.0)
        this.spriteDirection = this.direction = -1;
      else if ((double) this.velocity.X < 0.0)
        this.spriteDirection = this.direction = 1;
      if (this.type == 373)
      {
        if ((double) this.ai[1] > 0.0)
          this.ai[1] += (float) Main.rand.Next(1, 4);
        if ((double) this.ai[1] > 90.0)
        {
          this.ai[1] = 0.0f;
          this.netUpdate = true;
        }
      }
      else if (this.type == 375)
      {
        if ((double) this.ai[1] > 0.0)
        {
          ++this.ai[1];
          if (Main.rand.Next(3) == 0)
            ++this.ai[1];
        }
        if ((double) this.ai[1] > (double) Main.rand.Next(180, 900))
        {
          this.ai[1] = 0.0f;
          this.netUpdate = true;
        }
      }
      else if (this.type == 407)
      {
        if ((double) this.ai[1] > 0.0)
        {
          ++this.ai[1];
          if (Main.rand.Next(3) != 0)
            ++this.ai[1];
        }
        if ((double) this.ai[1] > 60.0)
        {
          this.ai[1] = 0.0f;
          this.netUpdate = true;
        }
      }
      else if (this.type == 423)
      {
        if ((double) this.ai[1] > 0.0)
        {
          ++this.ai[1];
          if (Main.rand.Next(3) != 0)
            ++this.ai[1];
        }
        if ((double) this.ai[1] > 30.0)
        {
          this.ai[1] = 0.0f;
          this.netUpdate = true;
        }
      }
      else if (this.type == 613)
      {
        if ((double) this.ai[1] > 0.0)
        {
          ++this.ai[1];
          if (Main.rand.Next(3) != 0)
            ++this.ai[1];
        }
        if ((double) this.ai[1] > 60.0)
        {
          this.ai[1] = 0.0f;
          this.netUpdate = true;
        }
      }
      if ((double) this.ai[0] != 0.0)
        return;
      float num21 = 0.0f;
      int Type = 0;
      if (this.type == 373)
      {
        num21 = 10f;
        Type = 374;
      }
      else if (this.type == 375)
      {
        num21 = 11f;
        Type = 376;
      }
      else if (this.type == 407)
      {
        num21 = 14f;
        Type = 408;
      }
      else if (this.type == 423)
      {
        num21 = 4f;
        Type = 433;
      }
      else if (this.type == 613)
      {
        num21 = 14f;
        Type = 614;
      }
      if (!flag)
        return;
      if (this.type == 375)
      {
        if ((double) (vector2_1 - this.Center).X > 0.0)
          this.spriteDirection = this.direction = -1;
        else if ((double) (vector2_1 - this.Center).X < 0.0)
          this.spriteDirection = this.direction = 1;
      }
      if (this.type == 407 && Collision.SolidCollision(this.position, this.width, this.height))
        return;
      if (this.type == 423)
      {
        if ((double) Math.Abs((vector2_1 - this.Center).ToRotation() - 1.570796f) > 0.785398185253143)
        {
          this.velocity = this.velocity + Vector2.Normalize(vector2_1 - this.Center - Vector2.UnitY * 80f);
        }
        else
        {
          if ((double) (vector2_1 - this.Center).Length() > 400.0 || (double) this.ai[1] != 0.0)
            return;
          ++this.ai[1];
          if (Main.myPlayer != this.owner)
            return;
          Vector2 vector2_14 = vector2_1 - this.Center;
          vector2_14.Normalize();
          Vector2 vector2_15 = vector2_14 * num21;
          Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_15.X, vector2_15.Y, Type, this.damage, 0.0f, Main.myPlayer);
          this.netUpdate = true;
        }
      }
      else if ((double) this.ai[1] == 0.0 && this.type == 613)
      {
        if ((double) (vector2_1 - this.Center).Length() > 500.0 || (double) this.ai[1] != 0.0)
          return;
        ++this.ai[1];
        if (Main.myPlayer == this.owner)
        {
          Vector2 vector2_16 = vector2_1 - this.Center;
          vector2_16.Normalize();
          Vector2 vector2_17 = vector2_16 * num21;
          int index = Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_17.X, vector2_17.Y, Type, this.damage, 0.0f, Main.myPlayer, ai1: ((float) num5));
          Main.projectile[index].timeLeft = 300;
          Main.projectile[index].netUpdate = true;
          this.velocity = this.velocity - vector2_17 / 3f;
          this.netUpdate = true;
        }
        for (int index1 = 0; index1 < 5; ++index1)
        {
          int num22 = this.width / 4;
          Vector2 vector2_18 = ((float) Main.rand.NextDouble() * 6.283185f).ToRotationVector2() * (float) Main.rand.Next(24, 41) / 8f;
          int index2 = Dust.NewDust(this.Center - Vector2.One * (float) num22, num22 * 2, num22 * 2, 88);
          Dust dust = Main.dust[index2];
          Vector2 vector2_19 = Vector2.Normalize(dust.position - this.Center);
          dust.position = this.Center + vector2_19 * (float) num22 * this.scale - new Vector2(4f);
          dust.velocity = index1 >= 30 ? 2f * vector2_19 * (float) Main.rand.Next(45, 91) / 10f : vector2_19 * dust.velocity.Length() * 2f;
          dust.noGravity = true;
          dust.scale = 0.7f + Main.rand.NextFloat();
        }
      }
      else
      {
        if ((double) this.ai[1] != 0.0)
          return;
        ++this.ai[1];
        if (Main.myPlayer != this.owner)
          return;
        Vector2 vector2_20 = vector2_1 - this.Center;
        vector2_20.Normalize();
        Vector2 vector2_21 = vector2_20 * num21;
        int index = Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_21.X, vector2_21.Y, Type, this.damage, 0.0f, Main.myPlayer);
        Main.projectile[index].timeLeft = 300;
        Main.projectile[index].netUpdate = true;
        this.netUpdate = true;
      }
    }

    private void AI_075()
    {
      Player player = Main.player[this.owner];
      float num1 = 1.570796f;
      Vector2 vector2_1 = player.RotatedRelativePoint(player.MountedCenter);
      if (this.type == 439)
      {
        ++this.ai[0];
        int num2 = 0;
        if ((double) this.ai[0] >= 40.0)
          ++num2;
        if ((double) this.ai[0] >= 80.0)
          ++num2;
        if ((double) this.ai[0] >= 120.0)
          ++num2;
        int num3 = 24;
        int num4 = 6;
        ++this.ai[1];
        bool flag = false;
        if ((double) this.ai[1] >= (double) (num3 - num4 * num2))
        {
          this.ai[1] = 0.0f;
          flag = true;
        }
        this.frameCounter += 1 + num2;
        if (this.frameCounter >= 4)
        {
          this.frameCounter = 0;
          ++this.frame;
          if (this.frame >= 6)
            this.frame = 0;
        }
        if (this.soundDelay <= 0)
        {
          this.soundDelay = num3 - num4 * num2;
          if ((double) this.ai[0] != 1.0)
            Main.PlaySound(SoundID.Item91, this.position);
        }
        if ((double) this.ai[1] == 1.0 && (double) this.ai[0] != 1.0)
        {
          Vector2 vector2_2 = this.Center + (Vector2.UnitX * 24f).RotatedBy((double) this.rotation - 1.57079637050629);
          for (int index1 = 0; index1 < 2; ++index1)
          {
            int index2 = Dust.NewDust(vector2_2 - Vector2.One * 8f, 16, 16, 135, this.velocity.X / 2f, this.velocity.Y / 2f, 100);
            Main.dust[index2].velocity *= 0.66f;
            Main.dust[index2].noGravity = true;
            Main.dust[index2].scale = 1.4f;
          }
        }
        if (flag && Main.myPlayer == this.owner)
        {
          if ((!player.channel || !player.CheckMana(player.inventory[player.selectedItem].mana, true) || player.noItems ? 0 : (!player.CCed ? 1 : 0)) != 0)
          {
            float num5 = player.inventory[player.selectedItem].shootSpeed * this.scale;
            Vector2 vector2_3 = vector2_1;
            Vector2 vector2_4 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_3;
            if ((double) player.gravDir == -1.0)
              vector2_4.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_3.Y;
            Vector2 vector2_5 = Vector2.Normalize(vector2_4);
            if (float.IsNaN(vector2_5.X) || float.IsNaN(vector2_5.Y))
              vector2_5 = -Vector2.UnitY;
            Vector2 vector2_6 = vector2_5 * num5;
            if ((double) vector2_6.X != (double) this.velocity.X || (double) vector2_6.Y != (double) this.velocity.Y)
              this.netUpdate = true;
            this.velocity = vector2_6;
            int Type = 440;
            float num6 = 14f;
            int num7 = 7;
            for (int index = 0; index < 2; ++index)
            {
              Vector2 vector2_7 = this.Center + new Vector2((float) Main.rand.Next(-num7, num7 + 1), (float) Main.rand.Next(-num7, num7 + 1));
              Vector2 vector2_8 = (Vector2.Normalize(this.velocity) * num6).RotatedBy(Main.rand.NextDouble() * 0.196349546313286 - 0.0981747731566429);
              if (float.IsNaN(vector2_8.X) || float.IsNaN(vector2_8.Y))
                vector2_8 = -Vector2.UnitY;
              Projectile.NewProjectile(vector2_7.X, vector2_7.Y, vector2_8.X, vector2_8.Y, Type, this.damage, this.knockBack, this.owner);
            }
          }
          else
            this.Kill();
        }
      }
      if (this.type == 445)
      {
        ++this.localAI[0];
        if ((double) this.localAI[0] >= 60.0)
          this.localAI[0] = 0.0f;
        if ((double) Vector2.Distance(vector2_1, this.Center) >= 5.0)
        {
          float num8 = this.localAI[0] / 60f;
          if ((double) num8 > 0.5)
            num8 = 1f - num8;
          Vector3 vector3 = Vector3.Lerp(new Vector3(0.0f, 1f, 0.7f), new Vector3(0.0f, 0.7f, 1f), (float) (1.0 - (double) num8 * 2.0)) * 0.5f;
          if ((double) Vector2.Distance(vector2_1, this.Center) >= 30.0)
          {
            Vector2 vector2_9 = this.Center - vector2_1;
            vector2_9.Normalize();
            Vector2 vector2_10 = vector2_9 * (Vector2.Distance(vector2_1, this.Center) - 30f);
            DelegateMethods.v3_1 = vector3 * 0.8f;
            Utils.PlotTileLine(this.Center - vector2_10, this.Center, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
          }
          Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, vector3.X, vector3.Y, vector3.Z);
        }
        if (Main.myPlayer == this.owner)
        {
          if ((double) this.localAI[1] > 0.0)
            --this.localAI[1];
          if (!player.channel || player.noItems || player.CCed)
            this.Kill();
          else if ((double) this.localAI[1] == 0.0)
          {
            Vector2 vector2_11 = vector2_1;
            Vector2 vector2_12 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_11;
            if ((double) player.gravDir == -1.0)
              vector2_12.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_11.Y;
            if (Main.tile[Player.tileTargetX, Player.tileTargetY].active())
            {
              vector2_12 = new Vector2((float) Player.tileTargetX, (float) Player.tileTargetY) * 16f + Vector2.One * 8f - vector2_11;
              this.localAI[1] = 2f;
            }
            Vector2 vector2_13 = Vector2.Lerp(vector2_12, this.velocity, 0.7f);
            if (float.IsNaN(vector2_13.X) || float.IsNaN(vector2_13.Y))
              vector2_13 = -Vector2.UnitY;
            float num9 = 30f;
            if ((double) vector2_13.Length() < (double) num9)
              vector2_13 = Vector2.Normalize(vector2_13) * num9;
            int tileBoost = player.inventory[player.selectedItem].tileBoost;
            int num10 = -Player.tileRangeX - tileBoost + 1;
            int num11 = Player.tileRangeX + tileBoost - 1;
            int num12 = -Player.tileRangeY - tileBoost;
            int num13 = Player.tileRangeY + tileBoost - 1;
            int num14 = 12;
            bool flag = false;
            if ((double) vector2_13.X < (double) (num10 * 16 - num14))
              flag = true;
            if ((double) vector2_13.Y < (double) (num12 * 16 - num14))
              flag = true;
            if ((double) vector2_13.X > (double) (num11 * 16 + num14))
              flag = true;
            if ((double) vector2_13.Y > (double) (num13 * 16 + num14))
              flag = true;
            if (flag)
            {
              Vector2 vector2_14 = Vector2.Normalize(vector2_13);
              float num15 = -1f;
              if ((double) vector2_14.X < 0.0 && ((double) (num10 * 16 - num14) / (double) vector2_14.X < (double) num15 || (double) num15 == -1.0))
                num15 = (float) (num10 * 16 - num14) / vector2_14.X;
              if ((double) vector2_14.X > 0.0 && ((double) (num11 * 16 + num14) / (double) vector2_14.X < (double) num15 || (double) num15 == -1.0))
                num15 = (float) (num11 * 16 + num14) / vector2_14.X;
              if ((double) vector2_14.Y < 0.0 && ((double) (num12 * 16 - num14) / (double) vector2_14.Y < (double) num15 || (double) num15 == -1.0))
                num15 = (float) (num12 * 16 - num14) / vector2_14.Y;
              if ((double) vector2_14.Y > 0.0 && ((double) (num13 * 16 + num14) / (double) vector2_14.Y < (double) num15 || (double) num15 == -1.0))
                num15 = (float) (num13 * 16 + num14) / vector2_14.Y;
              vector2_13 = vector2_14 * num15;
            }
            if ((double) vector2_13.X != (double) this.velocity.X || (double) vector2_13.Y != (double) this.velocity.Y)
              this.netUpdate = true;
            this.velocity = vector2_13;
          }
        }
      }
      if (this.type == 460)
      {
        ++this.ai[0];
        int num16 = 0;
        if ((double) this.ai[0] >= 60.0)
          ++num16;
        if ((double) this.ai[0] >= 180.0)
          ++num16;
        bool flag1 = false;
        if ((double) this.ai[0] == 60.0 || (double) this.ai[0] == 180.0 || (double) this.ai[0] > 180.0 && (double) this.ai[0] % 20.0 == 0.0)
          flag1 = true;
        bool flag2 = (double) this.ai[0] >= 180.0;
        int num17 = 10;
        if (!flag2)
          ++this.ai[1];
        bool flag3 = false;
        if (flag2 && (double) this.ai[0] % 20.0 == 0.0)
          flag3 = true;
        if ((double) this.ai[1] >= (double) num17 && !flag2)
        {
          this.ai[1] = 0.0f;
          flag3 = true;
          if (!flag2)
          {
            float num18 = player.inventory[player.selectedItem].shootSpeed * this.scale;
            Vector2 vector2_15 = vector2_1;
            Vector2 vector2_16 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_15;
            if ((double) player.gravDir == -1.0)
              vector2_16.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_15.Y;
            Vector2 vector2_17 = Vector2.Normalize(vector2_16);
            if (float.IsNaN(vector2_17.X) || float.IsNaN(vector2_17.Y))
              vector2_17 = -Vector2.UnitY;
            Vector2 vector2_18 = vector2_17 * num18;
            if ((double) vector2_18.X != (double) this.velocity.X || (double) vector2_18.Y != (double) this.velocity.Y)
              this.netUpdate = true;
            this.velocity = vector2_18;
          }
        }
        if (this.soundDelay <= 0 && !flag2)
        {
          this.soundDelay = num17 - num16;
          this.soundDelay *= 2;
          if ((double) this.ai[0] != 1.0)
            Main.PlaySound(SoundID.Item15, this.position);
        }
        if ((double) this.ai[0] > 10.0 && !flag2)
        {
          Vector2 vector2_19 = this.Center + (Vector2.UnitX * 18f).RotatedBy((double) this.rotation - 1.57079637050629);
          for (int index3 = 0; index3 < num16 + 1; ++index3)
          {
            int Type = 226;
            float num19 = 0.4f;
            if (index3 % 2 == 1)
            {
              Type = 226;
              num19 = 0.65f;
            }
            Vector2 vector2_20 = vector2_19 + ((float) Main.rand.NextDouble() * 6.283185f).ToRotationVector2() * (12f - (float) (num16 * 2));
            int index4 = Dust.NewDust(vector2_20 - Vector2.One * 8f, 16, 16, Type, this.velocity.X / 2f, this.velocity.Y / 2f);
            Main.dust[index4].velocity = Vector2.Normalize(vector2_19 - vector2_20) * 1.5f * (float) (10.0 - (double) num16 * 2.0) / 10f;
            Main.dust[index4].noGravity = true;
            Main.dust[index4].scale = num19;
            Main.dust[index4].customData = (object) player;
          }
        }
        if (flag3 && Main.myPlayer == this.owner)
        {
          bool flag4 = !flag1 || player.CheckMana(player.inventory[player.selectedItem].mana, true);
          if ((!(player.channel & flag4) || player.noItems ? 0 : (!player.CCed ? 1 : 0)) != 0)
          {
            if ((double) this.ai[0] == 180.0)
            {
              Vector2 center = this.Center;
              Vector2 vector2_21 = Vector2.Normalize(this.velocity);
              if (float.IsNaN(vector2_21.X) || float.IsNaN(vector2_21.Y))
                vector2_21 = -Vector2.UnitY;
              int Damage = (int) ((double) this.damage * 3.0);
              this.ai[1] = (float) Projectile.NewProjectile(center.X, center.Y, vector2_21.X, vector2_21.Y, 461, Damage, this.knockBack, this.owner, ai1: ((float) this.whoAmI));
              this.netUpdate = true;
            }
            else if (flag2)
            {
              Projectile projectile = Main.projectile[(int) this.ai[1]];
              if (!projectile.active || projectile.type != 461)
              {
                this.Kill();
                return;
              }
            }
          }
          else
          {
            if (!flag2)
            {
              int Type = 459;
              float num20 = 10f;
              Vector2 center = this.Center;
              Vector2 vector2_22 = Vector2.Normalize(this.velocity) * num20;
              if (float.IsNaN(vector2_22.X) || float.IsNaN(vector2_22.Y))
                vector2_22 = -Vector2.UnitY;
              float ai1 = (float) (0.699999988079071 + (double) num16 * 0.300000011920929);
              int Damage = (double) ai1 < 1.0 ? this.damage : (int) ((double) this.damage * 2.0);
              Projectile.NewProjectile(center.X, center.Y, vector2_22.X, vector2_22.Y, Type, Damage, this.knockBack, this.owner, ai1: ai1);
            }
            this.Kill();
          }
        }
      }
      if (this.type == 633)
      {
        float num21 = 30f;
        if ((double) this.ai[0] > 90.0)
          num21 = 15f;
        if ((double) this.ai[0] > 120.0)
          num21 = 5f;
        this.damage = (int) ((double) player.inventory[player.selectedItem].damage * (double) player.magicDamage);
        ++this.ai[0];
        ++this.ai[1];
        bool flag5 = false;
        if ((double) this.ai[0] % (double) num21 == 0.0)
          flag5 = true;
        int num22 = 10;
        bool flag6 = false;
        if ((double) this.ai[0] % (double) num21 == 0.0)
          flag6 = true;
        if ((double) this.ai[1] >= 1.0)
        {
          this.ai[1] = 0.0f;
          flag6 = true;
          if (Main.myPlayer == this.owner)
          {
            float num23 = player.inventory[player.selectedItem].shootSpeed * this.scale;
            Vector2 vector2_23 = vector2_1;
            Vector2 vector2_24 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_23;
            if ((double) player.gravDir == -1.0)
              vector2_24.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_23.Y;
            Vector2 vector2_25 = Vector2.Normalize(vector2_24);
            if (float.IsNaN(vector2_25.X) || float.IsNaN(vector2_25.Y))
              vector2_25 = -Vector2.UnitY;
            Vector2 vector2_26 = Vector2.Normalize(Vector2.Lerp(vector2_25, Vector2.Normalize(this.velocity), 0.92f)) * num23;
            if ((double) vector2_26.X != (double) this.velocity.X || (double) vector2_26.Y != (double) this.velocity.Y)
              this.netUpdate = true;
            this.velocity = vector2_26;
          }
        }
        ++this.frameCounter;
        if (this.frameCounter >= ((double) this.ai[0] < 120.0 ? 4 : 1))
        {
          this.frameCounter = 0;
          if (++this.frame >= 5)
            this.frame = 0;
        }
        if (this.soundDelay <= 0)
        {
          this.soundDelay = num22;
          this.soundDelay *= 2;
          if ((double) this.ai[0] != 1.0)
            Main.PlaySound(SoundID.Item15, this.position);
        }
        if (flag6 && Main.myPlayer == this.owner)
        {
          bool flag7 = !flag5 || player.CheckMana(player.inventory[player.selectedItem].mana, true);
          if ((!(player.channel & flag7) || player.noItems ? 0 : (!player.CCed ? 1 : 0)) != 0)
          {
            if ((double) this.ai[0] == 1.0)
            {
              Vector2 center = this.Center;
              Vector2 vector2_27 = Vector2.Normalize(this.velocity);
              if (float.IsNaN(vector2_27.X) || float.IsNaN(vector2_27.Y))
                vector2_27 = -Vector2.UnitY;
              int damage = this.damage;
              for (int index = 0; index < 6; ++index)
                Projectile.NewProjectile(center.X, center.Y, vector2_27.X, vector2_27.Y, 632, damage, this.knockBack, this.owner, (float) index, (float) this.whoAmI);
              this.netUpdate = true;
            }
          }
          else
            this.Kill();
        }
      }
      if (this.type == 595)
      {
        num1 = 0.0f;
        if (this.spriteDirection == -1)
          num1 = 3.141593f;
        if (++this.frame >= Main.projFrames[this.type])
          this.frame = 0;
        --this.soundDelay;
        if (this.soundDelay <= 0)
        {
          Main.PlaySound(SoundID.Item1, this.Center);
          this.soundDelay = 12;
        }
        if (Main.myPlayer == this.owner)
        {
          if (player.channel && !player.noItems && !player.CCed)
          {
            float num24 = 1f;
            if (player.inventory[player.selectedItem].shoot == this.type)
              num24 = player.inventory[player.selectedItem].shootSpeed * this.scale;
            Vector2 vec = Main.MouseWorld - vector2_1;
            vec.Normalize();
            if (vec.HasNaNs())
              vec = Vector2.UnitX * (float) player.direction;
            vec *= num24;
            if ((double) vec.X != (double) this.velocity.X || (double) vec.Y != (double) this.velocity.Y)
              this.netUpdate = true;
            this.velocity = vec;
          }
          else
            this.Kill();
        }
        Vector2 position = this.Center + this.velocity * 3f;
        Lighting.AddLight(position, 0.8f, 0.8f, 0.8f);
        if (Main.rand.Next(3) == 0)
        {
          int index = Dust.NewDust(position - this.Size / 2f, this.width, this.height, 63, this.velocity.X, this.velocity.Y, 100, Scale: 2f);
          Main.dust[index].noGravity = true;
          Main.dust[index].position -= this.velocity;
        }
      }
      if (this.type == 600)
      {
        if ((double) this.ai[0] == 0.0)
        {
          if ((double) this.ai[1] != 0.0)
            Main.PlaySound(SoundID.Item114, this.position);
          else
            Main.PlaySound(SoundID.Item115, this.position);
        }
        ++this.ai[0];
        if (Main.myPlayer == this.owner && (double) this.ai[0] == 1.0)
        {
          float num25 = player.inventory[player.selectedItem].shootSpeed * this.scale;
          Vector2 vector2_28 = vector2_1;
          Vector2 vector2_29 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_28;
          if ((double) player.gravDir == -1.0)
            vector2_29.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_28.Y;
          Vector2 vector2_30 = Vector2.Normalize(vector2_29);
          if (float.IsNaN(vector2_30.X) || float.IsNaN(vector2_30.Y))
            vector2_30 = -Vector2.UnitY;
          Vector2 vector2_31 = vector2_30 * num25;
          if ((double) vector2_31.X != (double) this.velocity.X || (double) vector2_31.Y != (double) this.velocity.Y)
            this.netUpdate = true;
          this.velocity = vector2_31;
          int Type = 601;
          float num26 = 3f;
          Vector2 center = this.Center;
          Vector2 vector2_32 = Vector2.Normalize(this.velocity) * num26;
          if (float.IsNaN(vector2_32.X) || float.IsNaN(vector2_32.Y))
            vector2_32 = -Vector2.UnitY;
          Projectile.NewProjectile(center.X, center.Y, vector2_32.X, vector2_32.Y, Type, this.damage, this.knockBack, this.owner, this.ai[1]);
        }
        if ((double) this.ai[0] >= 30.0)
          this.Kill();
      }
      if (this.type == 611)
      {
        if ((double) this.localAI[1] > 0.0)
          --this.localAI[1];
        this.alpha -= 42;
        if (this.alpha < 0)
          this.alpha = 0;
        if ((double) this.localAI[0] == 0.0)
          this.localAI[0] = this.velocity.ToRotation();
        float num27 = (double) this.localAI[0].ToRotationVector2().X >= 0.0 ? 1f : -1f;
        if ((double) this.ai[1] <= 0.0)
          num27 *= -1f;
        Vector2 rotationVector2 = (num27 * (float) ((double) this.ai[0] / 30.0 * 6.28318548202515 - 1.57079637050629)).ToRotationVector2();
        rotationVector2.Y *= (float) Math.Sin((double) this.ai[1]);
        if ((double) this.ai[1] <= 0.0)
          rotationVector2.Y *= -1f;
        Vector2 vector2_33 = rotationVector2.RotatedBy((double) this.localAI[0]);
        ++this.ai[0];
        if ((double) this.ai[0] < 30.0)
          this.velocity = this.velocity + 48f * vector2_33;
        else
          this.Kill();
      }
      if (this.type == 615)
      {
        num1 = 0.0f;
        if (this.spriteDirection == -1)
          num1 = 3.141593f;
        ++this.ai[0];
        int num28 = 0;
        if ((double) this.ai[0] >= 40.0)
          ++num28;
        if ((double) this.ai[0] >= 80.0)
          ++num28;
        if ((double) this.ai[0] >= 120.0)
          ++num28;
        int num29 = 5;
        int num30 = 0;
        --this.ai[1];
        bool flag = false;
        int num31 = -1;
        if ((double) this.ai[1] <= 0.0)
        {
          this.ai[1] = (float) (num29 - num30 * num28);
          flag = true;
          if ((int) this.ai[0] / (num29 - num30 * num28) % 7 == 0)
            num31 = 0;
        }
        this.frameCounter += 1 + num28;
        if (this.frameCounter >= 4)
        {
          this.frameCounter = 0;
          ++this.frame;
          if (this.frame >= Main.projFrames[this.type])
            this.frame = 0;
        }
        if (this.soundDelay <= 0)
        {
          this.soundDelay = num29 - num30 * num28;
          if ((double) this.ai[0] != 1.0)
            Main.PlaySound(SoundID.Item36, this.position);
        }
        if (flag && Main.myPlayer == this.owner)
        {
          bool canShoot = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
          int shoot = 14;
          float speed = 14f;
          int weaponDamage = player.GetWeaponDamage(player.inventory[player.selectedItem]);
          float knockBack = player.inventory[player.selectedItem].knockBack;
          if (canShoot)
          {
            player.PickAmmo(player.inventory[player.selectedItem], ref shoot, ref speed, ref canShoot, ref weaponDamage, ref knockBack);
            float weaponKnockback = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack);
            float num32 = player.inventory[player.selectedItem].shootSpeed * this.scale;
            Vector2 vector2_34 = vector2_1;
            Vector2 vector2_35 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_34;
            if ((double) player.gravDir == -1.0)
              vector2_35.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_34.Y;
            Vector2 vector2_36 = Vector2.Normalize(vector2_35);
            if (float.IsNaN(vector2_36.X) || float.IsNaN(vector2_36.Y))
              vector2_36 = -Vector2.UnitY;
            Vector2 vector2_37 = (vector2_36 * num32).RotatedBy(Main.rand.NextDouble() * 0.130899697542191 - 0.0654498487710953);
            if ((double) vector2_37.X != (double) this.velocity.X || (double) vector2_37.Y != (double) this.velocity.Y)
              this.netUpdate = true;
            this.velocity = vector2_37;
            for (int index = 0; index < 1; ++index)
            {
              Vector2 vector2_38 = (Vector2.Normalize(this.velocity) * speed).RotatedBy(Main.rand.NextDouble() * 0.196349546313286 - 0.0981747731566429);
              if (float.IsNaN(vector2_38.X) || float.IsNaN(vector2_38.Y))
                vector2_38 = -Vector2.UnitY;
              Projectile.NewProjectile(vector2_34.X, vector2_34.Y, vector2_38.X, vector2_38.Y, shoot, weaponDamage, weaponKnockback, this.owner);
            }
            if (num31 == 0)
            {
              shoot = 616;
              float num33 = 8f;
              for (int index = 0; index < 1; ++index)
              {
                Vector2 vector2_39 = (Vector2.Normalize(this.velocity) * num33).RotatedBy(Main.rand.NextDouble() * 0.392699092626572 - 0.196349546313286);
                if (float.IsNaN(vector2_39.X) || float.IsNaN(vector2_39.Y))
                  vector2_39 = -Vector2.UnitY;
                Projectile.NewProjectile(vector2_34.X, vector2_34.Y, vector2_39.X, vector2_39.Y, shoot, weaponDamage + 20, weaponKnockback * 1.25f, this.owner);
              }
            }
          }
          else
            this.Kill();
        }
      }
      if (this.type == 630)
      {
        num1 = 0.0f;
        if (this.spriteDirection == -1)
          num1 = 3.141593f;
        ++this.ai[0];
        int num34 = 0;
        if ((double) this.ai[0] >= 40.0)
          ++num34;
        if ((double) this.ai[0] >= 80.0)
          ++num34;
        if ((double) this.ai[0] >= 120.0)
          ++num34;
        int num35 = 24;
        int num36 = 2;
        --this.ai[1];
        bool flag = false;
        if ((double) this.ai[1] <= 0.0)
        {
          this.ai[1] = (float) (num35 - num36 * num34);
          flag = true;
          int num37 = (int) this.ai[0] / (num35 - num36 * num34);
        }
        bool canShoot = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
        if ((double) this.localAI[0] > 0.0)
          --this.localAI[0];
        if (this.soundDelay <= 0 & canShoot)
        {
          this.soundDelay = num35 - num36 * num34;
          if ((double) this.ai[0] != 1.0)
            Main.PlaySound(SoundID.Item5, this.position);
          this.localAI[0] = 12f;
        }
        player.phantasmTime = 2;
        if (flag && Main.myPlayer == this.owner)
        {
          int shoot = 14;
          float speed = 14f;
          int weaponDamage = player.GetWeaponDamage(player.inventory[player.selectedItem]);
          float knockBack = player.inventory[player.selectedItem].knockBack;
          if (canShoot)
          {
            player.PickAmmo(player.inventory[player.selectedItem], ref shoot, ref speed, ref canShoot, ref weaponDamage, ref knockBack);
            float weaponKnockback = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack);
            float num38 = player.inventory[player.selectedItem].shootSpeed * this.scale;
            Vector2 vector2_40 = vector2_1;
            Vector2 vector2_41 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_40;
            if ((double) player.gravDir == -1.0)
              vector2_41.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_40.Y;
            Vector2 vector2_42 = Vector2.Normalize(vector2_41);
            if (float.IsNaN(vector2_42.X) || float.IsNaN(vector2_42.Y))
              vector2_42 = -Vector2.UnitY;
            Vector2 vector2_43 = vector2_42 * num38;
            if ((double) vector2_43.X != (double) this.velocity.X || (double) vector2_43.Y != (double) this.velocity.Y)
              this.netUpdate = true;
            this.velocity = vector2_43 * 0.55f;
            for (int index5 = 0; index5 < 4; ++index5)
            {
              Vector2 vector2_44 = Vector2.Normalize(this.velocity) * speed * (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.800000011920929);
              if (float.IsNaN(vector2_44.X) || float.IsNaN(vector2_44.Y))
                vector2_44 = -Vector2.UnitY;
              Vector2 vector2_45 = vector2_40 + Utils.RandomVector2(Main.rand, -15f, 15f);
              int index6 = Projectile.NewProjectile(vector2_45.X, vector2_45.Y, vector2_44.X, vector2_44.Y, shoot, weaponDamage, weaponKnockback, this.owner);
              Main.projectile[index6].noDropItem = true;
            }
          }
          else
            this.Kill();
        }
      }
      if (this.type == 705)
      {
        num1 = 0.0f;
        if (this.spriteDirection == -1)
          num1 = 3.141593f;
        ++this.ai[0];
        int itemAnimationMax = player.itemAnimationMax;
        --this.ai[1];
        bool flag = false;
        if ((double) this.ai[1] <= 0.0)
        {
          this.ai[1] = (float) itemAnimationMax;
          flag = true;
        }
        bool canShoot = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
        if ((double) this.localAI[0] > 0.0)
          --this.localAI[0];
        if (this.soundDelay <= 0 & canShoot)
        {
          this.soundDelay = itemAnimationMax;
          if ((double) this.ai[0] != 1.0)
            Main.PlaySound(SoundID.Item5, this.position);
          this.localAI[0] = 12f;
        }
        if (flag && Main.myPlayer == this.owner)
        {
          int shoot = 14;
          float speed = 12f;
          int weaponDamage = player.GetWeaponDamage(player.inventory[player.selectedItem]);
          float knockBack = player.inventory[player.selectedItem].knockBack;
          int num39 = 2;
          float max = 1.5f;
          if (canShoot)
          {
            player.PickAmmo(player.inventory[player.selectedItem], ref shoot, ref speed, ref canShoot, ref weaponDamage, ref knockBack);
            float weaponKnockback = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack);
            if (shoot == 1)
              shoot = 2;
            if (++player.phantomPhoneixCounter >= 4)
            {
              player.phantomPhoneixCounter = 0;
              num39 = 1;
              weaponDamage *= 2;
              max = 0.0f;
              this.ai[1] *= 1.5f;
              shoot = 706;
              speed = 16f;
            }
            float num40 = player.inventory[player.selectedItem].shootSpeed * this.scale;
            Vector2 vector2_46 = vector2_1;
            Vector2 vector2_47 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_46;
            if ((double) player.gravDir == -1.0)
              vector2_47.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_46.Y;
            Vector2 vector2_48 = Vector2.Normalize(vector2_47);
            if (float.IsNaN(vector2_48.X) || float.IsNaN(vector2_48.Y))
              vector2_48 = -Vector2.UnitY;
            Vector2 vector2_49 = vector2_48 * num40;
            if ((double) vector2_49.X != (double) this.velocity.X || (double) vector2_49.Y != (double) this.velocity.Y)
              this.netUpdate = true;
            this.velocity = vector2_49 * 0.55f;
            for (int index7 = 0; index7 < num39; ++index7)
            {
              Vector2 vector2_50 = Vector2.Normalize(this.velocity) * speed + Main.rand.NextVector2Square(-max, max);
              if (float.IsNaN(vector2_50.X) || float.IsNaN(vector2_50.Y))
                vector2_50 = -Vector2.UnitY;
              Vector2 vector2_51 = vector2_46;
              int index8 = Projectile.NewProjectile(vector2_51.X, vector2_51.Y, vector2_50.X, vector2_50.Y, shoot, weaponDamage, weaponKnockback, this.owner);
              Main.projectile[index8].noDropItem = true;
            }
          }
          else
            this.Kill();
        }
      }
      this.position = player.RotatedRelativePoint(player.MountedCenter) - this.Size / 2f;
      this.rotation = this.velocity.ToRotation() + num1;
      this.spriteDirection = this.direction;
      this.timeLeft = 2;
      player.ChangeDir(this.direction);
      player.heldProj = this.whoAmI;
      player.itemTime = 2;
      player.itemAnimation = 2;
      player.itemRotation = (float) Math.Atan2((double) this.velocity.Y * (double) this.direction, (double) this.velocity.X * (double) this.direction);
      if (this.type == 460 || this.type == 611)
      {
        Vector2 vector2_52 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f;
        if (player.direction != 1)
          vector2_52.X = (float) player.bodyFrame.Width - vector2_52.X;
        if ((double) player.gravDir != 1.0)
          vector2_52.Y = (float) player.bodyFrame.Height - vector2_52.Y;
        Vector2 vector2_53 = vector2_52 - new Vector2((float) (player.bodyFrame.Width - player.width), (float) (player.bodyFrame.Height - 42)) / 2f;
        this.Center = player.RotatedRelativePoint(player.position + vector2_53) - this.velocity;
      }
      if (this.type == 615)
        this.position.Y += player.gravDir * 2f;
      if (this.type != 611 || this.alpha != 0)
        return;
      for (int index = 0; index < 2; ++index)
      {
        Dust dust = Main.dust[Dust.NewDust(this.position + this.velocity * 2f, this.width, this.height, 6, Alpha: 100, newColor: Color.Transparent, Scale: 2f)];
        dust.noGravity = true;
        dust.velocity *= 2f;
        dust.velocity += this.localAI[0].ToRotationVector2();
        dust.fadeIn = 1.5f;
      }
      float num41 = 18f;
      for (int index = 0; (double) index < (double) num41; ++index)
      {
        if (Main.rand.Next(4) == 0)
        {
          Vector2 Position = this.position + this.velocity + this.velocity * ((float) index / num41);
          Dust dust = Main.dust[Dust.NewDust(Position, this.width, this.height, 6, Alpha: 100, newColor: Color.Transparent)];
          dust.noGravity = true;
          dust.fadeIn = 0.5f;
          dust.velocity += this.localAI[0].ToRotationVector2();
          dust.noLight = true;
        }
      }
    }

    private void AI_099_1()
    {
      this.timeLeft = 6;
      bool flag1 = true;
      float num1 = 250f;
      float num2 = 0.1f;
      float num3 = 15f;
      float num4 = 12f;
      float num5 = num1 * 0.5f;
      float num6 = num3 * 0.8f;
      float num7 = num4 * 1.5f;
      if (this.owner == Main.myPlayer)
      {
        bool flag2 = false;
        for (int index = 0; index < 1000; ++index)
        {
          if (Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].aiStyle == 99 && (Main.projectile[index].type < 556 || Main.projectile[index].type > 561))
            flag2 = true;
        }
        if (!flag2)
        {
          this.ai[0] = -1f;
          this.netUpdate = true;
        }
      }
      if (Main.player[this.owner].yoyoString)
        num5 += (float) ((double) num5 * 0.25 + 10.0);
      this.rotation += 0.5f;
      if (Main.player[this.owner].dead)
      {
        this.Kill();
      }
      else
      {
        if (!flag1)
        {
          Main.player[this.owner].heldProj = this.whoAmI;
          Main.player[this.owner].itemAnimation = 2;
          Main.player[this.owner].itemTime = 2;
          if ((double) this.position.X + (double) (this.width / 2) > (double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2))
          {
            Main.player[this.owner].ChangeDir(1);
            this.direction = 1;
          }
          else
          {
            Main.player[this.owner].ChangeDir(-1);
            this.direction = -1;
          }
        }
        if ((double) this.ai[0] == 0.0 || (double) this.ai[0] == 1.0)
        {
          if ((double) this.ai[0] == 1.0)
            num5 *= 0.75f;
          float num8 = num7 * 0.5f;
          bool flag3 = false;
          Vector2 vector2_1 = Main.player[this.owner].Center - this.Center;
          if ((double) vector2_1.Length() > (double) num5 * 0.9)
            flag3 = true;
          if ((double) vector2_1.Length() > (double) num5)
          {
            float num9 = vector2_1.Length() - num5;
            Vector2 vector2_2;
            vector2_2.X = vector2_1.Y;
            vector2_2.Y = vector2_1.X;
            vector2_1.Normalize();
            Vector2 vector2_3 = vector2_1 * num5;
            this.position = Main.player[this.owner].Center - vector2_3;
            this.position.X -= (float) (this.width / 2);
            this.position.Y -= (float) (this.height / 2);
            float num10 = this.velocity.Length();
            this.velocity.Normalize();
            if ((double) num9 > (double) num10 - 1.0)
              num9 = num10 - 1f;
            this.velocity = this.velocity * (num10 - num9);
            this.velocity.Length();
            Vector2 vector2_4 = new Vector2(this.Center.X, this.Center.Y);
            Vector2 vector2_5 = new Vector2(Main.player[this.owner].Center.X, Main.player[this.owner].Center.Y);
            if ((double) vector2_4.Y < (double) vector2_5.Y)
              vector2_2.Y = Math.Abs(vector2_2.Y);
            else if ((double) vector2_4.Y > (double) vector2_5.Y)
              vector2_2.Y = -Math.Abs(vector2_2.Y);
            if ((double) vector2_4.X < (double) vector2_5.X)
              vector2_2.X = Math.Abs(vector2_2.X);
            else if ((double) vector2_4.X > (double) vector2_5.X)
              vector2_2.X = -Math.Abs(vector2_2.X);
            vector2_2.Normalize();
            Vector2 vector2_6 = vector2_2 * this.velocity.Length();
            Vector2 vector2_7 = new Vector2(vector2_6.X, vector2_6.Y);
            if ((double) Math.Abs(this.velocity.X) > (double) Math.Abs(this.velocity.Y))
            {
              Vector2 velocity = this.velocity;
              velocity.Y += vector2_6.Y;
              velocity.Normalize();
              Vector2 vector2_8 = velocity * this.velocity.Length();
              if ((double) Math.Abs(vector2_6.X) < 0.1 || (double) Math.Abs(vector2_6.Y) < 0.1)
                this.velocity = vector2_8;
              else
                this.velocity = (vector2_8 + this.velocity * 2f) / 3f;
            }
            else
            {
              Vector2 velocity = this.velocity;
              velocity.X += vector2_6.X;
              velocity.Normalize();
              Vector2 vector2_9 = velocity * this.velocity.Length();
              if ((double) Math.Abs(vector2_6.X) < 0.2 || (double) Math.Abs(vector2_6.Y) < 0.2)
                this.velocity = vector2_9;
              else
                this.velocity = (vector2_9 + this.velocity * 2f) / 3f;
            }
          }
          if (Main.myPlayer == this.owner)
          {
            if (Main.player[this.owner].channel)
            {
              Vector2 vector2_10 = new Vector2((float) (Main.mouseX - Main.lastMouseX), (float) (Main.mouseY - Main.lastMouseY));
              if ((double) this.velocity.X != 0.0 || (double) this.velocity.Y != 0.0)
              {
                if (flag1)
                  vector2_10 *= -1f;
                if (flag3)
                {
                  if ((double) this.Center.X < (double) Main.player[this.owner].Center.X && (double) vector2_10.X < 0.0)
                    vector2_10.X = 0.0f;
                  if ((double) this.Center.X > (double) Main.player[this.owner].Center.X && (double) vector2_10.X > 0.0)
                    vector2_10.X = 0.0f;
                  if ((double) this.Center.Y < (double) Main.player[this.owner].Center.Y && (double) vector2_10.Y < 0.0)
                    vector2_10.Y = 0.0f;
                  if ((double) this.Center.Y > (double) Main.player[this.owner].Center.Y && (double) vector2_10.Y > 0.0)
                    vector2_10.Y = 0.0f;
                }
                this.velocity = this.velocity + vector2_10 * num2;
                this.netUpdate = true;
              }
            }
            else
            {
              this.ai[0] = 10f;
              this.netUpdate = true;
            }
          }
          if (flag1 || this.type == 562 || this.type == 547 || this.type == 555 || this.type == 564 || this.type == 552 || this.type == 563 || this.type == 549 || this.type == 550 || this.type == 554 || this.type == 553 || this.type == 603)
          {
            float num11 = 800f;
            Vector2 vector2_11 = new Vector2();
            bool flag4 = false;
            if (this.type == 549)
              num11 = 200f;
            if (this.type == 554)
              num11 = 400f;
            if (this.type == 553)
              num11 = 250f;
            if (this.type == 603)
              num11 = 320f;
            for (int index = 0; index < 200; ++index)
            {
              if (Main.npc[index].CanBeChasedBy((object) this))
              {
                float num12 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
                float num13 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
                float num14 = Math.Abs(this.position.X + (float) (this.width / 2) - num12) + Math.Abs(this.position.Y + (float) (this.height / 2) - num13);
                if ((double) num14 < (double) num11 && (this.type != 563 || (double) num14 >= 200.0) && Collision.CanHit(this.position, this.width, this.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && (double) (Main.npc[index].Center - Main.player[this.owner].Center).Length() < (double) num5 * 0.9)
                {
                  num11 = num14;
                  vector2_11.X = num12;
                  vector2_11.Y = num13;
                  flag4 = true;
                }
              }
            }
            if (flag4)
            {
              vector2_11 -= this.Center;
              vector2_11.Normalize();
              if (this.type == 563)
              {
                vector2_11 *= 4f;
                this.velocity = (this.velocity * 14f + vector2_11) / 15f;
              }
              else if (this.type == 553)
              {
                vector2_11 *= 5f;
                this.velocity = (this.velocity * 12f + vector2_11) / 13f;
              }
              else if (this.type == 603)
              {
                vector2_11 *= 16f;
                this.velocity = (this.velocity * 9f + vector2_11) / 10f;
              }
              else if (this.type == 554)
              {
                vector2_11 *= 8f;
                this.velocity = (this.velocity * 6f + vector2_11) / 7f;
              }
              else
              {
                vector2_11 *= 6f;
                this.velocity = (this.velocity * 7f + vector2_11) / 8f;
              }
            }
          }
          if ((double) this.velocity.Length() > (double) num6)
          {
            this.velocity.Normalize();
            this.velocity = this.velocity * num6;
          }
          if ((double) this.velocity.Length() >= (double) num8)
            return;
          this.velocity.Normalize();
          this.velocity = this.velocity * num8;
        }
        else
        {
          this.tileCollide = false;
          Vector2 vec = Main.player[this.owner].Center - this.Center;
          if ((double) vec.Length() < 40.0 || vec.HasNaNs())
          {
            this.Kill();
          }
          else
          {
            float num15 = num6 * 1.5f;
            if (this.type == 546)
              num15 *= 1.5f;
            if (this.type == 554)
              num15 *= 1.25f;
            if (this.type == 555)
              num15 *= 1.35f;
            if (this.type == 562)
              num15 *= 1.25f;
            float num16 = 12f;
            vec.Normalize();
            vec *= num15;
            this.velocity = (this.velocity * (num16 - 1f) + vec) / num16;
          }
        }
      }
    }

    private void AI_099_2()
    {
      bool flag1 = false;
      for (int index = 0; index < this.whoAmI; ++index)
      {
        if (Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == this.type)
          flag1 = true;
      }
      if (this.owner == Main.myPlayer)
      {
        ++this.localAI[0];
        if (flag1)
          this.localAI[0] += (float) Main.rand.Next(10, 31) * 0.1f;
        float num1 = this.localAI[0] / 60f / (float) ((1.0 + (double) Main.player[this.owner].meleeSpeed) / 2.0);
        float num2 = ProjectileID.Sets.YoyosLifeTimeMultiplier[this.type];
        if ((double) num2 != -1.0 && (double) num1 > (double) num2)
          this.ai[0] = -1f;
      }
      if (this.type == 603 && this.owner == Main.myPlayer)
      {
        ++this.localAI[1];
        if ((double) this.localAI[1] >= 6.0)
        {
          float num3 = 400f;
          Vector2 velocity = this.velocity;
          Vector2 vector2_1 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
          vector2_1.Normalize();
          Vector2 vector2_2 = vector2_1 * ((float) Main.rand.Next(10, 41) * 0.1f);
          if (Main.rand.Next(3) == 0)
            vector2_2 *= 2f;
          Vector2 vector2_3 = velocity * 0.25f + vector2_2;
          for (int index = 0; index < 200; ++index)
          {
            if (Main.npc[index].CanBeChasedBy((object) this))
            {
              float num4 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
              float num5 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
              float num6 = Math.Abs(this.position.X + (float) (this.width / 2) - num4) + Math.Abs(this.position.Y + (float) (this.height / 2) - num5);
              if ((double) num6 < (double) num3 && Collision.CanHit(this.position, this.width, this.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
              {
                num3 = num6;
                vector2_3.X = num4;
                vector2_3.Y = num5;
                Vector2 vector2_4 = vector2_3 - this.Center;
                vector2_4.Normalize();
                vector2_3 = vector2_4 * 8f;
              }
            }
          }
          Vector2 vector2_5 = vector2_3 * 0.8f;
          Projectile.NewProjectile(this.Center.X - vector2_5.X, this.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, 604, this.damage, this.knockBack, this.owner);
          this.localAI[1] = 0.0f;
        }
      }
      bool flag2 = false;
      if (this.type >= 556 && this.type <= 561)
        flag2 = true;
      if (Main.player[this.owner].dead)
      {
        this.Kill();
      }
      else
      {
        if (!flag2 && !flag1)
        {
          Main.player[this.owner].heldProj = this.whoAmI;
          Main.player[this.owner].itemAnimation = 2;
          Main.player[this.owner].itemTime = 2;
          if ((double) this.position.X + (double) (this.width / 2) > (double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2))
          {
            Main.player[this.owner].ChangeDir(1);
            this.direction = 1;
          }
          else
          {
            Main.player[this.owner].ChangeDir(-1);
            this.direction = -1;
          }
        }
        if (this.velocity.HasNaNs())
          this.Kill();
        this.timeLeft = 6;
        float num7 = ProjectileID.Sets.YoyosMaximumRange[this.type];
        float num8 = ProjectileID.Sets.YoyosTopSpeed[this.type];
        if (this.type == 545)
        {
          if (Main.rand.Next(6) == 0)
          {
            int index = Dust.NewDust(this.position, this.width, this.height, 6);
            Main.dust[index].noGravity = true;
          }
        }
        else if (this.type == 553 && Main.rand.Next(2) == 0)
        {
          int index = Dust.NewDust(this.position, this.width, this.height, 6);
          Main.dust[index].noGravity = true;
          Main.dust[index].scale = 1.6f;
        }
        if (Main.player[this.owner].yoyoString)
          num7 = (float) ((double) num7 * 1.25 + 30.0);
        float num9 = num7 / (float) ((1.0 + (double) Main.player[this.owner].meleeSpeed * 3.0) / 4.0);
        float num10 = num8 / (float) ((1.0 + (double) Main.player[this.owner].meleeSpeed * 3.0) / 4.0);
        float num11 = (float) (14.0 - (double) num10 / 2.0);
        float num12 = (float) (5.0 + (double) num10 / 2.0);
        if (flag1)
          num12 += 20f;
        if ((double) this.ai[0] >= 0.0)
        {
          if ((double) this.velocity.Length() > (double) num10)
            this.velocity = this.velocity * 0.98f;
          bool flag3 = false;
          bool flag4 = false;
          Vector2 vector2_6 = Main.player[this.owner].Center - this.Center;
          if ((double) vector2_6.Length() > (double) num9)
          {
            flag3 = true;
            if ((double) vector2_6.Length() > (double) num9 * 1.3)
              flag4 = true;
          }
          if (this.owner == Main.myPlayer)
          {
            if (!Main.player[this.owner].channel || Main.player[this.owner].stoned || Main.player[this.owner].frozen)
            {
              this.ai[0] = -1f;
              this.ai[1] = 0.0f;
              this.netUpdate = true;
            }
            else
            {
              Vector2 vector2_7 = Main.ReverseGravitySupport(Main.MouseScreen) + Main.screenPosition;
              float x = vector2_7.X;
              float y = vector2_7.Y;
              Vector2 vector2_8 = new Vector2(x, y) - Main.player[this.owner].Center;
              if ((double) vector2_8.Length() > (double) num9)
              {
                vector2_8.Normalize();
                Vector2 vector2_9 = vector2_8 * num9;
                Vector2 vector2_10 = Main.player[this.owner].Center + vector2_9;
                x = vector2_10.X;
                y = vector2_10.Y;
              }
              if ((double) this.ai[0] != (double) x || (double) this.ai[1] != (double) y)
              {
                Vector2 vector2_11 = new Vector2(x, y) - Main.player[this.owner].Center;
                if ((double) vector2_11.Length() > (double) num9 - 1.0)
                {
                  vector2_11.Normalize();
                  vector2_11 *= num9 - 1f;
                  Vector2 vector2_12 = Main.player[this.owner].Center + vector2_11;
                  x = vector2_12.X;
                  y = vector2_12.Y;
                }
                this.ai[0] = x;
                this.ai[1] = y;
                this.netUpdate = true;
              }
            }
          }
          if (flag4 && this.owner == Main.myPlayer)
          {
            this.ai[0] = -1f;
            this.netUpdate = true;
          }
          if ((double) this.ai[0] >= 0.0)
          {
            if (flag3)
            {
              num11 /= 2f;
              num10 *= 2f;
              if ((double) this.Center.X > (double) Main.player[this.owner].Center.X && (double) this.velocity.X > 0.0)
                this.velocity.X *= 0.5f;
              if ((double) this.Center.Y > (double) Main.player[this.owner].Center.Y && (double) this.velocity.Y > 0.0)
                this.velocity.Y *= 0.5f;
              if ((double) this.Center.X < (double) Main.player[this.owner].Center.X && (double) this.velocity.X > 0.0)
                this.velocity.X *= 0.5f;
              if ((double) this.Center.Y < (double) Main.player[this.owner].Center.Y && (double) this.velocity.Y > 0.0)
                this.velocity.Y *= 0.5f;
            }
            Vector2 vector2_13 = new Vector2(this.ai[0], this.ai[1]) - this.Center;
            double num13 = (double) this.velocity.Length();
            float num14 = vector2_13.Length();
            if ((double) num14 > (double) num12)
            {
              vector2_13.Normalize();
              float num15 = (double) num14 > (double) num10 * 2.0 ? num10 : num14 / 2f;
              vector2_13 *= num15;
              this.velocity = (this.velocity * (num11 - 1f) + vector2_13) / num11;
            }
            else if (flag1)
            {
              if ((double) this.velocity.Length() < (double) num10 * 0.6)
              {
                vector2_13 = this.velocity;
                vector2_13.Normalize();
                vector2_13 *= num10 * 0.6f;
                this.velocity = (this.velocity * (num11 - 1f) + vector2_13) / num11;
              }
            }
            else
              this.velocity = this.velocity * 0.8f;
            if (flag1 && !flag3 && (double) this.velocity.Length() < (double) num10 * 0.6)
            {
              this.velocity.Normalize();
              this.velocity = this.velocity * (num10 * 0.6f);
            }
          }
        }
        else
        {
          float num16 = (float) (int) ((double) num11 * 0.8);
          float num17 = num10 * 1.5f;
          this.tileCollide = false;
          Vector2 vector2 = Main.player[this.owner].position - this.Center;
          float num18 = vector2.Length();
          if ((double) num18 < (double) num17 + 10.0 || (double) num18 == 0.0)
          {
            this.Kill();
          }
          else
          {
            vector2.Normalize();
            vector2 *= num17;
            this.velocity = (this.velocity * (num16 - 1f) + vector2) / num16;
          }
        }
        this.rotation += 0.45f;
      }
    }

    private void AI_130_FlameBurstTower()
    {
      float shot_range = 900f;
      float angleRatioMax = 1f;
      Vector2 vector2_1 = this.Center;
      int Type = 664;
      int num1 = 12;
      float num2 = 12f;
      int num3 = 1;
      int num4 = 6;
      int num5 = 4;
      int num6 = 80;
      switch (this.type)
      {
        case 663:
          Lighting.AddLight(this.Center, new Vector3(0.4f, 0.2f, 0.1f));
          Lighting.AddLight(this.Bottom + new Vector2(0.0f, -10f), new Vector3(0.4f, 0.2f, 0.1f));
          vector2_1 = this.Bottom + new Vector2((float) (this.direction * 6), -40f);
          if ((double) ++this.localAI[0] >= 300.0)
            this.localAI[0] = 0.0f;
          Microsoft.Xna.Framework.Rectangle r1 = new Microsoft.Xna.Framework.Rectangle((int) this.position.X + this.width / 4, (int) this.position.Y + this.height - 16, this.width / 4 * 3, 6);
          if (this.direction == 1)
            r1.X -= this.width / 4;
          for (int index = 0; index < 1; ++index)
          {
            if (Main.rand.Next(2) == 0)
            {
              Dust dust = Dust.NewDustDirect(r1.TopLeft() + new Vector2(-2f, -2f), r1.Width + 4, r1.Height + 4, 270, (float) (-this.direction * 2), -2f, 200, new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0));
              dust.fadeIn = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.600000023841858);
              dust.scale = 0.4f;
              dust.noGravity = true;
              dust.noLight = true;
              dust.velocity = Vector2.Zero;
              dust.velocity.X = (float) -this.direction * Main.rand.NextFloat() * dust.fadeIn;
            }
          }
          r1 = new Microsoft.Xna.Framework.Rectangle((int) this.Center.X, (int) this.Bottom.Y, this.width / 4, 10);
          if (this.direction == -1)
            r1.X -= r1.Width;
          r1.X += this.direction * 4;
          r1.Y -= this.height - 10;
          for (int index = 0; index < 1; ++index)
          {
            if (Main.rand.Next(5) == 0)
            {
              Dust dust = Dust.NewDustDirect(r1.TopLeft(), r1.Width, r1.Height, 6);
              dust.fadeIn = 1f;
              dust.scale = 1f;
              dust.noGravity = true;
              dust.noLight = true;
              dust.velocity *= 2f;
            }
          }
          break;
        case 665:
          Lighting.AddLight(this.Center, new Vector3(0.4f, 0.2f, 0.1f) * 1.2f);
          Lighting.AddLight(this.Bottom + new Vector2(0.0f, -10f), new Vector3(0.4f, 0.2f, 0.1f) * 1.2f);
          num6 = 70;
          num2 += 3f;
          num4 = 8;
          Type = 666;
          vector2_1 = this.Bottom + new Vector2((float) (this.direction * 6), -44f);
          if ((double) ++this.localAI[0] >= 300.0)
            this.localAI[0] = 0.0f;
          Microsoft.Xna.Framework.Rectangle r2 = new Microsoft.Xna.Framework.Rectangle((int) this.position.X + this.width / 4, (int) this.position.Y + this.height - 16, this.width / 4 * 2, 6);
          if (this.direction == 1)
            r2.X -= this.width / 4;
          for (int index = 0; index < 1; ++index)
          {
            if (Main.rand.Next(2) == 0)
            {
              Dust dust = Dust.NewDustDirect(r2.TopLeft() + new Vector2(-2f, -2f), r2.Width + 4, r2.Height + 4, 270, (float) (-this.direction * 2), -2f, 200, new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0));
              dust.fadeIn = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.600000023841858);
              dust.scale = 0.4f;
              dust.noGravity = true;
              dust.noLight = true;
              dust.velocity = Vector2.Zero;
              dust.velocity.X = (float) -this.direction * Main.rand.NextFloat() * dust.fadeIn;
            }
          }
          r2 = new Microsoft.Xna.Framework.Rectangle((int) this.Center.X, (int) this.Bottom.Y, this.width / 4, 10);
          if (this.direction == -1)
            r2.X -= r2.Width;
          r2.X += this.direction * 4;
          r2.Y -= this.height - 10;
          for (int index = 0; index < 2; ++index)
          {
            if (Main.rand.Next(5) == 0)
            {
              Dust dust = Dust.NewDustDirect(r2.TopLeft(), r2.Width, r2.Height, 6);
              dust.fadeIn = 1f;
              dust.scale = 1f;
              dust.noGravity = true;
              dust.noLight = true;
              dust.velocity *= 2f;
            }
          }
          break;
        case 667:
          Lighting.AddLight(this.Center, new Vector3(0.4f, 0.2f, 0.1f) * 1.5f);
          Lighting.AddLight(this.Bottom + new Vector2(0.0f, -10f), new Vector3(0.4f, 0.2f, 0.1f) * 1.5f);
          num6 = 60;
          num2 += 6f;
          num4 = 8;
          Type = 668;
          vector2_1 = this.Bottom + new Vector2((float) (this.direction * 6), -46f);
          if ((double) ++this.localAI[0] >= 300.0)
            this.localAI[0] = 0.0f;
          Microsoft.Xna.Framework.Rectangle r3 = new Microsoft.Xna.Framework.Rectangle((int) this.position.X + this.width / 4, (int) this.position.Y + this.height - 16, this.width / 4 * 2, 6);
          if (this.direction == 1)
            r3.X -= this.width / 4;
          for (int index = 0; index < 1; ++index)
          {
            if (Main.rand.Next(2) == 0)
            {
              Dust dust = Dust.NewDustDirect(r3.TopLeft() + new Vector2(-2f, -2f), r3.Width + 4, r3.Height + 4, 270, (float) (-this.direction * 2), -2f, 200, new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0));
              dust.fadeIn = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.600000023841858);
              dust.scale = 0.4f;
              dust.noGravity = true;
              dust.noLight = true;
              dust.velocity = Vector2.Zero;
              dust.velocity.X = (float) -this.direction * Main.rand.NextFloat() * dust.fadeIn;
            }
          }
          r3 = new Microsoft.Xna.Framework.Rectangle((int) this.Center.X, (int) this.Bottom.Y, this.width / 4, 10);
          if (this.direction == -1)
            r3.X -= r3.Width;
          r3.X += this.direction * 4;
          r3.Y -= this.height - 10;
          for (int index = 0; index < 3; ++index)
          {
            if (Main.rand.Next(5) == 0)
            {
              Dust dust = Dust.NewDustDirect(r3.TopLeft(), r3.Width, r3.Height, 6);
              dust.fadeIn = 1.1f;
              dust.scale = 1f;
              dust.noGravity = true;
              dust.noLight = true;
              dust.velocity *= 2.4f;
            }
          }
          break;
      }
      if (Main.player[this.owner].setApprenticeT2)
      {
        angleRatioMax = 0.1f;
        shot_range *= 1.5f;
        num2 *= 1.4f;
      }
      if ((double) this.ai[0] == 0.0)
      {
        this.direction = this.spriteDirection = Main.player[this.owner].direction;
        this.ai[0] = 1f;
        this.ai[1] = 0.0f;
        this.netUpdate = true;
      }
      if ((double) this.ai[0] == 1.0)
      {
        this.frame = 0;
        bool flag = false;
        if ((double) this.ai[1] > 0.0)
          --this.ai[1];
        else
          flag = true;
        if (flag && this.owner == Main.myPlayer)
        {
          int target = this.AI_130_FlameBurstTower_FindTarget(shot_range, angleRatioMax, vector2_1);
          if (target != -1)
          {
            this.direction = Math.Sign(this.DirectionTo(Main.npc[target].Center).X);
            this.ai[0] = 2f;
            this.ai[1] = 0.0f;
            this.netUpdate = true;
          }
        }
      }
      else if ((double) this.ai[0] == 2.0)
      {
        this.frame = num3 + (int) ((double) this.ai[1] / (double) num5);
        if ((double) this.ai[1] == (double) num1)
        {
          Vector2 vector2_2 = new Vector2((float) this.direction, 0.0f);
          int target = this.AI_130_FlameBurstTower_FindTarget(shot_range, angleRatioMax, vector2_1, false);
          if (target != -1)
            vector2_2 = (Main.npc[target].Center - vector2_1).SafeNormalize(Vector2.UnitX * (float) this.direction);
          Vector2 velocity = vector2_2 * num2;
          if (this.owner == Main.myPlayer)
            Projectile.NewProjectile(vector2_1, velocity, Type, this.damage, this.knockBack, this.owner);
        }
        if ((double) ++this.ai[1] >= (double) (num4 * num5))
        {
          this.ai[0] = 1f;
          this.ai[1] = (float) num6;
        }
      }
      this.spriteDirection = this.direction;
      this.tileCollide = true;
      this.velocity.Y += 0.2f;
    }

    private int AI_130_FlameBurstTower_FindTarget(
      float shot_range,
      float angleRatioMax,
      Vector2 shootingSpot,
      bool canChangeDirection = true)
    {
      int index1 = -1;
      NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
      if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this))
      {
        for (int index2 = 0; index2 < 1; ++index2)
        {
          if (minionAttackTargetNpc.CanBeChasedBy((object) this))
          {
            float num = Vector2.Distance(shootingSpot, minionAttackTargetNpc.Center);
            if ((double) num <= (double) shot_range)
            {
              Vector2 vector2 = (minionAttackTargetNpc.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
              if ((double) Math.Abs(vector2.X) >= (double) Math.Abs(vector2.Y) * (double) angleRatioMax && (canChangeDirection || (double) this.direction * (double) vector2.X >= 0.0) && (index1 == -1 || (double) num < (double) Vector2.Distance(shootingSpot, Main.npc[index1].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, minionAttackTargetNpc.Center, 0, 0))
                index1 = minionAttackTargetNpc.whoAmI;
            }
          }
        }
        if (index1 != -1)
          return index1;
      }
      for (int index3 = 0; index3 < 200; ++index3)
      {
        NPC npc = Main.npc[index3];
        if (npc.CanBeChasedBy((object) this))
        {
          float num = Vector2.Distance(shootingSpot, npc.Center);
          if ((double) num <= (double) shot_range)
          {
            Vector2 vector2 = (npc.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
            if ((double) Math.Abs(vector2.X) >= (double) Math.Abs(vector2.Y) * (double) angleRatioMax && (canChangeDirection || (double) this.direction * (double) vector2.X >= 0.0) && (index1 == -1 || (double) num < (double) Vector2.Distance(shootingSpot, Main.npc[index1].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, npc.Center, 0, 0))
              index1 = index3;
          }
        }
      }
      return index1;
    }

    private int AI_134_Ballista_FindTarget(
      float shot_range,
      float deadBottomAngle,
      Vector2 shootingSpot)
    {
      int index1 = -1;
      NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
      if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this))
      {
        for (int index2 = 0; index2 < 1; ++index2)
        {
          if (minionAttackTargetNpc.CanBeChasedBy((object) this, true))
          {
            float num = Vector2.Distance(shootingSpot, minionAttackTargetNpc.Center);
            if ((double) num <= (double) shot_range)
            {
              Vector2 vector2 = (minionAttackTargetNpc.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
              if (((double) Math.Abs(vector2.X) >= (double) Math.Abs(vector2.Y) * (double) deadBottomAngle || (double) vector2.Y <= 0.0) && (index1 == -1 || (double) num < (double) Vector2.Distance(shootingSpot, Main.npc[index1].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, minionAttackTargetNpc.Center, 0, 0))
                index1 = minionAttackTargetNpc.whoAmI;
            }
          }
        }
        if (index1 != -1)
          return index1;
      }
      for (int index3 = 0; index3 < 200; ++index3)
      {
        NPC npc = Main.npc[index3];
        if (npc.CanBeChasedBy((object) this, true))
        {
          float num = Vector2.Distance(shootingSpot, npc.Center);
          if ((double) num <= (double) shot_range)
          {
            Vector2 vector2 = (npc.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
            if (((double) Math.Abs(vector2.X) >= (double) Math.Abs(vector2.Y) * (double) deadBottomAngle || (double) vector2.Y <= 0.0) && (index1 == -1 || (double) num < (double) Vector2.Distance(shootingSpot, Main.npc[index1].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, npc.Center, 0, 0))
              index1 = index3;
          }
        }
      }
      return index1;
    }

    private void AI_131_FlameBurstShot()
    {
      if (this.type != 664 && this.type != 666 && this.type != 668)
        return;
      if ((double) this.localAI[0] == 0.0)
      {
        this.localAI[0] = 1f;
        Main.PlayTrackedSound((SoundStyle) SoundID.DD2_FlameburstTowerShot, this.Center);
      }
      if (this.alpha > 0)
      {
        this.alpha -= 25;
        if (this.alpha < 0)
          this.alpha = 0;
      }
      int num = 1;
      if (this.type == 666)
        num = 2;
      if (this.type == 668)
        num = 3;
      for (int index = 0; index < num; ++index)
      {
        if (Main.rand.Next(2) != 0)
        {
          Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 2f);
          dust.noGravity = true;
          dust.velocity *= 0.3f;
          if (Main.rand.Next(1) == 0)
          {
            dust.velocity.Y += (float) Math.Sign(dust.velocity.Y) * 1.2f;
            dust.fadeIn += 0.5f;
          }
        }
      }
      this.rotation = this.velocity.ToRotation() + 1.570796f;
    }

    private void AI_134_Ballista()
    {
      float shot_range = 900f;
      float deadBottomAngle = 0.75f;
      Vector2 center = this.Center;
      int Type = 680;
      float num1 = 16f;
      int num2 = 1;
      int num3 = 5;
      int num4 = 5;
      int num5 = 180;
      if (Main.player[this.owner].setSquireT2)
        num1 = 21f;
      if (Main.player[this.owner].setSquireT3)
        num5 = 100;
      if (Main.player[this.owner].ballistaPanic)
        num5 = 60;
      if (Main.player[this.owner].ballistaPanic && Main.player[this.owner].setSquireT3)
        num5 = 30;
      int num6 = num4;
      if (this.type == 677)
        center.Y -= 4f;
      if ((double) this.ai[0] == 0.0)
      {
        this.direction = this.spriteDirection = Main.player[this.owner].direction;
        this.ai[0] = 1f;
        this.ai[1] = 0.0f;
        this.netUpdate = true;
        if (this.direction == -1)
          this.rotation = 3.141593f;
      }
      if ((double) this.ai[0] == 1.0)
      {
        this.frame = 0;
        bool flag = false;
        if (Main.player[this.owner].ballistaPanic && (double) this.ai[1] > 60.0)
          this.ai[1] = 60f;
        if (Main.player[this.owner].ballistaPanic && Main.player[this.owner].setSquireT3 && (double) this.ai[1] > 30.0)
          this.ai[1] = 30f;
        if ((double) this.ai[1] > 0.0)
          --this.ai[1];
        else
          flag = true;
        int target = this.AI_134_Ballista_FindTarget(shot_range, deadBottomAngle, center);
        if (target != -1)
        {
          Vector2 v = (Main.npc[target].Center - center).SafeNormalize(Vector2.UnitY);
          this.rotation = this.rotation.AngleLerp(v.ToRotation(), 0.08f);
          if ((double) this.rotation > 1.57079637050629 || (double) this.rotation < -1.57079637050629)
            this.direction = -1;
          else
            this.direction = 1;
          if (flag && this.owner == Main.myPlayer)
          {
            this.direction = Math.Sign(v.X);
            this.ai[0] = 2f;
            this.ai[1] = 0.0f;
            this.netUpdate = true;
          }
        }
        else
        {
          float targetAngle = 0.0f;
          if (this.direction == -1)
            targetAngle = 3.141593f;
          this.rotation = this.rotation.AngleLerp(targetAngle, 0.05f);
        }
      }
      else if ((double) this.ai[0] == 2.0)
      {
        this.frame = num2 + (int) ((double) this.ai[1] / (double) num4);
        if ((double) this.ai[1] == (double) num6)
        {
          Main.PlayTrackedSound((SoundStyle) SoundID.DD2_BallistaTowerShot, this.Center);
          Vector2 v = new Vector2((float) this.direction, 0.0f);
          int target = this.AI_134_Ballista_FindTarget(shot_range, deadBottomAngle, center);
          if (target != -1)
            v = (Main.npc[target].Center - center).SafeNormalize(Vector2.UnitX * (float) this.direction);
          this.rotation = v.ToRotation();
          if ((double) this.rotation > 1.57079637050629 || (double) this.rotation < -1.57079637050629)
            this.direction = -1;
          else
            this.direction = 1;
          Vector2 velocity = v * num1;
          if (this.owner == Main.myPlayer)
            Projectile.NewProjectile(center, velocity, Type, this.damage, this.knockBack, this.owner);
        }
        if ((double) ++this.ai[1] >= (double) (num3 * num4))
        {
          this.ai[0] = 1f;
          this.ai[1] = (float) num5;
        }
      }
      this.spriteDirection = this.direction;
      this.tileCollide = true;
      this.velocity.Y += 0.2f;
    }

    private void AI_135_OgreStomp()
    {
      ++this.ai[0];
      if ((double) this.ai[0] > 9.0)
      {
        this.Kill();
      }
      else
      {
        this.velocity = Vector2.Zero;
        this.position = this.Center;
        this.Size = new Vector2(16f, 16f) * MathHelper.Lerp(5f, 40f, Utils.InverseLerp(0.0f, 9f, this.ai[0]));
        this.Center = this.position;
        Point tileCoordinates1 = this.TopLeft.ToTileCoordinates();
        Point tileCoordinates2 = this.BottomRight.ToTileCoordinates();
        int num1 = tileCoordinates1.X / 2 + tileCoordinates2.X / 2;
        int num2 = this.width / 2;
        if ((int) this.ai[0] % 3 != 0)
          return;
        int num3 = (int) this.ai[0] / 3;
        for (int x = tileCoordinates1.X; x <= tileCoordinates2.X; ++x)
        {
          for (int y = tileCoordinates1.Y; y <= tileCoordinates2.Y; ++y)
          {
            if ((double) Vector2.Distance(this.Center, new Vector2((float) (x * 16), (float) (y * 16))) <= (double) num2)
            {
              Tile tileSafely1 = Framing.GetTileSafely(x, y);
              if (tileSafely1.active() && Main.tileSolid[(int) tileSafely1.type] && !Main.tileSolidTop[(int) tileSafely1.type] && !Main.tileFrameImportant[(int) tileSafely1.type])
              {
                Tile tileSafely2 = Framing.GetTileSafely(x, y - 1);
                if (!tileSafely2.active() || !Main.tileSolid[(int) tileSafely2.type] || Main.tileSolidTop[(int) tileSafely2.type])
                {
                  int tileDustAmount = WorldGen.KillTile_GetTileDustAmount(true, tileSafely1);
                  for (int index = 0; index < tileDustAmount; ++index)
                  {
                    Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(x, y, tileSafely1)];
                    dust.velocity.Y -= (float) (3.0 + (double) num3 * 1.5);
                    dust.velocity.Y *= Main.rand.NextFloat();
                    dust.scale += (float) num3 * 0.03f;
                  }
                  if (num3 >= 2)
                  {
                    for (int index = 0; index < tileDustAmount - 1; ++index)
                    {
                      Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(x, y, tileSafely1)];
                      dust.velocity.Y -= 1f + (float) num3;
                      dust.velocity.Y *= Main.rand.NextFloat();
                    }
                  }
                  if (tileDustAmount > 0 && Main.rand.Next(3) != 0)
                  {
                    float num4 = (float) Math.Abs(num1 - x) / 20f;
                    Gore gore = Gore.NewGoreDirect(this.position, Vector2.Zero, 61 + Main.rand.Next(3), (float) (1.0 - (double) num3 * 0.150000005960464 + (double) num4 * 0.5));
                    gore.velocity.Y -= (float) (0.100000001490116 + (double) num3 * 0.5 + (double) num4 * (double) num3 * 1.0);
                    gore.velocity.Y *= Main.rand.NextFloat();
                    gore.position = new Vector2((float) (x * 16 + 20), (float) (y * 16 + 20));
                  }
                }
              }
            }
          }
        }
      }
    }

    private void AI_136_BetsyBreath()
    {
      if ((double) this.ai[1] < 0.0 || (double) this.ai[1] > 200.0)
      {
        this.Kill();
      }
      else
      {
        NPC npc = Main.npc[(int) this.ai[1]];
        float num1 = -8f;
        this.Center = npc.Center + new Vector2((110f + num1) * (float) npc.spriteDirection, 30f).RotatedBy((double) npc.rotation);
        this.rotation = npc.DirectionTo(this.Center).ToRotation();
        DelegateMethods.v3_1 = new Vector3(1.2f, 1f, 0.3f);
        float num2 = this.ai[0] / 40f;
        if ((double) num2 > 1.0)
          num2 = 1f;
        float num3 = (float) (((double) this.ai[0] - 38.0) / 40.0);
        if ((double) num3 < 0.0)
          num3 = 0.0f;
        Utils.PlotTileLine(this.Center + this.rotation.ToRotationVector2() * 400f * num3, this.Center + this.rotation.ToRotationVector2() * 400f * num2, 16f, new Utils.PerLinePoint(DelegateMethods.CastLight));
        Utils.PlotTileLine(this.Center + this.rotation.ToRotationVector2().RotatedBy(0.196349546313286) * 400f * num3, this.Center + this.rotation.ToRotationVector2().RotatedBy(0.196349546313286) * 400f * num2, 16f, new Utils.PerLinePoint(DelegateMethods.CastLight));
        Utils.PlotTileLine(this.Center + this.rotation.ToRotationVector2().RotatedBy(-0.196349546313286) * 400f * num3, this.Center + this.rotation.ToRotationVector2().RotatedBy(-0.196349546313286) * 400f * num2, 16f, new Utils.PerLinePoint(DelegateMethods.CastLight));
        if ((double) num3 == 0.0 && (double) num2 > 0.100000001490116)
        {
          for (int index = 0; index < 3; ++index)
          {
            Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 6);
            dust.fadeIn = 1.5f;
            dust.velocity = this.rotation.ToRotationVector2().RotatedBy((double) Main.rand.NextFloatDirection() * 0.261799395084381) * (float) (0.5 + (double) Main.rand.NextFloat() * 2.5) * 15f;
            dust.velocity += npc.velocity * 2f;
            dust.noLight = true;
            dust.noGravity = true;
            dust.alpha = 200;
          }
        }
        if (Main.rand.Next(5) == 0 && (double) this.ai[0] >= 15.0)
        {
          Gore gore = Gore.NewGoreDirect(this.Center + this.rotation.ToRotationVector2() * 300f - Utils.RandomVector2(Main.rand, -20f, 20f), Vector2.Zero, 61 + Main.rand.Next(3), 0.5f);
          gore.velocity *= 0.3f;
          gore.velocity += this.rotation.ToRotationVector2() * 4f;
        }
        for (int index = 0; index < 1; ++index)
        {
          Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 31);
          dust.fadeIn = 1.5f;
          dust.scale = 0.4f;
          dust.velocity = this.rotation.ToRotationVector2().RotatedBy((double) Main.rand.NextFloatDirection() * 0.261799395084381) * (float) (0.5 + (double) Main.rand.NextFloat() * 2.5) * 15f;
          dust.velocity += npc.velocity * 2f;
          dust.velocity *= 0.3f;
          dust.noLight = true;
          dust.noGravity = true;
          float amount = Main.rand.NextFloat();
          dust.position = Vector2.Lerp(this.Center + this.rotation.ToRotationVector2() * 400f * num3, this.Center + this.rotation.ToRotationVector2() * 400f * num2, amount);
          dust.position += this.rotation.ToRotationVector2().RotatedBy(1.57079637050629) * (float) (20.0 + 100.0 * ((double) amount - 0.5));
        }
        ++this.frameCounter;
        ++this.ai[0];
        if ((double) this.ai[0] < 78.0)
          return;
        this.Kill();
      }
    }

    private void AI_137_LightningAura()
    {
      int maxDistance = 10;
      int num1 = 999;
      int num2 = 30;
      int num3 = 40;
      int num4 = 4;
      this.knockBack = 0.0f;
      if (Main.player[this.owner].setMonkT2)
        num2 -= 5;
      if (Main.player[this.owner].setMonkT3)
      {
        maxDistance = 14;
        num4 = 8;
      }
      ++this.ai[0];
      if ((double) this.ai[0] >= (double) num2)
        this.ai[0] = 0.0f;
      if ((double) this.ai[0] == 0.0)
      {
        bool flag = false;
        for (int index = 0; index < 200; ++index)
        {
          NPC npc = Main.npc[index];
          if (npc.CanBeChasedBy((object) this) && (double) npc.Hitbox.Distance(this.Center) < (double) (this.width / 2) && this.Colliding(this.Hitbox, npc.Hitbox))
          {
            flag = true;
            break;
          }
        }
        if (flag)
          Main.PlayTrackedSound((SoundStyle) SoundID.DD2_LightningAuraZap, this.Center);
      }
      if ((double) this.localAI[0] == 0.0)
      {
        this.localAI[0] = 1f;
        this.velocity = Vector2.Zero;
        Point tileCoordinates = this.Center.ToTileCoordinates();
        Point result1;
        if (!WorldUtils.Find(tileCoordinates, Searches.Chain((GenSearch) new Searches.Down(500), (GenCondition) new Conditions.IsSolid()), out result1))
        {
          this.position.Y += 16f;
          return;
        }
        Point result2;
        if (!WorldUtils.Find(new Point(result1.X, result1.Y - 1), Searches.Chain((GenSearch) new Searches.Up(maxDistance), (GenCondition) new Conditions.IsSolid()), out result2))
          result2 = new Point(tileCoordinates.X, tileCoordinates.Y - maxDistance - 1);
        Vector2 worldCoordinates1 = result1.ToWorldCoordinates(autoAddY: 0.0f);
        Vector2 worldCoordinates2 = result2.ToWorldCoordinates(autoAddY: 0.0f);
        this.Size = new Vector2(1f, worldCoordinates1.Y - worldCoordinates2.Y);
        if (this.height > maxDistance * 16)
          this.height = maxDistance * 16;
        if (this.height < num4 * 16)
          this.height = num4 * 16;
        this.height *= 2;
        this.width = (int) ((double) this.height * 1.0);
        if (this.width > num1)
          this.width = num1;
        this.Center = worldCoordinates1;
      }
      if (++this.frameCounter >= 8)
      {
        this.frameCounter = 0;
        if (++this.frame >= Main.projFrames[this.type])
          this.frame = 0;
      }
      DelegateMethods.v3_1 = new Vector3(0.2f, 0.7f, 1f);
      Utils.PlotTileLine(this.Center + Vector2.UnitX * -40f, this.Center + Vector2.UnitX * 40f, 80f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
      Vector2 vector2_1 = new Vector2(this.Top.X, this.position.Y + (float) num3);
      for (int index = 0; index < 4; ++index)
      {
        if (Main.rand.Next(6) == 0)
        {
          Vector2 vector2_2 = Main.rand.NextVector2Unit();
          if ((double) Math.Abs(vector2_2.X) >= 0.119999997317791)
          {
            Vector2 vector2_3 = this.Center + vector2_2 * new Vector2((float) ((this.height - num3) / 2));
            if (!WorldGen.SolidTile((int) vector2_3.X / 16, (int) vector2_3.Y / 16) && this.AI_137_CanHit(vector2_3))
            {
              Dust dust = Dust.NewDustDirect(vector2_3, 0, 0, 226, Alpha: 100);
              dust.position = vector2_3;
              dust.velocity = (vector2_1 - dust.position).SafeNormalize(Vector2.Zero);
              dust.scale = 0.7f;
              dust.fadeIn = 1f;
              dust.noGravity = true;
              dust.noLight = true;
            }
          }
        }
      }
      for (int index = 0; index < 0; ++index)
      {
        if (Main.rand.Next(10) == 0)
        {
          Vector2 vector2_4 = Main.rand.NextVector2Unit();
          if ((double) Math.Abs(vector2_4.X) >= 0.119999997317791)
          {
            Vector2 vector2_5 = this.Center + vector2_4 * new Vector2((float) ((this.height - num3) / 2)) * Main.rand.NextFloat();
            if (!WorldGen.SolidTile((int) vector2_5.X / 16, (int) vector2_5.Y / 16) && this.AI_137_CanHit(vector2_5))
            {
              Dust dust = Dust.NewDustDirect(vector2_5, 0, 0, 226, Alpha: 100);
              dust.velocity *= 0.6f;
              dust.velocity += Vector2.UnitY * -2f;
              dust.noGravity = true;
              dust.noLight = true;
            }
          }
        }
      }
      for (int index = 0; index < 4; ++index)
      {
        if (Main.rand.Next(10) == 0)
        {
          Dust dust = Dust.NewDustDirect(vector2_1 - new Vector2(8f, 0.0f), 16, this.height / 2 - 40, 226, Alpha: 100);
          dust.velocity *= 0.6f;
          dust.velocity += Vector2.UnitY * -2f;
          dust.scale = 0.7f;
          dust.noGravity = true;
          dust.noLight = true;
        }
      }
      this.tileCollide = true;
      this.velocity.Y += 0.2f;
    }

    private void AI_138_ExplosiveTrap()
    {
      this.spriteDirection = this.direction = 1;
      int num1 = 110;
      int Type = 694;
      int num2 = 48;
      if (Main.player[this.owner].setHuntressT2)
        num1 = 74;
      if (Main.player[this.owner].setHuntressT3)
        num1 = 40;
      switch (this.type)
      {
        case 692:
          Type = 695;
          break;
        case 693:
          Type = 696;
          break;
      }
      Lighting.AddLight(this.Center, 0.6f, 0.5f, 0.3f);
      if (++this.frameCounter >= 12)
      {
        this.frameCounter = 0;
        if (++this.frame >= Main.projFrames[this.type])
          this.frame = 0;
      }
      if ((double) this.localAI[0] > 0.0)
        --this.localAI[0];
      if ((double) this.localAI[0] <= 0.0 && this.owner == Main.myPlayer)
      {
        this.localAI[0] = 3f;
        bool flag = false;
        Microsoft.Xna.Framework.Rectangle rectangle = Utils.CenteredRectangle(this.Center + new Vector2(0.0f, (float) -num2), new Vector2((float) (num2 * 2)));
        for (int index = 0; index < 200; ++index)
        {
          NPC npc = Main.npc[index];
          if (npc.CanBeChasedBy((object) this, true) && rectangle.Intersects(npc.Hitbox))
          {
            flag = true;
            break;
          }
        }
        if (flag)
        {
          Main.PlayTrackedSound((SoundStyle) SoundID.DD2_ExplosiveTrapExplode);
          this.localAI[0] = (float) num1;
          Projectile.NewProjectile(this.Center + new Vector2(0.0f, (float) -num2), Vector2.Zero, Type, this.damage, this.knockBack, this.owner);
        }
      }
      this.tileCollide = true;
      this.velocity.Y += 0.2f;
    }

    private void AI_139_ExplosiveTrapExplosion()
    {
      int projFrame = Main.projFrames[this.type];
      int num = 3;
      this.alpha -= 25;
      if (this.alpha < 0)
        this.alpha = 0;
      if ((double) this.localAI[0] == 0.0)
        this.localAI[0] = 1f;
      if (++this.frameCounter >= num)
      {
        this.frameCounter = 0;
        if (++this.frame >= projFrame)
        {
          this.Kill();
          return;
        }
      }
      DelegateMethods.v3_1 = new Vector3(1.3f, 0.9f, 0.2f);
      Utils.PlotTileLine(this.Top, this.Bottom, 2f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
    }

    private void AI_140_MonkStaffT1()
    {
      float num1 = 50f;
      float num2 = 2f;
      float num3 = 20f;
      Player player = Main.player[this.owner];
      float num4 = -0.7853982f;
      Vector2 vector2_1 = player.RotatedRelativePoint(player.MountedCenter);
      Vector2 vector2_2 = Vector2.Zero;
      if (player.dead)
      {
        this.Kill();
      }
      else
      {
        if (this.type == 697)
        {
          int Damage = this.damage * 2;
          int num5 = Math.Sign(this.velocity.X);
          this.velocity = new Vector2((float) num5, 0.0f);
          if ((double) this.ai[0] == 0.0)
          {
            this.rotation = (float) ((double) new Vector2((float) num5, -player.gravDir).ToRotation() + (double) num4 + 3.14159274101257);
            if ((double) this.velocity.X < 0.0)
              this.rotation -= 1.570796f;
          }
          this.alpha -= 128;
          if (this.alpha < 0)
            this.alpha = 0;
          double num6 = (double) this.ai[0] / (double) num1;
          ++this.ai[0];
          this.rotation += 6.283185f * num2 / num1 * (float) num5;
          bool flag = (double) this.ai[0] == (double) (int) ((double) num1 / 2.0);
          if ((double) this.ai[0] >= (double) num1 || flag && !player.controlUseItem)
          {
            this.Kill();
            player.reuseDelay = 10;
          }
          else if (flag)
          {
            Vector2 mouseWorld = Main.MouseWorld;
            int dir = (double) player.DirectionTo(mouseWorld).X > 0.0 ? 1 : -1;
            if ((double) dir != (double) this.velocity.X)
            {
              player.ChangeDir(dir);
              this.velocity = new Vector2((float) dir, 0.0f);
              this.netUpdate = true;
              this.rotation -= 3.141593f;
            }
          }
          float num7 = this.rotation - 0.7853982f * (float) num5;
          vector2_2 = (num7 + (num5 == -1 ? 3.141593f : 0.0f)).ToRotationVector2() * (this.ai[0] / num1) * num3;
          Vector2 vec = this.Center + (num7 + (num5 == -1 ? 3.141593f : 0.0f)).ToRotationVector2() * 30f;
          if (Main.rand.Next(2) == 0)
          {
            Dust dust = Dust.NewDustDirect(vec - new Vector2(5f), 10, 10, 31, player.velocity.X, player.velocity.Y, 150);
            dust.velocity = this.DirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f;
          }
          if (num6 >= 0.75)
          {
            Dust dust = Dust.NewDustDirect(vec - new Vector2(5f), 10, 10, 55, player.velocity.X, player.velocity.Y, 50);
            dust.velocity = this.DirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f;
            dust.noGravity = true;
            dust.color = new Color(20, (int) byte.MaxValue, 100, 160);
          }
          if ((double) this.ai[0] >= (double) num1 - 8.0 && (double) this.ai[0] < (double) num1 - 2.0)
          {
            for (int index = 0; index < 5; ++index)
            {
              Dust dust = Dust.NewDustDirect(vec - new Vector2(5f), 10, 10, 55, player.velocity.X, player.velocity.Y, 50);
              dust.velocity *= 1.2f;
              dust.noGravity = true;
              dust.scale += 0.1f;
              dust.color = new Color(20, (int) byte.MaxValue, 100, 160);
            }
          }
          if ((double) this.ai[0] == (double) num1 - 3.0 && this.owner == Main.myPlayer)
          {
            if ((double) this.localAI[1] != 1.0)
            {
              if (!WorldUtils.Find(vec.ToTileCoordinates(), Searches.Chain((GenSearch) new Searches.Down(4), (GenCondition) new Conditions.IsSolid()), out Point _))
              {
                Main.PlayTrackedSound((SoundStyle) SoundID.DD2_MonkStaffGroundMiss, this.Center);
                goto label_26;
              }
            }
            Projectile.NewProjectile(vec + new Vector2((float) (num5 * 20), -60f), Vector2.Zero, 698, Damage, 0.0f, this.owner);
            Main.PlayTrackedSound((SoundStyle) SoundID.DD2_MonkStaffGroundImpact, this.Center);
          }
        }
label_26:
        if (this.type == 707)
        {
          Lighting.AddLight(player.Center, 0.75f, 0.9f, 1.15f);
          int num8 = Math.Sign(this.velocity.X);
          this.velocity = new Vector2((float) num8, 0.0f);
          if ((double) this.ai[0] == 0.0)
          {
            this.rotation = (float) ((double) new Vector2((float) num8, -player.gravDir).ToRotation() + (double) num4 + 3.14159274101257);
            if ((double) this.velocity.X < 0.0)
              this.rotation -= 1.570796f;
          }
          this.alpha -= 128;
          if (this.alpha < 0)
            this.alpha = 0;
          double num9 = (double) this.ai[0] / (double) num1;
          float num10 = 1f;
          this.ai[0] += num10;
          this.rotation += 6.283185f * num2 / num1 * (float) num8;
          bool flag = (double) this.ai[0] == (double) (int) ((double) num1 / 2.0);
          if ((double) this.ai[0] >= (double) num1 || flag && !player.controlUseItem)
          {
            this.Kill();
            player.reuseDelay = 2;
          }
          else if (flag)
          {
            Vector2 mouseWorld = Main.MouseWorld;
            int dir = (double) player.DirectionTo(mouseWorld).X > 0.0 ? 1 : -1;
            if ((double) dir != (double) this.velocity.X)
            {
              player.ChangeDir(dir);
              this.velocity = new Vector2((float) dir, 0.0f);
              this.netUpdate = true;
              this.rotation -= 3.141593f;
            }
          }
          if (((double) this.ai[0] == (double) num10 || (double) this.ai[0] == (double) (int) ((double) num1 / 2.0) && this.active) && this.owner == Main.myPlayer)
          {
            Vector2 mouseWorld = Main.MouseWorld;
            Vector2 vector2_3 = player.DirectionTo(mouseWorld) * 0.0f;
          }
          float f = this.rotation - 0.7853982f * (float) num8;
          vector2_2 = (f + (num8 == -1 ? 3.141593f : 0.0f)).ToRotationVector2() * (this.ai[0] / num1) * num3;
          Vector2 vector2_4 = this.Center + (f + (num8 == -1 ? 3.141593f : 0.0f)).ToRotationVector2() * 30f;
          Vector2 rotationVector2 = f.ToRotationVector2();
          Vector2 vector2_5 = rotationVector2.RotatedBy(1.57079637050629 * (double) this.spriteDirection);
          if (Main.rand.Next(2) == 0)
          {
            Dust dust = Dust.NewDustDirect(vector2_4 - new Vector2(5f), 10, 10, 31, player.velocity.X, player.velocity.Y, 150);
            dust.velocity = this.DirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f;
          }
          for (int index = 0; index < 4; ++index)
          {
            float num11 = 1f;
            float num12 = 1f;
            switch (index - 1)
            {
              case 0:
                num12 = -1f;
                break;
              case 1:
                num12 = 1.25f;
                num11 = 0.5f;
                break;
              case 2:
                num12 = -1.25f;
                num11 = 0.5f;
                break;
            }
            if (Main.rand.Next(6) != 0)
            {
              Dust dust = Dust.NewDustDirect(this.position, 0, 0, 226, Alpha: 100);
              dust.position = this.Center + rotationVector2 * (float) (60.0 + (double) Main.rand.NextFloat() * 20.0) * num12;
              dust.velocity = vector2_5 * (float) (4.0 + 4.0 * (double) Main.rand.NextFloat()) * num12 * num11;
              dust.noGravity = true;
              dust.noLight = true;
              dust.scale = 0.5f;
              dust.customData = (object) this;
              if (Main.rand.Next(4) == 0)
                dust.noGravity = false;
            }
          }
        }
        this.position = vector2_1 - this.Size / 2f;
        this.position = this.position + vector2_2;
        this.spriteDirection = this.direction;
        this.timeLeft = 2;
        player.ChangeDir(this.direction);
        player.heldProj = this.whoAmI;
        player.itemTime = 2;
        player.itemAnimation = 2;
        player.itemRotation = MathHelper.WrapAngle(this.rotation);
      }
    }

    private void AI_141_MonkStaffT1Explosion()
    {
      Point tileCoordinates1 = this.TopLeft.ToTileCoordinates();
      Point tileCoordinates2 = this.BottomRight.ToTileCoordinates();
      int num1 = tileCoordinates1.X / 2;
      int num2 = tileCoordinates2.X / 2;
      int width = this.width;
      ++this.ai[0];
      if ((double) this.ai[0] > 20.0)
      {
        this.Kill();
      }
      else
      {
        if ((double) this.ai[0] != 1.0)
          return;
        bool flag = false;
        int num3 = 4;
        for (int x = tileCoordinates1.X; x <= tileCoordinates2.X; ++x)
        {
          for (int y = tileCoordinates1.Y; y <= tileCoordinates2.Y; ++y)
          {
            if ((double) Vector2.Distance(this.Bottom, new Vector2((float) (x * 16), (float) (y * 16))) <= (double) width)
            {
              Tile tileSafely1 = Framing.GetTileSafely(x, y);
              if (tileSafely1.active() && Main.tileSolid[(int) tileSafely1.type] && !Main.tileSolidTop[(int) tileSafely1.type] && !Main.tileFrameImportant[(int) tileSafely1.type])
              {
                Tile tileSafely2 = Framing.GetTileSafely(x, y - 1);
                if (!tileSafely2.active() || !Main.tileSolid[(int) tileSafely2.type] || Main.tileSolidTop[(int) tileSafely2.type])
                {
                  int num4 = WorldGen.KillTile_GetTileDustAmount(true, tileSafely1) * 6;
                  for (int index = 0; index < num4; ++index)
                  {
                    Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(x, y, tileSafely1)];
                    dust.velocity.Y -= (float) (3.0 + (double) num3 * 1.5);
                    dust.velocity.Y *= Main.rand.NextFloat();
                    dust.scale += (float) num3 * 0.03f;
                  }
                  if (num3 >= 2)
                  {
                    for (int index = 0; index < num4 - 1; ++index)
                    {
                      Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(x, y, tileSafely1)];
                      dust.velocity.Y -= 1f + (float) num3;
                      dust.velocity.Y *= Main.rand.NextFloat();
                    }
                  }
                  if (num4 > 0)
                    flag = true;
                }
              }
            }
          }
        }
        Vector2 bottom = this.Bottom;
        Vector2 spinningpoint = new Vector2(7f, 0.0f);
        Vector2 vector2_1 = new Vector2(1f, 0.7f);
        Color color = new Color(20, (int) byte.MaxValue, 100, 200);
        for (float num5 = 0.0f; (double) num5 < 25.0; ++num5)
        {
          Vector2 vector2_2 = spinningpoint.RotatedBy((double) num5 * 6.28318548202515 / 25.0) * vector2_1;
          Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 55);
          dust.alpha = 0;
          if (!flag)
            dust.alpha = 50;
          dust.color = color;
          dust.position = bottom + vector2_2;
          dust.velocity.Y -= 3f;
          dust.velocity.X *= 0.5f;
          dust.fadeIn = (float) (0.5 + (double) Main.rand.NextFloat() * 0.5);
          dust.noLight = true;
        }
        if (flag)
          return;
        for (float num6 = 0.0f; (double) num6 < 25.0; ++num6)
        {
          Vector2 vector2_3 = spinningpoint.RotatedBy((double) num6 * 6.28318548202515 / 25.0) * vector2_1;
          Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 55);
          dust.alpha = 100;
          dust.color = color;
          dust.position = bottom + vector2_3;
          dust.velocity.Y -= 5f;
          dust.velocity.X *= 0.8f;
          dust.fadeIn = (float) (0.5 + (double) Main.rand.NextFloat() * 0.5);
          dust.noLight = true;
        }
      }
    }

    private void AI_142_MonkStaffT2And3()
    {
      Player player = Main.player[this.owner];
      Vector2 vector2_1 = player.RotatedRelativePoint(player.MountedCenter);
      this.direction = player.direction;
      player.heldProj = this.whoAmI;
      this.Center = vector2_1;
      if (player.dead)
      {
        this.Kill();
      }
      else
      {
        if (!player.frozen)
        {
          if (this.type == 699)
          {
            this.spriteDirection = this.direction = player.direction;
            this.alpha -= (int) sbyte.MaxValue;
            if (this.alpha < 0)
              this.alpha = 0;
            if ((double) this.localAI[0] > 0.0)
              --this.localAI[0];
            float num1 = 1f - (float) player.itemAnimation / (float) player.itemAnimationMax;
            float rotation = this.velocity.ToRotation();
            float x = this.velocity.Length();
            float num2 = 22f;
            Vector2 spinningpoint1 = new Vector2(1f, 0.0f).RotatedBy(3.14159274101257 + (double) num1 * 6.28318548202515) * new Vector2(x, this.ai[0]);
            this.position = this.position + (spinningpoint1.RotatedBy((double) rotation) + new Vector2(x + num2, 0.0f).RotatedBy((double) rotation));
            Vector2 Destination = vector2_1 + spinningpoint1.RotatedBy((double) rotation) + new Vector2((float) ((double) x + (double) num2 + 40.0), 0.0f).RotatedBy((double) rotation);
            this.rotation = player.AngleTo(Destination) + 0.7853982f * (float) player.direction;
            if (this.spriteDirection == -1)
              this.rotation += 3.141593f;
            player.DirectionTo(this.Center);
            Vector2 vector2_2 = player.DirectionTo(Destination);
            Vector2 spinningpoint2 = this.velocity.SafeNormalize(Vector2.UnitY);
            float num3 = 2f;
            for (int index = 0; (double) index < (double) num3; ++index)
            {
              Dust dust = Dust.NewDustDirect(this.Center, 14, 14, 228, Alpha: 110);
              dust.velocity = player.DirectionTo(dust.position) * 2f;
              dust.position = this.Center + spinningpoint2.RotatedBy((double) num1 * 6.28318548202515 * 2.0 + (double) index / (double) num3 * 6.28318548202515) * 10f;
              dust.scale = (float) (1.0 + 0.600000023841858 * (double) Main.rand.NextFloat());
              dust.velocity += spinningpoint2 * 3f;
              dust.noGravity = true;
            }
            for (int index = 0; index < 1; ++index)
            {
              if (Main.rand.Next(3) == 0)
              {
                Dust dust = Dust.NewDustDirect(this.Center, 20, 20, 228, Alpha: 110);
                dust.velocity = player.DirectionTo(dust.position) * 2f;
                dust.position = this.Center + vector2_2 * -110f;
                dust.scale = (float) (0.449999988079071 + 0.400000005960464 * (double) Main.rand.NextFloat());
                dust.fadeIn = (float) (0.699999988079071 + 0.400000005960464 * (double) Main.rand.NextFloat());
                dust.noGravity = true;
                dust.noLight = true;
              }
            }
          }
          else if (this.type == 708)
          {
            Lighting.AddLight(player.Center, 0.75f, 0.9f, 1.15f);
            this.spriteDirection = this.direction = player.direction;
            this.alpha -= (int) sbyte.MaxValue;
            if (this.alpha < 0)
              this.alpha = 0;
            float num4 = 1f - (float) player.itemAnimation / (float) player.itemAnimationMax;
            float rotation = this.velocity.ToRotation();
            float x = this.velocity.Length();
            float num5 = 22f;
            Vector2 spinningpoint3 = new Vector2(1f, 0.0f).RotatedBy(3.14159274101257 + (double) num4 * 6.28318548202515) * new Vector2(x, this.ai[0]);
            this.position = this.position + (spinningpoint3.RotatedBy((double) rotation) + new Vector2(x + num5, 0.0f).RotatedBy((double) rotation));
            Vector2 Destination = vector2_1 + spinningpoint3.RotatedBy((double) rotation) + new Vector2((float) ((double) x + (double) num5 + 40.0), 0.0f).RotatedBy((double) rotation);
            this.rotation = player.AngleTo(Destination) + 0.7853982f * (float) player.direction;
            if (this.spriteDirection == -1)
              this.rotation += 3.141593f;
            player.DirectionTo(this.Center);
            player.DirectionTo(Destination);
            Vector2 spinningpoint4 = this.velocity.SafeNormalize(Vector2.UnitY);
            if ((player.itemAnimation == 2 || player.itemAnimation == 6 || player.itemAnimation == 10) && this.owner == Main.myPlayer)
            {
              Vector2 vector2_3 = (spinningpoint4 + Main.rand.NextVector2Square(-0.2f, 0.2f)) * 12f;
              switch (player.itemAnimation)
              {
                case 2:
                  vector2_3 = spinningpoint4.RotatedBy(0.383972465991974);
                  break;
                case 6:
                  vector2_3 = spinningpoint4.RotatedBy(-0.383972465991974);
                  break;
                case 10:
                  vector2_3 = spinningpoint4.RotatedBy(0.0);
                  break;
              }
              Projectile.NewProjectile(this.Center, vector2_3 * (10f + (float) Main.rand.Next(4)), 709, this.damage, 0.0f, this.owner);
            }
            for (int index = 0; index < 3; index += 2)
            {
              float num6 = 1f;
              float num7 = 1f;
              switch (index - 1)
              {
                case 0:
                  num7 = -1f;
                  break;
                case 1:
                  num7 = 1.25f;
                  num6 = 0.5f;
                  break;
                case 2:
                  num7 = -1.25f;
                  num6 = 0.5f;
                  break;
              }
              if (Main.rand.Next(6) != 0)
              {
                float num8 = num7 * 1.2f;
                Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 226, Alpha: 100);
                dust.velocity = spinningpoint4 * (float) (4.0 + 4.0 * (double) Main.rand.NextFloat()) * num8 * num6;
                dust.noGravity = true;
                dust.noLight = true;
                dust.scale = 0.75f;
                dust.fadeIn = 0.8f;
                dust.customData = (object) this;
                if (Main.rand.Next(3) == 0)
                {
                  dust.noGravity = false;
                  dust.fadeIn = 0.0f;
                }
              }
            }
          }
        }
        if (player.itemAnimation != 2)
          return;
        this.Kill();
        player.reuseDelay = 2;
      }
    }

    private void AI_143_MonkStaffT2Ghast()
    {
      SlotId slotId;
      if ((double) this.ai[0] == 0.0)
      {
        float[] localAi = this.localAI;
        slotId = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_GhastlyGlaiveImpactGhost, this.Center);
        double num = (double) ((SlotId) ref slotId).ToFloat();
        localAi[1] = (float) num;
      }
      ActiveSound activeSound = Main.GetActiveSound(SlotId.FromFloat(this.localAI[1]));
      if (activeSound == null)
      {
        float[] localAi = this.localAI;
        slotId = (SlotId) SlotId.Invalid;
        double num = (double) ((SlotId) ref slotId).ToFloat();
        localAi[1] = (float) num;
      }
      else
        activeSound.Position = this.Center;
      ++this.ai[0];
      if ((double) this.ai[0] > 50.0)
      {
        this.alpha += 25;
        if (this.alpha > (int) byte.MaxValue)
          this.alpha = (int) byte.MaxValue;
      }
      else
      {
        this.alpha -= 25;
        if (this.alpha < 100)
          this.alpha = 100;
      }
      this.velocity = this.velocity * 0.98f;
      if (++this.frameCounter >= 5)
      {
        this.frameCounter = 0;
        if (++this.frame >= 4)
          this.frame = 0;
      }
      if ((double) this.ai[0] >= 60.0)
        this.Kill();
      this.direction = this.spriteDirection = (double) this.velocity.X > 0.0 ? 1 : -1;
      this.rotation = this.velocity.ToRotation();
      if (this.spriteDirection == -1)
        this.rotation += 3.141593f;
      if ((double) this.ai[0] < 10.0 || (double) this.ai[0] >= 34.0)
        return;
      Vector2 spinningpoint = this.velocity.SafeNormalize(Vector2.UnitY);
      float num1 = this.ai[0] / 60f;
      float num2 = 2f;
      for (int index = 0; (double) index < (double) num2; ++index)
      {
        Dust dust = Dust.NewDustDirect(this.Center, 14, 14, 228, Alpha: 110);
        dust.velocity = spinningpoint * 2f;
        dust.position = this.Center + spinningpoint.RotatedBy((double) num1 * 6.28318548202515 * 2.0 + (double) index / (double) num2 * 6.28318548202515) * 7f;
        dust.scale = (float) (1.0 + 0.600000023841858 * (double) Main.rand.NextFloat());
        dust.velocity += spinningpoint * 3f;
        dust.noGravity = true;
      }
    }

    private void AI_144_DD2Pet()
    {
      Player player = Main.player[this.owner];
      float num1 = 4f;
      int num2 = 6;
      int num3 = 4;
      int num4 = Main.projFrames[this.type];
      int num5 = 0;
      Vector2 vector2_1 = new Vector2((float) (player.direction * 30), -20f);
      if (player.dead)
      {
        this.Kill();
      }
      else
      {
        bool flag = true;
        switch (this.type)
        {
          case 701:
            if (Main.myPlayer == this.owner && player.petFlagDD2Dragon)
            {
              this.timeLeft = 2;
              break;
            }
            break;
          case 702:
            if (Main.myPlayer == this.owner && player.petFlagDD2Ghost)
              this.timeLeft = 2;
            vector2_1.Y += (float) Math.Cos((double) this.localAI[0] * 0.0523598790168762) * 2f;
            num3 = 4;
            num2 = 10;
            flag = false;
            num1 = 6f;
            Vector2 vector2_2 = new Vector2(this.spriteDirection == -1 ? -6f : -2f, -20f).RotatedBy((double) this.rotation);
            if (Main.rand.Next(24) == 0)
            {
              Dust dust = Dust.NewDustDirect(this.Center + vector2_2, 4, 4, 135, Alpha: 100);
              if (Main.rand.Next(3) != 0)
              {
                dust.noGravity = true;
                dust.velocity.Y -= 3f;
                dust.noLight = true;
              }
              else if (Main.rand.Next(2) != 0)
                dust.noLight = true;
              dust.velocity *= 0.5f;
              dust.velocity.Y -= 0.9f;
              dust.scale += (float) (0.100000001490116 + (double) Main.rand.NextFloat() * 0.600000023841858);
            }
            DelegateMethods.v3_1 = new Vector3(0.3f, 0.5f, 1f);
            Utils.PlotTileLine(this.Center, this.Center + this.velocity * 6f, 20f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
            Utils.PlotTileLine(this.Left, this.Right, 20f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
            Utils.PlotTileLine(player.Center, player.Center + player.velocity * 6f, 40f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
            Utils.PlotTileLine(player.Left, player.Right, 40f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
            break;
          case 703:
            if (Main.myPlayer == this.owner && player.petFlagDD2Gato)
              this.timeLeft = 2;
            vector2_1.Y += (float) Math.Cos((double) this.localAI[0] * 0.104719758033752) * 2f;
            num2 = 4;
            num3 = 2;
            num1 = 3f;
            num4 = 4;
            break;
        }
        if (flag && (player.suspiciouslookingTentacle || player.petFlagDD2Ghost))
          vector2_1.X += (float) (-player.direction * 64);
        this.direction = this.spriteDirection = player.direction;
        Vector2 vector2_3 = player.MountedCenter + vector2_1;
        double num6 = (double) Vector2.Distance(this.Center, vector2_3);
        if (num6 > 1000.0)
          this.Center = player.Center + vector2_1;
        Vector2 vector2_4 = vector2_3 - this.Center;
        if (num6 < (double) num1)
          this.velocity = this.velocity * 0.25f;
        if (vector2_4 != Vector2.Zero)
        {
          if ((double) vector2_4.Length() < (double) num1 * 0.5)
            this.velocity = vector2_4;
          else
            this.velocity = vector2_4 * 0.1f;
        }
        if ((double) this.velocity.Length() > 6.0)
        {
          float num7 = (float) ((double) this.velocity.X * 0.0799999982118607 + (double) this.velocity.Y * (double) this.spriteDirection * 0.0199999995529652);
          if ((double) Math.Abs(this.rotation - num7) >= 3.14159274101257)
          {
            if ((double) num7 < (double) this.rotation)
              this.rotation -= 6.283185f;
            else
              this.rotation += 6.283185f;
          }
          float num8 = 12f;
          this.rotation = (this.rotation * (num8 - 1f) + num7) / num8;
          if (++this.frameCounter >= num3)
          {
            this.frameCounter = 0;
            if (++this.frame >= num4)
              this.frame = num5;
          }
        }
        else
        {
          if ((double) this.rotation > 3.14159274101257)
            this.rotation -= 6.283185f;
          if ((double) this.rotation > -0.00499999988824129 && (double) this.rotation < 0.00499999988824129)
            this.rotation = 0.0f;
          else
            this.rotation *= 0.96f;
          if (++this.frameCounter >= num2)
          {
            this.frameCounter = 0;
            if (++this.frame >= num4)
              this.frame = num5;
          }
        }
        ++this.localAI[0];
        if ((double) this.localAI[0] <= 120.0)
          return;
        this.localAI[0] = 0.0f;
      }
    }

    private void AI_145_BookStaffStorm()
    {
      float num1 = 300f;
      SlotId slotId;
      if (this.soundDelay == 0)
      {
        this.soundDelay = -1;
        float[] localAi = this.localAI;
        slotId = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_BookStaffTwisterLoop, this.Center);
        double num2 = (double) ((SlotId) ref slotId).ToFloat();
        localAi[1] = (float) num2;
      }
      ActiveSound activeSound = Main.GetActiveSound(SlotId.FromFloat(this.localAI[1]));
      if (activeSound != null)
      {
        activeSound.Position = this.Center;
        activeSound.Volume = (float) (1.0 - (double) Math.Max(this.ai[0] - (num1 - 15f), 0.0f) / 15.0);
      }
      else
      {
        float[] localAi = this.localAI;
        slotId = (SlotId) SlotId.Invalid;
        double num3 = (double) ((SlotId) ref slotId).ToFloat();
        localAi[1] = (float) num3;
      }
      if ((double) this.localAI[0] >= 16.0 && (double) this.ai[0] < (double) num1 - 15.0)
        this.ai[0] = num1 - 15f;
      ++this.ai[0];
      if ((double) this.ai[0] >= (double) num1)
        this.Kill();
      Vector2 top = this.Top;
      Vector2 bottom = this.Bottom;
      Vector2 vector2_1 = Vector2.Lerp(top, bottom, 0.5f);
      Vector2 vector2_2 = new Vector2(0.0f, bottom.Y - top.Y);
      vector2_2.X = vector2_2.Y * 0.2f;
      int Width = 16;
      int Height = 160;
      for (int index = 0; index < 1; ++index)
      {
        Vector2 Position = new Vector2(this.Center.X - (float) (Width / 2), this.position.Y + (float) this.height - (float) Height);
        if (Collision.SolidCollision(Position, Width, Height) || Collision.WetCollision(Position, Width, Height))
        {
          if ((double) this.velocity.Y > 0.0)
            this.velocity.Y = 0.0f;
          if ((double) this.velocity.Y > -4.0)
          {
            this.velocity.Y -= 2f;
          }
          else
          {
            this.velocity.Y -= 4f;
            this.localAI[0] += 2f;
          }
          if ((double) this.velocity.Y < -16.0)
            this.velocity.Y = -16f;
        }
        else
        {
          --this.localAI[0];
          if ((double) this.localAI[0] < 0.0)
            this.localAI[0] = 0.0f;
          if ((double) this.velocity.Y < 0.0)
            this.velocity.Y = 0.0f;
          if ((double) this.velocity.Y < 4.0)
            this.velocity.Y += 2f;
          else
            this.velocity.Y += 4f;
          if ((double) this.velocity.Y > 16.0)
            this.velocity.Y = 16f;
        }
      }
      if ((double) this.ai[0] < (double) num1 - 30.0)
      {
        for (int index = 0; index < 1; ++index)
        {
          float num4 = -1f;
          float num5 = 0.9f;
          float amount = Main.rand.NextFloat();
          Vector2 vector2_3 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(num4, num5, amount));
          vector2_3.X *= MathHelper.Lerp(2.2f, 0.6f, amount);
          vector2_3.X *= -1f;
          Vector2 vector2_4 = new Vector2(6f, 10f);
          Vector2 Position = vector2_1 + vector2_2 * vector2_3 * 0.5f + vector2_4;
          Dust dust = Main.dust[Dust.NewDust(Position, 0, 0, 274)];
          dust.position = Position;
          dust.fadeIn = 1.3f;
          dust.scale = 0.87f;
          dust.alpha = 211;
          if ((double) vector2_3.X > -1.20000004768372)
            dust.velocity.X = 1f + Main.rand.NextFloat();
          dust.noGravity = true;
          dust.velocity.Y = (float) ((double) Main.rand.NextFloat() * -0.5 - 1.29999995231628);
          dust.velocity.X += this.velocity.X * 2.1f;
          dust.noLight = true;
        }
      }
      Vector2 Position1 = this.Bottom + new Vector2(-25f, -25f);
      for (int index = 0; index < 4; ++index)
      {
        Dust dust = Dust.NewDustDirect(Position1, 50, 25, 31, this.velocity.X, -2f, 100);
        dust.fadeIn = 1.1f;
        dust.noGravity = true;
      }
      for (int index = 0; index < 1; ++index)
      {
        if (Main.rand.Next(5) == 0)
        {
          Gore gore = Gore.NewGoreDirect(this.TopLeft + Main.rand.NextVector2Square(0.0f, 1f) * this.Size, new Vector2(this.velocity.X * 1.5f, (float) (-(double) Main.rand.NextFloat() * 16.0)), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
          gore.timeLeft = 60;
          gore.alpha = 50;
          gore.velocity.X += this.velocity.X;
        }
      }
      for (int index = 0; index < 1; ++index)
      {
        if (Main.rand.Next(7) == 0)
        {
          Gore gore = Gore.NewGoreDirect(this.TopLeft + Main.rand.NextVector2Square(0.0f, 1f) * this.Size, new Vector2(this.velocity.X * 1.5f, (float) (-(double) Main.rand.NextFloat() * 16.0)), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
          gore.timeLeft = 0;
          gore.alpha = 80;
        }
      }
      for (int index = 0; index < 1; ++index)
      {
        if (Main.rand.Next(7) == 0)
        {
          Gore gore = Gore.NewGoreDirect(this.TopLeft + Main.rand.NextVector2Square(0.0f, 1f) * this.Size, new Vector2(this.velocity.X * 1.5f, (float) (-(double) Main.rand.NextFloat() * 16.0)), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
          gore.timeLeft = 0;
          gore.alpha = 80;
        }
      }
    }

    public bool AI_137_CanHit(Vector2 targetPosition)
    {
      if (WorldGen.SolidTile((int) targetPosition.X / 16, (int) targetPosition.Y / 16))
        return false;
      Vector2 Position1 = this.Top + Vector2.UnitY * 20f;
      bool flag = Collision.CanHitLine(Position1, 0, 0, targetPosition, 0, 0);
      if (!flag)
      {
        Vector2 v = targetPosition - Position1;
        Vector2 spinningpoint = v.SafeNormalize(Vector2.UnitY);
        Vector2 vector2_1 = Vector2.Lerp(Position1, targetPosition, 0.5f);
        Vector2 vector2_2 = vector2_1 + spinningpoint.RotatedBy(1.57079637050629) * v.Length() * 0.2f;
        if (Collision.CanHitLine(Position1, 0, 0, vector2_2, 0, 0) && Collision.CanHitLine(vector2_2, 0, 0, targetPosition, 0, 0))
          flag = true;
        if (!flag)
        {
          Vector2 vector2_3 = vector2_1 + spinningpoint.RotatedBy(-1.57079637050629) * v.Length() * 0.2f;
          if (Collision.CanHitLine(Position1, 0, 0, vector2_3, 0, 0) && Collision.CanHitLine(vector2_3, 0, 0, targetPosition, 0, 0))
            flag = true;
        }
      }
      return flag;
    }

    public void Kill()
    {
      if (!this.active)
        return;
      Main.projectileIdentity[this.owner, this.identity] = -1;
      int timeLeft = this.timeLeft;
      this.timeLeft = 0;
      if (this.type == 686)
        Main.PlayTrackedSound((SoundStyle) SoundID.DD2_BetsyFireballImpact, this.Center);
      else if (this.type == 711)
        Main.PlayTrackedSound((SoundStyle) SoundID.DD2_BetsysWrathImpact, this.Center);
      else if (this.type == 704)
      {
        ActiveSound activeSound = Main.GetActiveSound(SlotId.FromFloat(this.localAI[1]));
        if (activeSound != null)
        {
          activeSound.Volume = 0.0f;
          activeSound.Stop();
        }
      }
      if (this.type == 710)
      {
        this.ai[1] = -1f;
        this.position = this.Center;
        this.width = this.height = 40;
        this.Center = this.position;
        this.Damage();
        Main.PlaySound(SoundID.Item14, this.position);
        for (int index1 = 0; index1 < 2; ++index1)
        {
          int index2 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index2].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
        }
        for (int index3 = 0; index3 < 10; ++index3)
        {
          int index4 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Scale: 2.5f);
          Main.dust[index4].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index4].noGravity = true;
          Main.dust[index4].velocity *= 2f;
        }
        for (int index5 = 0; index5 < 5; ++index5)
        {
          int index6 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Scale: 1.5f);
          Main.dust[index6].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index6].noGravity = true;
          Main.dust[index6].velocity *= 2f;
        }
      }
      else if (this.type == 711)
      {
        Microsoft.Xna.Framework.Rectangle hitbox = this.Hitbox;
        for (int index7 = 0; index7 < this.oldPos.Length / 2; index7 += 2)
        {
          hitbox.X = (int) this.oldPos[index7].X;
          hitbox.Y = (int) this.oldPos[index7].Y;
          for (int index8 = 0; index8 < 2; ++index8)
          {
            int Type = Utils.SelectRandom<int>(Main.rand, 6, 55, 158);
            int index9 = Dust.NewDust(hitbox.TopLeft(), this.width, this.height, Type, (float) this.direction, -2.5f);
            Main.dust[index9].alpha = 200;
            Main.dust[index9].velocity *= 2.4f;
            Main.dust[index9].scale += Main.rand.NextFloat();
            Main.dust[index9].scale -= 0.5f;
            if (Main.dust[index9].type == 55)
              Main.dust[index9].color = Color.Lerp(new Color(128, 0, 180, 128), Color.Gold, Main.rand.NextFloat());
            Main.dust[index9].noLight = true;
          }
        }
        for (int index10 = 10; index10 < this.oldPos.Length; index10 += 2)
        {
          hitbox.X = (int) this.oldPos[index10].X;
          hitbox.Y = (int) this.oldPos[index10].Y;
          for (int index11 = 0; index11 < 2; ++index11)
          {
            if (Main.rand.Next(3) != 0)
            {
              int Type = Utils.SelectRandom<int>(Main.rand, 55);
              int index12 = Dust.NewDust(hitbox.TopLeft(), this.width, this.height, Type, (float) this.direction, -2.5f);
              Main.dust[index12].alpha = 120;
              Main.dust[index12].velocity *= 2.4f;
              Main.dust[index12].scale += Main.rand.NextFloat() * 0.7f;
              Main.dust[index12].scale -= 0.5f;
              if (Main.dust[index12].type == 55)
                Main.dust[index12].color = Color.Lerp(Color.Purple, Color.Black, Main.rand.NextFloat());
              Main.dust[index12].noLight = true;
            }
          }
        }
        for (int index13 = 5; index13 < this.oldPos.Length; ++index13)
        {
          hitbox.X = (int) this.oldPos[index13].X;
          hitbox.Y = (int) this.oldPos[index13].Y;
          for (int index14 = 0; index14 < 1; ++index14)
          {
            if (Main.rand.Next(3) != 0)
            {
              int Type = Utils.SelectRandom<int>(Main.rand, 55);
              int index15 = Dust.NewDust(hitbox.TopLeft(), this.width, this.height, Type, (float) this.direction, -2.5f);
              Main.dust[index15].alpha = 80;
              Main.dust[index15].velocity *= 0.3f;
              Main.dust[index15].velocity += this.velocity * 0.5f;
              Main.dust[index15].scale += Main.rand.NextFloat() * 0.7f;
              Main.dust[index15].scale -= 0.5f;
              if (Main.dust[index15].type == 55)
                Main.dust[index15].color = Color.Lerp(Color.Purple, Color.Black, Main.rand.NextFloat());
              Main.dust[index15].noLight = true;
            }
          }
        }
        for (int index = 0; index < 20; ++index)
        {
          if (Main.rand.Next(3) != 0)
          {
            int Type = 228;
            Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type)];
            dust.noGravity = true;
            dust.scale = 1.25f + Main.rand.NextFloat();
            dust.fadeIn = 1.5f;
            dust.velocity *= 6f;
            dust.noLight = true;
          }
        }
        for (int index = 0; index < 20; ++index)
        {
          if (Main.rand.Next(3) != 0)
          {
            int Type = 55;
            Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type)];
            dust.noGravity = true;
            dust.scale = 1.25f + Main.rand.NextFloat();
            dust.fadeIn = 1.5f;
            dust.velocity *= 6f;
            dust.noLight = true;
            dust.color = new Color(0, 0, 220, 128);
          }
        }
        if (this.owner == Main.myPlayer)
        {
          this.position = this.Center;
          this.Size = new Vector2(140f);
          this.Center = this.position;
          this.penetrate = -1;
          this.usesLocalNPCImmunity = true;
          this.localNPCHitCooldown = -1;
          this.Damage();
        }
      }
      else if (this.type == 662 || this.type == 685)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        Vector2 vector2 = this.oldVelocity.SafeNormalize(Vector2.Zero);
        Vector2 Position = this.position + vector2 * 16f;
        for (int index = 0; index < 16; ++index)
        {
          if (Main.rand.Next(2) == 0)
          {
            Position -= vector2 * 8f;
          }
          else
          {
            Dust dust = Dust.NewDustDirect(Position, this.width, this.height, 11);
            dust.position = (dust.position + this.Center) / 2f;
            dust.velocity += this.oldVelocity * 0.4f;
            dust.velocity *= 0.5f;
            dust.noGravity = true;
            Position -= vector2 * 8f;
          }
        }
      }
      if (this.type == 680)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        Vector2 vector2 = this.oldVelocity.SafeNormalize(Vector2.Zero);
        Vector2 Position = this.position + vector2 * 16f;
        for (int index = 0; index < 16; ++index)
        {
          if (Main.rand.Next(2) == 0)
          {
            Position -= vector2 * 8f;
          }
          else
          {
            Dust dust = Dust.NewDustDirect(Position, this.width, this.height, 11);
            dust.position = (dust.position + this.Center) / 2f;
            dust.velocity += this.oldVelocity * 0.4f;
            dust.velocity *= 0.5f;
            dust.noGravity = true;
            Position -= vector2 * 8f;
          }
        }
        Dust.NewDustDirect(this.position, this.width, this.height, 11, newColor: Color.Red, Scale: 1.6f).noGravity = true;
      }
      if (this.type == 664 || this.type == 666 || this.type == 668 || this.type == 706)
      {
        int num1 = 4;
        int num2 = 20;
        int num3 = 10;
        int num4 = 20;
        int num5 = 20;
        int num6 = 4;
        float num7 = 1.5f;
        int num8 = 6;
        int Type = 6;
        if (Main.player[this.owner].setApprenticeT3)
        {
          num1 += 4;
          num5 += 10;
          num2 += 20;
          num4 += 30;
          num3 /= 2;
          num6 += 4;
          num7 += 0.5f;
          num8 += 7;
          Type = 270;
        }
        this.position = this.Center;
        this.width = this.height = 16 * num8;
        this.Center = this.position;
        this.Damage();
        Main.PlaySound(SoundID.Item100, this.position);
        for (int index16 = 0; index16 < num1; ++index16)
        {
          int index17 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index17].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
        }
        for (int index = 0; index < num2; ++index)
        {
          Dust dust = Dust.NewDustDirect(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 200, Scale: 2.5f);
          dust.position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 10f;
          dust.velocity *= 16f;
          if ((double) dust.velocity.Y > -2.0)
            dust.velocity.Y *= -0.4f;
          dust.noLight = true;
          dust.noGravity = true;
        }
        for (int index = 0; index < num4; ++index)
        {
          Dust dust = Dust.NewDustDirect(new Vector2(this.position.X, this.position.Y), this.width, this.height, Type, Alpha: 100, Scale: 1.5f);
          dust.position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          dust.velocity *= 2f;
          dust.noGravity = true;
          dust.fadeIn = num7;
        }
        for (int index18 = 0; index18 < num3; ++index18)
        {
          int index19 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Scale: 2.7f);
          Main.dust[index19].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index19].noGravity = true;
          Main.dust[index19].velocity *= 3f;
        }
        for (int index20 = 0; index20 < num5; ++index20)
        {
          int index21 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Scale: 1.5f);
          Main.dust[index21].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index21].noGravity = true;
          Main.dust[index21].velocity *= 3f;
        }
        for (int index22 = 0; index22 < num6; ++index22)
        {
          int index23 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index23].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.gore[index23].position -= Vector2.One * 16f;
          if (Main.rand.Next(2) == 0)
            Main.gore[index23].position.Y -= 30f;
          Main.gore[index23].velocity *= 0.3f;
          Main.gore[index23].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index23].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
      }
      else if (this.type == 681)
      {
        this.position.X += (float) (this.width / 2);
        this.position.Y += (float) (this.height / 2);
        Main.PlaySound(SoundID.DD2_GoblinBomb, this.position);
        this.width = 22;
        this.height = 22;
        this.position.X -= (float) (this.width / 2);
        this.position.Y -= (float) (this.height / 2);
        for (int index24 = 0; index24 < 10; ++index24)
        {
          int index25 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index25].velocity *= 1.4f;
          int index26 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
          Main.dust[index26].velocity *= 1.4f;
          Main.dust[index26].noGravity = true;
          Main.dust[index26].fadeIn = 2f;
        }
        for (int index27 = 0; index27 < 10; ++index27)
        {
          int index28 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.5f);
          Main.dust[index28].noGravity = true;
          Main.dust[index28].velocity *= 5f;
          int index29 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
          Main.dust[index29].velocity *= 3f;
        }
        int index30 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
        Main.gore[index30].velocity *= 0.4f;
        ++Main.gore[index30].velocity.X;
        ++Main.gore[index30].velocity.Y;
        int index31 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
        Main.gore[index31].velocity *= 0.4f;
        --Main.gore[index31].velocity.X;
        ++Main.gore[index31].velocity.Y;
        int index32 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
        Main.gore[index32].velocity *= 0.4f;
        ++Main.gore[index32].velocity.X;
        --Main.gore[index32].velocity.Y;
        int index33 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
        Main.gore[index33].velocity *= 0.4f;
        --Main.gore[index33].velocity.X;
        --Main.gore[index33].velocity.Y;
        this.position.X += (float) (this.width / 2);
        this.position.Y += (float) (this.height / 2);
        this.width = 80;
        this.height = 80;
        this.position.X -= (float) (this.width / 2);
        this.position.Y -= (float) (this.height / 2);
        this.Damage();
      }
      if (this.type == 669)
      {
        Main.PlaySound(13, (int) this.position.X, (int) this.position.Y);
        Vector2 vector2 = new Vector2(20f, 20f);
        for (int index = 0; index < 10; ++index)
          Dust.NewDustDirect(this.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 4, Alpha: 100, newColor: new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 110), Scale: 1.1f).velocity *= 1.4f;
        for (int index = 0; index < 40; ++index)
        {
          Dust dust = Dust.NewDustDirect(this.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 4, Alpha: 50, newColor: new Color(245, 200, 30, 155), Scale: 1.2f);
          dust.noGravity = true;
          dust.velocity *= 4f;
          Dust.NewDustDirect(this.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 4, Alpha: 50, newColor: new Color(245, 200, 30, 155), Scale: 0.8f).velocity *= 2f;
        }
      }
      if (this.type == 634 || this.type == 635)
      {
        int num9 = Utils.SelectRandom<int>(Main.rand, 242, 73, 72, 71, (int) byte.MaxValue);
        int Type1 = (int) byte.MaxValue;
        int Type2 = (int) byte.MaxValue;
        int num10 = 50;
        float Scale1 = 1.7f;
        float Scale2 = 0.8f;
        float Scale3 = 2f;
        Vector2 vector2 = (this.rotation - 1.570796f).ToRotationVector2() * this.velocity.Length() * (float) this.MaxUpdates;
        if (this.type == 635)
        {
          Type1 = 88;
          Type2 = 88;
          num9 = Utils.SelectRandom<int>(Main.rand, 242, 59, 88);
          Scale1 = 3.7f;
          Scale2 = 1.5f;
          Scale3 = 2.2f;
          vector2 *= 0.5f;
        }
        Main.PlaySound(SoundID.Item14, this.position);
        this.position = this.Center;
        this.width = this.height = num10;
        this.Center = this.position;
        this.maxPenetrate = -1;
        this.penetrate = -1;
        this.Damage();
        for (int index34 = 0; index34 < 40; ++index34)
        {
          int Type3 = Utils.SelectRandom<int>(Main.rand, 242, 73, 72, 71, (int) byte.MaxValue);
          if (this.type == 635)
            Type3 = Utils.SelectRandom<int>(Main.rand, 242, 59, 88);
          int index35 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, Type3, Alpha: 200, Scale: Scale1);
          Main.dust[index35].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index35].noGravity = true;
          Main.dust[index35].velocity *= 3f;
          Main.dust[index35].velocity += vector2 * Main.rand.NextFloat();
          int index36 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, Type1, Alpha: 100, Scale: Scale2);
          Main.dust[index36].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index36].velocity *= 2f;
          Main.dust[index36].noGravity = true;
          Main.dust[index36].fadeIn = 1f;
          Main.dust[index36].color = Color.Crimson * 0.5f;
          Main.dust[index36].velocity += vector2 * Main.rand.NextFloat();
        }
        for (int index37 = 0; index37 < 20; ++index37)
        {
          int index38 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, Type2, Scale: Scale3);
          Main.dust[index38].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 3f;
          Main.dust[index38].noGravity = true;
          Main.dust[index38].velocity *= 0.5f;
          Main.dust[index38].velocity += vector2 * (float) (0.600000023841858 + 0.600000023841858 * (double) Main.rand.NextFloat());
        }
      }
      else if (this.type == 651)
      {
        if ((double) this.localAI[0] == 1.0 && this.owner == Main.myPlayer)
        {
          Player master = Main.player[this.owner];
          Point point = new Vector2(this.ai[0], this.ai[1]).ToPoint();
          Point tileCoordinates = this.Center.ToTileCoordinates();
          if (Main.netMode == 1)
            NetMessage.SendData(109, number: point.X, number2: ((float) point.Y), number3: ((float) tileCoordinates.X), number4: ((float) tileCoordinates.Y), number5: ((int) WiresUI.Settings.ToolMode));
          else
            Wiring.MassWireOperation(point, tileCoordinates, master);
        }
      }
      else if (this.type == 641)
      {
        if (this.owner == Main.myPlayer)
        {
          for (int index = 0; index < 1000; ++index)
          {
            if (Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == 642)
              Main.projectile[index].Kill();
          }
        }
      }
      else if (this.type == 643)
      {
        if (this.owner == Main.myPlayer)
        {
          for (int index = 0; index < 1000; ++index)
          {
            if (Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == 644)
              Main.projectile[index].Kill();
          }
        }
      }
      else if (this.type == 645)
      {
        bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int) this.position.X / 16, (int) this.position.Y / 16));
        for (int index = 0; index < 4; ++index)
          Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
        for (int index39 = 0; index39 < 4; ++index39)
        {
          int index40 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, Scale: 2.5f);
          Main.dust[index40].noGravity = true;
          Main.dust[index40].velocity *= 3f;
          if (flag)
            Main.dust[index40].noLight = true;
          int index41 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, Alpha: 100, Scale: 1.5f);
          Main.dust[index41].velocity *= 2f;
          Main.dust[index41].noGravity = true;
          if (flag)
            Main.dust[index41].noLight = true;
        }
        for (int index42 = 0; index42 < 1; ++index42)
        {
          int index43 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index43].velocity *= 0.3f;
          Main.gore[index43].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index43].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
      }
      else if (this.type == 636)
      {
        Microsoft.Xna.Framework.Rectangle hitbox = this.Hitbox;
        for (int index44 = 0; index44 < 6; index44 += 3)
        {
          hitbox.X = (int) this.oldPos[index44].X;
          hitbox.Y = (int) this.oldPos[index44].Y;
          for (int index45 = 0; index45 < 5; ++index45)
          {
            int Type = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
            int index46 = Dust.NewDust(hitbox.TopLeft(), this.width, this.height, Type, 2.5f * (float) this.direction, -2.5f);
            Main.dust[index46].alpha = 200;
            Main.dust[index46].velocity *= 2.4f;
            Main.dust[index46].scale += Main.rand.NextFloat();
          }
        }
      }
      else if (this.type == 614)
      {
        for (int index = 0; index < 10; ++index)
        {
          Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
          dust.noGravity = true;
          dust.velocity *= 3f;
        }
      }
      if (this.type == 644)
      {
        Vector2 spinningpoint = new Vector2(0.0f, -3f).RotatedByRandom(3.14159274101257);
        float num11 = (float) Main.rand.Next(7, 13);
        Vector2 vector2 = new Vector2(2.1f, 2f);
        Color rgb = Main.hslToRgb(this.ai[0], 1f, 0.5f);
        rgb.A = byte.MaxValue;
        for (float num12 = 0.0f; (double) num12 < (double) num11; ++num12)
        {
          int dustIndex = Dust.NewDust(this.Center, 0, 0, 267, newColor: rgb);
          Main.dust[dustIndex].position = this.Center;
          Main.dust[dustIndex].velocity = spinningpoint.RotatedBy(6.28318548202515 * (double) num12 / (double) num11) * vector2 * (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.400000005960464);
          Main.dust[dustIndex].noGravity = true;
          Main.dust[dustIndex].scale = 2f;
          Main.dust[dustIndex].fadeIn = Main.rand.NextFloat() * 2f;
          Dust dust = Dust.CloneDust(dustIndex);
          dust.scale /= 2f;
          dust.fadeIn /= 2f;
          dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
        }
        for (float num13 = 0.0f; (double) num13 < (double) num11; ++num13)
        {
          int dustIndex = Dust.NewDust(this.Center, 0, 0, 267, newColor: rgb);
          Main.dust[dustIndex].position = this.Center;
          Main.dust[dustIndex].velocity = spinningpoint.RotatedBy(6.28318548202515 * (double) num13 / (double) num11) * vector2 * (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.400000005960464);
          Main.dust[dustIndex].velocity *= Main.rand.NextFloat() * 0.8f;
          Main.dust[dustIndex].noGravity = true;
          Main.dust[dustIndex].scale = Main.rand.NextFloat() * 1f;
          Main.dust[dustIndex].fadeIn = Main.rand.NextFloat() * 2f;
          Dust dust = Dust.CloneDust(dustIndex);
          dust.scale /= 2f;
          dust.fadeIn /= 2f;
          dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
        }
        if (Main.myPlayer == this.owner)
        {
          this.friendly = true;
          int width = this.width;
          int height = this.height;
          int penetrate = this.penetrate;
          this.position = this.Center;
          this.width = this.height = 60;
          this.Center = this.position;
          this.penetrate = -1;
          this.maxPenetrate = -1;
          this.Damage();
          this.penetrate = penetrate;
          this.position = this.Center;
          this.width = width;
          this.height = height;
          this.Center = this.position;
        }
      }
      if (this.type == 608)
      {
        this.maxPenetrate = -1;
        this.penetrate = -1;
        this.Damage();
        Main.PlaySound(SoundID.Item14, this.position);
        for (int index47 = 0; index47 < 4; ++index47)
        {
          int index48 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index48].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
        }
        for (int index49 = 0; index49 < 30; ++index49)
        {
          int index50 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 200, Scale: 3.7f);
          Main.dust[index50].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index50].noGravity = true;
          Main.dust[index50].velocity *= 3f;
          Main.dust[index50].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].ArmorSetDye(), Main.player[this.owner]);
          int index51 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
          Main.dust[index51].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index51].velocity *= 2f;
          Main.dust[index51].noGravity = true;
          Main.dust[index51].fadeIn = 2.5f;
          Main.dust[index51].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].ArmorSetDye(), Main.player[this.owner]);
        }
        for (int index52 = 0; index52 < 10; ++index52)
        {
          int index53 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Scale: 2.7f);
          Main.dust[index53].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index53].noGravity = true;
          Main.dust[index53].velocity *= 3f;
          Main.dust[index53].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].ArmorSetDye(), Main.player[this.owner]);
        }
        for (int index54 = 0; index54 < 10; ++index54)
        {
          int index55 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Scale: 1.5f);
          Main.dust[index55].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index55].noGravity = true;
          Main.dust[index55].velocity *= 3f;
        }
        for (int index56 = 0; index56 < 2; ++index56)
        {
          int index57 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index57].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.gore[index57].velocity *= 0.3f;
          Main.gore[index57].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index57].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
      }
      else if (this.type == 661)
      {
        this.position = this.Center;
        this.width = this.height = 160;
        this.Center = this.position;
        this.maxPenetrate = -1;
        this.penetrate = -1;
        this.Damage();
        Main.PlaySound(SoundID.Item14, this.position);
        Vector2 Position = this.Center + Vector2.One * -20f;
        int Width = 40;
        int Height = Width;
        for (int index58 = 0; index58 < 4; ++index58)
        {
          int index59 = Dust.NewDust(Position, Width, Height, 240, Alpha: 100, Scale: 1.5f);
          Main.dust[index59].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) Width / 2f;
        }
        for (int index60 = 0; index60 < 20; ++index60)
        {
          int index61 = Dust.NewDust(Position, Width, Height, 62, Alpha: 200, Scale: 3.7f);
          Main.dust[index61].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) Width / 2f;
          Main.dust[index61].noGravity = true;
          Main.dust[index61].noLight = true;
          Main.dust[index61].velocity *= 3f;
          Main.dust[index61].velocity += this.DirectionTo(Main.dust[index61].position) * (float) (2.0 + (double) Main.rand.NextFloat() * 4.0);
          int index62 = Dust.NewDust(Position, Width, Height, 62, Alpha: 100, Scale: 1.5f);
          Main.dust[index62].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) Width / 2f;
          Main.dust[index62].velocity *= 2f;
          Main.dust[index62].noGravity = true;
          Main.dust[index62].fadeIn = 1f;
          Main.dust[index62].color = Color.Crimson * 0.5f;
          Main.dust[index62].noLight = true;
          Main.dust[index62].velocity += this.DirectionTo(Main.dust[index62].position) * 8f;
        }
        for (int index63 = 0; index63 < 20; ++index63)
        {
          int index64 = Dust.NewDust(Position, Width, Height, 62, Scale: 2.7f);
          Main.dust[index64].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) Width / 2f;
          Main.dust[index64].noGravity = true;
          Main.dust[index64].noLight = true;
          Main.dust[index64].velocity *= 3f;
          Main.dust[index64].velocity += this.DirectionTo(Main.dust[index64].position) * 2f;
        }
        for (int index65 = 0; index65 < 70; ++index65)
        {
          int index66 = Dust.NewDust(Position, Width, Height, 240, Scale: 1.5f);
          Main.dust[index66].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) Width / 2f;
          Main.dust[index66].noGravity = true;
          Main.dust[index66].velocity *= 3f;
          Main.dust[index66].velocity += this.DirectionTo(Main.dust[index66].position) * 3f;
        }
      }
      else if (this.type == 617)
      {
        this.position = this.Center;
        this.width = this.height = 176;
        this.Center = this.position;
        this.maxPenetrate = -1;
        this.penetrate = -1;
        this.Damage();
        Main.PlaySound(SoundID.Item14, this.position);
        for (int index67 = 0; index67 < 4; ++index67)
        {
          int index68 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 240, Alpha: 100, Scale: 1.5f);
          Main.dust[index68].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
        }
        for (int index69 = 0; index69 < 30; ++index69)
        {
          int index70 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 62, Alpha: 200, Scale: 3.7f);
          Main.dust[index70].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index70].noGravity = true;
          Main.dust[index70].velocity *= 3f;
          int index71 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 90, Alpha: 100, Scale: 1.5f);
          Main.dust[index71].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index71].velocity *= 2f;
          Main.dust[index71].noGravity = true;
          Main.dust[index71].fadeIn = 1f;
          Main.dust[index71].color = Color.Crimson * 0.5f;
        }
        for (int index72 = 0; index72 < 10; ++index72)
        {
          int index73 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 62, Scale: 2.7f);
          Main.dust[index73].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index73].noGravity = true;
          Main.dust[index73].velocity *= 3f;
        }
        for (int index74 = 0; index74 < 10; ++index74)
        {
          int index75 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 240, Scale: 1.5f);
          Main.dust[index75].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index75].noGravity = true;
          Main.dust[index75].velocity *= 3f;
        }
        for (int index76 = 0; index76 < 2; ++index76)
        {
          int index77 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index77].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.gore[index77].velocity *= 0.3f;
          Main.gore[index77].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index77].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
        if (Main.myPlayer == this.owner)
        {
          for (int index = 0; index < 1000; ++index)
          {
            if (Main.projectile[index].active && Main.projectile[index].type == 618 && (double) Main.projectile[index].ai[1] == (double) this.whoAmI)
              Main.projectile[index].Kill();
          }
          int num14 = Main.rand.Next(5, 9);
          int num15 = Main.rand.Next(5, 9);
          int num16 = Utils.SelectRandom<int>(Main.rand, 86, 90);
          int num17 = num16 == 86 ? 90 : 86;
          for (int index = 0; index < num14; ++index)
          {
            Vector2 vector2_1 = this.Center + Utils.RandomVector2(Main.rand, -30f, 30f);
            Vector2 vector2_2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
            while ((double) vector2_2.X == 0.0 && (double) vector2_2.Y == 0.0)
              vector2_2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
            vector2_2.Normalize();
            if ((double) vector2_2.Y > 0.200000002980232)
              vector2_2.Y *= -1f;
            vector2_2 *= (float) Main.rand.Next(70, 101) * 0.1f;
            Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_2.X, vector2_2.Y, 620, (int) ((double) this.damage * 0.65), this.knockBack * 0.8f, this.owner, (float) num16);
          }
          for (int index = 0; index < num15; ++index)
          {
            Vector2 vector2_3 = this.Center + Utils.RandomVector2(Main.rand, -30f, 30f);
            Vector2 vector2_4 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
            while ((double) vector2_4.X == 0.0 && (double) vector2_4.Y == 0.0)
              vector2_4 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
            vector2_4.Normalize();
            if ((double) vector2_4.Y > 0.400000005960464)
              vector2_4.Y *= -1f;
            vector2_4 *= (float) Main.rand.Next(40, 81) * 0.1f;
            Projectile.NewProjectile(vector2_3.X, vector2_3.Y, vector2_4.X, vector2_4.Y, 620, (int) ((double) this.damage * 0.65), this.knockBack * 0.8f, this.owner, (float) num17);
          }
        }
      }
      else if (this.type == 658)
      {
        for (int index78 = 0; index78 < 10; ++index78)
        {
          int index79 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 269, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, Scale: 0.5f);
          if (Main.rand.Next(3) == 0)
          {
            Main.dust[index79].fadeIn = (float) (0.75 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
            Main.dust[index79].scale = (float) (0.25 + (double) Main.rand.Next(-10, 11) * 0.00499999988824129);
            ++Main.dust[index79].type;
          }
          else
            Main.dust[index79].scale = (float) (1.0 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
          Main.dust[index79].noGravity = true;
          Main.dust[index79].velocity *= 1.25f;
          Main.dust[index79].velocity -= this.oldVelocity / 10f;
        }
      }
      else if (this.type == 620 || this.type == 618)
      {
        if (this.type == 618)
          this.ai[0] = 86f;
        for (int index80 = 0; index80 < 10; ++index80)
        {
          int index81 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, (int) this.ai[0], this.velocity.X * 0.1f, this.velocity.Y * 0.1f, Scale: 0.5f);
          if (Main.rand.Next(3) == 0)
          {
            Main.dust[index81].fadeIn = (float) (0.75 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
            Main.dust[index81].scale = (float) (0.25 + (double) Main.rand.Next(-10, 11) * 0.00499999988824129);
            ++Main.dust[index81].type;
          }
          else
            Main.dust[index81].scale = (float) (1.0 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
          Main.dust[index81].noGravity = true;
          Main.dust[index81].velocity *= 1.25f;
          Main.dust[index81].velocity -= this.oldVelocity / 10f;
        }
      }
      else if (this.type == 619)
      {
        Main.PlaySound(SoundID.Item50, this.position);
        for (int index82 = 0; index82 < 20; ++index82)
        {
          int index83 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, (int) this.ai[0], this.velocity.X * 0.1f, this.velocity.Y * 0.1f, Scale: 0.5f);
          if (Main.rand.Next(3) == 0)
          {
            Main.dust[index83].fadeIn = (float) (1.10000002384186 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
            Main.dust[index83].scale = (float) (0.349999994039536 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
            ++Main.dust[index83].type;
          }
          else
            Main.dust[index83].scale = (float) (1.20000004768372 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
          Main.dust[index83].noGravity = true;
          Main.dust[index83].velocity *= 2.5f;
          Main.dust[index83].velocity -= this.oldVelocity / 10f;
        }
        if (Main.myPlayer == this.owner)
        {
          int num = Main.rand.Next(3, 6);
          for (int index = 0; index < num; ++index)
          {
            Vector2 vector2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
            while ((double) vector2.X == 0.0 && (double) vector2.Y == 0.0)
              vector2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
            vector2.Normalize();
            vector2 *= (float) Main.rand.Next(70, 101) * 0.1f;
            Projectile.NewProjectile(this.oldPosition.X + (float) (this.width / 2), this.oldPosition.Y + (float) (this.height / 2), vector2.X, vector2.Y, 620, (int) ((double) this.damage * 0.8), this.knockBack * 0.8f, this.owner, this.ai[0]);
          }
        }
      }
      if (this.type == 601)
      {
        Color portalColor = PortalHelper.GetPortalColor(this.owner, (int) this.ai[0]);
        portalColor.A = byte.MaxValue;
        for (int index = 0; index < 6; ++index)
        {
          Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * (3f * Main.rand.NextFloat());
          Dust dust = Main.dust[Dust.NewDust(this.Center, 0, 0, 263)];
          dust.position = this.Center;
          dust.velocity = vector2 + this.velocity / 5f;
          dust.color = portalColor;
          dust.scale = 2f;
          dust.noLight = true;
          dust.noGravity = true;
        }
      }
      if (this.type == 596)
      {
        this.position = this.Center;
        this.width = this.height = 60;
        this.Center = this.position;
        int num = 40;
        if (Main.expertMode)
          num = 30;
        this.damage = num;
        this.Damage();
        Main.PlaySound(SoundID.Item14, this.position);
        for (int index84 = 0; index84 < 4; ++index84)
        {
          int index85 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index85].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
        }
        for (int index86 = 0; index86 < 20; ++index86)
        {
          int index87 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, Scale: 2.5f);
          Main.dust[index87].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index87].noGravity = true;
          Main.dust[index87].velocity *= 2f;
        }
        for (int index88 = 0; index88 < 10; ++index88)
        {
          int index89 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Scale: 1.5f);
          Main.dust[index89].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index89].noGravity = true;
          Main.dust[index89].velocity *= 2f;
        }
      }
      if (this.type == 659)
      {
        if ((double) this.ai[0] >= 0.0)
        {
          this.position = this.Center;
          this.width = this.height = 40;
          this.Center = this.position;
          this.Damage();
          Main.PlaySound(SoundID.Item14, this.position);
          for (int index90 = 0; index90 < 2; ++index90)
          {
            int index91 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
            Main.dust[index91].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          }
          for (int index92 = 0; index92 < 10; ++index92)
          {
            int index93 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, Scale: 2.5f);
            Main.dust[index93].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
            Main.dust[index93].noGravity = true;
            Main.dust[index93].velocity *= 2f;
          }
          for (int index94 = 0; index94 < 5; ++index94)
          {
            int index95 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Scale: 1.5f);
            Main.dust[index95].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
            Main.dust[index95].noGravity = true;
            Main.dust[index95].velocity *= 2f;
          }
        }
      }
      else if (this.type >= 625 && this.type <= 628)
      {
        for (int index96 = 0; index96 < 6; ++index96)
        {
          int index97 = Dust.NewDust(this.position, this.width, this.height, 135, Alpha: 100, Scale: 2f);
          Main.dust[index97].noGravity = true;
          Main.dust[index97].noLight = true;
        }
      }
      if (this.type == 631)
      {
        int num = Main.rand.Next(5, 10);
        for (int index98 = 0; index98 < num; ++index98)
        {
          int index99 = Dust.NewDust(this.Center, 0, 0, 229, Alpha: 100);
          Main.dust[index99].velocity *= 1.6f;
          --Main.dust[index99].velocity.Y;
          Main.dust[index99].position -= Vector2.One * 4f;
          Main.dust[index99].position = Vector2.Lerp(Main.dust[index99].position, this.Center, 0.5f);
          Main.dust[index99].noGravity = true;
        }
      }
      if (this.type == 539)
      {
        this.position = this.Center;
        this.width = this.height = 80;
        this.Center = this.position;
        this.Damage();
        Main.PlaySound(4, (int) this.position.X, (int) this.position.Y, 7);
        for (int index100 = 0; index100 < 4; ++index100)
        {
          int index101 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index101].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
        }
        for (int index102 = 0; index102 < 20; ++index102)
        {
          int index103 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 176, Alpha: 200, Scale: 3.7f);
          Main.dust[index103].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index103].noGravity = true;
          Main.dust[index103].velocity *= 3f;
        }
        for (int index104 = 0; index104 < 20; ++index104)
        {
          int index105 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 180, Scale: 2.7f);
          Main.dust[index105].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index105].noGravity = true;
          Main.dust[index105].velocity *= 3f;
        }
        for (int index106 = 0; index106 < 10; ++index106)
        {
          int index107 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Scale: 1.5f);
          Main.dust[index107].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index107].noGravity = true;
          Main.dust[index107].velocity *= 3f;
        }
      }
      else if (this.type == 585)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 27);
        for (int index108 = 0; index108 < 20; ++index108)
        {
          int index109 = Dust.NewDust(this.position, this.width, this.height, 26, Alpha: 100);
          Main.dust[index109].noGravity = true;
          Main.dust[index109].velocity *= 1.2f;
          Main.dust[index109].scale = 1.3f;
          Main.dust[index109].velocity -= this.oldVelocity * 0.3f;
          int index110 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 27, Alpha: 100, Scale: 2f);
          Main.dust[index110].noGravity = true;
          Main.dust[index110].velocity *= 3f;
        }
      }
      else if (this.type == 590)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 27);
        for (int index111 = 0; index111 < 10; ++index111)
        {
          int index112 = Dust.NewDust(this.position, this.width, this.height, 165, Alpha: 50, Scale: 1.5f);
          Main.dust[index112].velocity *= 2f;
          Main.dust[index112].noGravity = true;
        }
        float Scale = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.400000005960464);
        int index113 = Gore.NewGore(this.position, Vector2.Zero, 375, Scale);
        Main.gore[index113].velocity *= 0.3f;
        int index114 = Gore.NewGore(this.position, Vector2.Zero, 376, Scale);
        Main.gore[index114].velocity *= 0.3f;
        int index115 = Gore.NewGore(this.position, Vector2.Zero, 377, Scale);
        Main.gore[index115].velocity *= 0.3f;
      }
      else if (this.type == 587)
      {
        Color rgb = Main.hslToRgb(this.ai[1], 1f, 0.5f);
        rgb.A = (byte) 200;
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index116 = 0; index116 < 10; ++index116)
        {
          int index117 = Dust.NewDust(this.position, this.width, this.height, 76, newColor: rgb);
          Main.dust[index117].noGravity = true;
          Main.dust[index117].velocity *= 1.2f;
          Main.dust[index117].scale = 0.9f;
          Main.dust[index117].velocity -= this.oldVelocity * 0.3f;
          int index118 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 76, newColor: rgb, Scale: 1.1f);
          Main.dust[index118].noGravity = true;
          Main.dust[index118].velocity *= 2f;
        }
      }
      else if (this.type == 572)
      {
        for (int index119 = 0; index119 < 15; ++index119)
        {
          int index120 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 40, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 100);
          Main.dust[index120].velocity *= 3f;
          Main.dust[index120].noGravity = true;
          Main.dust[index120].scale = 1.25f;
          Main.dust[index120].position = (this.Center + this.position) / 2f;
        }
      }
      else if (this.type == 581)
      {
        for (int index = 0; index < 30; ++index)
        {
          int Type = Utils.SelectRandom<int>(Main.rand, 229, 229, 161);
          Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type)];
          dust.noGravity = true;
          dust.scale = 1.25f + Main.rand.NextFloat();
          dust.fadeIn = 0.25f;
          dust.velocity *= 2f;
          dust.noLight = true;
        }
      }
      else if (this.type == 671)
      {
        for (int index = 0; index < 30; ++index)
        {
          int Type = Utils.SelectRandom<int>(Main.rand, 27, 27, 62);
          Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type)];
          dust.noGravity = true;
          dust.scale = 1.25f + Main.rand.NextFloat();
          dust.fadeIn = 0.25f;
          dust.velocity *= 2f;
          dust.noLight = true;
        }
      }
      else if (this.type == 675)
      {
        for (int index = 0; index < 40; ++index)
        {
          int Type = Utils.SelectRandom<int>(Main.rand, 27, 242, 73, 72, 71, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
          Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type)];
          dust.noGravity = true;
          dust.scale = 1.25f + Main.rand.NextFloat();
          dust.fadeIn = 0.25f;
          dust.velocity *= 3f;
          dust.noLight = true;
        }
      }
      else if (this.type == 676)
      {
        for (int index = 0; index < 120; ++index)
        {
          int Type = Utils.SelectRandom<int>(Main.rand, 4, 256);
          Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type, Alpha: 100)];
          dust.scale = (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.600000023841858);
          dust.fadeIn = 0.5f;
          dust.velocity *= 4.5f;
          dust.noLight = true;
          if ((double) dust.velocity.Y > 0.0)
            dust.velocity *= -0.5f;
          if (dust.type == 4)
            dust.color = new Color(80, 170, 40, 120);
        }
        for (int index = 0; index < 10; ++index)
          Gore.NewGoreDirect(this.Center, new Vector2(MathHelper.Lerp(-5f, 5f, Main.rand.NextFloat()), (float) (-(double) Main.rand.NextFloat() * 5.0)), 1024);
        for (int index = 0; index < 10; ++index)
          Gore.NewGoreDirect(this.Center, new Vector2(MathHelper.Lerp(-5f, 5f, Main.rand.NextFloat()), (float) (-(double) Main.rand.NextFloat() * 5.0)), 1025);
        for (int index = 0; index < 10; ++index)
          Gore.NewGoreDirect(this.Center, new Vector2(MathHelper.Lerp(-5f, 5f, Main.rand.NextFloat()), (float) (-(double) Main.rand.NextFloat() * 5.0)), 1026);
        for (int index = 0; index < 20; ++index)
          Gore.NewGoreDirect(this.Center, new Vector2(MathHelper.Lerp(-0.5f, 0.5f, Main.rand.NextFloat()), (float) (-(double) Main.rand.NextFloat() * 2.0)), 1026);
        if (Main.netMode != 2)
        {
          Player player = Main.player[Main.myPlayer];
          if (!player.dead && player.active && (double) (player.Center - this.Center).Length() < 300.0)
            player.AddBuff(197, 900, false);
        }
      }
      else if (this.type == 686)
      {
        Microsoft.Xna.Framework.Rectangle hitbox = this.Hitbox;
        for (int index121 = 0; index121 < this.oldPos.Length / 2; index121 += 2)
        {
          hitbox.X = (int) this.oldPos[index121].X;
          hitbox.Y = (int) this.oldPos[index121].Y;
          for (int index122 = 0; index122 < 3; ++index122)
          {
            int Type = Utils.SelectRandom<int>(Main.rand, 6, 55, 158);
            int index123 = Dust.NewDust(hitbox.TopLeft(), this.width, this.height, Type, (float) this.direction, -2.5f);
            Main.dust[index123].alpha = 200;
            Main.dust[index123].velocity *= 2.4f;
            Main.dust[index123].scale += Main.rand.NextFloat();
            Main.dust[index123].scale -= 0.5f;
            if (Main.dust[index123].type == 55)
              Main.dust[index123].color = Color.Lerp(Color.Red, Color.Gold, Main.rand.NextFloat());
            Main.dust[index123].noLight = true;
          }
        }
        for (int index124 = 10; index124 < this.oldPos.Length; index124 += 2)
        {
          hitbox.X = (int) this.oldPos[index124].X;
          hitbox.Y = (int) this.oldPos[index124].Y;
          for (int index125 = 0; index125 < 2; ++index125)
          {
            int Type = Utils.SelectRandom<int>(Main.rand, 55);
            int index126 = Dust.NewDust(hitbox.TopLeft(), this.width, this.height, Type, (float) this.direction, -2.5f);
            Main.dust[index126].alpha = 120;
            Main.dust[index126].velocity *= 2.4f;
            Main.dust[index126].scale += Main.rand.NextFloat() * 0.7f;
            Main.dust[index126].scale -= 0.5f;
            if (Main.dust[index126].type == 55)
              Main.dust[index126].color = Color.Lerp(Color.Purple, Color.Black, Main.rand.NextFloat());
            Main.dust[index126].noLight = true;
          }
        }
        for (int index127 = 5; index127 < this.oldPos.Length; ++index127)
        {
          hitbox.X = (int) this.oldPos[index127].X;
          hitbox.Y = (int) this.oldPos[index127].Y;
          for (int index128 = 0; index128 < 1; ++index128)
          {
            int Type = Utils.SelectRandom<int>(Main.rand, 55);
            int index129 = Dust.NewDust(hitbox.TopLeft(), this.width, this.height, Type, (float) this.direction, -2.5f);
            Main.dust[index129].alpha = 80;
            Main.dust[index129].velocity *= 0.3f;
            Main.dust[index129].velocity += this.velocity * 0.5f;
            Main.dust[index129].scale += Main.rand.NextFloat() * 0.7f;
            Main.dust[index129].scale -= 0.5f;
            if (Main.dust[index129].type == 55)
              Main.dust[index129].color = Color.Lerp(Color.Purple, Color.Black, Main.rand.NextFloat());
            Main.dust[index129].noLight = true;
          }
        }
        for (int index = 0; index < 30; ++index)
        {
          int Type = 228;
          Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type)];
          dust.noGravity = true;
          dust.scale = 1.25f + Main.rand.NextFloat();
          dust.fadeIn = 1.5f;
          dust.velocity *= 6f;
          dust.noLight = true;
        }
      }
      if (this.type == 405)
      {
        Main.PlaySound(SoundID.Item54, this.position);
        Vector2 center = this.Center;
        for (int index130 = 0; index130 < 20; ++index130)
        {
          int num = 10;
          int index131 = Dust.NewDust(this.Center - Vector2.One * (float) num, num * 2, num * 2, 212);
          Dust dust = Main.dust[index131];
          Vector2 vector2 = Vector2.Normalize(dust.position - this.Center);
          dust.position = this.Center + vector2 * (float) num * this.scale;
          dust.velocity = index130 >= 30 ? vector2 * (float) Main.rand.Next(45, 91) / 10f : vector2 * dust.velocity.Length();
          dust.color = Main.hslToRgb((float) (0.400000005960464 + Main.rand.NextDouble() * 0.200000002980232), 0.9f, 0.5f);
          dust.color = Color.Lerp(dust.color, Color.White, 0.3f);
          dust.noGravity = true;
          dust.scale = 0.7f;
        }
      }
      if (this.type == 501)
      {
        Main.PlaySound(13, (int) this.position.X, (int) this.position.Y);
        int num18 = 20;
        this.position.X -= (float) num18;
        this.position.Y -= (float) num18;
        this.width += num18 * 2;
        this.height += num18 * 2;
        int num19 = num18 + 20;
        for (int index132 = 0; index132 < 20; ++index132)
        {
          int index133 = Dust.NewDust(this.position, this.width, this.height, 188, Alpha: 100, Scale: 1.5f);
          Main.dust[index133].velocity *= 0.5f;
        }
        for (int index134 = 0; index134 < 5; ++index134)
        {
          int index135 = Gore.NewGore(new Vector2(this.position.X + (float) Main.rand.Next(this.width), this.position.Y + (float) Main.rand.Next(this.height)), new Vector2(), Main.rand.Next(435, 438));
          Main.gore[index135].velocity *= 0.5f;
          if (index134 == 0)
          {
            ++Main.gore[index135].velocity.X;
            ++Main.gore[index135].velocity.Y;
          }
          else if (index134 == 1)
          {
            --Main.gore[index135].velocity.X;
            ++Main.gore[index135].velocity.Y;
          }
          else if (index134 == 2)
          {
            ++Main.gore[index135].velocity.X;
            --Main.gore[index135].velocity.Y;
          }
          else
          {
            --Main.gore[index135].velocity.X;
            --Main.gore[index135].velocity.Y;
          }
          Main.gore[index135].velocity *= 0.5f;
        }
        this.position.X -= (float) num19;
        this.position.Y -= (float) num19;
        this.width += num19 * 2;
        this.height += num19 * 2;
        this.Damage();
      }
      if (this.type == 410)
      {
        Main.PlaySound(SoundID.Item54, this.position);
        Vector2 center = this.Center;
        for (int index136 = 0; index136 < 10; ++index136)
        {
          int num = (int) (10.0 * (double) this.ai[1]);
          int index137 = Dust.NewDust(this.Center - Vector2.One * (float) num, num * 2, num * 2, 212);
          Dust dust = Main.dust[index137];
          Vector2 vector2 = Vector2.Normalize(dust.position - this.Center);
          dust.position = this.Center + vector2 * (float) num * this.scale;
          dust.velocity = index136 >= 30 ? vector2 * (float) Main.rand.Next(45, 91) / 10f : vector2 * dust.velocity.Length();
          dust.color = Main.hslToRgb((float) (0.400000005960464 + Main.rand.NextDouble() * 0.200000002980232), 0.9f, 0.5f);
          dust.color = Color.Lerp(dust.color, Color.White, 0.3f);
          dust.noGravity = true;
          dust.scale = 0.7f;
        }
      }
      if (this.type == 629 && Main.netMode != 1)
      {
        switch (Main.npc[(int) this.ai[0]].type)
        {
          case 422:
            if (NPC.ShieldStrengthTowerVortex != 0)
              Main.npc[(int) this.ai[0]].ai[3] = 1f;
            NPC.ShieldStrengthTowerVortex = (int) MathHelper.Clamp((float) (NPC.ShieldStrengthTowerVortex - 1), 0.0f, (float) NPC.ShieldStrengthTowerMax);
            break;
          case 493:
            if (NPC.ShieldStrengthTowerStardust != 0)
              Main.npc[(int) this.ai[0]].ai[3] = 1f;
            NPC.ShieldStrengthTowerStardust = (int) MathHelper.Clamp((float) (NPC.ShieldStrengthTowerStardust - 1), 0.0f, (float) NPC.ShieldStrengthTowerMax);
            break;
          case 507:
            if (NPC.ShieldStrengthTowerNebula != 0)
              Main.npc[(int) this.ai[0]].ai[3] = 1f;
            NPC.ShieldStrengthTowerNebula = (int) MathHelper.Clamp((float) (NPC.ShieldStrengthTowerNebula - 1), 0.0f, (float) NPC.ShieldStrengthTowerMax);
            break;
          case 517:
            if (NPC.ShieldStrengthTowerSolar != 0)
              Main.npc[(int) this.ai[0]].ai[3] = 1f;
            NPC.ShieldStrengthTowerSolar = (int) MathHelper.Clamp((float) (NPC.ShieldStrengthTowerSolar - 1), 0.0f, (float) NPC.ShieldStrengthTowerMax);
            break;
        }
        Main.npc[(int) this.ai[0]].netUpdate = true;
        NetMessage.SendData(101);
      }
      if (this.aiStyle == 105 && this.owner == Main.myPlayer && (double) this.ai[1] == 0.0)
      {
        Vector2 vector2_5 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
        vector2_5.Normalize();
        Vector2 vector2_6 = vector2_5 * 0.3f;
        Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_6.X, vector2_6.Y, Main.rand.Next(569, 572), this.damage, 0.0f, this.owner);
      }
      if (this.type == 452)
      {
        Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 103);
        this.position = this.Center;
        this.width = this.height = 144;
        this.position.X -= (float) (this.width / 2);
        this.position.Y -= (float) (this.height / 2);
        for (int index = 0; index < 4; ++index)
          Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
        for (int index138 = 0; index138 < 40; ++index138)
        {
          int index139 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, Scale: 2.5f);
          Main.dust[index139].noGravity = true;
          Main.dust[index139].velocity *= 3f;
          int index140 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, Alpha: 100, Scale: 1.5f);
          Main.dust[index140].velocity *= 2f;
          Main.dust[index140].noGravity = true;
        }
        for (int index141 = 0; index141 < 1; ++index141)
        {
          int index142 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index142].velocity *= 0.3f;
          Main.gore[index142].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index142].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
        this.Damage();
      }
      if (this.type == 454)
      {
        Main.PlaySound(4, (int) this.position.X, (int) this.position.Y, 6);
        this.position = this.Center;
        this.width = this.height = 208;
        this.position.X -= (float) (this.width / 2);
        this.position.Y -= (float) (this.height / 2);
        for (int index143 = 0; index143 < 7; ++index143)
        {
          int index144 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index144].position = new Vector2((float) (this.width / 2), 0.0f).RotatedBy(6.28318548202515 * Main.rand.NextDouble()) * (float) Main.rand.NextDouble() + this.Center;
        }
        for (int index145 = 0; index145 < 60; ++index145)
        {
          int index146 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, Scale: 2.5f);
          Main.dust[index146].position = new Vector2((float) (this.width / 2), 0.0f).RotatedBy(6.28318548202515 * Main.rand.NextDouble()) * (float) Main.rand.NextDouble() + this.Center;
          Main.dust[index146].noGravity = true;
          Main.dust[index146].velocity *= 1f;
          int index147 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, Alpha: 100, Scale: 1.5f);
          Main.dust[index147].position = new Vector2((float) (this.width / 2), 0.0f).RotatedBy(6.28318548202515 * Main.rand.NextDouble()) * (float) Main.rand.NextDouble() + this.Center;
          Main.dust[index147].velocity *= 1f;
          Main.dust[index147].noGravity = true;
        }
        for (int index148 = 0; index148 < 3; ++index148)
        {
          int index149 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index149].velocity *= 0.3f;
          Main.gore[index149].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index149].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
        this.Damage();
      }
      if (this.type == 467)
      {
        this.position = this.Center;
        this.width = this.height = 176;
        this.Center = this.position;
        this.Damage();
        Main.PlaySound(SoundID.Item14, this.position);
        for (int index150 = 0; index150 < 4; ++index150)
        {
          int index151 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index151].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
        }
        for (int index152 = 0; index152 < 30; ++index152)
        {
          int index153 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 200, Scale: 3.7f);
          Main.dust[index153].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index153].noGravity = true;
          Main.dust[index153].velocity *= 3f;
          int index154 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
          Main.dust[index154].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index154].velocity *= 2f;
          Main.dust[index154].noGravity = true;
          Main.dust[index154].fadeIn = 2.5f;
        }
        for (int index155 = 0; index155 < 10; ++index155)
        {
          int index156 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Scale: 2.7f);
          Main.dust[index156].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index156].noGravity = true;
          Main.dust[index156].velocity *= 3f;
        }
        for (int index157 = 0; index157 < 10; ++index157)
        {
          int index158 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Scale: 1.5f);
          Main.dust[index158].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index158].noGravity = true;
          Main.dust[index158].velocity *= 3f;
        }
        for (int index159 = 0; index159 < 2; ++index159)
        {
          int index160 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index160].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.gore[index160].velocity *= 0.3f;
          Main.gore[index160].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index160].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
      }
      if (this.type == 468)
      {
        this.position = this.Center;
        this.width = this.height = 176;
        this.Center = this.position;
        this.Damage();
        Main.PlaySound(SoundID.Item14, this.position);
        for (int index161 = 0; index161 < 4; ++index161)
        {
          int index162 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index162].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
        }
        for (int index163 = 0; index163 < 20; ++index163)
        {
          int index164 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, Alpha: 200, Scale: 3.7f);
          Main.dust[index164].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index164].noGravity = true;
          Main.dust[index164].velocity *= 3f;
          int index165 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, Alpha: 100, Scale: 1.5f);
          Main.dust[index165].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.dust[index165].velocity *= 2f;
          Main.dust[index165].noGravity = true;
          Main.dust[index165].fadeIn = 2.5f;
        }
        for (int index166 = 0; index166 < 10; ++index166)
        {
          int index167 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, Scale: 2.7f);
          Main.dust[index167].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index167].noGravity = true;
          Main.dust[index167].velocity *= 3f;
        }
        for (int index168 = 0; index168 < 10; ++index168)
        {
          int index169 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Scale: 1.5f);
          Main.dust[index169].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
          Main.dust[index169].noGravity = true;
          Main.dust[index169].velocity *= 3f;
        }
        for (int index170 = 0; index170 < 2; ++index170)
        {
          int index171 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index171].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
          Main.gore[index171].velocity *= 0.3f;
          Main.gore[index171].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index171].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
      }
      if (this.type == 485)
      {
        for (int index172 = 0; index172 < 15; ++index172)
        {
          int index173 = Dust.NewDust(this.position, this.width, this.height, 6);
          Main.dust[index173].noGravity = true;
          Main.dust[index173].velocity -= this.oldVelocity * (float) Main.rand.Next(20, 60) * 0.01f;
        }
      }
      else if (this.type == 484)
      {
        for (int index174 = 0; index174 < 5; ++index174)
        {
          int index175 = Dust.NewDust(this.position, this.width, this.height, 78);
          Main.dust[index175].noGravity = true;
          Main.dust[index175].velocity -= this.oldVelocity / 5f;
          Main.dust[index175].scale = 0.85f;
        }
      }
      else if (this.type == 483)
      {
        Main.PlaySound(SoundID.Item14, this.position);
        if (this.owner == Main.myPlayer)
        {
          int length = Main.rand.Next(4, 8);
          int[] numArray = new int[length];
          int maxValue = 0;
          for (int index = 0; index < 200; ++index)
          {
            if (Main.npc[index].CanBeChasedBy((object) this, true) && Collision.CanHitLine(this.position, this.width, this.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
            {
              numArray[maxValue] = index;
              ++maxValue;
              if (maxValue == length)
                break;
            }
          }
          if (maxValue > 1)
          {
            for (int index176 = 0; index176 < 100; ++index176)
            {
              int index177 = Main.rand.Next(maxValue);
              int index178 = index177;
              while (index178 == index177)
                index178 = Main.rand.Next(maxValue);
              int num = numArray[index177];
              numArray[index177] = numArray[index178];
              numArray[index178] = num;
            }
          }
          Vector2 vector2_7 = new Vector2(-1f, -1f);
          for (int index = 0; index < maxValue; ++index)
          {
            Vector2 vector2_8 = Main.npc[numArray[index]].Center - this.Center;
            vector2_8.Normalize();
            vector2_7 += vector2_8;
          }
          vector2_7.Normalize();
          for (int index = 0; index < length; ++index)
          {
            float num = (float) Main.rand.Next(8, 15);
            Vector2 vector2_9 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
            vector2_9.Normalize();
            if (maxValue > 0)
            {
              vector2_9 += vector2_7;
              vector2_9.Normalize();
            }
            vector2_9 *= num;
            if (maxValue > 0)
            {
              --maxValue;
              vector2_9 = Main.npc[numArray[maxValue]].Center - this.Center;
              vector2_9.Normalize();
              vector2_9 *= num;
            }
            Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_9.X, vector2_9.Y, 484, (int) ((double) this.damage * 0.7), this.knockBack * 0.7f, this.owner);
          }
        }
        for (int index179 = 0; index179 < 20; ++index179)
        {
          int index180 = Dust.NewDust(this.position, this.width, this.height, 78);
          Main.dust[index180].noGravity = true;
          Main.dust[index180].velocity *= 4f;
        }
        for (int index181 = 0; index181 < 7; ++index181)
        {
          int index182 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index182].velocity *= 0.9f;
          Main.dust[index182].scale = 0.9f;
        }
        for (int index183 = 0; index183 < 3; ++index183)
        {
          int index184 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.5f);
          Main.dust[index184].noGravity = true;
          Main.dust[index184].velocity *= 3f;
          int index185 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
          Main.dust[index185].velocity *= 2f;
        }
        int index186 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
        Main.gore[index186].velocity *= 0.3f;
        Main.gore[index186].velocity.X += (float) Main.rand.Next(-1, 2);
        Main.gore[index186].velocity.Y += (float) Main.rand.Next(-1, 2);
        if (this.owner == Main.myPlayer)
        {
          int num = 100;
          this.position.X -= (float) (num / 2);
          this.position.Y -= (float) (num / 2);
          this.width += num;
          ++this.height;
          this.penetrate = -1;
          this.Damage();
        }
      }
      if (this.type == 523)
      {
        Main.PlaySound(SoundID.Item54, this.position);
        for (int index187 = 0; index187 < 25; ++index187)
        {
          int index188 = Dust.NewDust(this.position, this.width, this.height, 256);
          Main.dust[index188].noGravity = true;
          Main.dust[index188].position = (Main.dust[index188].position + this.position) / 2f;
          Main.dust[index188].velocity = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
          Main.dust[index188].velocity.Normalize();
          Main.dust[index188].velocity *= (float) Main.rand.Next(1, 30) * 0.1f;
          Main.dust[index188].alpha = this.alpha;
        }
      }
      else if (this.type == 522)
      {
        Main.PlaySound(SoundID.Item118, this.position);
        for (int index189 = 0; index189 < 10; ++index189)
        {
          int index190 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 254, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, Scale: 0.5f);
          if (Main.rand.Next(3) == 0)
          {
            Main.dust[index190].fadeIn = (float) (0.75 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
            Main.dust[index190].scale = (float) (0.25 + (double) Main.rand.Next(-10, 11) * 0.00499999988824129);
            ++Main.dust[index190].type;
          }
          else
            Main.dust[index190].scale = (float) (1.0 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
          Main.dust[index190].noGravity = true;
          Main.dust[index190].velocity *= 1.25f;
          Main.dust[index190].velocity -= this.oldVelocity / 10f;
        }
      }
      else if (this.type == 521)
      {
        Main.PlaySound(SoundID.Item110, this.position);
        for (int index191 = 0; index191 < 20; ++index191)
        {
          int index192 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 254, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, Scale: 0.5f);
          if (Main.rand.Next(3) == 0)
          {
            Main.dust[index192].fadeIn = (float) (1.10000002384186 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
            Main.dust[index192].scale = (float) (0.349999994039536 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
            ++Main.dust[index192].type;
          }
          else
            Main.dust[index192].scale = (float) (1.20000004768372 + (double) Main.rand.Next(-10, 11) * 0.00999999977648258);
          Main.dust[index192].noGravity = true;
          Main.dust[index192].velocity *= 2.5f;
          Main.dust[index192].velocity -= this.oldVelocity / 10f;
        }
        if (Main.myPlayer == this.owner)
        {
          int num = Main.rand.Next(3, 6);
          for (int index = 0; index < num; ++index)
          {
            Vector2 vector2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
            while ((double) vector2.X == 0.0 && (double) vector2.Y == 0.0)
              vector2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
            vector2.Normalize();
            vector2 *= (float) Main.rand.Next(70, 101) * 0.1f;
            Projectile.NewProjectile(this.oldPosition.X + (float) (this.width / 2), this.oldPosition.Y + (float) (this.height / 2), vector2.X, vector2.Y, 522, (int) ((double) this.damage * 0.8), this.knockBack * 0.8f, this.owner);
          }
        }
      }
      if (this.type == 520)
      {
        Main.PlaySound(SoundID.Item50, this.position);
        for (int index193 = 0; index193 < 10; ++index193)
        {
          int index194 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 252, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, Scale: 0.75f);
          Main.dust[index194].noGravity = true;
          Main.dust[index194].velocity -= this.oldVelocity / 3f;
        }
      }
      if (this.type == 459 || this.type == 709)
      {
        int num20 = 3;
        int num21 = 10;
        int num22 = 0;
        if ((double) this.scale >= 1.0)
        {
          this.position = this.Center;
          this.width = this.height = 144;
          this.Center = this.position;
          num20 = 7;
          num21 = 30;
          num22 = 2;
          this.Damage();
        }
        for (int index195 = 0; index195 < num20; ++index195)
        {
          int index196 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index196].position = new Vector2((float) (this.width / 2), 0.0f).RotatedBy(6.28318548202515 * Main.rand.NextDouble()) * (float) Main.rand.NextDouble() + this.Center;
        }
        for (int index197 = 0; index197 < num21; ++index197)
        {
          int index198 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 226, Scale: 1.5f);
          Main.dust[index198].position = new Vector2((float) (this.width / 2), 0.0f).RotatedBy(6.28318548202515 * Main.rand.NextDouble()) * (float) Main.rand.NextDouble() + this.Center;
          Main.dust[index198].noGravity = true;
          Main.dust[index198].velocity *= 1f;
        }
        for (int index199 = 0; index199 < num22; ++index199)
        {
          int index200 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index200].velocity *= 0.3f;
          Main.gore[index200].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index200].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
        if (this.type == 709 && Main.myPlayer == this.owner)
        {
          Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) this.Center.X - 40, (int) this.Center.Y - 40, 80, 80);
          for (int index = 0; index < 1000; ++index)
          {
            if (index != this.whoAmI && Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == 443 && Main.projectile[index].getRect().Intersects(rectangle))
            {
              Main.projectile[index].ai[1] = 1f;
              Main.projectile[index].velocity = (this.Center - Main.projectile[index].Center) / 5f;
              Main.projectile[index].netUpdate = true;
            }
          }
          int index201 = Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 443, this.damage, 0.0f, this.owner);
          Main.projectile[index201].timeLeft = 30 * Main.rand.Next(2, 6);
          float[] localAi = Main.projectile[index201].localAI;
          SlotId slotId = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_SkyDragonsFuryCircle, this.Center);
          double num23 = (double) ((SlotId) ref slotId).ToFloat();
          localAi[0] = (float) num23;
        }
      }
      if (this.owner != Main.myPlayer && this.type == 453 && Main.player[this.owner].mount.AbilityActive)
        Main.player[this.owner].mount.UseAbility(Main.player[this.owner], this.position, false);
      if (this.type == 441)
        Main.player[this.owner].mount.StopAbilityCharge();
      if (this.type == 444)
      {
        Main.PlaySound(SoundID.Item96, this.position);
        int num = Main.rand.Next(5, 9);
        for (int index202 = 0; index202 < num; ++index202)
        {
          int index203 = Dust.NewDust(this.Center, 0, 0, 171, Alpha: 100, Scale: 1.4f);
          Main.dust[index203].velocity *= 0.8f;
          Main.dust[index203].position = Vector2.Lerp(Main.dust[index203].position, this.Center, 0.5f);
          Main.dust[index203].noGravity = true;
        }
        if (this.owner == Main.myPlayer)
        {
          Vector2 vector2_10 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY);
          if ((double) Main.player[this.owner].gravDir == -1.0)
            vector2_10.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y;
          Vector2 vector2_11 = Vector2.Normalize(vector2_10 - this.Center) * this.localAI[1];
          Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_11.X, vector2_11.Y, (int) this.localAI[0], this.damage, this.knockBack, this.owner);
        }
      }
      if (this.type == 472)
      {
        for (int index204 = 0; index204 < 20; ++index204)
        {
          int index205 = Dust.NewDust(this.position, this.width, this.height, 30);
          Main.dust[index205].noGravity = true;
          Main.dust[index205].velocity *= 0.45f;
          Main.dust[index205].velocity += this.velocity * 0.9f;
        }
      }
      if (this.type == 639 || this.type == 640)
      {
        int num24 = Main.rand.Next(5, 10);
        for (int index206 = 0; index206 < num24; ++index206)
        {
          int index207 = Dust.NewDust(this.Center, 0, 0, 220, Alpha: 100, Scale: 0.5f);
          Main.dust[index207].velocity *= 1.6f;
          --Main.dust[index207].velocity.Y;
          Main.dust[index207].position = Vector2.Lerp(Main.dust[index207].position, this.Center, 0.5f);
          Main.dust[index207].noGravity = true;
        }
        if (this.owner == Main.myPlayer && this.type == 639)
        {
          int num25 = timeLeft + 1;
          int nextSlot = Projectile.GetNextSlot();
          if (Main.ProjectileUpdateLoopIndex < nextSlot && Main.ProjectileUpdateLoopIndex != -1)
            ++num25;
          Vector2 vector2 = new Vector2(this.ai[0], this.ai[1]);
          Projectile.NewProjectile(this.localAI[0], this.localAI[1], vector2.X, vector2.Y, 640, this.damage, this.knockBack, this.owner, ai1: ((float) num25));
        }
      }
      if (this.type == 684)
      {
        int num = Main.rand.Next(15, 25);
        for (int index208 = 0; index208 < num; ++index208)
        {
          int index209 = Dust.NewDust(this.Center, 0, 0, 60, Alpha: 100, newColor: new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), Scale: 1.3f);
          Main.dust[index209].velocity *= (float) (8.0 * (0.300000011920929 + 0.699999988079071 * (double) Main.rand.NextFloat()));
          Main.dust[index209].fadeIn = (float) (1.29999995231628 + (double) Main.rand.NextFloat() * 0.200000002980232);
          Main.dust[index209].noLight = true;
          Main.dust[index209].noGravity = true;
          Main.dust[index209].position += Main.dust[index209].velocity * 4f;
        }
      }
      if (this.type == 435)
      {
        int num = Main.rand.Next(5, 10);
        for (int index210 = 0; index210 < num; ++index210)
        {
          int index211 = Dust.NewDust(this.Center, 0, 0, 226, Alpha: 100, Scale: 0.5f);
          Main.dust[index211].velocity *= 1.6f;
          --Main.dust[index211].velocity.Y;
          Main.dust[index211].position = Vector2.Lerp(Main.dust[index211].position, this.Center, 0.5f);
          Main.dust[index211].noGravity = true;
        }
      }
      if (this.type == 682)
      {
        int num = 22;
        for (int index212 = 0; index212 < num; ++index212)
        {
          int index213 = Dust.NewDust(this.Center, 0, 0, 272, Scale: 0.5f);
          Main.dust[index213].velocity *= 1.6f;
          --Main.dust[index213].velocity.Y;
          Main.dust[index213].position = Vector2.Lerp(Main.dust[index213].position, this.Center, 0.5f);
        }
      }
      if (this.type == 436)
      {
        int num = Main.rand.Next(5, 10);
        for (int index214 = 0; index214 < num; ++index214)
        {
          int index215 = Dust.NewDust(this.Center, 0, 0, 220, Alpha: 100, Scale: 0.5f);
          Main.dust[index215].velocity *= 1.6f;
          --Main.dust[index215].velocity.Y;
          Main.dust[index215].position = Vector2.Lerp(Main.dust[index215].position, this.Center, 0.5f);
          Main.dust[index215].noGravity = true;
        }
      }
      if (this.type == 462)
      {
        int num = Main.rand.Next(5, 10);
        for (int index216 = 0; index216 < num; ++index216)
        {
          int index217 = Dust.NewDust(this.Center, 0, 0, 229, Alpha: 100, Scale: 0.5f);
          Main.dust[index217].velocity *= 1.6f;
          --Main.dust[index217].velocity.Y;
          Main.dust[index217].position -= Vector2.One * 4f;
          Main.dust[index217].position = Vector2.Lerp(Main.dust[index217].position, this.Center, 0.5f);
          Main.dust[index217].noGravity = true;
        }
      }
      if (this.type == 442)
      {
        Main.PlaySound(SoundID.Item94, this.position);
        int num = Main.rand.Next(3, 7);
        for (int index218 = 0; index218 < num; ++index218)
        {
          int index219 = Dust.NewDust(this.position, this.width, this.height, 135, Alpha: 100, Scale: 2.1f);
          Main.dust[index219].velocity *= 2f;
          Main.dust[index219].noGravity = true;
        }
        if (Main.myPlayer == this.owner)
        {
          Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) this.Center.X - 40, (int) this.Center.Y - 40, 80, 80);
          for (int index = 0; index < 1000; ++index)
          {
            if (index != this.whoAmI && Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == 443 && Main.projectile[index].getRect().Intersects(rectangle))
            {
              Main.projectile[index].ai[1] = 1f;
              Main.projectile[index].velocity = (this.Center - Main.projectile[index].Center) / 5f;
              Main.projectile[index].netUpdate = true;
            }
          }
          Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 443, this.damage, 0.0f, this.owner);
        }
      }
      if (this.type == 440)
      {
        int num = Main.rand.Next(3, 7);
        for (int index220 = 0; index220 < num; ++index220)
        {
          int index221 = Dust.NewDust(this.Center - this.velocity / 2f, 0, 0, 135, Alpha: 100, Scale: 2.1f);
          Main.dust[index221].velocity *= 2f;
          Main.dust[index221].noGravity = true;
        }
      }
      if (this.type == 606)
      {
        int num = Main.rand.Next(3, 7);
        for (int index222 = 0; index222 < num; ++index222)
        {
          int index223 = Dust.NewDust(this.Center - this.velocity / 2f, 0, 0, 182, Alpha: 100, Scale: 1.6f);
          Main.dust[index223].velocity *= 1.5f;
          Main.dust[index223].noGravity = true;
        }
      }
      if (this.type == 449)
      {
        int num = Main.rand.Next(3, 7);
        for (int index224 = 0; index224 < num; ++index224)
        {
          int index225 = Dust.NewDust(this.Center - this.velocity / 2f, 0, 0, 228, Alpha: 100, Scale: 2.1f);
          Main.dust[index225].velocity *= 2f;
          Main.dust[index225].noGravity = true;
        }
      }
      if (this.type == 495)
      {
        for (int index226 = 0; index226 < 15; ++index226)
        {
          int index227 = Dust.NewDust(this.Center, 10, 10, 27);
          Main.dust[index227].noGravity = true;
          Main.dust[index227].velocity -= this.oldVelocity * 0.3f;
        }
      }
      if (this.type == 497)
      {
        for (int index228 = 0; index228 < 15; ++index228)
        {
          int index229 = Dust.NewDust(this.Center, 10, 10, 27);
          Main.dust[index229].noGravity = true;
          Main.dust[index229].velocity *= 2f;
          Main.dust[index229].velocity -= this.oldVelocity * 0.3f;
          Main.dust[index229].scale += (float) Main.rand.Next(150) * (1f / 1000f);
        }
      }
      if (this.type == 448)
      {
        Main.PlaySound(SoundID.Item14, this.position);
        this.position = this.Center;
        this.width = this.height = 112;
        this.position.X -= (float) (this.width / 2);
        this.position.Y -= (float) (this.height / 2);
        for (int index = 0; index < 4; ++index)
          Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
        for (int index230 = 0; index230 < 40; ++index230)
        {
          int index231 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 228, Scale: 2.5f);
          Main.dust[index231].noGravity = true;
          Main.dust[index231].velocity *= 3f;
          int index232 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 228, Alpha: 100, Scale: 1.5f);
          Main.dust[index232].velocity *= 2f;
          Main.dust[index232].noGravity = true;
        }
        for (int index233 = 0; index233 < 1; ++index233)
        {
          int index234 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index234].velocity *= 0.3f;
          Main.gore[index234].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index234].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
        this.Damage();
      }
      if (this.type == 616)
      {
        Main.PlaySound(SoundID.Item14, this.position);
        this.position = this.Center;
        this.width = this.height = 80;
        this.position.X -= (float) (this.width / 2);
        this.position.Y -= (float) (this.height / 2);
        for (int index = 0; index < 4; ++index)
          Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
        for (int index235 = 0; index235 < 40; ++index235)
        {
          int index236 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, Alpha: 200, Scale: 2.5f);
          Main.dust[index236].noGravity = true;
          Main.dust[index236].velocity *= 2f;
          int index237 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, Alpha: 200, Scale: 1.5f);
          Main.dust[index237].velocity *= 1.2f;
          Main.dust[index237].noGravity = true;
        }
        for (int index238 = 0; index238 < 1; ++index238)
        {
          int index239 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index239].velocity *= 0.3f;
          Main.gore[index239].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index239].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
        this.Damage();
      }
      if (this.type == 502)
      {
        Vector2 vector2 = new Vector2((float) this.width, (float) this.height) / 2f;
        for (int index240 = 0; index240 < this.oldPos.Length; ++index240)
        {
          if (!(this.oldPos[index240] == Vector2.Zero))
          {
            int index241 = Dust.NewDust(this.oldPos[index240] + vector2, 0, 0, 66, Alpha: 150, newColor: Color.Transparent, Scale: 0.7f);
            Main.dust[index241].color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f);
            Main.dust[index241].noGravity = true;
          }
        }
      }
      if (this.type == 510)
      {
        Main.PlaySound(SoundID.Item107, this.position);
        Gore.NewGore(this.Center, -this.oldVelocity * 0.2f, 704);
        Gore.NewGore(this.Center, -this.oldVelocity * 0.2f, 705);
        if (this.owner == Main.myPlayer)
        {
          int num = Main.rand.Next(20, 31);
          for (int index = 0; index < num; ++index)
          {
            Vector2 vector2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
            vector2.Normalize();
            vector2 *= (float) Main.rand.Next(10, 201) * 0.01f;
            Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2.X, vector2.Y, 511 + Main.rand.Next(3), this.damage, 1f, this.owner, ai1: ((float) Main.rand.Next(-45, 1)));
          }
        }
      }
      if (this.type == 408)
      {
        for (int index242 = 0; index242 < 15; ++index242)
        {
          int index243 = Dust.NewDust(this.Center - Vector2.One * 10f, 50, 50, 5, SpeedY: -2f);
          Main.dust[index243].velocity /= 2f;
        }
        int num = 10;
        int index244 = Gore.NewGore(this.Center, this.velocity * 0.8f, 584);
        Main.gore[index244].timeLeft /= num;
        int index245 = Gore.NewGore(this.Center, this.velocity * 0.9f, 585);
        Main.gore[index245].timeLeft /= num;
        int index246 = Gore.NewGore(this.Center, this.velocity * 1f, 586);
        Main.gore[index246].timeLeft /= num;
      }
      if (this.type == 385)
      {
        Main.PlaySound(4, (int) this.Center.X, (int) this.Center.Y, 19);
        int num26 = 36;
        for (int index247 = 0; index247 < num26; ++index247)
        {
          Vector2 vector2_12 = (Vector2.Normalize(this.velocity) * new Vector2((float) this.width / 2f, (float) this.height) * 0.75f).RotatedBy((double) (index247 - (num26 / 2 - 1)) * 6.28318548202515 / (double) num26) + this.Center;
          Vector2 vector2_13 = vector2_12 - this.Center;
          int index248 = Dust.NewDust(vector2_12 + vector2_13, 0, 0, 172, vector2_13.X * 2f, vector2_13.Y * 2f, 100, Scale: 1.4f);
          Main.dust[index248].noGravity = true;
          Main.dust[index248].noLight = true;
          Main.dust[index248].velocity = vector2_13;
        }
        if (this.owner == Main.myPlayer)
        {
          if ((double) this.ai[1] < 1.0)
          {
            int index = Projectile.NewProjectile(this.Center.X - (float) (this.direction * 30), this.Center.Y - 4f, (float) -this.direction * 0.01f, 0.0f, 384, Main.expertMode ? 25 : 40, 4f, this.owner, 16f, 15f);
            Main.projectile[index].netUpdate = true;
          }
          else
          {
            int num27 = (int) ((double) this.Center.Y / 16.0);
            int index249 = (int) ((double) this.Center.X / 16.0);
            int num28 = 100;
            if (index249 < 10)
              index249 = 10;
            if (index249 > Main.maxTilesX - 10)
              index249 = Main.maxTilesX - 10;
            if (num27 < 10)
              num27 = 10;
            if (num27 > Main.maxTilesY - num28 - 10)
              num27 = Main.maxTilesY - num28 - 10;
            for (int index250 = num27; index250 < num27 + num28; ++index250)
            {
              Tile tile = Main.tile[index249, index250];
              if (tile.active() && (Main.tileSolid[(int) tile.type] || tile.liquid != (byte) 0))
              {
                num27 = index250;
                break;
              }
            }
            int Damage = Main.expertMode ? 50 : 80;
            int index251 = Projectile.NewProjectile((float) (index249 * 16 + 8), (float) (num27 * 16 - 24), 0.0f, 0.0f, 386, Damage, 4f, Main.myPlayer, 16f, 24f);
            Main.projectile[index251].netUpdate = true;
          }
        }
      }
      else if (this.type >= 424 && this.type <= 426)
      {
        Main.PlaySound(SoundID.Item89, this.position);
        this.position.X += (float) (this.width / 2);
        this.position.Y += (float) (this.height / 2);
        this.width = (int) (128.0 * (double) this.scale);
        this.height = (int) (128.0 * (double) this.scale);
        this.position.X -= (float) (this.width / 2);
        this.position.Y -= (float) (this.height / 2);
        for (int index = 0; index < 8; ++index)
          Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
        for (int index252 = 0; index252 < 32; ++index252)
        {
          int index253 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.5f);
          Main.dust[index253].noGravity = true;
          Main.dust[index253].velocity *= 3f;
          int index254 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
          Main.dust[index254].velocity *= 2f;
          Main.dust[index254].noGravity = true;
        }
        for (int index255 = 0; index255 < 2; ++index255)
        {
          int index256 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index256].velocity *= 0.3f;
          Main.gore[index256].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
          Main.gore[index256].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
        }
        if (this.owner == Main.myPlayer)
        {
          this.localAI[1] = -1f;
          this.maxPenetrate = 0;
          this.Damage();
        }
        for (int index257 = 0; index257 < 5; ++index257)
        {
          int index258 = Dust.NewDust(this.position, this.width, this.height, Utils.SelectRandom<int>(Main.rand, 6, 259, 158), 2.5f * (float) this.direction, -2.5f);
          Main.dust[index258].alpha = 200;
          Main.dust[index258].velocity *= 2.4f;
          Main.dust[index258].scale += Main.rand.NextFloat();
        }
      }
      if (this.type == 399)
      {
        Main.PlaySound(13, (int) this.position.X, (int) this.position.Y);
        Vector2 vector2 = new Vector2(20f, 20f);
        for (int index = 0; index < 5; ++index)
          Dust.NewDust(this.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 12, newColor: Color.Red);
        for (int index259 = 0; index259 < 10; ++index259)
        {
          int index260 = Dust.NewDust(this.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, Alpha: 100, Scale: 1.5f);
          Main.dust[index260].velocity *= 1.4f;
        }
        for (int index261 = 0; index261 < 20; ++index261)
        {
          int index262 = Dust.NewDust(this.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 6, Alpha: 100, Scale: 2.5f);
          Main.dust[index262].noGravity = true;
          Main.dust[index262].velocity *= 5f;
          int index263 = Dust.NewDust(this.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 6, Alpha: 100, Scale: 1.5f);
          Main.dust[index263].velocity *= 3f;
        }
        if (Main.myPlayer == this.owner)
        {
          for (int index = 0; index < 6; ++index)
          {
            float SpeedX = (float) (-(double) this.velocity.X * (double) Main.rand.Next(20, 50) * 0.00999999977648258 + (double) Main.rand.Next(-20, 21) * 0.400000005960464);
            float SpeedY = (float) (-(double) Math.Abs(this.velocity.Y) * (double) Main.rand.Next(30, 50) * 0.00999999977648258 + (double) Main.rand.Next(-20, 5) * 0.400000005960464);
            Projectile.NewProjectile(this.Center.X + SpeedX, this.Center.Y + SpeedY, SpeedX, SpeedY, 400 + Main.rand.Next(3), (int) ((double) this.damage * 0.5), 0.0f, this.owner);
          }
        }
      }
      if (this.type == 384 || this.type == 386)
      {
        for (int index264 = 0; index264 < 20; ++index264)
        {
          int index265 = Dust.NewDust(this.position, this.width, this.height, 212, (float) (this.direction * 2), Alpha: 100, Scale: 1.4f);
          Dust dust = Main.dust[index265];
          dust.color = Color.CornflowerBlue;
          dust.color = Color.Lerp(dust.color, Color.White, 0.3f);
          dust.noGravity = true;
        }
      }
      if (this.type == 507 || this.type == 508)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        Vector2 position = this.position;
        Vector2 oldVelocity = this.oldVelocity;
        oldVelocity.Normalize();
        Vector2 Position = position + oldVelocity * 16f;
        for (int index266 = 0; index266 < 20; ++index266)
        {
          int index267 = Dust.NewDust(Position, this.width, this.height, 81);
          Main.dust[index267].position = (Main.dust[index267].position + this.Center) / 2f;
          Main.dust[index267].velocity += this.oldVelocity * 0.4f;
          Main.dust[index267].velocity *= 0.5f;
          Main.dust[index267].noGravity = true;
          Position -= oldVelocity * 8f;
        }
      }
      if (this.type == 598)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        Vector2 position = this.position;
        Vector2 rotationVector2 = (this.rotation - 1.570796f).ToRotationVector2();
        Vector2 Position = position + rotationVector2 * 16f;
        for (int index268 = 0; index268 < 20; ++index268)
        {
          int index269 = Dust.NewDust(Position, this.width, this.height, 81);
          Main.dust[index269].position = (Main.dust[index269].position + this.Center) / 2f;
          Main.dust[index269].velocity += rotationVector2 * 2f;
          Main.dust[index269].velocity *= 0.5f;
          Main.dust[index269].noGravity = true;
          Position -= rotationVector2 * 8f;
        }
      }
      if (this.type == 1 || this.type == 81 || this.type == 98)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index = 0; index < 10; ++index)
          Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 7);
      }
      if (this.type == 336 || this.type == 345)
      {
        for (int index270 = 0; index270 < 6; ++index270)
        {
          int index271 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 196);
          Main.dust[index271].noGravity = true;
          Main.dust[index271].scale = this.scale;
        }
      }
      if (this.type == 358)
      {
        this.velocity = this.oldVelocity * 0.2f;
        for (int index272 = 0; index272 < 100; ++index272)
        {
          int index273 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 211, Alpha: 75, Scale: 1.2f);
          if (Main.rand.Next(2) == 0)
            Main.dust[index273].alpha += 25;
          if (Main.rand.Next(2) == 0)
            Main.dust[index273].alpha += 25;
          if (Main.rand.Next(2) == 0)
            Main.dust[index273].alpha += 25;
          if (Main.rand.Next(2) == 0)
            Main.dust[index273].scale = 0.6f;
          else
            Main.dust[index273].noGravity = true;
          Main.dust[index273].velocity *= 0.3f;
          Main.dust[index273].velocity += this.velocity;
          Main.dust[index273].velocity *= (float) (1.0 + (double) Main.rand.Next(-100, 101) * 0.00999999977648258);
          Main.dust[index273].velocity.X += (float) Main.rand.Next(-50, 51) * 0.015f;
          Main.dust[index273].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.015f;
          Main.dust[index273].position = this.Center;
        }
      }
      if (this.type == 406)
      {
        int Alpha = 175;
        Color newColor = new Color(0, 80, (int) byte.MaxValue, 100);
        this.velocity = this.oldVelocity * 0.2f;
        for (int index274 = 0; index274 < 40; ++index274)
        {
          int index275 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 4, Alpha: Alpha, newColor: newColor, Scale: 1.6f);
          if (Main.rand.Next(2) == 0)
            Main.dust[index275].alpha += 25;
          if (Main.rand.Next(2) == 0)
            Main.dust[index275].alpha += 25;
          if (Main.rand.Next(2) == 0)
            Main.dust[index275].alpha += 25;
          if (Main.rand.Next(2) == 0)
            Main.dust[index275].scale = 0.6f;
          else
            Main.dust[index275].noGravity = true;
          Main.dust[index275].velocity *= 0.3f;
          Main.dust[index275].velocity += this.velocity;
          Main.dust[index275].velocity *= (float) (1.0 + (double) Main.rand.Next(-100, 101) * 0.00999999977648258);
          Main.dust[index275].velocity.X += (float) Main.rand.Next(-50, 51) * 0.015f;
          Main.dust[index275].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.015f;
          Main.dust[index275].position = this.Center;
        }
      }
      if (this.type == 344)
      {
        for (int index276 = 0; index276 < 3; ++index276)
        {
          int index277 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 197);
          Main.dust[index277].noGravity = true;
          Main.dust[index277].scale = this.scale;
        }
      }
      else if (this.type == 343)
      {
        Main.PlaySound(SoundID.Item27, this.position);
        for (int index278 = 4; index278 < 31; ++index278)
        {
          int index279 = Dust.NewDust(new Vector2(this.oldPosition.X - this.oldVelocity.X * (30f / (float) index278), this.oldPosition.Y - this.oldVelocity.Y * (30f / (float) index278)), 8, 8, 197, this.oldVelocity.X, this.oldVelocity.Y, 100, Scale: 1.2f);
          Main.dust[index279].noGravity = true;
          Main.dust[index279].velocity *= 0.5f;
        }
      }
      else if (this.type == 349)
      {
        Main.PlaySound(SoundID.Item27, this.position);
        for (int index280 = 0; index280 < 3; ++index280)
        {
          int index281 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 76);
          Main.dust[index281].noGravity = true;
          Main.dust[index281].noLight = true;
          Main.dust[index281].scale = 0.7f;
        }
      }
      if (this.type == 323)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index282 = 0; index282 < 20; ++index282)
        {
          int index283 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 7);
          if (Main.rand.Next(2) == 0)
          {
            Main.dust[index283].noGravity = true;
            Main.dust[index283].scale = 1.3f;
            Main.dust[index283].velocity *= 1.5f;
            Main.dust[index283].velocity -= this.oldVelocity * 0.5f;
            Main.dust[index283].velocity *= 1.5f;
          }
          else
          {
            Main.dust[index283].velocity *= 0.75f;
            Main.dust[index283].velocity -= this.oldVelocity * 0.25f;
            Main.dust[index283].scale = 0.8f;
          }
        }
      }
      if (this.type == 589)
      {
        Main.PlaySound(SoundID.Item27, this.position);
        Color newColor = Color.Red;
        if ((double) this.ai[1] == 1.0)
          newColor = Color.Green;
        if ((double) this.ai[1] == 2.0)
          newColor = Color.Purple;
        if ((double) this.ai[1] == 3.0)
          newColor = Color.Gold;
        if ((double) this.ai[1] == 4.0)
          newColor = Color.White;
        newColor.A = (byte) 100;
        for (int index284 = 0; index284 < 30; ++index284)
        {
          int index285 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 11, newColor: newColor);
          Main.dust[index285].velocity *= (float) (1.0 + (double) Main.rand.NextFloat() * 1.0);
          if (index284 < 10)
          {
            Main.dust[index285].noGravity = true;
            Main.dust[index285].velocity *= 0.5f;
          }
        }
      }
      if (this.type == 346)
      {
        Main.PlaySound(SoundID.Item27, this.position);
        for (int index286 = 0; index286 < 10; ++index286)
        {
          int Type = 10;
          if ((double) this.ai[1] == 1.0)
            Type = 4;
          int index287 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, Type);
          Main.dust[index287].noGravity = true;
        }
      }
      if (this.type == 335)
      {
        Main.PlaySound(SoundID.Item27, this.position);
        for (int index288 = 0; index288 < 10; ++index288)
        {
          int index289 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 90 - (int) this.ai[1]);
          Main.dust[index289].noLight = true;
          Main.dust[index289].scale = 0.8f;
        }
      }
      if (this.type == 318)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index290 = 0; index290 < 10; ++index290)
        {
          int index291 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 30);
          if (Main.rand.Next(2) == 0)
            Main.dust[index291].noGravity = true;
        }
      }
      if (this.type == 378)
      {
        for (int index292 = 0; index292 < 10; ++index292)
        {
          int index293 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 30);
          if (Main.rand.Next(2) == 0)
            Main.dust[index293].noGravity = true;
        }
      }
      else if (this.type == 311)
      {
        for (int index294 = 0; index294 < 5; ++index294)
        {
          int index295 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 189);
          Main.dust[index295].scale = 0.85f;
          Main.dust[index295].noGravity = true;
          Main.dust[index295].velocity += this.velocity * 0.5f;
        }
      }
      else if (this.type == 316)
      {
        for (int index296 = 0; index296 < 5; ++index296)
        {
          int index297 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 195);
          Main.dust[index297].scale = 0.85f;
          Main.dust[index297].noGravity = true;
          Main.dust[index297].velocity += this.velocity * 0.5f;
        }
      }
      else if (this.type == 184 || this.type == 195)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index = 0; index < 5; ++index)
          Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 7);
      }
      else if (this.type == 275 || this.type == 276)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index = 0; index < 5; ++index)
          Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 7);
      }
      else if (this.type == 291)
      {
        if (this.owner == Main.myPlayer)
          Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 292, this.damage, this.knockBack, this.owner);
      }
      else if (this.type == 295)
      {
        if (this.owner == Main.myPlayer)
          Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 296, (int) ((double) this.damage * 0.65), this.knockBack, this.owner);
      }
      else if (this.type == 270)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 27);
        if ((double) this.ai[0] < 0.0)
        {
          for (int index298 = 0; index298 < 20; ++index298)
          {
            int index299 = Dust.NewDust(this.position, this.width, this.height, 26, Alpha: 100);
            Main.dust[index299].noGravity = true;
            Main.dust[index299].velocity *= 1.2f;
            Main.dust[index299].scale = 1.3f;
            Main.dust[index299].velocity -= this.oldVelocity * 0.3f;
            int index300 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 5, Alpha: 100, Scale: 1.5f);
            Main.dust[index300].noGravity = true;
            Main.dust[index300].velocity *= 3f;
          }
        }
        else
        {
          for (int index301 = 0; index301 < 20; ++index301)
          {
            int index302 = Dust.NewDust(this.position, this.width, this.height, 26, Alpha: 100);
            Main.dust[index302].noGravity = true;
            Main.dust[index302].velocity *= 1.2f;
            Main.dust[index302].scale = 1.3f;
            Main.dust[index302].velocity -= this.oldVelocity * 0.3f;
            int index303 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 6, Alpha: 100, Scale: 2f);
            Main.dust[index303].noGravity = true;
            Main.dust[index303].velocity *= 3f;
          }
        }
      }
      else if (this.type == 265)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 27);
        for (int index304 = 0; index304 < 15; ++index304)
        {
          int index305 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 163, Alpha: 100, Scale: 1.2f);
          Main.dust[index305].noGravity = true;
          Main.dust[index305].velocity *= 1.2f;
          Main.dust[index305].velocity -= this.oldVelocity * 0.3f;
        }
      }
      else if (this.type == 355)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 27);
        for (int index306 = 0; index306 < 15; ++index306)
        {
          int index307 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 205, Alpha: 100, Scale: 1.2f);
          Main.dust[index307].noGravity = true;
          Main.dust[index307].velocity *= 1.2f;
          Main.dust[index307].velocity -= this.oldVelocity * 0.3f;
        }
      }
      else if (this.type == 304)
      {
        for (int index308 = 0; index308 < 3; ++index308)
        {
          int index309 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 182, Alpha: 100, Scale: 0.8f);
          Main.dust[index309].noGravity = true;
          Main.dust[index309].velocity *= 1.2f;
          Main.dust[index309].velocity -= this.oldVelocity * 0.3f;
        }
      }
      else if (this.type == 263)
      {
        Main.PlaySound(SoundID.Item27, this.position);
        for (int index310 = 0; index310 < 15; ++index310)
        {
          int index311 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 92, this.velocity.X, this.velocity.Y, Main.rand.Next(0, 101), Scale: ((float) (1.0 + (double) Main.rand.Next(40) * 0.00999999977648258)));
          Main.dust[index311].noGravity = true;
          Main.dust[index311].velocity *= 2f;
        }
      }
      else if (this.type == 261)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index = 0; index < 5; ++index)
          Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 148);
      }
      else if (this.type == 229)
      {
        for (int index312 = 0; index312 < 25; ++index312)
        {
          int index313 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 157);
          Main.dust[index313].noGravity = true;
          Main.dust[index313].velocity *= 1.5f;
          Main.dust[index313].scale = 1.5f;
        }
      }
      else if (this.type == 239)
      {
        int index = Dust.NewDust(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 2.0)), 2, 2, 154);
        Main.dust[index].position.X -= 2f;
        Main.dust[index].alpha = 38;
        Main.dust[index].velocity *= 0.1f;
        Main.dust[index].velocity += -this.oldVelocity * 0.25f;
        Main.dust[index].scale = 0.95f;
      }
      else if (this.type == 245)
      {
        int index = Dust.NewDust(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 2.0)), 2, 2, 114);
        Main.dust[index].noGravity = true;
        Main.dust[index].position.X -= 2f;
        Main.dust[index].alpha = 38;
        Main.dust[index].velocity *= 0.1f;
        Main.dust[index].velocity += -this.oldVelocity * 0.25f;
        Main.dust[index].scale = 0.95f;
      }
      else if (this.type == 264)
      {
        int index = Dust.NewDust(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 2.0)), 2, 2, 54);
        Main.dust[index].noGravity = true;
        Main.dust[index].position.X -= 2f;
        Main.dust[index].alpha = 38;
        Main.dust[index].velocity *= 0.1f;
        Main.dust[index].velocity += -this.oldVelocity * 0.25f;
        Main.dust[index].scale = 0.95f;
      }
      else if (this.type == 206 || this.type == 225)
      {
        Main.PlaySound(6, (int) this.position.X, (int) this.position.Y);
        for (int index = 0; index < 5; ++index)
          Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 40);
      }
      else if (this.type == 227)
      {
        Main.PlaySound(6, (int) this.position.X, (int) this.position.Y);
        for (int index314 = 0; index314 < 15; ++index314)
        {
          int index315 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 157);
          Main.dust[index315].noGravity = true;
          Main.dust[index315].velocity += this.oldVelocity;
          Main.dust[index315].scale = 1.5f;
        }
      }
      else if (this.type == 237 && this.owner == Main.myPlayer)
        Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 238, this.damage, this.knockBack, this.owner);
      else if (this.type == 243 && this.owner == Main.myPlayer)
        Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 244, this.damage, this.knockBack, this.owner);
      else if (this.type == 120)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index316 = 0; index316 < 10; ++index316)
        {
          int index317 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 67, this.velocity.X, this.velocity.Y, 100);
          if (index316 < 5)
            Main.dust[index317].noGravity = true;
          Main.dust[index317].velocity *= 0.2f;
        }
      }
      else if (this.type == 181 || this.type == 189 || this.type == 566)
      {
        for (int index318 = 0; index318 < 6; ++index318)
        {
          int index319 = Dust.NewDust(this.position, this.width, this.height, 150, this.velocity.X, this.velocity.Y, 50);
          Main.dust[index319].noGravity = true;
          Main.dust[index319].scale = 1f;
        }
      }
      else if (this.type == 178)
      {
        for (int index320 = 0; index320 < 85; ++index320)
        {
          int index321 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, Main.rand.Next(139, 143), this.velocity.X, this.velocity.Y, Scale: 1.2f);
          Main.dust[index321].velocity.X += (float) Main.rand.Next(-50, 51) * 0.01f;
          Main.dust[index321].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.01f;
          Main.dust[index321].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
          Main.dust[index321].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
          Main.dust[index321].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f;
          Main.dust[index321].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f;
          Main.dust[index321].scale *= (float) (1.0 + (double) Main.rand.Next(-30, 31) * 0.00999999977648258);
        }
        for (int index322 = 0; index322 < 40; ++index322)
        {
          int index323 = Gore.NewGore(this.position, this.velocity, Main.rand.Next(276, 283));
          Main.gore[index323].velocity.X += (float) Main.rand.Next(-50, 51) * 0.01f;
          Main.gore[index323].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.01f;
          Main.gore[index323].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
          Main.gore[index323].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
          Main.gore[index323].scale *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258);
          Main.gore[index323].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f;
          Main.gore[index323].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f;
        }
      }
      else if (this.type == 289)
      {
        for (int index324 = 0; index324 < 30; ++index324)
        {
          int index325 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, Main.rand.Next(139, 143), this.velocity.X, this.velocity.Y, Scale: 1.2f);
          Main.dust[index325].velocity.X += (float) Main.rand.Next(-50, 51) * 0.01f;
          Main.dust[index325].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.01f;
          Main.dust[index325].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
          Main.dust[index325].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
          Main.dust[index325].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f;
          Main.dust[index325].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f;
          Main.dust[index325].scale *= (float) (1.0 + (double) Main.rand.Next(-30, 31) * 0.00999999977648258);
        }
        for (int index326 = 0; index326 < 15; ++index326)
        {
          int index327 = Gore.NewGore(this.position, this.velocity, Main.rand.Next(276, 283));
          Main.gore[index327].velocity.X += (float) Main.rand.Next(-50, 51) * 0.01f;
          Main.gore[index327].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.01f;
          Main.gore[index327].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
          Main.gore[index327].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
          Main.gore[index327].scale *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258);
          Main.gore[index327].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f;
          Main.gore[index327].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f;
        }
      }
      else if (this.type == 475 || this.type == 505 || this.type == 506)
      {
        if ((double) this.ai[1] == 0.0)
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        if ((double) this.ai[1] < 10.0)
        {
          Vector2 Position = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
          float num29 = -this.velocity.X;
          float num30 = -this.velocity.Y;
          float num31 = 1f;
          if ((double) this.ai[0] <= 17.0)
            num31 = this.ai[0] / 17f;
          int num32 = (int) (30.0 * (double) num31);
          float num33 = 1f;
          if ((double) this.ai[0] <= 30.0)
            num33 = this.ai[0] / 30f;
          float num34 = 0.4f * num33;
          float num35 = num34;
          float num36 = num30 + num35;
          for (int index328 = 0; index328 < num32; ++index328)
          {
            float num37 = (float) Math.Sqrt((double) num29 * (double) num29 + (double) num36 * (double) num36);
            float num38 = 5.6f;
            if ((double) Math.Abs(num29) + (double) Math.Abs(num36) < 1.0)
              num38 *= Math.Abs(num29) + Math.Abs(num36) / 1f;
            float num39 = num38 / num37;
            float num40 = num29 * num39;
            float num41 = num36 * num39;
            Math.Atan2((double) num41, (double) num40);
            int Type = 3;
            if (this.type == 506)
              Type = 30;
            if (this.type == 505)
              Type = 239;
            if ((double) index328 > (double) this.ai[1])
            {
              for (int index329 = 0; index329 < 4; ++index329)
              {
                int index330 = Dust.NewDust(Position, this.width, this.height, Type);
                Main.dust[index330].noGravity = true;
                Main.dust[index330].velocity *= 0.3f;
              }
            }
            Position.X += num40;
            Position.Y += num41;
            num29 = -this.velocity.X;
            float num42 = -this.velocity.Y;
            num35 += num34;
            num36 = num42 + num35;
          }
        }
      }
      else if (this.type == 171)
      {
        if ((double) this.ai[1] == 0.0)
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        if ((double) this.ai[1] < 10.0)
        {
          Vector2 Position = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
          float num43 = -this.velocity.X;
          float num44 = -this.velocity.Y;
          float num45 = 1f;
          if ((double) this.ai[0] <= 17.0)
            num45 = this.ai[0] / 17f;
          int num46 = (int) (30.0 * (double) num45);
          float num47 = 1f;
          if ((double) this.ai[0] <= 30.0)
            num47 = this.ai[0] / 30f;
          float num48 = 0.4f * num47;
          float num49 = num48;
          float num50 = num44 + num49;
          for (int index331 = 0; index331 < num46; ++index331)
          {
            float num51 = (float) Math.Sqrt((double) num43 * (double) num43 + (double) num50 * (double) num50);
            float num52 = 5.6f;
            if ((double) Math.Abs(num43) + (double) Math.Abs(num50) < 1.0)
              num52 *= Math.Abs(num43) + Math.Abs(num50) / 1f;
            float num53 = num52 / num51;
            float num54 = num43 * num53;
            float num55 = num50 * num53;
            Math.Atan2((double) num55, (double) num54);
            if ((double) index331 > (double) this.ai[1])
            {
              for (int index332 = 0; index332 < 4; ++index332)
              {
                int index333 = Dust.NewDust(Position, this.width, this.height, 129);
                Main.dust[index333].noGravity = true;
                Main.dust[index333].velocity *= 0.3f;
              }
            }
            Position.X += num54;
            Position.Y += num55;
            num43 = -this.velocity.X;
            float num56 = -this.velocity.Y;
            num49 += num48;
            num50 = num56 + num49;
          }
        }
      }
      else if (this.type == 117)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index = 0; index < 10; ++index)
          Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 26);
      }
      else if (this.type == 166)
      {
        Main.PlaySound(SoundID.Item51, this.position);
        for (int index334 = 0; index334 < 10; ++index334)
        {
          int index335 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 76);
          Main.dust[index335].noGravity = true;
          Main.dust[index335].velocity -= this.oldVelocity * 0.25f;
        }
      }
      else if (this.type == 158)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index336 = 0; index336 < 10; ++index336)
        {
          int index337 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 9);
          Main.dust[index337].noGravity = true;
          Main.dust[index337].velocity -= this.velocity * 0.5f;
        }
      }
      else if (this.type == 159)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index338 = 0; index338 < 10; ++index338)
        {
          int index339 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 11);
          Main.dust[index339].noGravity = true;
          Main.dust[index339].velocity -= this.velocity * 0.5f;
        }
      }
      else if (this.type == 160)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index340 = 0; index340 < 10; ++index340)
        {
          int index341 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 19);
          Main.dust[index341].noGravity = true;
          Main.dust[index341].velocity -= this.velocity * 0.5f;
        }
      }
      else if (this.type == 161)
      {
        Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
        for (int index342 = 0; index342 < 10; ++index342)
        {
          int index343 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 11);
          Main.dust[index343].noGravity = true;
          Main.dust[index343].velocity -= this.velocity * 0.5f;
        }
      }
      else if (this.type >= 191 && this.type <= 194)
      {
        int index = Gore.NewGore(new Vector2(this.position.X - (float) (this.width / 2), this.position.Y - (float) (this.height / 2)), new Vector2(0.0f, 0.0f), Main.rand.Next(61, 64), this.scale);
        Main.gore[index].velocity *= 0.1f;
      }
      else if (!Main.projPet[this.type])
      {
        if (this.type == 93)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index344 = 0; index344 < 10; ++index344)
          {
            int index345 = Dust.NewDust(this.position, this.width, this.height, 57, Alpha: 100, Scale: 0.5f);
            Main.dust[index345].velocity.X *= 2f;
            Main.dust[index345].velocity.Y *= 2f;
          }
        }
        else if (this.type == 99)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index346 = 0; index346 < 30; ++index346)
          {
            int index347 = Dust.NewDust(this.position, this.width, this.height, 1);
            if (Main.rand.Next(2) == 0)
              Main.dust[index347].scale *= 1.4f;
            this.velocity = this.velocity * 1.9f;
          }
        }
        else if (this.type == 655)
        {
          Main.PlaySound(4, (int) this.position.X, (int) this.position.Y);
          for (int index348 = 0; index348 < 30; ++index348)
          {
            int index349 = Dust.NewDust(this.position, this.width, this.height, 147);
            if (Main.rand.Next(2) == 0)
              Main.dust[index349].scale *= 1.4f;
            this.velocity = this.velocity * 1.9f;
          }
          if (Main.netMode != 1 && !this.wet)
          {
            int num = 2;
            if (Main.rand.Next(3) == 0)
              ++num;
            if (Main.rand.Next(3) == 0)
              ++num;
            if (Main.rand.Next(3) == 0)
              ++num;
            for (int index350 = 0; index350 < num; ++index350)
            {
              int index351 = NPC.NewNPC((int) this.Center.X, (int) this.Center.Y, Main.rand.Next(210, 212), 1);
              Main.npc[index351].velocity.X = (float) Main.rand.Next(-200, 201) * (1f / 500f);
              Main.npc[index351].velocity.Y = (float) Main.rand.Next(-200, 201) * (1f / 500f);
              Main.npc[index351].netUpdate = true;
            }
            if (Main.rand.Next(4) == 0)
            {
              int index = NPC.NewNPC((int) this.Center.X, (int) this.Center.Y, 42, 1);
              Main.npc[index].SetDefaults(-16);
              Main.npc[index].velocity.X = (float) Main.rand.Next(-200, 201) * (1f / 1000f);
              Main.npc[index].velocity.Y = (float) Main.rand.Next(-200, 201) * (1f / 1000f);
              Main.npc[index].netUpdate = true;
            }
          }
        }
        else if (this.type == 91 || this.type == 92)
        {
          Main.PlaySound(SoundID.Item10, this.position);
          for (int index = 0; index < 10; ++index)
            Dust.NewDust(this.position, this.width, this.height, 58, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 150, Scale: 1.2f);
          for (int index = 0; index < 3; ++index)
            Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(16, 18));
          if (this.type == 12 && this.damage < 500)
          {
            for (int index = 0; index < 10; ++index)
              Dust.NewDust(this.position, this.width, this.height, 57, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 150, Scale: 1.2f);
            for (int index = 0; index < 3; ++index)
              Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(16, 18));
          }
          if ((this.type == 91 || this.type == 92 && (double) this.ai[0] > 0.0) && this.owner == Main.myPlayer)
          {
            float num57 = this.position.X + (float) Main.rand.Next(-400, 400);
            float num58 = this.position.Y - (float) Main.rand.Next(600, 900);
            Vector2 vector2 = new Vector2(num57, num58);
            float num59 = this.position.X + (float) (this.width / 2) - vector2.X;
            float num60 = this.position.Y + (float) (this.height / 2) - vector2.Y;
            float num61 = 22f / (float) Math.Sqrt((double) num59 * (double) num59 + (double) num60 * (double) num60);
            float SpeedX = num59 * num61;
            float SpeedY = num60 * num61;
            int damage = this.damage;
            int index = Projectile.NewProjectile(num57, num58, SpeedX, SpeedY, 92, damage, this.knockBack, this.owner);
            if (this.type == 91)
            {
              Main.projectile[index].ai[1] = this.position.Y;
              Main.projectile[index].ai[0] = 1f;
            }
            else
              Main.projectile[index].ai[1] = this.position.Y;
          }
        }
        else if (this.type == 89)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index352 = 0; index352 < 5; ++index352)
          {
            int index353 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 68);
            Main.dust[index353].noGravity = true;
            Main.dust[index353].velocity *= 1.5f;
            Main.dust[index353].scale *= 0.9f;
          }
          if (this.type == 89 && this.owner == Main.myPlayer)
          {
            for (int index = 0; index < 3; ++index)
            {
              float SpeedX = (float) (-(double) this.velocity.X * (double) Main.rand.Next(40, 70) * 0.00999999977648258 + (double) Main.rand.Next(-20, 21) * 0.400000005960464);
              float SpeedY = (float) (-(double) this.velocity.Y * (double) Main.rand.Next(40, 70) * 0.00999999977648258 + (double) Main.rand.Next(-20, 21) * 0.400000005960464);
              Projectile.NewProjectile(this.position.X + SpeedX, this.position.Y + SpeedY, SpeedX, SpeedY, 90, (int) ((double) this.damage * 0.5), 0.0f, this.owner);
            }
          }
        }
        else if (this.type == 177)
        {
          for (int index354 = 0; index354 < 20; ++index354)
          {
            int index355 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 137, Alpha: Main.rand.Next(0, 101), Scale: ((float) (1.0 + (double) Main.rand.Next(-20, 40) * 0.00999999977648258)));
            Main.dust[index355].velocity -= this.oldVelocity * 0.2f;
            if (Main.rand.Next(3) == 0)
            {
              Main.dust[index355].scale *= 0.8f;
              Main.dust[index355].velocity *= 0.5f;
            }
            else
              Main.dust[index355].noGravity = true;
          }
        }
        else if (this.type == 119 || this.type == 118 || this.type == 128 || this.type == 359)
        {
          int num = 10;
          if (this.type == 119 || this.type == 359)
            num = 20;
          Main.PlaySound(SoundID.Item27, this.position);
          for (int index356 = 0; index356 < num; ++index356)
          {
            int index357 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 92);
            if (Main.rand.Next(3) != 0)
            {
              Main.dust[index357].velocity *= 2f;
              Main.dust[index357].noGravity = true;
              Main.dust[index357].scale *= 1.75f;
            }
            else
              Main.dust[index357].scale *= 0.5f;
          }
        }
        else if (this.type == 309)
        {
          int num = 10;
          Main.PlaySound(SoundID.Item27, this.position);
          for (int index358 = 0; index358 < num; ++index358)
          {
            int index359 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 185);
            if (Main.rand.Next(2) == 0)
            {
              Main.dust[index359].velocity *= 2f;
              Main.dust[index359].noGravity = true;
              Main.dust[index359].scale *= 1.75f;
            }
          }
        }
        else if (this.type == 308)
        {
          int num = 80;
          Main.PlaySound(SoundID.Item27, this.position);
          for (int index360 = 0; index360 < num; ++index360)
          {
            int index361 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 16f), this.width, this.height - 16, 185);
            Main.dust[index361].velocity *= 2f;
            Main.dust[index361].noGravity = true;
            Main.dust[index361].scale *= 1.15f;
          }
        }
        else if (this.aiStyle == 29 && this.type <= 126)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          int Type = this.type - 121 + 86;
          for (int index362 = 0; index362 < 15; ++index362)
          {
            int index363 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, Type, this.oldVelocity.X, this.oldVelocity.Y, 50, Scale: 1.2f);
            Main.dust[index363].noGravity = true;
            Main.dust[index363].scale *= 1.25f;
            Main.dust[index363].velocity *= 0.5f;
          }
        }
        else if (this.type == 597)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index364 = 0; index364 < 15; ++index364)
          {
            int index365 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 262, this.oldVelocity.X, this.oldVelocity.Y, 50, Scale: 1.2f);
            Main.dust[index365].noGravity = true;
            Main.dust[index365].scale *= 1.25f;
            Main.dust[index365].velocity *= 0.5f;
          }
        }
        else if (this.type == 337)
        {
          Main.PlaySound(SoundID.Item27, this.position);
          for (int index366 = 0; index366 < 10; ++index366)
          {
            int index367 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 197);
            Main.dust[index367].noGravity = true;
          }
        }
        else if (this.type == 379 || this.type == 377)
        {
          for (int index368 = 0; index368 < 5; ++index368)
          {
            int index369 = Dust.NewDust(this.position, this.width, this.height, 171, Alpha: 100);
            Main.dust[index369].scale = (float) Main.rand.Next(1, 10) * 0.1f;
            Main.dust[index369].noGravity = true;
            Main.dust[index369].fadeIn = 1.5f;
            Main.dust[index369].velocity *= 0.75f;
          }
        }
        else if (this.type == 80)
        {
          if ((double) this.ai[0] >= 0.0)
          {
            Main.PlaySound(SoundID.Item27, this.position);
            for (int index = 0; index < 10; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67);
          }
          int i = (int) this.position.X / 16;
          int j = (int) this.position.Y / 16;
          if (Main.tile[i, j] == null)
            Main.tile[i, j] = new Tile();
          if (Main.tile[i, j].type == (ushort) sbyte.MaxValue && Main.tile[i, j].active())
            WorldGen.KillTile(i, j);
        }
        else if (this.type == 76 || this.type == 77 || this.type == 78)
        {
          for (int index370 = 0; index370 < 5; ++index370)
          {
            int index371 = Dust.NewDust(this.position, this.width, this.height, 27, Alpha: 80, Scale: 1.5f);
            Main.dust[index371].noGravity = true;
          }
        }
        else if (this.type == 55)
        {
          for (int index372 = 0; index372 < 5; ++index372)
          {
            int index373 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 18, Scale: 1.5f);
            Main.dust[index373].noGravity = true;
          }
        }
        else if (this.type == 51 || this.type == 267)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index = 0; index < 5; ++index)
            Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0, Scale: 0.7f);
        }
        else if (this.type == 478)
        {
          if (this.owner == Main.myPlayer)
            Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 480, (int) ((double) this.damage * 0.8), this.knockBack * 0.5f, this.owner);
        }
        else if (this.type == 477 || this.type == 479)
        {
          int num = 0;
          while (num < 5)
            ++num;
          Collision.HitTiles(this.position, this.velocity, this.width, this.height);
        }
        else if (this.type == 2 || this.type == 82)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index = 0; index < 10; ++index)
            Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100);
        }
        else if (this.type == 474)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index = 0; index < 20; ++index)
            Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 26, Scale: 0.9f);
        }
        else if (this.type == 172)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index = 0; index < 20; ++index)
            Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, Alpha: 100);
        }
        else if (this.type == 103)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index374 = 0; index374 < 20; ++index374)
          {
            int index375 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 75, Alpha: 100);
            if (Main.rand.Next(2) == 0)
            {
              Main.dust[index375].scale *= 2.5f;
              Main.dust[index375].noGravity = true;
              Main.dust[index375].velocity *= 5f;
            }
          }
        }
        else if (this.type == 278)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index376 = 0; index376 < 20; ++index376)
          {
            int index377 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 169, Alpha: 100);
            if (Main.rand.Next(2) == 0)
            {
              Main.dust[index377].scale *= 1.5f;
              Main.dust[index377].noGravity = true;
              Main.dust[index377].velocity *= 5f;
            }
          }
        }
        else if (this.type == 3 || this.type == 48 || this.type == 54 || this.type == 599)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index = 0; index < 10; ++index)
            Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 1, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, Scale: 0.75f);
        }
        else if (this.type == 330)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index = 0; index < 10; ++index)
            Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, Scale: 0.75f);
        }
        else if (this.type == 4)
        {
          Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
          for (int index = 0; index < 10; ++index)
            Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, Alpha: 150, Scale: 1.1f);
        }
        else if (this.type == 5)
        {
          Main.PlaySound(SoundID.Item10, this.position);
          for (int index = 0; index < 60; ++index)
          {
            int Type;
            switch (Main.rand.Next(3))
            {
              case 0:
                Type = 15;
                break;
              case 1:
                Type = 57;
                break;
              default:
                Type = 58;
                break;
            }
            Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, Scale: 1.5f);
          }
        }
        else if (this.type == 9 || this.type == 12 || this.type == 503)
        {
          Main.PlaySound(SoundID.Item10, this.position);
          int num62 = 10;
          int num63 = 3;
          if (this.type == 503)
          {
            num62 = 40;
            num63 = 2;
            this.velocity = this.velocity / 2f;
          }
          for (int index = 0; index < num62; ++index)
            Dust.NewDust(this.position, this.width, this.height, 58, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 150, Scale: 1.2f);
          for (int index = 0; index < num63; ++index)
          {
            int Type = Main.rand.Next(16, 18);
            if (this.type == 503)
              Type = 16;
            Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Type);
          }
          if (this.type == 12 && this.damage < 100)
          {
            for (int index = 0; index < 10; ++index)
              Dust.NewDust(this.position, this.width, this.height, 57, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 150, Scale: 1.2f);
            for (int index = 0; index < 3; ++index)
              Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(16, 18));
          }
        }
        else if (this.type == 281)
        {
          Main.PlaySound(4, (int) this.position.X, (int) this.position.Y);
          int index378 = Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-20, 21) * 0.2f, (float) Main.rand.Next(-20, 21) * 0.2f), 76);
          Main.gore[index378].velocity -= this.velocity * 0.5f;
          int index379 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2((float) Main.rand.Next(-20, 21) * 0.2f, (float) Main.rand.Next(-20, 21) * 0.2f), 77);
          Main.gore[index379].velocity -= this.velocity * 0.5f;
          Main.PlaySound(SoundID.Item14, this.position);
          for (int index380 = 0; index380 < 20; ++index380)
          {
            int index381 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
            Main.dust[index381].velocity *= 1.4f;
          }
          for (int index382 = 0; index382 < 10; ++index382)
          {
            int index383 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.5f);
            Main.dust[index383].noGravity = true;
            Main.dust[index383].velocity *= 5f;
            int index384 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
            Main.dust[index384].velocity *= 3f;
          }
          int index385 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index385].velocity *= 0.4f;
          ++Main.gore[index385].velocity.X;
          ++Main.gore[index385].velocity.Y;
          int index386 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index386].velocity *= 0.4f;
          --Main.gore[index386].velocity.X;
          ++Main.gore[index386].velocity.Y;
          int index387 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index387].velocity *= 0.4f;
          ++Main.gore[index387].velocity.X;
          --Main.gore[index387].velocity.Y;
          int index388 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index388].velocity *= 0.4f;
          --Main.gore[index388].velocity.X;
          --Main.gore[index388].velocity.Y;
          this.position.X += (float) (this.width / 2);
          this.position.Y += (float) (this.height / 2);
          this.width = 128;
          this.height = 128;
          this.position.X -= (float) (this.width / 2);
          this.position.Y -= (float) (this.height / 2);
          this.Damage();
        }
        else if (this.type == 162)
        {
          Main.PlaySound(SoundID.Item14, this.position);
          for (int index389 = 0; index389 < 20; ++index389)
          {
            int index390 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
            Main.dust[index390].velocity *= 1.4f;
          }
          for (int index391 = 0; index391 < 10; ++index391)
          {
            int index392 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.5f);
            Main.dust[index392].noGravity = true;
            Main.dust[index392].velocity *= 5f;
            int index393 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
            Main.dust[index393].velocity *= 3f;
          }
          int index394 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index394].velocity *= 0.4f;
          ++Main.gore[index394].velocity.X;
          ++Main.gore[index394].velocity.Y;
          int index395 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index395].velocity *= 0.4f;
          --Main.gore[index395].velocity.X;
          ++Main.gore[index395].velocity.Y;
          int index396 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index396].velocity *= 0.4f;
          ++Main.gore[index396].velocity.X;
          --Main.gore[index396].velocity.Y;
          int index397 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index397].velocity *= 0.4f;
          --Main.gore[index397].velocity.X;
          --Main.gore[index397].velocity.Y;
          this.position.X += (float) (this.width / 2);
          this.position.Y += (float) (this.height / 2);
          this.width = 128;
          this.height = 128;
          this.position.X -= (float) (this.width / 2);
          this.position.Y -= (float) (this.height / 2);
          this.Damage();
        }
        else if (this.type == 240)
        {
          Main.PlaySound(SoundID.Item14, this.position);
          for (int index398 = 0; index398 < 20; ++index398)
          {
            int index399 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
            Main.dust[index399].velocity *= 1.4f;
          }
          for (int index400 = 0; index400 < 10; ++index400)
          {
            int index401 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.5f);
            Main.dust[index401].noGravity = true;
            Main.dust[index401].velocity *= 5f;
            int index402 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
            Main.dust[index402].velocity *= 3f;
          }
          int index403 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index403].velocity *= 0.4f;
          ++Main.gore[index403].velocity.X;
          ++Main.gore[index403].velocity.Y;
          int index404 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index404].velocity *= 0.4f;
          --Main.gore[index404].velocity.X;
          ++Main.gore[index404].velocity.Y;
          int index405 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index405].velocity *= 0.4f;
          ++Main.gore[index405].velocity.X;
          --Main.gore[index405].velocity.Y;
          int index406 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
          Main.gore[index406].velocity *= 0.4f;
          --Main.gore[index406].velocity.X;
          --Main.gore[index406].velocity.Y;
          this.position.X += (float) (this.width / 2);
          this.position.Y += (float) (this.height / 2);
          this.width = 96;
          this.height = 96;
          this.position.X -= (float) (this.width / 2);
          this.position.Y -= (float) (this.height / 2);
          this.Damage();
        }
        else
        {
          int type = this.type;
          if (this.type == 283 || this.type == 282)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index407 = 0; index407 < 10; ++index407)
            {
              int index408 = Dust.NewDust(this.position, this.width, this.height, 171, Alpha: 100);
              Main.dust[index408].scale = (float) Main.rand.Next(1, 10) * 0.1f;
              Main.dust[index408].noGravity = true;
              Main.dust[index408].fadeIn = 1.5f;
              Main.dust[index408].velocity *= 0.75f;
            }
          }
          else if (this.type == 284)
          {
            for (int index409 = 0; index409 < 10; ++index409)
            {
              int index410 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, Main.rand.Next(139, 143), (float) (-(double) this.velocity.X * 0.300000011920929), (float) (-(double) this.velocity.Y * 0.300000011920929), Scale: 1.2f);
              Main.dust[index410].velocity.X += (float) Main.rand.Next(-50, 51) * 0.01f;
              Main.dust[index410].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.01f;
              Main.dust[index410].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
              Main.dust[index410].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
              Main.dust[index410].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f;
              Main.dust[index410].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f;
              Main.dust[index410].scale *= (float) (1.0 + (double) Main.rand.Next(-30, 31) * 0.00999999977648258);
            }
            for (int index411 = 0; index411 < 5; ++index411)
            {
              int index412 = Gore.NewGore(this.position, -this.velocity * 0.3f, Main.rand.Next(276, 283));
              Main.gore[index412].velocity.X += (float) Main.rand.Next(-50, 51) * 0.01f;
              Main.gore[index412].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.01f;
              Main.gore[index412].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
              Main.gore[index412].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
              Main.gore[index412].scale *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258);
              Main.gore[index412].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f;
              Main.gore[index412].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f;
            }
          }
          else if (this.type == 286)
          {
            Main.PlaySound(SoundID.Item14, this.position);
            for (int index = 0; index < 7; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
            for (int index413 = 0; index413 < 3; ++index413)
            {
              int index414 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.5f);
              Main.dust[index414].noGravity = true;
              Main.dust[index414].velocity *= 3f;
              int index415 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
              Main.dust[index415].velocity *= 2f;
            }
            int index416 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), new Vector2(), Main.rand.Next(61, 64));
            Main.gore[index416].velocity *= 0.3f;
            Main.gore[index416].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
            Main.gore[index416].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
            if (this.owner == Main.myPlayer)
            {
              this.localAI[1] = -1f;
              this.maxPenetrate = 0;
              this.position.X += (float) (this.width / 2);
              this.position.Y += (float) (this.height / 2);
              this.width = 80;
              this.height = 80;
              this.position.X -= (float) (this.width / 2);
              this.position.Y -= (float) (this.height / 2);
              this.Damage();
            }
          }
          else if (this.type == 14 || this.type == 20 || this.type == 36 || this.type == 83 || this.type == 84 || this.type == 389 || this.type == 104 || this.type == 279 || this.type == 100 || this.type == 110 || this.type == 180 || this.type == 207 || this.type == 357 || this.type == 242 || this.type == 302 || this.type == 257 || this.type == 259 || this.type == 285 || this.type == 287 || this.type == 576 || this.type == 577)
          {
            Collision.HitTiles(this.position, this.velocity, this.width, this.height);
            Main.PlaySound(SoundID.Item10, this.position);
          }
          else if (this.type == 660)
          {
            Collision.HitTiles(this.position, this.velocity, this.width, this.height);
            Main.PlaySound(SoundID.Item10, this.position);
            int num = Main.rand.Next(4, 10);
            for (int index417 = 0; index417 < num; ++index417)
            {
              int index418 = Dust.NewDust(this.Center, 0, 0, 180, Alpha: 100);
              Main.dust[index418].velocity *= 1.6f;
              --Main.dust[index418].velocity.Y;
              Main.dust[index418].velocity += -this.velocity * (float) ((double) Main.rand.NextFloat() * 2.0 - 1.0) * 0.5f;
              Main.dust[index418].scale = 2f;
              Main.dust[index418].fadeIn = 0.5f;
              Main.dust[index418].noGravity = true;
            }
          }
          else if (this.type == 712)
          {
            Collision.HitTiles(this.position, this.velocity, this.width, this.height);
            Main.PlaySound(SoundID.Item10, this.position);
            int num = Main.rand.Next(6, 12);
            for (int index419 = 0; index419 < num; ++index419)
            {
              int index420 = Dust.NewDust(this.Center, 0, 0, 15, Alpha: 100);
              Main.dust[index420].velocity *= 1.6f;
              --Main.dust[index420].velocity.Y;
              Main.dust[index420].velocity += -this.velocity * (float) ((double) Main.rand.NextFloat() * 2.0 - 1.0) * 0.5f;
              Main.dust[index420].scale = 1f;
              Main.dust[index420].fadeIn = 1.5f;
              Main.dust[index420].noGravity = true;
              Main.dust[index420].color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * 0.3f;
              Main.dust[index420].velocity *= 0.7f;
              Main.dust[index420].position += Main.dust[index420].velocity * 5f;
            }
            for (int index = 0; index < 3; ++index)
              Gore.NewGoreDirect(this.position, Vector2.Zero, 1008, (float) (1.0 + (double) Main.rand.NextFloatDirection() * 0.200000002980232)).velocity *= 4f;
          }
          else if (this.type == 638)
          {
            Collision.HitTiles(this.position, this.velocity, this.width, this.height);
            Main.PlaySound(SoundID.Item10, this.position);
            int num = Main.rand.Next(2, 5);
            for (int index421 = 0; index421 < num; ++index421)
            {
              int index422 = Dust.NewDust(this.Center, 0, 0, 229, Alpha: 100);
              Main.dust[index422].velocity *= 1.6f;
              --Main.dust[index422].velocity.Y;
              Main.dust[index422].position -= Vector2.One * 4f;
              Main.dust[index422].position = Vector2.Lerp(Main.dust[index422].position, this.Center, 0.5f);
              Main.dust[index422].noGravity = true;
            }
          }
          else if (this.type == 15 || this.type == 34 || this.type == 321)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index423 = 0; index423 < 20; ++index423)
            {
              int index424 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, (float) (-(double) this.velocity.X * 0.200000002980232), (float) (-(double) this.velocity.Y * 0.200000002980232), 100, Scale: 2f);
              Main.dust[index424].noGravity = true;
              Main.dust[index424].velocity *= 2f;
              int index425 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, (float) (-(double) this.velocity.X * 0.200000002980232), (float) (-(double) this.velocity.Y * 0.200000002980232), 100);
              Main.dust[index425].velocity *= 2f;
            }
          }
          else if (this.type == 253)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index426 = 0; index426 < 20; ++index426)
            {
              int index427 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, (float) (-(double) this.velocity.X * 0.200000002980232), (float) (-(double) this.velocity.Y * 0.200000002980232), 100, Scale: 2f);
              Main.dust[index427].noGravity = true;
              Main.dust[index427].velocity *= 2f;
              int index428 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, (float) (-(double) this.velocity.X * 0.200000002980232), (float) (-(double) this.velocity.Y * 0.200000002980232), 100);
              Main.dust[index428].velocity *= 2f;
            }
          }
          else if (this.type == 95 || this.type == 96)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index429 = 0; index429 < 20; ++index429)
            {
              int index430 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 75, (float) (-(double) this.velocity.X * 0.200000002980232), (float) (-(double) this.velocity.Y * 0.200000002980232), 100, Scale: (2f * this.scale));
              Main.dust[index430].noGravity = true;
              Main.dust[index430].velocity *= 2f;
              int index431 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 75, (float) (-(double) this.velocity.X * 0.200000002980232), (float) (-(double) this.velocity.Y * 0.200000002980232), 100, Scale: (1f * this.scale));
              Main.dust[index431].velocity *= 2f;
            }
          }
          else if (this.type == 79)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index432 = 0; index432 < 20; ++index432)
            {
              int index433 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 66, Alpha: 100, newColor: new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), Scale: 2f);
              Main.dust[index433].noGravity = true;
              Main.dust[index433].velocity *= 4f;
            }
          }
          else if (this.type == 16)
          {
            if (this.type == 16 && this.penetrate == 1)
            {
              this.maxPenetrate = -1;
              this.penetrate = -1;
              int num = 60;
              this.position.X -= (float) (num / 2);
              this.position.Y -= (float) (num / 2);
              this.width += num;
              this.height += num;
              this.tileCollide = false;
              this.velocity = this.velocity * 0.01f;
              this.Damage();
              this.scale = 0.01f;
            }
            this.position.X += (float) (this.width / 2);
            this.width = 10;
            this.position.X -= (float) (this.width / 2);
            this.position.Y += (float) (this.height / 2);
            this.height = 10;
            this.position.Y -= (float) (this.height / 2);
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index434 = 0; index434 < 20; ++index434)
            {
              int index435 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 15, Alpha: 100, Scale: 2f);
              Main.dust[index435].noGravity = true;
              Main.dust[index435].velocity *= 2f;
              Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 15, Alpha: 100);
            }
          }
          else if (this.type == 17)
          {
            Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
            for (int index = 0; index < 5; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0);
          }
          else if (this.type == 31 || this.type == 42)
          {
            Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
            for (int index436 = 0; index436 < 5; ++index436)
            {
              int index437 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 32);
              Main.dust[index437].velocity *= 0.6f;
            }
          }
          else if (this.type >= 411 && this.type <= 414)
          {
            int Type = 9;
            if (this.type == 412 || this.type == 414)
              Type = 11;
            if (this.type == 413)
              Type = 19;
            for (int index438 = 0; index438 < 5; ++index438)
            {
              int index439 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, Type, SpeedY: (this.velocity.Y / 2f));
              Main.dust[index439].noGravity = true;
              Main.dust[index439].velocity -= this.velocity * 0.5f;
            }
          }
          else if (this.type == 109)
          {
            Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
            for (int index440 = 0; index440 < 5; ++index440)
            {
              int index441 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 51, Scale: 0.6f);
              Main.dust[index441].velocity *= 0.6f;
            }
          }
          else if (this.type == 39)
          {
            Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
            for (int index442 = 0; index442 < 5; ++index442)
            {
              int index443 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 38);
              Main.dust[index443].velocity *= 0.6f;
            }
          }
          else if (this.type == 71)
          {
            Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
            for (int index444 = 0; index444 < 5; ++index444)
            {
              int index445 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 53);
              Main.dust[index445].velocity *= 0.6f;
            }
          }
          else if (this.type == 40)
          {
            Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
            for (int index446 = 0; index446 < 5; ++index446)
            {
              int index447 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 36);
              Main.dust[index447].velocity *= 0.6f;
            }
          }
          else if (this.type == 21 || this.type == 471 || this.type == 532)
          {
            Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
            for (int index = 0; index < 10; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 26, Scale: 0.8f);
          }
          else if (this.type == 583)
          {
            Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
            for (int index = 0; index < 10; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 4, Alpha: 100, newColor: new Color(20, 250, 20, 240), Scale: 0.8f);
          }
          else if (this.type == 584)
          {
            Main.PlaySound(0, (int) this.position.X, (int) this.position.Y);
            for (int index = 0; index < 10; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 4, Alpha: 100, newColor: new Color(250, 20, 120, 240), Scale: 0.8f);
          }
          else if (this.type == 24)
          {
            for (int index = 0; index < 10; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 1, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, Scale: 0.75f);
          }
          else if (this.type == 27)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index448 = 0; index448 < 30; ++index448)
            {
              int index449 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 172, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 100);
              Main.dust[index449].noGravity = true;
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 172, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 100, Scale: 0.5f);
            }
          }
          else if (this.type == 38)
          {
            for (int index = 0; index < 10; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 42, this.velocity.X * 0.1f, this.velocity.Y * 0.1f);
          }
          else if (this.type == 44 || this.type == 45)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index450 = 0; index450 < 30; ++index450)
            {
              int index451 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, this.velocity.X, this.velocity.Y, 100, Scale: 1.7f);
              Main.dust[index451].noGravity = true;
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, this.velocity.X, this.velocity.Y, 100);
            }
          }
          else if (this.type == 41)
          {
            Main.PlaySound(SoundID.Item14, this.position);
            for (int index = 0; index < 10; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
            for (int index452 = 0; index452 < 5; ++index452)
            {
              int index453 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.5f);
              Main.dust[index453].noGravity = true;
              Main.dust[index453].velocity *= 3f;
              int index454 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
              Main.dust[index454].velocity *= 2f;
            }
            int index455 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            Main.gore[index455].velocity *= 0.4f;
            Main.gore[index455].velocity.X += (float) Main.rand.Next(-10, 11) * 0.1f;
            Main.gore[index455].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.1f;
            int index456 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            Main.gore[index456].velocity *= 0.4f;
            Main.gore[index456].velocity.X += (float) Main.rand.Next(-10, 11) * 0.1f;
            Main.gore[index456].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.1f;
            if (this.owner == Main.myPlayer)
            {
              this.penetrate = -1;
              this.position.X += (float) (this.width / 2);
              this.position.Y += (float) (this.height / 2);
              this.width = 64;
              this.height = 64;
              this.position.X -= (float) (this.width / 2);
              this.position.Y -= (float) (this.height / 2);
              this.Damage();
            }
          }
          else if (this.type == 514)
          {
            Main.PlaySound(SoundID.Item14, this.position);
            for (int index457 = 0; index457 < 10; ++index457)
            {
              int index458 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.3f);
              Main.dust[index458].velocity *= 1.4f;
            }
            for (int index459 = 0; index459 < 6; ++index459)
            {
              int index460 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.1f);
              Main.dust[index460].noGravity = true;
              Main.dust[index460].velocity *= 4.6f;
              int index461 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.3f);
              Main.dust[index461].velocity *= 3.3f;
              if (Main.rand.Next(2) == 0)
              {
                int index462 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.1f);
                Main.dust[index462].velocity *= 2.7f;
              }
            }
            if (this.owner == Main.myPlayer)
            {
              this.penetrate = -1;
              this.position.X += (float) (this.width / 2);
              this.position.Y += (float) (this.height / 2);
              this.width = 112;
              this.height = 112;
              this.position.X -= (float) (this.width / 2);
              this.position.Y -= (float) (this.height / 2);
              this.ai[0] = 2f;
              this.Damage();
            }
          }
          else if (this.type == 306)
          {
            Main.PlaySound(3, (int) this.position.X, (int) this.position.Y);
            for (int index463 = 0; index463 < 20; ++index463)
            {
              int index464 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 184);
              Main.dust[index464].scale *= 1.1f;
              Main.dust[index464].noGravity = true;
            }
            for (int index465 = 0; index465 < 30; ++index465)
            {
              int index466 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 184);
              Main.dust[index466].velocity *= 2.5f;
              Main.dust[index466].scale *= 0.8f;
              Main.dust[index466].noGravity = true;
            }
            if (this.owner == Main.myPlayer)
            {
              int num = 2;
              if (Main.rand.Next(10) == 0)
                ++num;
              if (Main.rand.Next(10) == 0)
                ++num;
              if (Main.rand.Next(10) == 0)
                ++num;
              for (int index = 0; index < num; ++index)
                Projectile.NewProjectile(this.position.X, this.position.Y, (float) Main.rand.Next(-35, 36) * 0.02f * 10f, (float) Main.rand.Next(-35, 36) * 0.02f * 10f, 307, (int) ((double) this.damage * 0.7), (float) (int) ((double) this.knockBack * 0.35), Main.myPlayer);
            }
          }
          else if (this.type == 469)
          {
            if (this.owner == Main.myPlayer)
            {
              int num64 = 6;
              for (int index467 = 0; index467 < num64; ++index467)
              {
                if (index467 % 2 != 1 || Main.rand.Next(3) == 0)
                {
                  Vector2 position = this.position;
                  Vector2 oldVelocity = this.oldVelocity;
                  oldVelocity.Normalize();
                  oldVelocity *= 8f;
                  float num65 = (float) Main.rand.Next(-35, 36) * 0.01f;
                  float num66 = (float) Main.rand.Next(-35, 36) * 0.01f;
                  Vector2 vector2 = position - oldVelocity * (float) index467;
                  float SpeedX = num65 + this.oldVelocity.X / 6f;
                  float SpeedY = num66 + this.oldVelocity.Y / 6f;
                  int index468 = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Main.player[this.owner].beeType(), Main.player[this.owner].beeDamage(this.damage / 3), Main.player[this.owner].beeKB(0.0f), Main.myPlayer);
                  Main.projectile[index468].magic = false;
                  Main.projectile[index468].ranged = true;
                  Main.projectile[index468].penetrate = 2;
                }
              }
            }
          }
          else if (this.type == 183)
          {
            Main.PlaySound(SoundID.Item14, this.position);
            for (int index469 = 0; index469 < 20; ++index469)
            {
              int index470 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
              Main.dust[index470].velocity *= 1f;
            }
            int index471 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            ++Main.gore[index471].velocity.X;
            ++Main.gore[index471].velocity.Y;
            Main.gore[index471].velocity *= 0.3f;
            int index472 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            --Main.gore[index472].velocity.X;
            ++Main.gore[index472].velocity.Y;
            Main.gore[index472].velocity *= 0.3f;
            int index473 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            ++Main.gore[index473].velocity.X;
            --Main.gore[index473].velocity.Y;
            Main.gore[index473].velocity *= 0.3f;
            int index474 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            --Main.gore[index474].velocity.X;
            --Main.gore[index474].velocity.Y;
            Main.gore[index474].velocity *= 0.3f;
            if (this.owner == Main.myPlayer)
            {
              int num = Main.rand.Next(15, 25);
              for (int index475 = 0; index475 < num; ++index475)
                Projectile.NewProjectile(this.position.X, this.position.Y, (float) Main.rand.Next(-35, 36) * 0.02f, (float) Main.rand.Next(-35, 36) * 0.02f, Main.player[this.owner].beeType(), Main.player[this.owner].beeDamage(this.damage), Main.player[this.owner].beeKB(0.0f), Main.myPlayer);
            }
          }
          else if (this.aiStyle == 34)
          {
            if (this.owner != Main.myPlayer)
              this.timeLeft = 60;
            Main.PlaySound(SoundID.Item14, this.position);
            if (this.type == 167)
            {
              for (int index476 = 0; index476 < 400; ++index476)
              {
                float num67 = 16f;
                if (index476 < 300)
                  num67 = 12f;
                if (index476 < 200)
                  num67 = 8f;
                if (index476 < 100)
                  num67 = 4f;
                int index477 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 130, Alpha: 100);
                float num68 = Main.dust[index477].velocity.X;
                float y = Main.dust[index477].velocity.Y;
                if ((double) num68 == 0.0 && (double) y == 0.0)
                  num68 = 1f;
                float num69 = (float) Math.Sqrt((double) num68 * (double) num68 + (double) y * (double) y);
                float num70 = num67 / num69;
                float num71 = num68 * num70;
                float num72 = y * num70;
                Main.dust[index477].velocity *= 0.5f;
                Main.dust[index477].velocity.X += num71;
                Main.dust[index477].velocity.Y += num72;
                Main.dust[index477].scale = 1.3f;
                Main.dust[index477].noGravity = true;
              }
            }
            if (this.type == 168)
            {
              for (int index478 = 0; index478 < 400; ++index478)
              {
                float num73 = (float) (2.0 * ((double) index478 / 100.0));
                if (index478 > 100)
                  num73 = 10f;
                if (index478 > 250)
                  num73 = 13f;
                int index479 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 131, Alpha: 100);
                float num74 = Main.dust[index479].velocity.X;
                float y = Main.dust[index479].velocity.Y;
                if ((double) num74 == 0.0 && (double) y == 0.0)
                  num74 = 1f;
                float num75 = (float) Math.Sqrt((double) num74 * (double) num74 + (double) y * (double) y);
                float num76 = num73 / num75;
                float num77;
                float num78;
                if (index478 <= 200)
                {
                  num77 = num74 * num76;
                  num78 = y * num76;
                }
                else
                {
                  num77 = (float) ((double) num74 * (double) num76 * 1.25);
                  num78 = (float) ((double) y * (double) num76 * 0.75);
                }
                Main.dust[index479].velocity *= 0.5f;
                Main.dust[index479].velocity.X += num77;
                Main.dust[index479].velocity.Y += num78;
                if (index478 > 100)
                {
                  Main.dust[index479].scale = 1.3f;
                  Main.dust[index479].noGravity = true;
                }
              }
            }
            if (this.type == 169)
            {
              Vector2 spinningpoint = ((float) Main.rand.NextDouble() * 6.283185f).ToRotationVector2();
              float num79 = (float) Main.rand.Next(5, 9);
              float num80 = (float) Main.rand.Next(12, 17);
              float num81 = (float) Main.rand.Next(3, 7);
              float num82 = 20f;
              for (float num83 = 0.0f; (double) num83 < (double) num79; ++num83)
              {
                for (int index480 = 0; index480 < 2; ++index480)
                {
                  Vector2 vector2_14 = spinningpoint.RotatedBy((index480 == 0 ? 1.0 : -1.0) * 6.28318548202515 / ((double) num79 * 2.0));
                  for (float num84 = 0.0f; (double) num84 < (double) num82; ++num84)
                  {
                    Vector2 vector2_15 = Vector2.Lerp(spinningpoint, vector2_14, num84 / num82);
                    float num85 = MathHelper.Lerp(num80, num81, num84 / num82);
                    int index481 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 133, Alpha: 100, Scale: 1.3f);
                    Main.dust[index481].velocity *= 0.1f;
                    Main.dust[index481].noGravity = true;
                    Main.dust[index481].velocity += vector2_15 * num85;
                  }
                }
                spinningpoint = spinningpoint.RotatedBy(6.28318548202515 / (double) num79);
              }
              for (float num86 = 0.0f; (double) num86 < (double) num79; ++num86)
              {
                for (int index482 = 0; index482 < 2; ++index482)
                {
                  Vector2 vector2_16 = spinningpoint.RotatedBy((index482 == 0 ? 1.0 : -1.0) * 6.28318548202515 / ((double) num79 * 2.0));
                  for (float num87 = 0.0f; (double) num87 < (double) num82; ++num87)
                  {
                    Vector2 vector2_17 = Vector2.Lerp(spinningpoint, vector2_16, num87 / num82);
                    float num88 = MathHelper.Lerp(num80, num81, num87 / num82) / 2f;
                    int index483 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 133, Alpha: 100, Scale: 1.3f);
                    Main.dust[index483].velocity *= 0.1f;
                    Main.dust[index483].noGravity = true;
                    Main.dust[index483].velocity += vector2_17 * num88;
                  }
                }
                spinningpoint = spinningpoint.RotatedBy(6.28318548202515 / (double) num79);
              }
              for (int index484 = 0; index484 < 100; ++index484)
              {
                float num89 = num80;
                int index485 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 132, Alpha: 100);
                float num90 = Main.dust[index485].velocity.X;
                float y = Main.dust[index485].velocity.Y;
                if ((double) num90 == 0.0 && (double) y == 0.0)
                  num90 = 1f;
                float num91 = (float) Math.Sqrt((double) num90 * (double) num90 + (double) y * (double) y);
                float num92 = num89 / num91;
                float num93 = num90 * num92;
                float num94 = y * num92;
                Main.dust[index485].velocity *= 0.5f;
                Main.dust[index485].velocity.X += num93;
                Main.dust[index485].velocity.Y += num94;
                Main.dust[index485].scale = 1.3f;
                Main.dust[index485].noGravity = true;
              }
            }
            if (this.type == 170)
            {
              for (int index486 = 0; index486 < 400; ++index486)
              {
                int Type = 133;
                float num95 = 16f;
                if (index486 > 100)
                  num95 = 11f;
                if (index486 > 100)
                  Type = 134;
                if (index486 > 200)
                  num95 = 8f;
                if (index486 > 200)
                  Type = 133;
                if (index486 > 300)
                  num95 = 5f;
                if (index486 > 300)
                  Type = 134;
                int index487 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, Type, Alpha: 100);
                float num96 = Main.dust[index487].velocity.X;
                float y = Main.dust[index487].velocity.Y;
                if ((double) num96 == 0.0 && (double) y == 0.0)
                  num96 = 1f;
                float num97 = (float) Math.Sqrt((double) num96 * (double) num96 + (double) y * (double) y);
                float num98 = num95 / num97;
                float num99;
                float num100;
                if (index486 > 300)
                {
                  num99 = (float) ((double) num96 * (double) num98 * 0.699999988079071);
                  num100 = y * num98;
                }
                else if (index486 > 200)
                {
                  num99 = num96 * num98;
                  num100 = (float) ((double) y * (double) num98 * 0.699999988079071);
                }
                else if (index486 > 100)
                {
                  num99 = (float) ((double) num96 * (double) num98 * 0.699999988079071);
                  num100 = y * num98;
                }
                else
                {
                  num99 = num96 * num98;
                  num100 = (float) ((double) y * (double) num98 * 0.699999988079071);
                }
                Main.dust[index487].velocity *= 0.5f;
                Main.dust[index487].velocity.X += num99;
                Main.dust[index487].velocity.Y += num100;
                if (Main.rand.Next(3) != 0)
                {
                  Main.dust[index487].scale = 1.3f;
                  Main.dust[index487].noGravity = true;
                }
              }
            }
            if (this.type == 415)
            {
              Vector2 spinningpoint = ((float) Main.rand.NextDouble() * 6.283185f).ToRotationVector2();
              float num101 = (float) Main.rand.Next(5, 9);
              float num102 = (float) Main.rand.Next(10, 15) * 0.66f;
              float num103 = (float) Main.rand.Next(4, 7) / 2f;
              int num104 = 30;
              for (int index488 = 0; (double) index488 < (double) num104 * (double) num101; ++index488)
              {
                if (index488 % num104 == 0)
                  spinningpoint = spinningpoint.RotatedBy(6.28318548202515 / (double) num101);
                float num105 = MathHelper.Lerp(num103, num102, (float) (index488 % num104) / (float) num104);
                int index489 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 130, Alpha: 100);
                Main.dust[index489].velocity *= 0.1f;
                Main.dust[index489].velocity += spinningpoint * num105;
                Main.dust[index489].scale = 1.3f;
                Main.dust[index489].noGravity = true;
              }
              for (int index490 = 0; index490 < 100; ++index490)
              {
                float num106 = num102;
                if (index490 < 30)
                  num106 = (float) (((double) num103 + (double) num102) / 2.0);
                int index491 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 130, Alpha: 100);
                float num107 = Main.dust[index491].velocity.X;
                float y = Main.dust[index491].velocity.Y;
                if ((double) num107 == 0.0 && (double) y == 0.0)
                  num107 = 1f;
                float num108 = (float) Math.Sqrt((double) num107 * (double) num107 + (double) y * (double) y);
                float num109 = num106 / num108;
                float num110 = num107 * num109;
                float num111 = y * num109;
                Main.dust[index491].velocity *= 0.5f;
                Main.dust[index491].velocity.X += num110;
                Main.dust[index491].velocity.Y += num111;
                Main.dust[index491].scale = 1.3f;
                Main.dust[index491].noGravity = true;
              }
            }
            if (this.type == 416)
            {
              Vector2 spinningpoint1 = ((float) Main.rand.NextDouble() * 6.283185f).ToRotationVector2();
              Vector2 spinningpoint2 = spinningpoint1;
              float num112 = (float) (Main.rand.Next(3, 6) * 2);
              int num113 = 20;
              float num114 = Main.rand.Next(2) == 0 ? 1f : -1f;
              bool flag = true;
              for (int index492 = 0; (double) index492 < (double) num113 * (double) num112; ++index492)
              {
                if (index492 % num113 == 0)
                {
                  spinningpoint2 = spinningpoint2.RotatedBy((double) num114 * (6.28318548202515 / (double) num112));
                  spinningpoint1 = spinningpoint2;
                  flag = !flag;
                }
                else
                {
                  float num115 = 6.283185f / ((float) num113 * num112);
                  spinningpoint1 = spinningpoint1.RotatedBy((double) num115 * (double) num114 * 3.0);
                }
                float num116 = MathHelper.Lerp(1f, 8f, (float) (index492 % num113) / (float) num113);
                int index493 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 131, Alpha: 100, Scale: 1.4f);
                Main.dust[index493].velocity *= 0.1f;
                Main.dust[index493].velocity += spinningpoint1 * num116;
                if (flag)
                  Main.dust[index493].scale = 0.9f;
                Main.dust[index493].noGravity = true;
              }
            }
            if (this.type == 417)
            {
              float num117 = (float) Main.rand.NextDouble() * 6.283185f;
              float num118 = (float) Main.rand.NextDouble() * 6.283185f;
              float num119 = (float) (4.0 + Main.rand.NextDouble() * 3.0);
              float num120 = (float) (4.0 + Main.rand.NextDouble() * 3.0);
              float num121 = num119;
              if ((double) num120 > (double) num121)
                num121 = num120;
              for (int index494 = 0; index494 < 150; ++index494)
              {
                int Type = 132;
                float num122 = num121;
                if (index494 > 50)
                  num122 = num120;
                if (index494 > 50)
                  Type = 133;
                if (index494 > 100)
                  num122 = num119;
                if (index494 > 100)
                  Type = 132;
                int index495 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, Type, Alpha: 100);
                Vector2 velocity = Main.dust[index495].velocity;
                velocity.Normalize();
                Vector2 spinningpoint = velocity * num122;
                if (index494 > 100)
                {
                  spinningpoint.X *= 0.5f;
                  spinningpoint = spinningpoint.RotatedBy((double) num117);
                }
                else if (index494 > 50)
                {
                  spinningpoint.Y *= 0.5f;
                  spinningpoint = spinningpoint.RotatedBy((double) num118);
                }
                Main.dust[index495].velocity *= 0.2f;
                Main.dust[index495].velocity += spinningpoint;
                if (index494 <= 200)
                {
                  Main.dust[index495].scale = 1.3f;
                  Main.dust[index495].noGravity = true;
                }
              }
            }
            if (this.type == 418)
            {
              Vector2 spinningpoint = ((float) Main.rand.NextDouble() * 6.283185f).ToRotationVector2();
              float num123 = (float) Main.rand.Next(5, 12);
              float num124 = (float) Main.rand.Next(9, 14) * 0.66f;
              float num125 = (float) Main.rand.Next(2, 4) * 0.66f;
              float num126 = 15f;
              for (float num127 = 0.0f; (double) num127 < (double) num123; ++num127)
              {
                for (int index496 = 0; index496 < 2; ++index496)
                {
                  Vector2 vector2_18 = spinningpoint.RotatedBy((index496 == 0 ? 1.0 : -1.0) * 6.28318548202515 / ((double) num123 * 2.0));
                  for (float num128 = 0.0f; (double) num128 < (double) num126; ++num128)
                  {
                    Vector2 vector2_19 = Vector2.SmoothStep(spinningpoint, vector2_18, num128 / num126);
                    float num129 = MathHelper.SmoothStep(num124, num125, num128 / num126);
                    int index497 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 134, Alpha: 100, Scale: 1.3f);
                    Main.dust[index497].velocity *= 0.1f;
                    Main.dust[index497].noGravity = true;
                    Main.dust[index497].velocity += vector2_19 * num129;
                  }
                }
                spinningpoint = spinningpoint.RotatedBy(6.28318548202515 / (double) num123);
              }
              for (int index498 = 0; index498 < 120; ++index498)
              {
                float num130 = num124;
                int Type = 133;
                if (index498 < 80)
                  num130 = num125 - 0.5f;
                else
                  Type = 131;
                int index499 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, Type, Alpha: 100);
                float num131 = Main.dust[index499].velocity.X;
                float y = Main.dust[index499].velocity.Y;
                if ((double) num131 == 0.0 && (double) y == 0.0)
                  num131 = 1f;
                float num132 = (float) Math.Sqrt((double) num131 * (double) num131 + (double) y * (double) y);
                float num133 = num130 / num132;
                float num134 = num131 * num133;
                float num135 = y * num133;
                Main.dust[index499].velocity *= 0.2f;
                Main.dust[index499].velocity.X += num134;
                Main.dust[index499].velocity.Y += num135;
                Main.dust[index499].scale = 1.3f;
                Main.dust[index499].noGravity = true;
              }
            }
            this.position.X += (float) (this.width / 2);
            this.position.Y += (float) (this.height / 2);
            this.width = 192;
            this.height = 192;
            this.position.X -= (float) (this.width / 2);
            this.position.Y -= (float) (this.height / 2);
            this.penetrate = -1;
            this.Damage();
          }
          else if (this.type == 312)
          {
            Main.PlaySound(SoundID.Item14, this.position);
            this.position.X += (float) (this.width / 2);
            this.position.Y += (float) (this.height / 2);
            this.width = 22;
            this.height = 22;
            this.position.X -= (float) (this.width / 2);
            this.position.Y -= (float) (this.height / 2);
            for (int index500 = 0; index500 < 30; ++index500)
            {
              int index501 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
              Main.dust[index501].velocity *= 1.4f;
            }
            for (int index502 = 0; index502 < 20; ++index502)
            {
              int index503 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 3.5f);
              Main.dust[index503].noGravity = true;
              Main.dust[index503].velocity *= 7f;
              int index504 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
              Main.dust[index504].velocity *= 3f;
            }
            for (int index505 = 0; index505 < 2; ++index505)
            {
              float num = 0.4f;
              if (index505 == 1)
                num = 0.8f;
              int index506 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index506].velocity *= num;
              ++Main.gore[index506].velocity.X;
              ++Main.gore[index506].velocity.Y;
              int index507 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index507].velocity *= num;
              --Main.gore[index507].velocity.X;
              ++Main.gore[index507].velocity.Y;
              int index508 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index508].velocity *= num;
              ++Main.gore[index508].velocity.X;
              --Main.gore[index508].velocity.Y;
              int index509 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index509].velocity *= num;
              --Main.gore[index509].velocity.X;
              --Main.gore[index509].velocity.Y;
            }
            this.position.X += (float) (this.width / 2);
            this.position.Y += (float) (this.height / 2);
            this.width = 128;
            this.height = 128;
            this.position.X -= (float) (this.width / 2);
            this.position.Y -= (float) (this.height / 2);
            this.Damage();
          }
          else if (this.type == 133 || this.type == 134 || this.type == 135 || this.type == 136 || this.type == 137 || this.type == 138 || this.type == 303 || this.type == 338 || this.type == 339)
          {
            if (this.type == 30 || this.type == 133 || this.type == 136 || this.type == 139)
              Main.PlaySound(SoundID.Item62, this.position);
            else
              Main.PlaySound(SoundID.Item14, this.position);
            this.position.X += (float) (this.width / 2);
            this.position.Y += (float) (this.height / 2);
            this.width = 22;
            this.height = 22;
            this.position.X -= (float) (this.width / 2);
            this.position.Y -= (float) (this.height / 2);
            for (int index510 = 0; index510 < 30; ++index510)
            {
              int index511 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
              Main.dust[index511].velocity *= 1.4f;
            }
            for (int index512 = 0; index512 < 20; ++index512)
            {
              int index513 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 3.5f);
              Main.dust[index513].noGravity = true;
              Main.dust[index513].velocity *= 7f;
              int index514 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
              Main.dust[index514].velocity *= 3f;
            }
            for (int index515 = 0; index515 < 2; ++index515)
            {
              float num = 0.4f;
              if (index515 == 1)
                num = 0.8f;
              int index516 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index516].velocity *= num;
              ++Main.gore[index516].velocity.X;
              ++Main.gore[index516].velocity.Y;
              int index517 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index517].velocity *= num;
              --Main.gore[index517].velocity.X;
              ++Main.gore[index517].velocity.Y;
              int index518 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index518].velocity *= num;
              ++Main.gore[index518].velocity.X;
              --Main.gore[index518].velocity.Y;
              int index519 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index519].velocity *= num;
              --Main.gore[index519].velocity.X;
              --Main.gore[index519].velocity.Y;
            }
          }
          else if (this.type == 139 || this.type == 140 || this.type == 141 || this.type == 142 || this.type == 143 || this.type == 144 || this.type == 340 || this.type == 341)
          {
            if (this.type == 30 || this.type == 133 || this.type == 136 || this.type == 139)
              Main.PlaySound(SoundID.Item62, this.position);
            else
              Main.PlaySound(SoundID.Item14, this.position);
            this.position.X += (float) (this.width / 2);
            this.position.Y += (float) (this.height / 2);
            this.width = 80;
            this.height = 80;
            this.position.X -= (float) (this.width / 2);
            this.position.Y -= (float) (this.height / 2);
            for (int index520 = 0; index520 < 40; ++index520)
            {
              int index521 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 2f);
              Main.dust[index521].velocity *= 3f;
              if (Main.rand.Next(2) == 0)
              {
                Main.dust[index521].scale = 0.5f;
                Main.dust[index521].fadeIn = (float) (1.0 + (double) Main.rand.Next(10) * 0.100000001490116);
              }
            }
            for (int index522 = 0; index522 < 70; ++index522)
            {
              int index523 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 3f);
              Main.dust[index523].noGravity = true;
              Main.dust[index523].velocity *= 5f;
              int index524 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2f);
              Main.dust[index524].velocity *= 2f;
            }
            for (int index525 = 0; index525 < 3; ++index525)
            {
              float num = 0.33f;
              if (index525 == 1)
                num = 0.66f;
              if (index525 == 2)
                num = 1f;
              int index526 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index526].velocity *= num;
              ++Main.gore[index526].velocity.X;
              ++Main.gore[index526].velocity.Y;
              int index527 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index527].velocity *= num;
              --Main.gore[index527].velocity.X;
              ++Main.gore[index527].velocity.Y;
              int index528 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index528].velocity *= num;
              ++Main.gore[index528].velocity.X;
              --Main.gore[index528].velocity.Y;
              int index529 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index529].velocity *= num;
              --Main.gore[index529].velocity.X;
              --Main.gore[index529].velocity.Y;
            }
            this.position.X += (float) (this.width / 2);
            this.position.Y += (float) (this.height / 2);
            this.width = 10;
            this.height = 10;
            this.position.X -= (float) (this.width / 2);
            this.position.Y -= (float) (this.height / 2);
          }
          else if (this.type == 246)
          {
            Main.PlaySound(SoundID.Item14, this.position);
            for (int index530 = 0; index530 < 10; ++index530)
            {
              int index531 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
              Main.dust[index531].velocity *= 0.9f;
            }
            for (int index532 = 0; index532 < 5; ++index532)
            {
              int index533 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.5f);
              Main.dust[index533].noGravity = true;
              Main.dust[index533].velocity *= 3f;
              int index534 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
              Main.dust[index534].velocity *= 2f;
            }
            int index535 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            Main.gore[index535].velocity *= 0.3f;
            Main.gore[index535].velocity.X += (float) Main.rand.Next(-1, 2);
            Main.gore[index535].velocity.Y += (float) Main.rand.Next(-1, 2);
            this.position.X += (float) (this.width / 2);
            this.position.Y += (float) (this.height / 2);
            this.width = 150;
            this.height = 150;
            this.position.X -= (float) (this.width / 2);
            this.position.Y -= (float) (this.height / 2);
            this.penetrate = -1;
            this.maxPenetrate = 0;
            this.Damage();
            if (this.owner == Main.myPlayer)
            {
              int num136 = Main.rand.Next(2, 6);
              for (int index536 = 0; index536 < num136; ++index536)
              {
                float num137 = (float) Main.rand.Next(-100, 101) + 0.01f;
                float num138 = (float) Main.rand.Next(-100, 101);
                float num139 = num137 - 0.01f;
                float num140 = 8f / (float) Math.Sqrt((double) num139 * (double) num139 + (double) num138 * (double) num138);
                int index537 = Projectile.NewProjectile(this.Center.X - this.oldVelocity.X, this.Center.Y - this.oldVelocity.Y, num139 * num140, num138 * num140, 249, this.damage, this.knockBack, this.owner);
                Main.projectile[index537].maxPenetrate = 0;
              }
            }
          }
          else if (this.type == 249)
          {
            Main.PlaySound(SoundID.Item14, this.position);
            for (int index538 = 0; index538 < 7; ++index538)
            {
              int index539 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
              Main.dust[index539].velocity *= 0.8f;
            }
            for (int index540 = 0; index540 < 2; ++index540)
            {
              int index541 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.5f);
              Main.dust[index541].noGravity = true;
              Main.dust[index541].velocity *= 2.5f;
              int index542 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
              Main.dust[index542].velocity *= 1.5f;
            }
            int index = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            Main.gore[index].velocity *= 0.2f;
            Main.gore[index].velocity.X += (float) Main.rand.Next(-1, 2);
            Main.gore[index].velocity.Y += (float) Main.rand.Next(-1, 2);
            this.position.X += (float) (this.width / 2);
            this.position.Y += (float) (this.height / 2);
            this.width = 100;
            this.height = 100;
            this.position.X -= (float) (this.width / 2);
            this.position.Y -= (float) (this.height / 2);
            this.penetrate = -1;
            this.Damage();
          }
          else if (this.type == 588)
          {
            Main.PlaySound(SoundID.Item14, this.position);
            this.position = this.Center;
            this.width = this.height = 22;
            this.Center = this.position;
            for (int index543 = 0; index543 < 8; ++index543)
            {
              int index544 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 219 + Main.rand.Next(5));
              Main.dust[index544].velocity *= 1.4f;
              Main.dust[index544].fadeIn = 1f;
              Main.dust[index544].noGravity = true;
            }
            for (int index545 = 0; index545 < 15; ++index545)
            {
              int index546 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 139 + Main.rand.Next(4), Scale: 1.6f);
              Main.dust[index546].noGravity = true;
              Main.dust[index546].velocity *= 5f;
              int index547 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 139 + Main.rand.Next(4), Scale: 1.9f);
              Main.dust[index547].velocity *= 3f;
            }
            if (Main.rand.Next(2) == 0)
            {
              int index = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(276, 283));
              Main.gore[index].velocity *= 0.4f;
              ++Main.gore[index].velocity.X;
              ++Main.gore[index].velocity.Y;
            }
            if (Main.rand.Next(2) == 0)
            {
              int index = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(276, 283));
              Main.gore[index].velocity *= 0.4f;
              --Main.gore[index].velocity.X;
              ++Main.gore[index].velocity.Y;
            }
            if (Main.rand.Next(2) == 0)
            {
              int index = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(276, 283));
              Main.gore[index].velocity *= 0.4f;
              ++Main.gore[index].velocity.X;
              --Main.gore[index].velocity.Y;
            }
            if (Main.rand.Next(2) == 0)
            {
              int index = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(276, 283));
              Main.gore[index].velocity *= 0.4f;
              --Main.gore[index].velocity.X;
              --Main.gore[index].velocity.Y;
            }
          }
          else if (this.type == 28 || this.type == 30 || this.type == 37 || this.type == 75 || this.type == 102 || this.type == 164 || this.type == 397 || this.type == 517 || this.type == 516 || this.type == 519)
          {
            Main.PlaySound(SoundID.Item14, this.position);
            this.position.X += (float) (this.width / 2);
            this.position.Y += (float) (this.height / 2);
            this.width = 22;
            this.height = 22;
            this.position.X -= (float) (this.width / 2);
            this.position.Y -= (float) (this.height / 2);
            for (int index548 = 0; index548 < 20; ++index548)
            {
              int index549 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
              Main.dust[index549].velocity *= 1.4f;
            }
            for (int index550 = 0; index550 < 10; ++index550)
            {
              int index551 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2.5f);
              Main.dust[index551].noGravity = true;
              Main.dust[index551].velocity *= 5f;
              int index552 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
              Main.dust[index552].velocity *= 3f;
            }
            int index553 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            Main.gore[index553].velocity *= 0.4f;
            ++Main.gore[index553].velocity.X;
            ++Main.gore[index553].velocity.Y;
            int index554 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            Main.gore[index554].velocity *= 0.4f;
            --Main.gore[index554].velocity.X;
            ++Main.gore[index554].velocity.Y;
            int index555 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            Main.gore[index555].velocity *= 0.4f;
            ++Main.gore[index555].velocity.X;
            --Main.gore[index555].velocity.Y;
            int index556 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(61, 64));
            Main.gore[index556].velocity *= 0.4f;
            --Main.gore[index556].velocity.X;
            --Main.gore[index556].velocity.Y;
            if (this.type == 102)
            {
              this.position.X += (float) (this.width / 2);
              this.position.Y += (float) (this.height / 2);
              this.width = 128;
              this.height = 128;
              this.position.X -= (float) (this.width / 2);
              this.position.Y -= (float) (this.height / 2);
              this.damage = 40;
              this.Damage();
            }
          }
          else if (this.type == 29 || this.type == 108 || this.type == 470 || this.type == 637)
          {
            Main.PlaySound(SoundID.Item14, this.position);
            if (this.type == 29)
            {
              this.position.X += (float) (this.width / 2);
              this.position.Y += (float) (this.height / 2);
              this.width = 200;
              this.height = 200;
              this.position.X -= (float) (this.width / 2);
              this.position.Y -= (float) (this.height / 2);
            }
            for (int index557 = 0; index557 < 50; ++index557)
            {
              int index558 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 2f);
              Main.dust[index558].velocity *= 1.4f;
            }
            for (int index559 = 0; index559 < 80; ++index559)
            {
              int index560 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 3f);
              Main.dust[index560].noGravity = true;
              Main.dust[index560].velocity *= 5f;
              int index561 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2f);
              Main.dust[index561].velocity *= 3f;
            }
            for (int index562 = 0; index562 < 2; ++index562)
            {
              int index563 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index563].scale = 1.5f;
              Main.gore[index563].velocity.X += 1.5f;
              Main.gore[index563].velocity.Y += 1.5f;
              int index564 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index564].scale = 1.5f;
              Main.gore[index564].velocity.X -= 1.5f;
              Main.gore[index564].velocity.Y += 1.5f;
              int index565 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index565].scale = 1.5f;
              Main.gore[index565].velocity.X += 1.5f;
              Main.gore[index565].velocity.Y -= 1.5f;
              int index566 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64));
              Main.gore[index566].scale = 1.5f;
              Main.gore[index566].velocity.X -= 1.5f;
              Main.gore[index566].velocity.Y -= 1.5f;
            }
            this.position.X += (float) (this.width / 2);
            this.position.Y += (float) (this.height / 2);
            this.width = 10;
            this.height = 10;
            this.position.X -= (float) (this.width / 2);
            this.position.Y -= (float) (this.height / 2);
          }
          else if (this.type == 69)
          {
            Main.PlaySound(13, (int) this.position.X, (int) this.position.Y);
            for (int index = 0; index < 5; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 13);
            for (int index567 = 0; index567 < 30; ++index567)
            {
              int index568 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 33, SpeedY: -2f, Scale: 1.1f);
              Main.dust[index568].alpha = 100;
              Main.dust[index568].velocity.X *= 1.5f;
              Main.dust[index568].velocity *= 3f;
            }
          }
          else if (this.type == 70)
          {
            Main.PlaySound(13, (int) this.position.X, (int) this.position.Y);
            for (int index = 0; index < 5; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 13);
            for (int index569 = 0; index569 < 30; ++index569)
            {
              int index570 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 52, SpeedY: -2f, Scale: 1.1f);
              Main.dust[index570].alpha = 100;
              Main.dust[index570].velocity.X *= 1.5f;
              Main.dust[index570].velocity *= 3f;
            }
          }
          else if (this.type == 621)
          {
            Main.PlaySound(13, (int) this.position.X, (int) this.position.Y);
            for (int index = 0; index < 5; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 13);
            for (int index571 = 0; index571 < 30; ++index571)
            {
              int index572 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 266, SpeedY: -2f, Scale: 1.1f);
              Main.dust[index572].alpha = 100;
              Main.dust[index572].velocity.X *= 1.5f;
              Main.dust[index572].velocity *= 3f;
            }
          }
          else if (this.type == 114 || this.type == 115)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index573 = 4; index573 < 31; ++index573)
            {
              float num141 = this.oldVelocity.X * (30f / (float) index573);
              float num142 = this.oldVelocity.Y * (30f / (float) index573);
              int index574 = Dust.NewDust(new Vector2(this.position.X - num141, this.position.Y - num142), 8, 8, 27, this.oldVelocity.X, this.oldVelocity.Y, 100, Scale: 1.4f);
              Main.dust[index574].noGravity = true;
              Main.dust[index574].velocity *= 0.5f;
              int index575 = Dust.NewDust(new Vector2(this.position.X - num141, this.position.Y - num142), 8, 8, 27, this.oldVelocity.X, this.oldVelocity.Y, 100, Scale: 0.9f);
              Main.dust[index575].velocity *= 0.5f;
            }
          }
          else if (this.type == 116)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index576 = 4; index576 < 31; ++index576)
            {
              float num143 = this.oldVelocity.X * (30f / (float) index576);
              float num144 = this.oldVelocity.Y * (30f / (float) index576);
              int index577 = Dust.NewDust(new Vector2(this.position.X - num143, this.position.Y - num144), 8, 8, 64, this.oldVelocity.X, this.oldVelocity.Y, 100, Scale: 1.8f);
              Main.dust[index577].noGravity = true;
              int index578 = Dust.NewDust(new Vector2(this.position.X - num143, this.position.Y - num144), 8, 8, 64, this.oldVelocity.X, this.oldVelocity.Y, 100, Scale: 1.4f);
              Main.dust[index578].noGravity = true;
            }
          }
          else if (this.type == 173)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index579 = 4; index579 < 24; ++index579)
            {
              float num145 = this.oldVelocity.X * (30f / (float) index579);
              float num146 = this.oldVelocity.Y * (30f / (float) index579);
              int Type;
              switch (Main.rand.Next(3))
              {
                case 0:
                  Type = 15;
                  break;
                case 1:
                  Type = 57;
                  break;
                default:
                  Type = 58;
                  break;
              }
              int index580 = Dust.NewDust(new Vector2(this.position.X - num145, this.position.Y - num146), 8, 8, Type, this.oldVelocity.X * 0.2f, this.oldVelocity.Y * 0.2f, 100, Scale: 1.8f);
              Main.dust[index580].velocity *= 1.5f;
              Main.dust[index580].noGravity = true;
            }
          }
          else if (this.type == 132)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index581 = 4; index581 < 31; ++index581)
            {
              float num147 = this.oldVelocity.X * (30f / (float) index581);
              float num148 = this.oldVelocity.Y * (30f / (float) index581);
              int index582 = Dust.NewDust(new Vector2(this.oldPosition.X - num147, this.oldPosition.Y - num148), 8, 8, 107, this.oldVelocity.X, this.oldVelocity.Y, 100, Scale: 1.8f);
              Main.dust[index582].noGravity = true;
              Main.dust[index582].velocity *= 0.5f;
              int index583 = Dust.NewDust(new Vector2(this.oldPosition.X - num147, this.oldPosition.Y - num148), 8, 8, 107, this.oldVelocity.X, this.oldVelocity.Y, 100, Scale: 1.4f);
              Main.dust[index583].velocity *= 0.05f;
            }
          }
          else if (this.type == 156)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index584 = 4; index584 < 31; ++index584)
            {
              float num149 = this.oldVelocity.X * (30f / (float) index584);
              float num150 = this.oldVelocity.Y * (30f / (float) index584);
              int index585 = Dust.NewDust(new Vector2(this.oldPosition.X - num149, this.oldPosition.Y - num150), 8, 8, 73, this.oldVelocity.X, this.oldVelocity.Y, (int) byte.MaxValue, Scale: 1.8f);
              Main.dust[index585].noGravity = true;
              Main.dust[index585].velocity *= 0.5f;
              int index586 = Dust.NewDust(new Vector2(this.oldPosition.X - num149, this.oldPosition.Y - num150), 8, 8, 73, this.oldVelocity.X, this.oldVelocity.Y, (int) byte.MaxValue, Scale: 1.4f);
              Main.dust[index586].velocity *= 0.05f;
              Main.dust[index586].noGravity = true;
            }
          }
          else if (this.type == 157)
          {
            Main.PlaySound(SoundID.Item10, this.position);
            for (int index587 = 4; index587 < 31; ++index587)
            {
              int index588 = Dust.NewDust(this.position, this.width, this.height, 107, this.oldVelocity.X, this.oldVelocity.Y, 100, Scale: 1.8f);
              Main.dust[index588].noGravity = true;
              Main.dust[index588].velocity *= 0.5f;
            }
          }
          else if (this.type == 370)
          {
            Main.PlaySound(SoundID.Item4, this.position);
            for (int index = 0; index < 5; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 13);
            for (int index589 = 0; index589 < 30; ++index589)
            {
              Vector2 vector2 = new Vector2((float) Main.rand.Next(-10, 11), (float) Main.rand.Next(-10, 11));
              vector2.Normalize();
              int index590 = Gore.NewGore(this.Center + vector2 * 10f, vector2 * (float) Main.rand.Next(4, 9) * 0.66f + Vector2.UnitY * 1.5f, 331, (float) Main.rand.Next(40, 141) * 0.01f);
              Main.gore[index590].sticky = false;
            }
          }
          else if (this.type == 371)
          {
            Main.PlaySound(13, (int) this.position.X, (int) this.position.Y);
            Main.PlaySound(SoundID.Item16, this.position);
            for (int index = 0; index < 5; ++index)
              Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 13);
            for (int index591 = 0; index591 < 30; ++index591)
            {
              Vector2 vector2 = new Vector2((float) Main.rand.Next(-10, 11), (float) Main.rand.Next(-10, 11));
              vector2.Normalize();
              vector2 *= 0.4f;
              int index592 = Gore.NewGore(this.Center + vector2 * 10f, vector2 * (float) Main.rand.Next(4, 9) * 0.66f + Vector2.UnitY * 1.5f, Main.rand.Next(435, 438), (float) Main.rand.Next(20, 100) * 0.01f);
              Main.gore[index592].sticky = false;
            }
          }
        }
      }
      if (this.owner == Main.myPlayer && (this.type == 370 || this.type == 371))
      {
        float num = 80f;
        int type = 119;
        if (this.type == 371)
          type = 120;
        for (int index = 0; index < (int) byte.MaxValue; ++index)
        {
          Player player = Main.player[index];
          if (player.active && !player.dead && (double) Vector2.Distance(this.Center, player.Center) < (double) num)
            player.AddBuff(type, 1800, false);
        }
        for (int index = 0; index < 200; ++index)
        {
          NPC npc = Main.npc[index];
          if (npc.active && npc.life > 0 && (double) Vector2.Distance(this.Center, npc.Center) < (double) num)
            npc.AddBuff(type, 1800);
        }
      }
      if (this.owner == Main.myPlayer)
      {
        if (this.type == 28 || this.type == 29 || this.type == 37 || this.type == 108 || this.type == 136 || this.type == 137 || this.type == 138 || this.type == 142 || this.type == 143 || this.type == 144 || this.type == 339 || this.type == 341 || this.type == 470 || this.type == 516 || this.type == 519 || this.type == 637)
        {
          int num151 = 3;
          if (this.type == 28 || this.type == 37 || this.type == 516 || this.type == 519)
            num151 = 4;
          if (this.type == 29 || this.type == 470 || this.type == 637)
            num151 = 7;
          if (this.type == 142 || this.type == 143 || this.type == 144 || this.type == 341)
            num151 = 5;
          if (this.type == 108)
            num151 = 10;
          int num152 = (int) ((double) this.position.X / 16.0 - (double) num151);
          int num153 = (int) ((double) this.position.X / 16.0 + (double) num151);
          int num154 = (int) ((double) this.position.Y / 16.0 - (double) num151);
          int num155 = (int) ((double) this.position.Y / 16.0 + (double) num151);
          if (num152 < 0)
            num152 = 0;
          if (num153 > Main.maxTilesX)
            num153 = Main.maxTilesX;
          if (num154 < 0)
            num154 = 0;
          if (num155 > Main.maxTilesY)
            num155 = Main.maxTilesY;
          bool flag1 = false;
          for (int index593 = num152; index593 <= num153; ++index593)
          {
            for (int index594 = num154; index594 <= num155; ++index594)
            {
              float num156 = Math.Abs((float) index593 - this.position.X / 16f);
              float num157 = Math.Abs((float) index594 - this.position.Y / 16f);
              if (Math.Sqrt((double) num156 * (double) num156 + (double) num157 * (double) num157) < (double) num151 && Main.tile[index593, index594] != null && Main.tile[index593, index594].wall == (byte) 0)
              {
                flag1 = true;
                break;
              }
            }
          }
          AchievementsHelper.CurrentlyMining = true;
          for (int i1 = num152; i1 <= num153; ++i1)
          {
            for (int j1 = num154; j1 <= num155; ++j1)
            {
              float num158 = Math.Abs((float) i1 - this.position.X / 16f);
              float num159 = Math.Abs((float) j1 - this.position.Y / 16f);
              if (Math.Sqrt((double) num158 * (double) num158 + (double) num159 * (double) num159) < (double) num151)
              {
                bool flag2 = true;
                if (Main.tile[i1, j1] != null && Main.tile[i1, j1].active())
                {
                  flag2 = true;
                  if (Main.tileDungeon[(int) Main.tile[i1, j1].type] || Main.tile[i1, j1].type == (ushort) 88 || TileID.Sets.BasicChest[(int) Main.tile[i1, j1].type] || Main.tile[i1, j1].type == (ushort) 26 || Main.tile[i1, j1].type == (ushort) 107 || Main.tile[i1, j1].type == (ushort) 108 || Main.tile[i1, j1].type == (ushort) 111 || Main.tile[i1, j1].type == (ushort) 226 || Main.tile[i1, j1].type == (ushort) 237 || Main.tile[i1, j1].type == (ushort) 221 || Main.tile[i1, j1].type == (ushort) 222 || Main.tile[i1, j1].type == (ushort) 223 || Main.tile[i1, j1].type == (ushort) 211 || Main.tile[i1, j1].type == (ushort) 404)
                    flag2 = false;
                  if (!Main.hardMode && Main.tile[i1, j1].type == (ushort) 58)
                    flag2 = false;
                  if (flag2)
                  {
                    WorldGen.KillTile(i1, j1);
                    if (!Main.tile[i1, j1].active() && Main.netMode != 0)
                      NetMessage.SendData(17, number2: ((float) i1), number3: ((float) j1));
                  }
                }
                if (flag2)
                {
                  for (int i2 = i1 - 1; i2 <= i1 + 1; ++i2)
                  {
                    for (int j2 = j1 - 1; j2 <= j1 + 1; ++j2)
                    {
                      if (Main.tile[i2, j2] != null && Main.tile[i2, j2].wall > (byte) 0 && flag1)
                      {
                        WorldGen.KillWall(i2, j2);
                        if (Main.tile[i2, j2].wall == (byte) 0 && Main.netMode != 0)
                          NetMessage.SendData(17, number: 2, number2: ((float) i2), number3: ((float) j2));
                      }
                    }
                  }
                }
              }
            }
          }
          AchievementsHelper.CurrentlyMining = false;
        }
        if (Main.netMode != 0)
          NetMessage.SendData(29, number: this.identity, number2: ((float) this.owner));
        if (!this.noDropItem)
        {
          int number = -1;
          if (this.aiStyle == 10)
          {
            int i = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
            int j = (int) ((double) this.position.Y + (double) (this.width / 2)) / 16;
            int type = 0;
            int Type = 2;
            if (this.type == 109)
            {
              type = 147;
              Type = 0;
            }
            if (this.type == 31)
            {
              type = 53;
              Type = 0;
            }
            if (this.type == 42)
            {
              type = 53;
              Type = 0;
            }
            if (this.type == 56)
            {
              type = 112;
              Type = 0;
            }
            if (this.type == 65)
            {
              type = 112;
              Type = 0;
            }
            if (this.type == 67)
            {
              type = 116;
              Type = 0;
            }
            if (this.type == 68)
            {
              type = 116;
              Type = 0;
            }
            if (this.type == 71)
            {
              type = 123;
              Type = 0;
            }
            if (this.type == 39)
            {
              type = 59;
              Type = 176;
            }
            if (this.type == 40)
            {
              type = 57;
              Type = 172;
            }
            if (this.type == 179)
            {
              type = 224;
              Type = 0;
            }
            if (this.type == 241)
            {
              type = 234;
              Type = 0;
            }
            if (this.type == 354)
            {
              type = 234;
              Type = 0;
            }
            if (this.type == 411)
            {
              type = 330;
              Type = 71;
            }
            if (this.type == 412)
            {
              type = 331;
              Type = 72;
            }
            if (this.type == 413)
            {
              type = 332;
              Type = 73;
            }
            if (this.type == 414)
            {
              type = 333;
              Type = 74;
            }
            if (this.type == 109)
            {
              int closest = (int) Player.FindClosest(this.position, this.width, this.height);
              if ((double) (this.Center - Main.player[closest].Center).Length() > (double) Main.LogicCheckScreenWidth * 0.75)
              {
                type = -1;
                Type = 593;
              }
            }
            if (Main.tile[i, j].halfBrick() && (double) this.velocity.Y > 0.0 && (double) Math.Abs(this.velocity.Y) > (double) Math.Abs(this.velocity.X))
              --j;
            if (!Main.tile[i, j].active() && type >= 0)
            {
              bool flag = false;
              if (j < Main.maxTilesY - 2 && Main.tile[i, j + 1] != null && Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type == (ushort) 314)
                flag = true;
              if (!flag)
                WorldGen.PlaceTile(i, j, type, forced: true);
              if (!flag && Main.tile[i, j].active() && (int) Main.tile[i, j].type == type)
              {
                if (Main.tile[i, j + 1].halfBrick() || Main.tile[i, j + 1].slope() != (byte) 0)
                {
                  WorldGen.SlopeTile(i, j + 1);
                  if (Main.netMode == 2)
                    NetMessage.SendData(17, number: 14, number2: ((float) i), number3: ((float) (j + 1)));
                }
                if (Main.netMode != 0)
                  NetMessage.SendData(17, number: 1, number2: ((float) i), number3: ((float) j), number4: ((float) type));
              }
              else if (Type > 0)
                number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type);
            }
            else if (Type > 0)
              number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type);
          }
          if (this.type == 1 && Main.rand.Next(3) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 40);
          if (this.type == 474 && Main.rand.Next(3) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3003);
          if (this.type == 103 && Main.rand.Next(6) == 0)
            number = Main.rand.Next(3) != 0 ? Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 40) : Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 545);
          if (this.type == 2 && Main.rand.Next(3) == 0)
            number = Main.rand.Next(3) != 0 ? Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 40) : Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 41);
          if (this.type == 172 && Main.rand.Next(3) == 0)
            number = Main.rand.Next(3) != 0 ? Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 40) : Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 988);
          if (this.type == 171)
          {
            if ((double) this.ai[1] == 0.0)
            {
              number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 985);
              Main.item[number].noGrabDelay = 0;
            }
            else if ((double) this.ai[1] < 10.0)
            {
              number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 965, (int) (10.0 - (double) this.ai[1]));
              Main.item[number].noGrabDelay = 0;
            }
          }
          if (this.type == 475)
          {
            if ((double) this.ai[1] == 0.0)
            {
              number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3005);
              Main.item[number].noGrabDelay = 0;
            }
            else if ((double) this.ai[1] < 10.0)
            {
              number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2996, (int) (10.0 - (double) this.ai[1]));
              Main.item[number].noGrabDelay = 0;
            }
          }
          if (this.type == 505)
          {
            if ((double) this.ai[1] == 0.0)
            {
              number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3079);
              Main.item[number].noGrabDelay = 0;
            }
            else if ((double) this.ai[1] < 10.0)
            {
              number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3077, (int) (10.0 - (double) this.ai[1]));
              Main.item[number].noGrabDelay = 0;
            }
          }
          if (this.type == 506)
          {
            if ((double) this.ai[1] == 0.0)
            {
              number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3080);
              Main.item[number].noGrabDelay = 0;
            }
            else if ((double) this.ai[1] < 10.0)
            {
              number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3078, (int) (10.0 - (double) this.ai[1]));
              Main.item[number].noGrabDelay = 0;
            }
          }
          if (this.type == 91 && Main.rand.Next(6) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 516);
          if (this.type == 50 && Main.rand.Next(3) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 282);
          if (this.type == 515 && Main.rand.Next(3) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3112);
          if (this.type == 53 && Main.rand.Next(3) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 286);
          if (this.type == 48 && Main.rand.Next(2) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 279);
          if (this.type == 54 && Main.rand.Next(2) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 287);
          if (this.type == 3 && Main.rand.Next(2) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 42);
          if (this.type == 4 && Main.rand.Next(4) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 47);
          if (this.type == 12 && this.damage > 500)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 75);
          if (this.type == 155)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 859);
          if (this.type == 598 && Main.rand.Next(4) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3378);
          if (this.type == 599 && Main.rand.Next(4) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3379);
          if (this.type == 21 && Main.rand.Next(2) == 0)
            number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 154);
          if (Main.netMode == 1 && number >= 0)
            NetMessage.SendData(21, number: number, number2: 1f);
        }
        if (this.type == 69 || this.type == 70 || this.type == 621)
        {
          int i = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
          int j = (int) ((double) this.position.Y + (double) (this.height / 2)) / 16;
          if (this.type == 69)
            WorldGen.Convert(i, j, 2);
          if (this.type == 70)
            WorldGen.Convert(i, j, 1);
          if (this.type == 621)
            WorldGen.Convert(i, j, 4);
        }
        if (this.type == 378)
        {
          int num = Main.rand.Next(2, 4);
          if (Main.rand.Next(5) == 0)
            ++num;
          for (int index = 0; index < num; ++index)
          {
            float x = this.velocity.X;
            float y = this.velocity.Y;
            Projectile.NewProjectile(this.Center.X, this.Center.Y, x * (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258), y * (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258), 379, this.damage, this.knockBack, this.owner);
          }
        }
      }
      this.active = false;
    }

    public Color GetAlpha(Color newColor)
    {
      if (this.type == 270)
        return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, Main.rand.Next(0, (int) byte.MaxValue));
      int num1;
      int num2;
      int num3;
      if (this.type == 650)
      {
        int num4 = (int) ((double) newColor.R * 1.5);
        int num5 = (int) ((double) newColor.G * 1.5);
        int num6 = (int) ((double) newColor.B * 1.5);
        if (num4 > (int) byte.MaxValue)
          num1 = (int) byte.MaxValue;
        if (num5 > (int) byte.MaxValue)
          num2 = (int) byte.MaxValue;
        if (num6 > (int) byte.MaxValue)
          num3 = (int) byte.MaxValue;
      }
      else
      {
        if (this.type == 604 || this.type == 631)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
        if (this.type == 636)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 64 - this.alpha / 4);
        if (this.type == 673 || this.type == 706)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 180 - this.alpha / 2 - this.alpha / 4);
        if (this.type == 603 || this.type == 633)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
        if (this.type == 623 || this.type >= 625 && this.type <= 628 || this.type == 710)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
        if (this.type == 645 || this.type == 643)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) sbyte.MaxValue - this.alpha / 2);
        if (this.type == 611)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
        if (this.type == 640 || this.type == 644 || this.type == 658)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
        if (this.type == 612)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue);
        if (this.aiStyle == 105)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
        if (this.type == 554)
          return new Color(200, 200, 200, 200);
        if (this.type == 601)
          return PortalHelper.GetPortalColor(this.owner, (int) this.ai[0]);
        if (this.type == 602)
        {
          Color portalColor = PortalHelper.GetPortalColor(this.owner, (int) this.ai[1]);
          portalColor.A = (byte) 227;
          return portalColor;
        }
        if (this.type == 585)
        {
          byte a = newColor.A;
          newColor = Color.Lerp(newColor, Color.White, 0.5f);
          newColor.A = a;
          return newColor;
        }
        if (this.type == 573 || this.type == 578 || this.type == 579 || this.type == 617 || this.type == 641 || this.type == 707)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
        if (this.type == 9 || this.type == 490)
          return Color.White;
        if (this.type == 575 || this.type == 596 || this.type == 659)
        {
          if (this.timeLeft < 30)
            this.alpha = (int) ((double) byte.MaxValue - (double) byte.MaxValue * (double) ((float) this.timeLeft / 30f));
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 128 - this.alpha / 2);
        }
        if (this.type == 546)
          return new Color((int) byte.MaxValue, 200, (int) byte.MaxValue, 200);
        if (this.type == 553)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, 200, 200);
        if (this.type == 540)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
        if (this.type == 498)
          return new Color((int) byte.MaxValue, 100, 20, 200);
        if (this.type == 538)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
        if (this.type == 518)
        {
          float num7 = (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
          return new Color((int) (200.0 * (double) num7), (int) (200.0 * (double) num7), (int) (200.0 * (double) num7), (int) (100.0 * (double) num7));
        }
        if (this.type == 518 || this.type == 595)
        {
          Color color = Color.Lerp(newColor, Color.White, 0.85f);
          color.A = (byte) 128;
          return color * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
        }
        if (this.type == 536 || this.type == 607)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 63 - this.alpha / 4);
        if (this.type == 591)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 63 - this.alpha / 4);
        if (this.type == 493 || this.type == 494)
          return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
        if (this.type == 492)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
        if (this.type == 491)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
        if (this.type == 485 || this.type == 502)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
        if (this.type == 488)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
        if (this.type == 477 || this.type == 478 || this.type == 479)
          return this.alpha == 0 ? new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200) : new Color(0, 0, 0, 0);
        if (this.type == 473)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
        if (this.type == 50 || this.type == 53 || this.type == 515)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
        if (this.type == 92)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
        if (this.type == 91)
          return new Color(200, 200, 200, 0);
        if (this.type == 34 || this.type == 15 || this.type == 93 || this.type == 94 || this.type == 95 || this.type == 96 || this.type == 253 || this.type == 258 || this.type == 102 && this.alpha < (int) byte.MaxValue)
          return new Color(200, 200, 200, 25);
        if (this.type == 465)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
        if (this.type == 503)
        {
          Color color1 = Color.Lerp(newColor, Color.White, 0.5f) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
          Color color2 = Color.Lerp(Color.Purple, Color.White, 0.33f);
          float num8 = (float) (0.25 + Math.Cos((double) this.localAI[0]) * 0.25);
          Color color3 = color2;
          double num9 = (double) num8;
          return Color.Lerp(color1, color3, (float) num9);
        }
        if (this.type == 467)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
        if (this.type == 694 || this.type == 695 || this.type == 696)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
        if (this.type == 634 || this.type == 635)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * this.Opacity;
        if (this.type == 671)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue) * this.Opacity;
        if (this.type == 664 || this.type == 666 || this.type == 668)
        {
          newColor = Color.Lerp(newColor, Color.White, 0.5f);
          return new Color((int) newColor.R, (int) newColor.G, (int) newColor.B, 200) * this.Opacity;
        }
        if (this.type == 451)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200) * (float) (((double) byte.MaxValue - (double) this.alpha) / (double) byte.MaxValue);
        if (this.type == 684)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200) * (float) (((double) byte.MaxValue - (double) this.alpha) / (double) byte.MaxValue);
        if (this.type == 454 || this.type == 452)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
        if (this.type == 464)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue) * (float) (((double) byte.MaxValue - (double) this.alpha) / (double) byte.MaxValue);
        if (this.type == 450)
          return new Color(200, 200, 200, (int) byte.MaxValue - this.alpha);
        if (this.type == 459 || this.type == 709)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
        if (this.type == 447)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
        if (this.type == 446)
          return Color.Lerp(newColor, Color.White, 0.8f) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
        if (this.type == 691 || this.type == 692 || this.type == 693)
          return Color.Lerp(newColor, Color.White, 0.4f) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
        if (this.type >= 646 && this.type <= 649)
          return Color.Lerp(newColor, Color.White, 0.8f) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
        if (this.type == 445)
          return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
        if (this.type == 440 || this.type == 449 || this.type == 606)
        {
          num1 = (int) byte.MaxValue - this.alpha;
          num2 = (int) byte.MaxValue - this.alpha;
          num3 = (int) byte.MaxValue - this.alpha;
        }
        else
        {
          if (this.type == 444)
            return newColor * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
          if (this.type == 443 || this.type == 675 || this.type == 686 || this.type == 711)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
          if (this.type == 676)
            return newColor * this.Opacity;
          if (this.type == 438)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
          if (this.type == 592)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
          if (this.type == 437 || this.type == 700)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
          if (this.type == 462)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
          if (this.type == 352)
            return new Color(250, 250, 250, this.alpha);
          if (this.type == 435)
          {
            newColor = Color.Lerp(newColor, Color.White, 0.8f);
            return new Color((int) newColor.R, (int) newColor.G, (int) newColor.B, 25);
          }
          if (this.type == 682)
          {
            newColor = Color.Lerp(newColor, Color.White, 0.8f);
            return new Color((int) newColor.R, (int) newColor.G, (int) newColor.B, (int) sbyte.MaxValue);
          }
          if (this.type == 436)
          {
            newColor = Color.Lerp(newColor, Color.White, 0.8f);
            return new Color((int) newColor.R, (int) newColor.G, (int) newColor.B, 25);
          }
          if (this.type == 409)
            return new Color(250, 250, 250, 200);
          if (this.type == 348 || this.type == 349)
            return new Color(200, 200, 200, this.alpha);
          if (this.type == 337)
            return new Color(250, 250, 250, 150);
          if (this.type >= 424 && this.type <= 426)
          {
            byte num10 = 150;
            if ((int) newColor.R < (int) num10)
              newColor.R = num10;
            if ((int) newColor.G < (int) num10)
              newColor.G = num10;
            if ((int) newColor.B < (int) num10)
              newColor.B = num10;
            return new Color((int) newColor.R, (int) newColor.G, (int) newColor.B, (int) byte.MaxValue);
          }
          if (this.type == 431 || this.type == 432)
            return new Color(250, 250, 250, (int) byte.MaxValue - this.alpha);
          if (this.type == 343 || this.type == 344)
          {
            float num11 = (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
            return new Color((int) (250.0 * (double) num11), (int) (250.0 * (double) num11), (int) (250.0 * (double) num11), (int) (100.0 * (double) num11));
          }
          if (this.type == 332)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
          if (this.type == 329)
            return new Color(200, 200, 200, 50);
          if (this.type >= 326 && this.type <= 328 || this.type >= 400 && this.type <= 402)
            return Color.Transparent;
          if (this.type == 324 && this.frame >= 6 && this.frame <= 9)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
          if (this.type == 16)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
          if (this.type == 321)
            return new Color(200, 200, 200, 0);
          if (this.type == 76 || this.type == 77 || this.type == 78)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
          if (this.type == 308)
            return new Color(200, 200, (int) byte.MaxValue, 125);
          if (this.type == 263)
            return this.timeLeft < (int) byte.MaxValue ? new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) (byte) this.timeLeft) : new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
          if (this.type == 274)
          {
            if (this.timeLeft >= 85)
              return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 100);
            byte num12 = (byte) (this.timeLeft * 3);
            byte num13 = (byte) (100.0 * ((double) num12 / (double) byte.MaxValue));
            return new Color((int) num12, (int) num12, (int) num12, (int) num13);
          }
          if (this.type == 5)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
          if (this.type == 300 || this.type == 301)
            return new Color(250, 250, 250, 50);
          if (this.type == 712)
            return Color.Lerp(newColor, Color.White, 0.4f) * this.Opacity;
          if (this.type == 304)
            return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) (byte) ((double) ((int) byte.MaxValue - this.alpha) / 3.0));
          if (this.type == 116 || this.type == 132 || this.type == 156 || this.type == 157 || this.type == 157 || this.type == 173)
          {
            if ((double) this.localAI[1] >= 15.0)
              return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, this.alpha);
            if ((double) this.localAI[1] < 5.0)
              return Color.Transparent;
            int num14 = (int) (((double) this.localAI[1] - 5.0) / 10.0 * (double) byte.MaxValue);
            return new Color(num14, num14, num14, num14);
          }
          if (this.type == 254)
          {
            if (this.timeLeft < 30)
              this.alpha = (int) ((double) byte.MaxValue - (double) byte.MaxValue * (double) ((float) this.timeLeft / 30f));
            return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
          }
          if (this.type == 265 || this.type == 355)
            return this.alpha > 0 ? Color.Transparent : new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
          if (this.type == 270 && (double) this.ai[0] >= 0.0)
            return this.alpha > 0 ? Color.Transparent : new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
          if (this.type == 257)
            return this.alpha > 200 ? Color.Transparent : new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
          if (this.type == 259)
            return this.alpha > 200 ? Color.Transparent : new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
          if (this.type >= 150 && this.type <= 152)
            return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
          if (this.type == 250)
            return Color.Transparent;
          if (this.type == 251)
            return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
          if (this.type == 131)
            return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
          if (this.type == 211)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
          if (this.type == 229)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 50);
          if (this.type == 221)
            return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
          if (this.type == 20)
            return this.alpha <= 150 ? new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) : new Color(0, 0, 0, 0);
          if (this.type == 207)
          {
            num1 = (int) byte.MaxValue - this.alpha;
            num2 = (int) byte.MaxValue - this.alpha;
            num3 = (int) byte.MaxValue - this.alpha;
          }
          else
          {
            if (this.type == 242)
              return this.alpha < 140 ? new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 100) : Color.Transparent;
            if (this.type == 638)
              return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 100) * this.Opacity;
            if (this.type == 660)
              return new Color(150, (int) byte.MaxValue, (int) byte.MaxValue, 0) * this.Opacity;
            if (this.type == 209)
            {
              num1 = (int) newColor.R - this.alpha;
              num2 = (int) newColor.G - this.alpha;
              num3 = (int) newColor.B - this.alpha / 2;
            }
            else
            {
              if (this.type == 130)
                return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 175);
              if (this.type == 182)
                return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
              if (this.type == 226)
              {
                int maxValue1 = (int) byte.MaxValue;
                int maxValue2 = (int) byte.MaxValue;
                int maxValue3 = (int) byte.MaxValue;
                float num15 = (float) ((double) Main.mouseTextColor / 200.0 - 0.300000011920929);
                int num16 = (int) ((double) maxValue1 * (double) num15);
                int num17 = (int) ((double) maxValue2 * (double) num15);
                int num18 = (int) ((double) maxValue3 * (double) num15);
                int r = num16 + 50;
                if (r > (int) byte.MaxValue)
                  r = (int) byte.MaxValue;
                int g = num17 + 50;
                if (g > (int) byte.MaxValue)
                  g = (int) byte.MaxValue;
                int b = num18 + 50;
                if (b > (int) byte.MaxValue)
                  b = (int) byte.MaxValue;
                return new Color(r, g, b, 200);
              }
              if (this.type == 227)
              {
                int maxValue;
                int num19 = maxValue = (int) byte.MaxValue;
                int num20 = maxValue;
                int num21 = maxValue;
                float num22 = (float) ((double) Main.mouseTextColor / 100.0 - 1.60000002384186);
                int num23 = (int) ((double) num21 * (double) num22);
                int num24 = (int) ((double) num20 * (double) num22);
                int num25 = (int) ((double) num19 * (double) num22);
                int a = (int) (100.0 * (double) num22);
                int r = num23 + 50;
                if (r > (int) byte.MaxValue)
                  r = (int) byte.MaxValue;
                int g = num24 + 50;
                if (g > (int) byte.MaxValue)
                  g = (int) byte.MaxValue;
                int b = num25 + 50;
                if (b > (int) byte.MaxValue)
                  b = (int) byte.MaxValue;
                return new Color(r, g, b, a);
              }
              if (this.type == 114 || this.type == 115)
              {
                if ((double) this.localAI[1] >= 15.0)
                  return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, this.alpha);
                if ((double) this.localAI[1] < 5.0)
                  return Color.Transparent;
                int num26 = (int) (((double) this.localAI[1] - 5.0) / 10.0 * (double) byte.MaxValue);
                return new Color(num26, num26, num26, num26);
              }
              if (this.type == 83 || this.type == 88 || this.type == 89 || this.type == 90 || this.type == 100 || this.type == 104 || this.type == 279 || this.type >= 283 && this.type <= 287)
                return this.alpha < 200 ? new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0) : Color.Transparent;
              if (this.type == 34 || this.type == 35 || this.type == 15 || this.type == 19 || this.type == 44 || this.type == 45)
                return Color.White;
              if (this.type == 79)
              {
                num1 = Main.DiscoR;
                num2 = Main.DiscoG;
                num3 = Main.DiscoB;
                return new Color();
              }
              if (this.type == 9 || this.type == 15 || this.type == 34 || this.type == 50 || this.type == 53 || this.type == 76 || this.type == 77 || this.type == 78 || this.type == 92 || this.type == 91)
              {
                num1 = (int) newColor.R - this.alpha / 3;
                num2 = (int) newColor.G - this.alpha / 3;
                num3 = (int) newColor.B - this.alpha / 3;
              }
              else
              {
                if (this.type == 18)
                  return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 50);
                if (this.type == 16 || this.type == 44 || this.type == 45)
                {
                  num1 = (int) newColor.R;
                  num2 = (int) newColor.G;
                  num3 = (int) newColor.B;
                }
                else if (this.type == 12 || this.type == 72 || this.type == 86 || this.type == 87)
                  return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) newColor.A - this.alpha);
              }
            }
          }
        }
      }
      float num27 = (float) ((int) byte.MaxValue - this.alpha) / (float) byte.MaxValue;
      int r1 = (int) ((double) newColor.R * (double) num27);
      int g1 = (int) ((double) newColor.G * (double) num27);
      int b1 = (int) ((double) newColor.B * (double) num27);
      int a1 = (int) newColor.A - this.alpha;
      if (a1 < 0)
        a1 = 0;
      if (a1 > (int) byte.MaxValue)
        a1 = (int) byte.MaxValue;
      return new Color(r1, g1, b1, a1);
    }

    public override string ToString() => "type:" + (object) this.type + "name:" + this.Name + ", active:" + this.active.ToString() + ", whoAmI:" + (object) this.whoAmI + ", identity:" + (object) this.identity + ", ai0:" + (object) this.ai[0] + " , uuid:" + (object) this.projUUID;
  }
}
