示例#1
0
        public static void Changeinv(int index = 0)
        {
            if (LazyInventory.InuseCategory == null) { return; }

            if (index != 0)
            {
                index *= 40;
            }
            Main.playerInventory = true;
            ONclearinv(Save());
            int SlotCount = 0;
            for (int i = index; i < InuseCategory.invetory.Count; i++)
            {

                if (SlotCount <= 40)
                {
                    Item T = new Item();
                    T.SetDefaults(InuseCategory.invetory[i]);
                    T.stack = T.maxStack;
                    Main.player[Main.myPlayer].inventory[SlotCount] = T;
                    SlotCount++;

                }
                else { break; }
            }
        }
示例#2
0
        //new[]
        //    {
        //        new ItemId(1, "Gold Pickaxe"),
        //        new ItemId(4, "Gold Broadsword"),
        //        new ItemId(6, "Gold Shortsword"),
        //        new ItemId(10, "Gold Axe"),
        //        new ItemId(7, "Gold Hammer"),
        //        new ItemId(99, "Gold Bow"),
        //        new ItemId(1, "Silver Pickaxe"),
        //        new ItemId(4, "Silver Broadsword"),
        //        new ItemId(6, "Silver Shortsword"),
        //        new ItemId(10, "Silver Axe"),
        //        new ItemId(7, "Silver Hammer"),
        //        new ItemId(99, "Silver Bow"),
        //        new ItemId(1, "Copper Pickaxe"),
        //        new ItemId(4, "Copper Broadsword"),
        //        new ItemId(6, "Copper Shortsword"),
        //        new ItemId(10, "Copper Axe"),
        //        new ItemId(7, "Copper Hammer"),
        //        new ItemId(198, "Blue Phasesaber"),
        //        new ItemId(199, "Red Phasesaber"),
        //        new ItemId(200, "Green Phasesaber"),
        //        new ItemId(201, "Purple Phasesaber"),
        //        new ItemId(202, "White Phasesaber"),
        //        new ItemId(203, "Yellow Phasesaber"),
        //    };

        public Terraria.Item GetItem(int id)
        {
            var curitem = new Terraria.Item();

            curitem.SetDefaults(id);
            return(curitem);
        }
        //new[]
        //    {
        //        new ItemId(1, "Gold Pickaxe"),
        //        new ItemId(4, "Gold Broadsword"),
        //        new ItemId(6, "Gold Shortsword"),
        //        new ItemId(10, "Gold Axe"),
        //        new ItemId(7, "Gold Hammer"),
        //        new ItemId(99, "Gold Bow"),
        //        new ItemId(1, "Silver Pickaxe"),
        //        new ItemId(4, "Silver Broadsword"),
        //        new ItemId(6, "Silver Shortsword"),
        //        new ItemId(10, "Silver Axe"),
        //        new ItemId(7, "Silver Hammer"),
        //        new ItemId(99, "Silver Bow"),
        //        new ItemId(1, "Copper Pickaxe"),
        //        new ItemId(4, "Copper Broadsword"),
        //        new ItemId(6, "Copper Shortsword"),
        //        new ItemId(10, "Copper Axe"),
        //        new ItemId(7, "Copper Hammer"),
        //        new ItemId(198, "Blue Phasesaber"),
        //        new ItemId(199, "Red Phasesaber"),
        //        new ItemId(200, "Green Phasesaber"),
        //        new ItemId(201, "Purple Phasesaber"),
        //        new ItemId(202, "White Phasesaber"),
        //        new ItemId(203, "Yellow Phasesaber"),
        //    };

        public Terraria.Item GetItem(int id)
        {
            var curitem = new Terraria.Item();
            curitem.SetDefaults(id);
            return curitem;

        }
示例#4
0
		public override void SetupStartInventory(IList<Item> items)
		{
			Item item = new Item();
			item.SetDefaults(mod.ItemType("ExampleItem"));
			item.stack = 5;
			items.Add(item);
		}
示例#5
0
        private void FillPrefixEntries()
        {
            _scrollView.Content.RemoveAllChildren();

            if (_itemSlot.Item != null && _itemSlot.Item.type != 0)
            {
                var baseItem = new Item();
                baseItem.SetDefaults(_itemSlot.Item.type);

                var items = GetItemsPrefixes(_itemSlot.Item);

                float yPos = 5;
                for(int i = 0;i < items.Length; i++)
                {
                    var item = items[i];
                    var entry = new PrefixEntry(item);

                    entry.Top.Set(yPos, 0f);
                    entry.Width.Set(0, 0.5f);
                    entry.OnClick += entry_OnClick;
                    if (i % 2 == 1)
                    {
                        entry.Left.Set(0, 0.5f);
                        yPos += entry.Height.Pixels + 5;

                    }
                    _scrollView.Content.Append(entry);
                }
                _scrollView.SetContentHeight(yPos);
            }
            else
                _scrollView.SetContentHeight(0);
        }
示例#6
0
        public string GetWallsXml()
        {
            List <Terraria.Item> curItems = new List <Item>();

            for (int i = -255; i < maxItemTypes; i++)
            {
                try
                {
                    var curitem = new Terraria.Item();
                    curitem.SetDefaults(i);
                    curItems.Add(curitem);
                }
                catch
                {
                }
            }
            var output = new StringBuilder("  <Walls>\r\n");

            for (int i = 0; i < maxWallTypes; i++)
            {
                var creatingWall = curItems.FirstOrDefault(x => x.createWall == i);

                output.AppendFormat("    <Wall Id=\"{0}\" Name=\"{2}\" Color=\"#FFFF00FF\" IsHouse=\"{1}\"/>\r\n",
                                    i,
                                    wallHouse[i],
                                    creatingWall != null ? creatingWall.Name : string.Empty);
            }

            output.Append("  </Walls>");

            return(output.ToString());
        }
示例#7
0
 public override void PostSetupContent()
 {
     LoadReferences();
     Item ccoutfit = new Item();
     ccoutfit.SetDefaults(ItemType("CandyCopterOutfit"));
     Mounts.CandyCopter._outfit = ccoutfit.legSlot;
 }
示例#8
0
        public override void SetupStartInventory(IList<Item> items)
        {
            Item item = new Item();
            item.SetDefaults(mod.ItemType("QuestBook"));

            items.Add(item);
        }
示例#9
0
		public static IList<Item> SetupStartInventory(Player player)
		{
			IList<Item> items = new List<Item>();
			Item item = new Item();
			item.SetDefaults("Copper Shortsword");
			item.Prefix(-1);
			items.Add(item);
			item = new Item();
			item.SetDefaults("Copper Pickaxe");
			item.Prefix(-1);
			items.Add(item);
			item = new Item();
			item.SetDefaults("Copper Axe");
			item.Prefix(-1);
			items.Add(item);
			foreach (ModPlayer modPlayer in player.modPlayers)
			{
				modPlayer.SetupStartInventory(items);
			}
			IDictionary<int, int> counts = new Dictionary<int, int>();
			foreach (Item item0 in items)
			{
				if (item0.maxStack > 1)
				{
					if (!counts.ContainsKey(item0.netID))
					{
						counts[item0.netID] = 0;
					}
					counts[item0.netID] += item0.stack;
				}
			}
			int k = 0;
			while (k < items.Count)
			{
				bool flag = true;
				int id = items[k].netID;
				if (counts.ContainsKey(id))
				{
					items[k].stack = counts[id];
					if (items[k].stack > items[k].maxStack)
					{
						items[k].stack = items[k].maxStack;
					}
					counts[id] -= items[k].stack;
					if (items[k].stack <= 0)
					{
						items.RemoveAt(k);
						flag = false;
					}
				}
				if (flag)
				{
					k++;
				}
			}
			return items;
		}
示例#10
0
        void entry_OnClick(Terraria.UI.UIMouseEvent evt, Terraria.UI.UIElement listeningElement)
        {
            var entry = (PrefixEntry)listeningElement;

            var baseItem = new Item();
            baseItem.SetDefaults(entry.Item.type);
            baseItem.Prefix(entry.Item.prefix);
            _itemSlot.Item = baseItem;
        }
示例#11
0
        TextSnippet ITagHandler.Parse(string text, Color baseColor, string options)
        {
            Item obj = new Item();
            int result1;
            if (int.TryParse(text, out result1))
                obj.netDefaults(result1);
            else
                obj.SetDefaults(text);

            if (obj.itemId <= 0)
                return new TextSnippet(text);

            obj.stack = 1;
            if (options != null)
            {
                string[] strArray = options.Split(',');
                for (int index = 0; index < strArray.Length; ++index)
                {
                    if (strArray[index].Length != 0)
                    {
                        switch (strArray[index][0])
                        {
                            case 'p':
                                int result2;
                                if (int.TryParse(strArray[index].Substring(1), out result2))
                                {
                                    obj.Prefix(Utils.Clamp<int>(result2, 0, 84));
                                    continue;
                                }
                                continue;
                            case 's':
                            case 'x':
                                int result3;
                                if (int.TryParse(strArray[index].Substring(1), out result3))
                                {
                                    obj.stack = Utils.Clamp<int>(result3, 1, obj.maxStack);
                                    continue;
                                }
                                continue;
                            default:
                                continue;
                        }
                    }
                }
            }

            string str = "";
            if (obj.stack > 1)
                str = " (" + obj.stack + ")";

            ItemSnippet itemSnippet = new ItemSnippet(obj);
            itemSnippet.Text = "[" + obj.AffixName() + str + "]";
            itemSnippet.CheckForHover = true;
            itemSnippet.DeleteWhole = true;
            return itemSnippet;
        }
示例#12
0
        public string GetTilesXml()
        {
            List <Terraria.Item> curItems = new List <Item>();

            for (int i = 0; i < maxItemTypes; i++)
            {
                try
                {
                    var curitem = new Terraria.Item();
                    curitem.SetDefaults(i);
                    curItems.Add(curitem);
                }
                catch
                {
                }
            }

            StringBuilder output = new StringBuilder("  <Tiles>\r\n");

            for (int i = 0; i < maxTileSets; i++)
            {
                var creatingItem = curItems.FirstOrDefault(x => x.createTile == i);

                output.AppendFormat("    <Tile Id=\"{0}\" Name=\"{22}\" {5}{16}{17}{8} {21}\r\n",
                                    i,
                                    tileAlch[i],
                                    tileAxe[i],
                                    tileBlockLight[i],
                                    tileDungeon[i],
                                    tileFrameImportant[i] ? " Framed=\"true\"" : string.Empty,
                                    tileHammer[i],
                                    tileLavaDeath[i],
                                    tileLighted[i] ? " Light=\"true\"" : string.Empty,
                                    tileMergeDirt[i],
                                    //tileName[i],
                                    tileNoAttach[i],
                                    tileNoFail[i],
                                    tileNoSunLight[i],
                                    "",
                                    tileShine[i],
                                    tileShine2[i],
                                    tileSolid[i] ? " Solid=\"true\"" : string.Empty,
                                    tileSolidTop[i] ? " SolidTop=\"true\"" : string.Empty,
                                    tileStone[i],
                                    tileTable[i],
                                    tileWaterDeath[i],
                                    (tileFrameImportant[i]) ? ">\r\n      <Frames>\r\n        <Frame UV=\"0, 0\" Name=\"\" Variety=\"\" />\r\n      </ Frames>\r\n    </Tile>" : " />",
                                    creatingItem != null ? creatingItem.Name : string.Empty);
            }


            output.Append("  </Tiles>");

            return(output.ToString());
        }
示例#13
0
		static ItemLoader()
		{
			for (int k = 0; k < ItemID.Count; k++)
			{
				Item item = new Item();
				item.SetDefaults(k);
				if (item.wingSlot > 0)
				{
					vanillaWings[item.wingSlot] = k;
				}
			}
		}
示例#14
0
 public override void UpdateAccessory(Item item, Player player)
 {
     if (Main.myPlayer == player.whoAmI)
     {
         if (item.type == ItemID.MusicBox && Main.rand.Next(10800) == 0 && Main.curMusic >= Main.maxMusic && Main.curMusic < Main.music.Length)
         {
             if (Main.curMusic == mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DriveMusic"))
             {
                 item.SetDefaults(mod.ItemType("ExampleMusicBox"), false);
             }
         }
     }
 }
示例#15
0
 public Terraria.Item GetItem(int id)
 {
     try
     {
         var curitem = new Terraria.Item();
         curitem.SetDefaults(id);
         return(curitem);
     }
     catch
     {
         return(null);
     }
 }
示例#16
0
        public string GetTiles()
        {
            List <Terraria.Item> curItems = new List <Item>();

            for (int i = 0; i < maxItemTypes; i++)
            {
                var curitem = new Terraria.Item();
                curitem.SetDefaults(i);
                curItems.Add(curitem);
            }

            string output = "<Tiles>\r\n";

            for (int i = 0; i < maxTileSets; i++)
            {
                var creatingItem = curItems.FirstOrDefault(x => x.createTile == i);

                output += string.Format("<Tile Id=\"{0}\" Name=\"{22}\" {5}{16}{17}{8} {21}\r\n",
                                        i,
                                        tileAlch[i],
                                        tileAxe[i],
                                        tileBlockLight[i],
                                        tileDungeon[i],
                                        tileFrameImportant[i] ? " Framed=\"true\"" : string.Empty,
                                        tileHammer[i],
                                        tileLavaDeath[i],
                                        tileLighted[i] ? " Light=\"true\"" : string.Empty,
                                        tileMergeDirt[i],
                                        //tileName[i],
                                        tileNoAttach[i],
                                        tileNoFail[i],
                                        tileNoSunLight[i],
                                        tilePick[i],
                                        tileShine[i],
                                        tileShine2[i],
                                        tileSolid[i] ? " Solid=\"true\"" : string.Empty,
                                        tileSolidTop[i] ? " SolidTop=\"true\"" : string.Empty,
                                        tileStone[i],
                                        tileTable[i],
                                        tileWaterDeath[i],
                                        (tileFrameImportant[i]) ? ">\r\n  <Frames>\r\n  </Frames>\r\n</Tile>" : " />",
                                        creatingItem != null ? creatingItem.name : string.Empty);
            }

            return(output + "</Tiles>");
        }
示例#17
0
 public override void AnglerQuestReward(float quality, List<Item> rewardItems)
 {
     if (voidMonolith > 0)
     {
         Item sticky = new Item();
         sticky.SetDefaults(ItemID.StickyDynamite);
         sticky.stack = 4;
         rewardItems.Add(sticky);
     }
     foreach (Item item in rewardItems)
     {
         if (item.type == ItemID.GoldCoin)
         {
             int stack = item.stack;
             item.SetDefaults(ItemID.PlatinumCoin);
             item.stack = stack;
         }
     }
 }
示例#18
0
 internal static void SetStartInventory(Player player, IList<Item> items)
 {
     if (items.Count <= 50)
     {
         for (int k = 0; k < items.Count; k++)
         {
             player.inventory[k] = items[k];
         }
     }
     else
     {
         for (int k = 0; k < 49; k++)
         {
             player.inventory[k] = items[k];
         }
         Item bag = new Item();
         bag.SetDefaults(ModLoader.GetMod("ModLoader").ItemType("StartBag"));
         for (int k = 49; k < items.Count; k++)
         {
             ((StartBag)bag.modItem).AddItem(items[k]);
         }
         player.inventory[49] = bag;
     }
 }
示例#19
0
        public string GetWalls()
        {
            List <Terraria.Item> curItems = new List <Item>();

            for (int i = -255; i < maxItemTypes; i++)
            {
                var curitem = new Terraria.Item();
                curitem.SetDefaults(i);
                curItems.Add(curitem);
            }
            string output = "<Walls>\r\n";

            for (int i = 0; i < maxWallTypes; i++)
            {
                var creatingWall = curItems.FirstOrDefault(x => x.createWall == i);

                output += string.Format("<Wall Id=\"{0}\" Name=\"{2}\" Color=\"#FFFF00FF\" IsHouse=\"{1}\"/>\r\n",
                                        i,
                                        wallHouse[i],
                                        creatingWall != null ? creatingWall.name : string.Empty);
            }

            return(output + "</Walls>");
        }
示例#20
0
 public void FishingCheck()
 {
     int num = (int)(base.Center.X / 16f);
     int num2 = (int)(base.Center.Y / 16f);
     if (Main.tile[num, num2].liquid < 0)
     {
         num2++;
     }
     bool flag = false;
     bool flag2 = false;
     int num3 = num;
     int num4 = num;
     while (num3 > 10 && Main.tile[num3, num2].liquid > 0)
     {
         if (WorldGen.SolidTile(num3, num2))
         {
             break;
         }
         num3--;
     }
     while (num4 < Main.maxTilesX - 10 && Main.tile[num4, num2].liquid > 0 && !WorldGen.SolidTile(num4, num2))
     {
         num4++;
     }
     int num5 = 0;
     for (int i = num3; i <= num4; i++)
     {
         int num6 = num2;
         while (Main.tile[i, num6].liquid > 0 && !WorldGen.SolidTile(i, num6) && num6 < Main.maxTilesY - 10)
         {
             num5++;
             num6++;
             if (Main.tile[i, num6].lava())
             {
                 flag = true;
             }
             else if (Main.tile[i, num6].honey())
             {
                 flag2 = true;
             }
         }
     }
     if (flag2)
     {
         num5 = (int)((double)num5 * 1.5);
     }
     if (num5 < 75)
     {
         Main.player[this.owner].displayedFishingInfo = "Not Enough Water!";
         return;
     }
     int num7 = Main.player[this.owner].FishingLevel();
     if (num7 == 0)
     {
         return;
     }
     Main.player[this.owner].displayedFishingInfo = num7 + " Fishing Power";
     if (num7 < 0)
     {
         if (num7 == -1)
         {
             Main.player[this.owner].displayedFishingInfo = "Warning!";
             if ((num < 380 || num > Main.maxTilesX - 380) && num5 > 1000 && !NPC.AnyNPCs(NPCID.DukeFishron))
             {
                 this.ai[1] = (float)(Main.rand.Next(-180, -60) - 100);
                 this.localAI[1] = (float)num7;
                 this.netUpdate = true;
             }
         }
         return;
     }
     int num8 = 300;
     float num9 = (float)(Main.maxTilesX / 4200);
     num9 *= num9;
     float num10 = (float)((double)(this.position.Y / 16f - (60f + 10f * num9)) / (Main.worldSurface / 6.0));
     if ((double)num10 < 0.25)
     {
         num10 = 0.25f;
     }
     if (num10 > 1f)
     {
         num10 = 1f;
     }
     num8 = (int)((float)num8 * num10);
     float num11 = (float)num5 / (float)num8;
     if (num11 < 1f)
     {
         num7 = (int)((float)num7 * num11);
     }
     num11 = 1f - num11;
     if (num5 < num8)
     {
         Main.player[this.owner].displayedFishingInfo = string.Concat(new object[]
         {
             num7,
             " (",
             -Math.Round((double)(num11 * 100f)),
             "%) Fishing Power"
         });
     }
     int num12 = (num7 + 75) / 2;
     if (Main.player[this.owner].wet)
     {
         return;
     }
     if (Main.rand.Next(100) > num12)
     {
         return;
     }
     int num13 = 0;
     int num14;
     if ((double)num2 < Main.worldSurface * 0.5)
     {
         num14 = 0;
     }
     else if ((double)num2 < Main.worldSurface)
     {
         num14 = 1;
     }
     else if ((double)num2 < Main.rockLayer)
     {
         num14 = 2;
     }
     else if (num2 < Main.maxTilesY - 300)
     {
         num14 = 3;
     }
     else
     {
         num14 = 4;
     }
     int num15 = 150;
     int num16 = num15 / num7;
     int num17 = num15 * 2 / num7;
     int num18 = num15 * 7 / num7;
     int num19 = num15 * 15 / num7;
     int num20 = num15 * 30 / num7;
     if (num16 < 2)
     {
         num16 = 2;
     }
     if (num17 < 3)
     {
         num17 = 3;
     }
     if (num18 < 4)
     {
         num18 = 4;
     }
     if (num19 < 5)
     {
         num19 = 5;
     }
     if (num20 < 6)
     {
         num20 = 6;
     }
     bool flag3 = false;
     bool flag4 = false;
     bool flag5 = false;
     bool flag6 = false;
     bool flag7 = false;
     if (Main.rand.Next(num16) == 0)
     {
         flag3 = true;
     }
     if (Main.rand.Next(num17) == 0)
     {
         flag4 = true;
     }
     if (Main.rand.Next(num18) == 0)
     {
         flag5 = true;
     }
     if (Main.rand.Next(num19) == 0)
     {
         flag6 = true;
     }
     if (Main.rand.Next(num20) == 0)
     {
         flag7 = true;
     }
     int num21 = 10;
     if (Main.player[this.owner].cratePotion)
     {
         num21 += 10;
     }
     int num22 = Main.anglerQuestItemNetIDs[Main.anglerQuest];
     if (Main.player[this.owner].HasItem(num22))
     {
         num22 = -1;
     }
     if (Main.anglerQuestFinished)
     {
         num22 = -1;
     }
     if (flag)
     {
         if (Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].type != 2422)
         {
             return;
         }
         if (flag7)
         {
             num13 = 2331;
         }
         else if (flag6)
         {
             num13 = 2312;
         }
         else if (flag5)
         {
             num13 = 2315;
         }
     }
     else if (flag2)
     {
         if (flag5 || (flag4 && Main.rand.Next(2) == 0))
         {
             num13 = 2314;
         }
         else if (flag4 && num22 == 2451)
         {
             num13 = 2451;
         }
     }
     else if (Main.rand.Next(50) > num7 && Main.rand.Next(50) > num7 && num5 < num8)
     {
         num13 = Main.rand.Next(2337, 2340);
     }
     else if (Main.rand.Next(100) < num21)
     {
         if (flag6 || flag7)
         {
             num13 = 2336;
         }
         else if (flag5 && Main.player[this.owner].ZoneCorrupt)
         {
             num13 = 3203;
         }
         else if (flag5 && Main.player[this.owner].ZoneCrimson)
         {
             num13 = 3204;
         }
         else if (flag5 && Main.player[this.owner].ZoneHoly)
         {
             num13 = 3207;
         }
         else if (flag5 && Main.player[this.owner].ZoneDungeon)
         {
             num13 = 3205;
         }
         else if (flag5 && Main.player[this.owner].ZoneJungle)
         {
             num13 = 3208;
         }
         else if (flag5 && num14 == 0)
         {
             num13 = 3206;
         }
         else if (flag4)
         {
             num13 = 2335;
         }
         else
         {
             num13 = 2334;
         }
     }
     else if (flag7 && Main.rand.Next(5) == 0)
     {
         num13 = 2423;
     }
     else if (flag7 && Main.rand.Next(5) == 0)
     {
         num13 = 3225;
     }
     else if (flag7 && Main.rand.Next(10) == 0)
     {
         num13 = 2420;
     }
     else if (!flag7 && !flag6 && flag4 && Main.rand.Next(5) == 0)
     {
         num13 = 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 && num14 == 3 && Main.rand.Next(3) != 0)
             {
                 num13 = 2429;
             }
             else if (flag7 && Main.hardMode && Main.rand.Next(2) == 0)
             {
                 num13 = 3210;
             }
             else if (flag5)
             {
                 num13 = 2330;
             }
             else if (flag4 && num22 == 2454)
             {
                 num13 = 2454;
             }
             else if (flag4 && num22 == 2485)
             {
                 num13 = 2485;
             }
             else if (flag4 && num22 == 2457)
             {
                 num13 = 2457;
             }
             else if (flag4)
             {
                 num13 = 2318;
             }
         }
         else if (flag9)
         {
             if (flag7 && Main.hardMode && Main.player[this.owner].ZoneSnow && num14 == 3 && Main.rand.Next(3) != 0)
             {
                 num13 = 2429;
             }
             else if (flag7 && Main.hardMode && Main.rand.Next(2) == 0)
             {
                 num13 = 3211;
             }
             else if (flag4 && num22 == 2477)
             {
                 num13 = 2477;
             }
             else if (flag4 && num22 == 2463)
             {
                 num13 = 2463;
             }
             else if (flag4)
             {
                 num13 = 2319;
             }
             else if (flag3)
             {
                 num13 = 2305;
             }
         }
         else if (Main.player[this.owner].ZoneHoly)
         {
             if (flag7 && Main.hardMode && Main.player[this.owner].ZoneSnow && num14 == 3 && Main.rand.Next(3) != 0)
             {
                 num13 = 2429;
             }
             else if (flag7 && Main.hardMode && Main.rand.Next(2) == 0)
             {
                 num13 = 3209;
             }
             else if (num14 > 1 && flag6)
             {
                 num13 = 2317;
             }
             else if (num14 > 1 && flag5 && num22 == 2465)
             {
                 num13 = 2465;
             }
             else if (num14 < 2 && flag5 && num22 == 2468)
             {
                 num13 = 2468;
             }
             else if (flag5)
             {
                 num13 = 2310;
             }
             else if (flag4 && num22 == 2471)
             {
                 num13 = 2471;
             }
             else if (flag4)
             {
                 num13 = 2307;
             }
         }
         if (num13 == 0 && Main.player[this.owner].ZoneSnow)
         {
             if (num14 < 2 && flag4 && num22 == 2467)
             {
                 num13 = 2467;
             }
             else if (num14 == 1 && flag4 && num22 == 2470)
             {
                 num13 = 2470;
             }
             else if (num14 >= 2 && flag4 && num22 == 2484)
             {
                 num13 = 2484;
             }
             else if (num14 > 1 && flag4 && num22 == 2466)
             {
                 num13 = 2466;
             }
             else if ((flag3 && Main.rand.Next(12) == 0) || (flag4 && Main.rand.Next(6) == 0))
             {
                 num13 = 3197;
             }
             else if (flag4)
             {
                 num13 = 2306;
             }
             else if (flag3)
             {
                 num13 = 2299;
             }
             else if (num14 > 1 && Main.rand.Next(3) == 0)
             {
                 num13 = 2309;
             }
         }
         if (num13 == 0 && Main.player[this.owner].ZoneJungle)
         {
             if (Main.hardMode && flag7 && Main.rand.Next(2) == 0)
             {
                 num13 = 3018;
             }
             else if (num14 == 1 && flag4 && num22 == 2452)
             {
                 num13 = 2452;
             }
             else if (num14 == 1 && flag4 && num22 == 2483)
             {
                 num13 = 2483;
             }
             else if (num14 == 1 && flag4 && num22 == 2488)
             {
                 num13 = 2488;
             }
             else if (num14 >= 1 && flag4 && num22 == 2486)
             {
                 num13 = 2486;
             }
             else if (num14 > 1 && flag4)
             {
                 num13 = 2311;
             }
             else if (flag4)
             {
                 num13 = 2313;
             }
             else if (flag3)
             {
                 num13 = 2302;
             }
         }
         if (num13 == 0 && Main.shroomTiles > 200 && flag4 && num22 == 2475)
         {
             num13 = 2475;
         }
         if (num13 == 0)
         {
             if (num14 <= 1 && (num < 380 || num > Main.maxTilesX - 380) && num5 > 1000)
             {
                 if (flag6 && Main.rand.Next(2) == 0)
                 {
                     num13 = 2341;
                 }
                 else if (flag6)
                 {
                     num13 = 2342;
                 }
                 else if (flag5 && Main.rand.Next(5) == 0)
                 {
                     num13 = 2438;
                 }
                 else if (flag5 && Main.rand.Next(2) == 0)
                 {
                     num13 = 2332;
                 }
                 else if (flag4 && num22 == 2480)
                 {
                     num13 = 2480;
                 }
                 else if (flag4 && num22 == 2481)
                 {
                     num13 = 2481;
                 }
                 else if (flag4)
                 {
                     num13 = 2316;
                 }
                 else if (flag3 && Main.rand.Next(2) == 0)
                 {
                     num13 = 2301;
                 }
                 else if (flag3)
                 {
                     num13 = 2300;
                 }
                 else
                 {
                     num13 = 2297;
                 }
             }
             else
             {
                 int arg_CB8_0 = Main.sandTiles;
             }
         }
         if (num13 == 0)
         {
             if (num14 < 2 && flag4 && num22 == 2461)
             {
                 num13 = 2461;
             }
             else if (num14 == 0 && flag4 && num22 == 2453)
             {
                 num13 = 2453;
             }
             else if (num14 == 0 && flag4 && num22 == 2473)
             {
                 num13 = 2473;
             }
             else if (num14 == 0 && flag4 && num22 == 2476)
             {
                 num13 = 2476;
             }
             else if (num14 < 2 && flag4 && num22 == 2458)
             {
                 num13 = 2458;
             }
             else if (num14 < 2 && flag4 && num22 == 2459)
             {
                 num13 = 2459;
             }
             else if (num14 == 0 && flag4)
             {
                 num13 = 2304;
             }
             else if (num14 > 0 && num14 < 3 && flag4 && num22 == 2455)
             {
                 num13 = 2455;
             }
             else if (num14 == 1 && flag4 && num22 == 2479)
             {
                 num13 = 2479;
             }
             else if (num14 == 1 && flag4 && num22 == 2456)
             {
                 num13 = 2456;
             }
             else if (num14 == 1 && flag4 && num22 == 2474)
             {
                 num13 = 2474;
             }
             else if (num14 > 1 && flag5 && Main.rand.Next(5) == 0)
             {
                 if (Main.hardMode && Main.rand.Next(2) == 0)
                 {
                     num13 = 2437;
                 }
                 else
                 {
                     num13 = 2436;
                 }
             }
             else if (num14 > 1 && flag7)
             {
                 num13 = 2308;
             }
             else if (num14 > 1 && flag6 && Main.rand.Next(2) == 0)
             {
                 num13 = 2320;
             }
             else if (num14 > 1 && flag5)
             {
                 num13 = 2321;
             }
             else if (num14 > 1 && flag4 && num22 == 2478)
             {
                 num13 = 2478;
             }
             else if (num14 > 1 && flag4 && num22 == 2450)
             {
                 num13 = 2450;
             }
             else if (num14 > 1 && flag4 && num22 == 2464)
             {
                 num13 = 2464;
             }
             else if (num14 > 1 && flag4 && num22 == 2469)
             {
                 num13 = 2469;
             }
             else if (num14 > 2 && flag4 && num22 == 2462)
             {
                 num13 = 2462;
             }
             else if (num14 > 2 && flag4 && num22 == 2482)
             {
                 num13 = 2482;
             }
             else if (num14 > 2 && flag4 && num22 == 2472)
             {
                 num13 = 2472;
             }
             else if (num14 > 2 && flag4 && num22 == 2460)
             {
                 num13 = 2460;
             }
             else if (num14 > 1 && flag4 && Main.rand.Next(4) != 0)
             {
                 num13 = 2303;
             }
             else if (num14 > 1 && (flag4 || flag3 || Main.rand.Next(4) == 0))
             {
                 if (Main.rand.Next(4) == 0)
                 {
                     num13 = 2303;
                 }
                 else
                 {
                     num13 = 2309;
                 }
             }
             else if (flag4 && num22 == 2487)
             {
                 num13 = 2487;
             }
             else if (num5 > 1000 && flag3)
             {
                 num13 = 2298;
             }
             else
             {
                 num13 = 2290;
             }
         }
     }
     if (num13 > 0)
     {
         if (Main.player[this.owner].sonarPotion)
         {
             Item item = new Item();
             item.SetDefaults(num13, false);
             item.position = this.position;
             ItemText.NewText(item, 1, true, false);
         }
         float num23 = (float)num7;
         this.ai[1] = (float)Main.rand.Next(-240, -90) - num23;
         this.localAI[1] = (float)num13;
         this.netUpdate = true;
     }
 }
示例#21
0
 public static bool TryPlacingInChest(Item I, bool justCheck)
 {
     bool flag1 = false;
     Player player = Main.player[Main.myPlayer];
     Item[] objArray = player.bank.item;
     if (player.chest > -1)
     {
         objArray = Main.chest[player.chest].item;
         flag1 = Main.netMode == 1;
     }
     else if (player.chest == -2)
         objArray = player.bank.item;
     else if (player.chest == -3)
         objArray = player.bank2.item;
     bool flag2 = false;
     if (I.maxStack > 1)
     {
         for (int index = 0; index < 40; ++index)
         {
             if (objArray[index].stack < objArray[index].maxStack && I.IsTheSameAs(objArray[index]))
             {
                 int num = I.stack;
                 if (I.stack + objArray[index].stack > objArray[index].maxStack)
                     num = objArray[index].maxStack - objArray[index].stack;
                 if (justCheck)
                 {
                     flag2 = flag2 || num > 0;
                     break;
                 }
                 I.stack -= num;
                 objArray[index].stack += num;
                 Main.PlaySound(7, -1, -1, 1);
                 if (I.stack <= 0)
                 {
                     I.SetDefaults(0, false);
                     if (flag1)
                     {
                         NetMessage.SendData(32, -1, -1, "", player.chest, (float)index, 0.0f, 0.0f, 0, 0, 0);
                         break;
                     }
                     break;
                 }
                 if (objArray[index].itemId == 0)
                 {
                     objArray[index] = I.Clone();
                     I.SetDefaults(0, false);
                 }
                 if (flag1)
                     NetMessage.SendData(32, -1, -1, "", player.chest, (float)index, 0.0f, 0.0f, 0, 0, 0);
             }
         }
     }
     if (I.stack > 0)
     {
         for (int index = 0; index < 40; ++index)
         {
             if (objArray[index].stack == 0)
             {
                 if (justCheck)
                 {
                     flag2 = true;
                     break;
                 }
                 Main.PlaySound(7, -1, -1, 1);
                 objArray[index] = I.Clone();
                 I.SetDefaults(0, false);
                 if (flag1)
                 {
                     NetMessage.SendData(32, -1, -1, "", player.chest, (float)index, 0.0f, 0.0f, 0, 0, 0);
                     break;
                 }
                 break;
             }
         }
     }
     return flag2;
 }
        public static void addinv()
        {
            List<string> pick = new List<string>();
            List<string> axe = new List<string>();
            List<string> hammer = new List<string>();
            List<string> createTile = new List<string>();
            List<string> createWall = new List<string>();
            List<string> potion = new List<string>();
            List<string> headSlot = new List<string>();
            List<string> bodySlot = new List<string>();
            List<string> legSlot = new List<string>();
            List<string> healLife = new List<string>();
            List<string> healMana = new List<string>();
            List<string> vanity = new List<string>();
            List<string> material = new List<string>();
            List<string> melee = new List<string>();
            List<string> magic = new List<string>();
            List<string> ranged = new List<string>();
            List<string> mech = new List<string>();
            List<string> channel = new List<string>();
            List<string> accessory = new List<string>();
            List<string> buffType = new List<string>();
            List<string> ammo = new List<string>();
            List<string> useAmmo = new List<string>();

            List<string> All = new List<string>();

            foreach (string name in Main.itemName)
            {
                Item T = new Item();
                T.SetDefaults(name);
                if (T.useAmmo > 0)
                {
                    ammo.Add(T.name);
                }
                if (T.ammo > 0)
                {
                    ammo.Add(T.name);
                }
                if (T.pick > 0)
                {
                    pick.Add(T.name);
                }
                if (T.axe > 0)
                {
                    axe.Add(T.name);
                }
                if (T.hammer > 0)
                {
                    hammer.Add(T.name);
                }
                if (T.createTile > -1)
                {
                    createTile.Add(T.name);
                }
                if (T.createWall > -1)
                {
                    createWall.Add(T.name);
                }
                if (T.headSlot > -1)
                {
                    headSlot.Add(T.name);
                }
                if (T.bodySlot > -1)
                {
                    bodySlot.Add(T.name);
                }
                if (T.legSlot > -1)
                {
                    legSlot.Add(T.name);
                }
                if (T.healLife > 0)
                {
                    healLife.Add(T.name);
                }
                if (T.potion)
                {
                    potion.Add(T.name);
                }
                if (T.healMana>0)
                {
                    healMana.Add(T.name);
                }
                if (T.vanity)
                {
                    vanity.Add(T.name);
                }
                if (T.material)
                {
                    material.Add(T.name);
                }
                if (T.melee)
                {
                    melee.Add(T.name);
                }
                if (T.magic)
                {
                    magic.Add(T.name);
                }
                if (T.ranged)
                {
                    ranged.Add(T.name);
                }
                if (T.mech)
                {
                    mech.Add(T.name);
                }
                if (T.channel)
                {
                    channel.Add(T.name);
                }
                if (T.accessory)
                {
                    accessory.Add(T.name);
                }
                if (T.useAmmo>0)
                {
                    useAmmo.Add(T.name);
                }
                if (T.buffType > 0)
                {
                    buffType.Add(T.name);
                }
                All.Add(T.name);

            }
            Lazyinventory.Add(new itemInventory(pick, "pick"));
            Lazyinventory.Add(new itemInventory(axe, "axe"));
            Lazyinventory.Add(new itemInventory(hammer, "hammer"));
            Lazyinventory.Add(new itemInventory(createWall, "createWall"));
            Lazyinventory.Add(new itemInventory(createTile, "createTile"));
            Lazyinventory.Add(new itemInventory(mech, "mech"));
            Lazyinventory.Add(new itemInventory(legSlot, "legSlot"));
            Lazyinventory.Add(new itemInventory(bodySlot, "bodySlot"));
            Lazyinventory.Add(new itemInventory(headSlot, "headSlot"));
            Lazyinventory.Add(new itemInventory(accessory, "accessory"));
            Lazyinventory.Add(new itemInventory(potion, "potion"));
            Lazyinventory.Add(new itemInventory(buffType, "buffType"));
            Lazyinventory.Add(new itemInventory(healMana, "healMana"));
            Lazyinventory.Add(new itemInventory(healLife, "healLife"));
            Lazyinventory.Add(new itemInventory(channel, "channel"));
            Lazyinventory.Add(new itemInventory(ranged, "ranged"));
            Lazyinventory.Add(new itemInventory(ammo, "ammo"));
            Lazyinventory.Add(new itemInventory(useAmmo, "useAmmo"));
            Lazyinventory.Add(new itemInventory(magic, "magic"));
            Lazyinventory.Add(new itemInventory(melee, "melee"));
            Lazyinventory.Add(new itemInventory(material, "material"));
            Lazyinventory.Add(new itemInventory(vanity, "vanity"));

            Lazyinventory.Add(new itemInventory(All, "All"));
        }
示例#23
0
 protected void Initialize()
 {
     NPC.clrNames();
     NPC.setNames();
     Main.bgAlpha[0] = 1f;
     Main.bgAlpha2[0] = 1f;
     for (int index = 0; index < 112; ++index)
         Main.projFrames[index] = 1;
     Main.projFrames[72] = 4;
     Main.projFrames[86] = 4;
     Main.projFrames[87] = 4;
     Main.projFrames[102] = 2;
     Main.projFrames[111] = 8;
     Main.pvpBuff[20] = true;
     Main.pvpBuff[24] = true;
     Main.pvpBuff[31] = true;
     Main.pvpBuff[39] = true;
     Main.debuff[20] = true;
     Main.debuff[21] = true;
     Main.debuff[22] = true;
     Main.debuff[23] = true;
     Main.debuff[24] = true;
     Main.debuff[25] = true;
     Main.debuff[28] = true;
     Main.debuff[30] = true;
     Main.debuff[31] = true;
     Main.debuff[32] = true;
     Main.debuff[33] = true;
     Main.debuff[34] = true;
     Main.debuff[35] = true;
     Main.debuff[36] = true;
     Main.debuff[37] = true;
     Main.debuff[38] = true;
     Main.debuff[39] = true;
     for (int index = 0; index < 10; ++index)
     {
         Main.recentWorld[index] = "";
         Main.recentIP[index] = "";
         Main.recentPort[index] = 0;
     }
     if (Main.rand == null)
         Main.rand = new Random((int)DateTime.Now.Ticks);
     if (WorldGen.genRand == null)
         WorldGen.genRand = new Random((int)DateTime.Now.Ticks);
     this.SetTitle();
     Main.lo = Main.rand.Next(6);
     Main.tileShine2[6] = true;
     Main.tileShine2[7] = true;
     Main.tileShine2[8] = true;
     Main.tileShine2[9] = true;
     Main.tileShine2[12] = true;
     Main.tileShine2[21] = true;
     Main.tileShine2[22] = true;
     Main.tileShine2[25] = true;
     Main.tileShine2[45] = true;
     Main.tileShine2[46] = true;
     Main.tileShine2[47] = true;
     Main.tileShine2[63] = true;
     Main.tileShine2[64] = true;
     Main.tileShine2[65] = true;
     Main.tileShine2[66] = true;
     Main.tileShine2[67] = true;
     Main.tileShine2[68] = true;
     Main.tileShine2[107] = true;
     Main.tileShine2[108] = true;
     Main.tileShine2[111] = true;
     Main.tileShine2[121] = true;
     Main.tileShine2[122] = true;
     Main.tileShine2[117] = true;
     Main.tileShine[129] = 300;
     Main.tileHammer[141] = true;
     Main.tileHammer[4] = true;
     Main.tileHammer[10] = true;
     Main.tileHammer[11] = true;
     Main.tileHammer[12] = true;
     Main.tileHammer[13] = true;
     Main.tileHammer[14] = true;
     Main.tileHammer[15] = true;
     Main.tileHammer[16] = true;
     Main.tileHammer[17] = true;
     Main.tileHammer[18] = true;
     Main.tileHammer[19] = true;
     Main.tileHammer[21] = true;
     Main.tileHammer[26] = true;
     Main.tileHammer[28] = true;
     Main.tileHammer[29] = true;
     Main.tileHammer[31] = true;
     Main.tileHammer[33] = true;
     Main.tileHammer[34] = true;
     Main.tileHammer[35] = true;
     Main.tileHammer[36] = true;
     Main.tileHammer[42] = true;
     Main.tileHammer[48] = true;
     Main.tileHammer[49] = true;
     Main.tileHammer[50] = true;
     Main.tileHammer[54] = true;
     Main.tileHammer[55] = true;
     Main.tileHammer[77] = true;
     Main.tileHammer[78] = true;
     Main.tileHammer[79] = true;
     Main.tileHammer[81] = true;
     Main.tileHammer[85] = true;
     Main.tileHammer[86] = true;
     Main.tileHammer[87] = true;
     Main.tileHammer[88] = true;
     Main.tileHammer[89] = true;
     Main.tileHammer[90] = true;
     Main.tileHammer[91] = true;
     Main.tileHammer[92] = true;
     Main.tileHammer[93] = true;
     Main.tileHammer[94] = true;
     Main.tileHammer[95] = true;
     Main.tileHammer[96] = true;
     Main.tileHammer[97] = true;
     Main.tileHammer[98] = true;
     Main.tileHammer[99] = true;
     Main.tileHammer[100] = true;
     Main.tileHammer[101] = true;
     Main.tileHammer[102] = true;
     Main.tileHammer[103] = true;
     Main.tileHammer[104] = true;
     Main.tileHammer[105] = true;
     Main.tileHammer[106] = true;
     Main.tileHammer[114] = true;
     Main.tileHammer[125] = true;
     Main.tileHammer[126] = true;
     Main.tileHammer[128] = true;
     Main.tileHammer[129] = true;
     Main.tileHammer[132] = true;
     Main.tileHammer[133] = true;
     Main.tileHammer[134] = true;
     Main.tileHammer[135] = true;
     Main.tileHammer[136] = true;
     Main.tileFrameImportant[139] = true;
     Main.tileHammer[139] = true;
     Main.tileLighted[149] = true;
     Main.tileFrameImportant[149] = true;
     Main.tileHammer[149] = true;
     Main.tileFrameImportant[142] = true;
     Main.tileHammer[142] = true;
     Main.tileFrameImportant[143] = true;
     Main.tileHammer[143] = true;
     Main.tileFrameImportant[144] = true;
     Main.tileHammer[144] = true;
     Main.tileStone[131] = true;
     Main.tileFrameImportant[136] = true;
     Main.tileFrameImportant[137] = true;
     Main.tileFrameImportant[138] = true;
     Main.tileBlockLight[137] = true;
     Main.tileSolid[137] = true;
     Main.tileBlockLight[145] = true;
     Main.tileSolid[145] = true;
     Main.tileMergeDirt[145] = true;
     Main.tileBlockLight[146] = true;
     Main.tileSolid[146] = true;
     Main.tileMergeDirt[146] = true;
     Main.tileBlockLight[147] = true;
     Main.tileSolid[147] = true;
     Main.tileMergeDirt[147] = true;
     Main.tileBlockLight[148] = true;
     Main.tileSolid[148] = true;
     Main.tileMergeDirt[148] = true;
     Main.tileBlockLight[138] = true;
     Main.tileSolid[138] = true;
     Main.tileBlockLight[140] = true;
     Main.tileSolid[140] = true;
     Main.tileAxe[5] = true;
     Main.tileAxe[30] = true;
     Main.tileAxe[72] = true;
     Main.tileAxe[80] = true;
     Main.tileAxe[124] = true;
     Main.tileShine[22] = 1150;
     Main.tileShine[6] = 1150;
     Main.tileShine[7] = 1100;
     Main.tileShine[8] = 1000;
     Main.tileShine[9] = 1050;
     Main.tileShine[12] = 1000;
     Main.tileShine[21] = 1200;
     Main.tileShine[63] = 900;
     Main.tileShine[64] = 900;
     Main.tileShine[65] = 900;
     Main.tileShine[66] = 900;
     Main.tileShine[67] = 900;
     Main.tileShine[68] = 900;
     Main.tileShine[45] = 1900;
     Main.tileShine[46] = 2000;
     Main.tileShine[47] = 2100;
     Main.tileShine[122] = 1800;
     Main.tileShine[121] = 1850;
     Main.tileShine[125] = 600;
     Main.tileShine[109] = 9000;
     Main.tileShine[110] = 9000;
     Main.tileShine[116] = 9000;
     Main.tileShine[117] = 9000;
     Main.tileShine[118] = 8000;
     Main.tileShine[107] = 950;
     Main.tileShine[108] = 900;
     Main.tileShine[111] = 850;
     Main.tileLighted[4] = true;
     Main.tileLighted[17] = true;
     Main.tileLighted[133] = true;
     Main.tileLighted[31] = true;
     Main.tileLighted[33] = true;
     Main.tileLighted[34] = true;
     Main.tileLighted[35] = true;
     Main.tileLighted[36] = true;
     Main.tileLighted[37] = true;
     Main.tileLighted[42] = true;
     Main.tileLighted[49] = true;
     Main.tileLighted[58] = true;
     Main.tileLighted[61] = true;
     Main.tileLighted[70] = true;
     Main.tileLighted[71] = true;
     Main.tileLighted[72] = true;
     Main.tileLighted[76] = true;
     Main.tileLighted[77] = true;
     Main.tileLighted[19] = true;
     Main.tileLighted[22] = true;
     Main.tileLighted[26] = true;
     Main.tileLighted[83] = true;
     Main.tileLighted[84] = true;
     Main.tileLighted[92] = true;
     Main.tileLighted[93] = true;
     Main.tileLighted[95] = true;
     Main.tileLighted[98] = true;
     Main.tileLighted[100] = true;
     Main.tileLighted[109] = true;
     Main.tileLighted[125] = true;
     Main.tileLighted[126] = true;
     Main.tileLighted[129] = true;
     Main.tileLighted[140] = true;
     Main.tileMergeDirt[1] = true;
     Main.tileMergeDirt[6] = true;
     Main.tileMergeDirt[7] = true;
     Main.tileMergeDirt[8] = true;
     Main.tileMergeDirt[9] = true;
     Main.tileMergeDirt[22] = true;
     Main.tileMergeDirt[25] = true;
     Main.tileMergeDirt[30] = true;
     Main.tileMergeDirt[37] = true;
     Main.tileMergeDirt[38] = true;
     Main.tileMergeDirt[40] = true;
     Main.tileMergeDirt[53] = true;
     Main.tileMergeDirt[56] = true;
     Main.tileMergeDirt[107] = true;
     Main.tileMergeDirt[108] = true;
     Main.tileMergeDirt[111] = true;
     Main.tileMergeDirt[112] = true;
     Main.tileMergeDirt[116] = true;
     Main.tileMergeDirt[117] = true;
     Main.tileMergeDirt[123] = true;
     Main.tileMergeDirt[140] = true;
     Main.tileMergeDirt[39] = true;
     Main.tileMergeDirt[122] = true;
     Main.tileMergeDirt[121] = true;
     Main.tileMergeDirt[120] = true;
     Main.tileMergeDirt[119] = true;
     Main.tileMergeDirt[118] = true;
     Main.tileMergeDirt[47] = true;
     Main.tileMergeDirt[46] = true;
     Main.tileMergeDirt[45] = true;
     Main.tileMergeDirt[44] = true;
     Main.tileMergeDirt[43] = true;
     Main.tileMergeDirt[41] = true;
     Main.tileFrameImportant[3] = true;
     Main.tileFrameImportant[4] = true;
     Main.tileFrameImportant[5] = true;
     Main.tileFrameImportant[10] = true;
     Main.tileFrameImportant[11] = true;
     Main.tileFrameImportant[12] = true;
     Main.tileFrameImportant[13] = true;
     Main.tileFrameImportant[14] = true;
     Main.tileFrameImportant[15] = true;
     Main.tileFrameImportant[16] = true;
     Main.tileFrameImportant[17] = true;
     Main.tileFrameImportant[18] = true;
     Main.tileFrameImportant[20] = true;
     Main.tileFrameImportant[21] = true;
     Main.tileFrameImportant[24] = true;
     Main.tileFrameImportant[26] = true;
     Main.tileFrameImportant[27] = true;
     Main.tileFrameImportant[28] = true;
     Main.tileFrameImportant[29] = true;
     Main.tileFrameImportant[31] = true;
     Main.tileFrameImportant[33] = true;
     Main.tileFrameImportant[34] = true;
     Main.tileFrameImportant[35] = true;
     Main.tileFrameImportant[36] = true;
     Main.tileFrameImportant[42] = true;
     Main.tileFrameImportant[50] = true;
     Main.tileFrameImportant[55] = true;
     Main.tileFrameImportant[61] = true;
     Main.tileFrameImportant[71] = true;
     Main.tileFrameImportant[72] = true;
     Main.tileFrameImportant[73] = true;
     Main.tileFrameImportant[74] = true;
     Main.tileFrameImportant[77] = true;
     Main.tileFrameImportant[78] = true;
     Main.tileFrameImportant[79] = true;
     Main.tileFrameImportant[81] = true;
     Main.tileFrameImportant[82] = true;
     Main.tileFrameImportant[83] = true;
     Main.tileFrameImportant[84] = true;
     Main.tileFrameImportant[85] = true;
     Main.tileFrameImportant[86] = true;
     Main.tileFrameImportant[87] = true;
     Main.tileFrameImportant[88] = true;
     Main.tileFrameImportant[89] = true;
     Main.tileFrameImportant[90] = true;
     Main.tileFrameImportant[91] = true;
     Main.tileFrameImportant[92] = true;
     Main.tileFrameImportant[93] = true;
     Main.tileFrameImportant[94] = true;
     Main.tileFrameImportant[95] = true;
     Main.tileFrameImportant[96] = true;
     Main.tileFrameImportant[97] = true;
     Main.tileFrameImportant[98] = true;
     Main.tileFrameImportant[99] = true;
     Main.tileFrameImportant[101] = true;
     Main.tileFrameImportant[102] = true;
     Main.tileFrameImportant[103] = true;
     Main.tileFrameImportant[104] = true;
     Main.tileFrameImportant[105] = true;
     Main.tileFrameImportant[100] = true;
     Main.tileFrameImportant[106] = true;
     Main.tileFrameImportant[110] = true;
     Main.tileFrameImportant[113] = true;
     Main.tileFrameImportant[114] = true;
     Main.tileFrameImportant[125] = true;
     Main.tileFrameImportant[126] = true;
     Main.tileFrameImportant[128] = true;
     Main.tileFrameImportant[129] = true;
     Main.tileFrameImportant[132] = true;
     Main.tileFrameImportant[133] = true;
     Main.tileFrameImportant[134] = true;
     Main.tileFrameImportant[135] = true;
     Main.tileFrameImportant[141] = true;
     Main.tileCut[3] = true;
     Main.tileCut[24] = true;
     Main.tileCut[28] = true;
     Main.tileCut[32] = true;
     Main.tileCut[51] = true;
     Main.tileCut[52] = true;
     Main.tileCut[61] = true;
     Main.tileCut[62] = true;
     Main.tileCut[69] = true;
     Main.tileCut[71] = true;
     Main.tileCut[73] = true;
     Main.tileCut[74] = true;
     Main.tileCut[82] = true;
     Main.tileCut[83] = true;
     Main.tileCut[84] = true;
     Main.tileCut[110] = true;
     Main.tileCut[113] = true;
     Main.tileCut[115] = true;
     Main.tileAlch[82] = true;
     Main.tileAlch[83] = true;
     Main.tileAlch[84] = true;
     Main.tileLavaDeath[104] = true;
     Main.tileLavaDeath[110] = true;
     Main.tileLavaDeath[113] = true;
     Main.tileLavaDeath[115] = true;
     Main.tileSolid[(int)sbyte.MaxValue] = true;
     Main.tileSolid[130] = true;
     Main.tileBlockLight[130] = true;
     Main.tileBlockLight[131] = true;
     Main.tileSolid[107] = true;
     Main.tileBlockLight[107] = true;
     Main.tileSolid[108] = true;
     Main.tileBlockLight[108] = true;
     Main.tileSolid[111] = true;
     Main.tileBlockLight[111] = true;
     Main.tileSolid[109] = true;
     Main.tileBlockLight[109] = true;
     Main.tileSolid[110] = false;
     Main.tileNoAttach[110] = true;
     Main.tileNoFail[110] = true;
     Main.tileSolid[112] = true;
     Main.tileBlockLight[112] = true;
     Main.tileSolid[116] = true;
     Main.tileBlockLight[116] = true;
     Main.tileSolid[117] = true;
     Main.tileBlockLight[117] = true;
     Main.tileSolid[123] = true;
     Main.tileBlockLight[123] = true;
     Main.tileSolid[118] = true;
     Main.tileBlockLight[118] = true;
     Main.tileSolid[119] = true;
     Main.tileBlockLight[119] = true;
     Main.tileSolid[120] = true;
     Main.tileBlockLight[120] = true;
     Main.tileSolid[121] = true;
     Main.tileBlockLight[121] = true;
     Main.tileSolid[122] = true;
     Main.tileBlockLight[122] = true;
     Main.tileBlockLight[115] = true;
     Main.tileSolid[0] = true;
     Main.tileBlockLight[0] = true;
     Main.tileSolid[1] = true;
     Main.tileBlockLight[1] = true;
     Main.tileSolid[2] = true;
     Main.tileBlockLight[2] = true;
     Main.tileSolid[3] = false;
     Main.tileNoAttach[3] = true;
     Main.tileNoFail[3] = true;
     Main.tileSolid[4] = false;
     Main.tileNoAttach[4] = true;
     Main.tileNoFail[4] = true;
     Main.tileNoFail[24] = true;
     Main.tileSolid[5] = false;
     Main.tileSolid[6] = true;
     Main.tileBlockLight[6] = true;
     Main.tileSolid[7] = true;
     Main.tileBlockLight[7] = true;
     Main.tileSolid[8] = true;
     Main.tileBlockLight[8] = true;
     Main.tileSolid[9] = true;
     Main.tileBlockLight[9] = true;
     Main.tileBlockLight[10] = true;
     Main.tileSolid[10] = true;
     Main.tileNoAttach[10] = true;
     Main.tileBlockLight[10] = true;
     Main.tileSolid[11] = false;
     Main.tileSolidTop[19] = true;
     Main.tileSolid[19] = true;
     Main.tileSolid[22] = true;
     Main.tileSolid[23] = true;
     Main.tileSolid[25] = true;
     Main.tileSolid[30] = true;
     Main.tileNoFail[32] = true;
     Main.tileBlockLight[32] = true;
     Main.tileSolid[37] = true;
     Main.tileBlockLight[37] = true;
     Main.tileSolid[38] = true;
     Main.tileBlockLight[38] = true;
     Main.tileSolid[39] = true;
     Main.tileBlockLight[39] = true;
     Main.tileSolid[40] = true;
     Main.tileBlockLight[40] = true;
     Main.tileSolid[41] = true;
     Main.tileBlockLight[41] = true;
     Main.tileSolid[43] = true;
     Main.tileBlockLight[43] = true;
     Main.tileSolid[44] = true;
     Main.tileBlockLight[44] = true;
     Main.tileSolid[45] = true;
     Main.tileBlockLight[45] = true;
     Main.tileSolid[46] = true;
     Main.tileBlockLight[46] = true;
     Main.tileSolid[47] = true;
     Main.tileBlockLight[47] = true;
     Main.tileSolid[48] = true;
     Main.tileBlockLight[48] = true;
     Main.tileSolid[53] = true;
     Main.tileBlockLight[53] = true;
     Main.tileSolid[54] = true;
     Main.tileBlockLight[52] = true;
     Main.tileSolid[56] = true;
     Main.tileBlockLight[56] = true;
     Main.tileSolid[57] = true;
     Main.tileBlockLight[57] = true;
     Main.tileSolid[58] = true;
     Main.tileBlockLight[58] = true;
     Main.tileSolid[59] = true;
     Main.tileBlockLight[59] = true;
     Main.tileSolid[60] = true;
     Main.tileBlockLight[60] = true;
     Main.tileSolid[63] = true;
     Main.tileBlockLight[63] = true;
     Main.tileStone[63] = true;
     Main.tileStone[130] = true;
     Main.tileSolid[64] = true;
     Main.tileBlockLight[64] = true;
     Main.tileStone[64] = true;
     Main.tileSolid[65] = true;
     Main.tileBlockLight[65] = true;
     Main.tileStone[65] = true;
     Main.tileSolid[66] = true;
     Main.tileBlockLight[66] = true;
     Main.tileStone[66] = true;
     Main.tileSolid[67] = true;
     Main.tileBlockLight[67] = true;
     Main.tileStone[67] = true;
     Main.tileSolid[68] = true;
     Main.tileBlockLight[68] = true;
     Main.tileStone[68] = true;
     Main.tileSolid[75] = true;
     Main.tileBlockLight[75] = true;
     Main.tileSolid[76] = true;
     Main.tileBlockLight[76] = true;
     Main.tileSolid[70] = true;
     Main.tileBlockLight[70] = true;
     Main.tileNoFail[50] = true;
     Main.tileNoAttach[50] = true;
     Main.tileDungeon[41] = true;
     Main.tileDungeon[43] = true;
     Main.tileDungeon[44] = true;
     Main.tileBlockLight[30] = true;
     Main.tileBlockLight[25] = true;
     Main.tileBlockLight[23] = true;
     Main.tileBlockLight[22] = true;
     Main.tileBlockLight[62] = true;
     Main.tileSolidTop[18] = true;
     Main.tileSolidTop[14] = true;
     Main.tileSolidTop[16] = true;
     Main.tileSolidTop[114] = true;
     Main.tileNoAttach[20] = true;
     Main.tileNoAttach[19] = true;
     Main.tileNoAttach[13] = true;
     Main.tileNoAttach[14] = true;
     Main.tileNoAttach[15] = true;
     Main.tileNoAttach[16] = true;
     Main.tileNoAttach[17] = true;
     Main.tileNoAttach[18] = true;
     Main.tileNoAttach[19] = true;
     Main.tileNoAttach[21] = true;
     Main.tileNoAttach[27] = true;
     Main.tileNoAttach[114] = true;
     Main.tileTable[14] = true;
     Main.tileTable[18] = true;
     Main.tileTable[19] = true;
     Main.tileTable[114] = true;
     Main.tileNoAttach[86] = true;
     Main.tileNoAttach[87] = true;
     Main.tileNoAttach[88] = true;
     Main.tileNoAttach[89] = true;
     Main.tileNoAttach[90] = true;
     Main.tileLavaDeath[86] = true;
     Main.tileLavaDeath[87] = true;
     Main.tileLavaDeath[88] = true;
     Main.tileLavaDeath[89] = true;
     Main.tileLavaDeath[125] = true;
     Main.tileLavaDeath[126] = true;
     Main.tileLavaDeath[101] = true;
     Main.tileTable[101] = true;
     Main.tileNoAttach[101] = true;
     Main.tileLavaDeath[102] = true;
     Main.tileNoAttach[102] = true;
     Main.tileNoAttach[94] = true;
     Main.tileNoAttach[95] = true;
     Main.tileNoAttach[96] = true;
     Main.tileNoAttach[97] = true;
     Main.tileNoAttach[98] = true;
     Main.tileNoAttach[99] = true;
     Main.tileLavaDeath[94] = true;
     Main.tileLavaDeath[95] = true;
     Main.tileLavaDeath[96] = true;
     Main.tileLavaDeath[97] = true;
     Main.tileLavaDeath[98] = true;
     Main.tileLavaDeath[99] = true;
     Main.tileLavaDeath[100] = true;
     Main.tileLavaDeath[103] = true;
     Main.tileTable[87] = true;
     Main.tileTable[88] = true;
     Main.tileSolidTop[87] = true;
     Main.tileSolidTop[88] = true;
     Main.tileSolidTop[101] = true;
     Main.tileNoAttach[91] = true;
     Main.tileLavaDeath[91] = true;
     Main.tileNoAttach[92] = true;
     Main.tileLavaDeath[92] = true;
     Main.tileNoAttach[93] = true;
     Main.tileLavaDeath[93] = true;
     Main.tileWaterDeath[4] = true;
     Main.tileWaterDeath[51] = true;
     Main.tileWaterDeath[93] = true;
     Main.tileWaterDeath[98] = true;
     Main.tileLavaDeath[3] = true;
     Main.tileLavaDeath[5] = true;
     Main.tileLavaDeath[10] = true;
     Main.tileLavaDeath[11] = true;
     Main.tileLavaDeath[12] = true;
     Main.tileLavaDeath[13] = true;
     Main.tileLavaDeath[14] = true;
     Main.tileLavaDeath[15] = true;
     Main.tileLavaDeath[16] = true;
     Main.tileLavaDeath[17] = true;
     Main.tileLavaDeath[18] = true;
     Main.tileLavaDeath[19] = true;
     Main.tileLavaDeath[20] = true;
     Main.tileLavaDeath[27] = true;
     Main.tileLavaDeath[28] = true;
     Main.tileLavaDeath[29] = true;
     Main.tileLavaDeath[32] = true;
     Main.tileLavaDeath[33] = true;
     Main.tileLavaDeath[34] = true;
     Main.tileLavaDeath[35] = true;
     Main.tileLavaDeath[36] = true;
     Main.tileLavaDeath[42] = true;
     Main.tileLavaDeath[49] = true;
     Main.tileLavaDeath[50] = true;
     Main.tileLavaDeath[52] = true;
     Main.tileLavaDeath[55] = true;
     Main.tileLavaDeath[61] = true;
     Main.tileLavaDeath[62] = true;
     Main.tileLavaDeath[69] = true;
     Main.tileLavaDeath[71] = true;
     Main.tileLavaDeath[72] = true;
     Main.tileLavaDeath[73] = true;
     Main.tileLavaDeath[74] = true;
     Main.tileLavaDeath[79] = true;
     Main.tileLavaDeath[80] = true;
     Main.tileLavaDeath[81] = true;
     Main.tileLavaDeath[106] = true;
     Main.wallHouse[1] = true;
     Main.wallHouse[4] = true;
     Main.wallHouse[5] = true;
     Main.wallHouse[6] = true;
     Main.wallHouse[10] = true;
     Main.wallHouse[11] = true;
     Main.wallHouse[12] = true;
     Main.wallHouse[16] = true;
     Main.wallHouse[17] = true;
     Main.wallHouse[18] = true;
     Main.wallHouse[19] = true;
     Main.wallHouse[20] = true;
     Main.wallHouse[21] = true;
     Main.wallHouse[22] = true;
     Main.wallHouse[23] = true;
     Main.wallHouse[24] = true;
     Main.wallHouse[25] = true;
     Main.wallHouse[26] = true;
     Main.wallHouse[27] = true;
     Main.wallHouse[29] = true;
     Main.wallHouse[30] = true;
     Main.wallHouse[31] = true;
     for (int index = 0; index < 32; ++index)
         Main.wallBlend[index] = index != 20 ? (index != 19 ? (index != 18 ? (index != 17 ? (index != 16 ? index : 2) : 7) : 8) : 9) : 14;
     Main.tileNoFail[32] = true;
     Main.tileNoFail[61] = true;
     Main.tileNoFail[69] = true;
     Main.tileNoFail[73] = true;
     Main.tileNoFail[74] = true;
     Main.tileNoFail[82] = true;
     Main.tileNoFail[83] = true;
     Main.tileNoFail[84] = true;
     Main.tileNoFail[110] = true;
     Main.tileNoFail[113] = true;
     for (int index = 0; index < 150; ++index)
     {
         Main.tileName[index] = "";
         if (Main.tileSolid[index])
             Main.tileNoSunLight[index] = true;
     }
     Main.tileNoSunLight[19] = false;
     Main.tileNoSunLight[11] = true;
     for (int index = 0; index < Main.maxMenuItems; ++index)
         this.menuItemScale[index] = 0.8f;
     for (int index = 0; index < 2001; ++index)
         Main.dust[index] = new Dust();
     for (int index = 0; index < 201; ++index)
         Main.item[index] = new Item();
     for (int index = 0; index < 201; ++index)
     {
         Main.npc[index] = new NPC();
         Main.npc[index].whoAmI = index;
     }
     for (int index = 0; index < 256; ++index)
         Main.player[index] = new Player();
     for (int index = 0; index < 1001; ++index)
         Main.projectile[index] = new Projectile();
     for (int index = 0; index < 201; ++index)
         Main.gore[index] = new Gore();
     for (int index = 0; index < 100; ++index)
         Main.cloud[index] = new Cloud();
     for (int index = 0; index < 100; ++index)
         Main.combatText[index] = new CombatText();
     for (int index = 0; index < 20; ++index)
         Main.itemText[index] = new ItemText();
     var orilang = Lang.lang;
     Lang.lang = 1;
     for (int Type = 0; Type < 604; ++Type)
     {
         Item obj = new Item();
         obj.SetDefaults(Type, false);
         Main.itemName[Type] = obj.name;
         if (obj.headSlot > 0)
             Item.headType[obj.headSlot] = obj.type;
         if (obj.bodySlot > 0)
             Item.bodyType[obj.bodySlot] = obj.type;
         if (obj.legSlot > 0)
             Item.legType[obj.legSlot] = obj.type;
     }
     Lang.lang = orilang;
     for (int index = 0; index < Recipe.maxRecipes; ++index)
     {
         Main.recipe[index] = new Recipe();
         Main.availableRecipeY[index] = (float)(65 * index);
     }
     Recipe.SetupRecipes();
     for (int index = 0; index < Main.numChatLines; ++index)
         Main.chatLine[index] = new ChatLine();
     for (int index = 0; index < Liquid.resLiquid; ++index)
         Main.liquid[index] = new Liquid();
     for (int index = 0; index < 10000; ++index)
         Main.liquidBuffer[index] = new LiquidBuffer();
     this.shop[0] = new Chest();
     this.shop[1] = new Chest();
     this.shop[1].SetupShop(1);
     this.shop[2] = new Chest();
     this.shop[2].SetupShop(2);
     this.shop[3] = new Chest();
     this.shop[3].SetupShop(3);
     this.shop[4] = new Chest();
     this.shop[4].SetupShop(4);
     this.shop[5] = new Chest();
     this.shop[5].SetupShop(5);
     this.shop[6] = new Chest();
     this.shop[6].SetupShop(6);
     this.shop[7] = new Chest();
     this.shop[7].SetupShop(7);
     this.shop[8] = new Chest();
     this.shop[8].SetupShop(8);
     this.shop[9] = new Chest();
     this.shop[9].SetupShop(9);
     Main.teamColor[0] = Color.White;
     Main.teamColor[1] = new Color(230, 40, 20);
     Main.teamColor[2] = new Color(20, 200, 30);
     Main.teamColor[3] = new Color(75, 90, (int)byte.MaxValue);
     Main.teamColor[4] = new Color(200, 180, 0);
     if (Main.menuMode == 1)
         Main.LoadPlayers();
     for (int Type = 1; Type < 112; ++Type)
     {
         Projectile projectile = new Projectile();
         projectile.SetDefaults(Type);
         if (projectile.hostile)
             Main.projHostile[Type] = true;
     }
     Netplay.Init();
     if (Main.skipMenu)
     {
         WorldGen.clearWorld();
         Main.gameMenu = false;
         Main.LoadPlayers();
         Main.player[Main.myPlayer] = (Player)Main.loadPlayer[0].Clone();
         Main.PlayerPath = Main.loadPlayerPath[0];
         Main.LoadWorlds();
         WorldGen.generateWorld(-1);
         WorldGen.EveryTileFrame();
         Main.player[Main.myPlayer].Spawn();
     }
 }
示例#24
0
 /// <summary>Returns the item used to attempt a rejected background wall edit to the player.</summary>
 /// <param name="player">The player attempting the edit</param>
 /// <param name="e">The data from the edit event</param>
 public void giveWall(Player player, TShockAPI.GetDataHandlers.TileEditEventArgs e)
 {
     Item item = new Item(); bool found = false;
     for (int i = 1; i <= Terraria.ID.ItemID.Count; i++) {
         item.SetDefaults(i, true);
         if (item.createWall == e.EditData) {
             found = true;
             break;
         }
     }
     if (found) giveItem(player, item);
 }
示例#25
0
		public void ItemCheck(int i)
		{
			if (this.frozen)
			{
				return;
			}
			bool flag = false;
			float num = 5E-06f;
			int num2 = this.inventory[this.selectedItem].damage;
			if (num2 > 0)
			{
				if (this.inventory[this.selectedItem].melee)
				{
					num2 = (int)((float)num2 * this.meleeDamage + num);
				}
				else if (this.inventory[this.selectedItem].ranged)
				{
					num2 = (int)((float)num2 * this.rangedDamage + num);
					if (this.inventory[this.selectedItem].useAmmo == 1 || this.inventory[this.selectedItem].useAmmo == 323)
					{
						num2 = (int)((float)num2 * this.arrowDamage + num);
					}
					if (this.inventory[this.selectedItem].useAmmo == 14 || this.inventory[this.selectedItem].useAmmo == 311)
					{
						num2 = (int)((float)num2 * this.bulletDamage + num);
					}
					if (this.inventory[this.selectedItem].useAmmo == 771 || this.inventory[this.selectedItem].useAmmo == 246 || this.inventory[this.selectedItem].useAmmo == 312)
					{
						num2 = (int)((float)num2 * this.rocketDamage + num);
					}
				}
				else if (this.inventory[this.selectedItem].magic)
				{
					num2 = (int)((float)num2 * this.magicDamage + num);
				}
			}
			if (this.inventory[this.selectedItem].autoReuse && !this.noItems)
			{
				this.releaseUseItem = true;
				if (this.itemAnimation == 1 && this.inventory[this.selectedItem].stack > 0)
				{
					if (this.inventory[this.selectedItem].shoot > 0 && this.whoAmi != Main.myPlayer && this.controlUseItem && this.inventory[this.selectedItem].useStyle == 5)
					{
						this.itemAnimation = 2;
					}
					else
					{
						this.itemAnimation = 0;
					}
				}
			}
			if (this.inventory[this.selectedItem].fishingPole > 0)
			{
				this.inventory[this.selectedItem].holdStyle = 0;
				if (this.itemTime == 0 && this.itemAnimation == 0)
				{
					for (int j = 0; j < 1000; j++)
					{
						if (Main.projectile[j].active && Main.projectile[j].owner == this.whoAmi && Main.projectile[j].bobber)
						{
							this.inventory[this.selectedItem].holdStyle = 1;
						}
					}
				}
			}
			if (this.whoAmi == Main.myPlayer && this.mount.Active)
			{
				if (this.inventory[this.selectedItem].mountType != this.mount.Type && this.itemAnimation > 0)
				{
					this.mount.Dismount(this);
				}
				if (this.gravDir == -1f)
				{
					this.mount.Dismount(this);
				}
			}
			if (this.itemAnimation == 0 && this.reuseDelay > 0)
			{
				this.itemAnimation = this.reuseDelay;
				this.itemTime = this.reuseDelay;
				this.reuseDelay = 0;
			}
			if (this.controlUseItem && this.releaseUseItem && (this.inventory[this.selectedItem].headSlot > 0 || this.inventory[this.selectedItem].bodySlot > 0 || this.inventory[this.selectedItem].legSlot > 0))
			{
				if (this.inventory[this.selectedItem].useStyle == 0)
				{
					this.releaseUseItem = false;
				}
				if (this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f >= (float)Player.tileTargetY)
				{
					int num3 = Player.tileTargetX;
					int num4 = Player.tileTargetY;
					if (Main.tile[num3, num4].active() && (Main.tile[num3, num4].type == 128 || Main.tile[num3, num4].type == 269))
					{
						int num5 = (int)Main.tile[num3, num4].frameY;
						int k = 0;
						if (this.inventory[this.selectedItem].bodySlot >= 0)
						{
							k = 1;
						}
						if (this.inventory[this.selectedItem].legSlot >= 0)
						{
							k = 2;
						}
						num5 /= 18;
						while (k > num5)
						{
							num4++;
							num5 = (int)Main.tile[num3, num4].frameY;
							num5 /= 18;
						}
						while (k < num5)
						{
							num4--;
							num5 = (int)Main.tile[num3, num4].frameY;
							num5 /= 18;
						}
						int l;
						for (l = (int)Main.tile[num3, num4].frameX; l >= 100; l -= 100)
						{
						}
						if (l >= 36)
						{
							l -= 36;
						}
						num3 -= l / 18;
						int m = (int)Main.tile[num3, num4].frameX;
						WorldGen.KillTile(num3, num4, true, false, false);
						if (Main.netMode == 1)
						{
							NetMessage.SendData(17, -1, -1, "", 0, (float)num3, (float)num4, 1f, 0);
						}
						while (m >= 100)
						{
							m -= 100;
						}
						if (num5 == 0 && this.inventory[this.selectedItem].headSlot >= 0)
						{
							Main.blockMouse = true;
							Main.tile[num3, num4].frameX = (short)(m + this.inventory[this.selectedItem].headSlot * 100);
							if (Main.netMode == 1)
							{
								NetMessage.SendTileSquare(-1, num3, num4, 1);
							}
							this.inventory[this.selectedItem].stack--;
							if (this.inventory[this.selectedItem].stack <= 0)
							{
								this.inventory[this.selectedItem].SetDefaults(0, false);
								Main.mouseItem.SetDefaults(0, false);
							}
							if (this.selectedItem == 58)
							{
								Main.mouseItem = this.inventory[this.selectedItem].Clone();
							}
							this.releaseUseItem = false;
							this.mouseInterface = true;
						}
						else if (num5 == 1 && this.inventory[this.selectedItem].bodySlot >= 0)
						{
							Main.blockMouse = true;
							Main.tile[num3, num4].frameX = (short)(m + this.inventory[this.selectedItem].bodySlot * 100);
							if (Main.netMode == 1)
							{
								NetMessage.SendTileSquare(-1, num3, num4, 1);
							}
							this.inventory[this.selectedItem].stack--;
							if (this.inventory[this.selectedItem].stack <= 0)
							{
								this.inventory[this.selectedItem].SetDefaults(0, false);
								Main.mouseItem.SetDefaults(0, false);
							}
							if (this.selectedItem == 58)
							{
								Main.mouseItem = this.inventory[this.selectedItem].Clone();
							}
							this.releaseUseItem = false;
							this.mouseInterface = true;
						}
						else if (num5 == 2 && this.inventory[this.selectedItem].legSlot >= 0)
						{
							Main.blockMouse = true;
							Main.tile[num3, num4].frameX = (short)(m + this.inventory[this.selectedItem].legSlot * 100);
							if (Main.netMode == 1)
							{
								NetMessage.SendTileSquare(-1, num3, num4, 1);
							}
							this.inventory[this.selectedItem].stack--;
							if (this.inventory[this.selectedItem].stack <= 0)
							{
								this.inventory[this.selectedItem].SetDefaults(0, false);
								Main.mouseItem.SetDefaults(0, false);
							}
							if (this.selectedItem == 58)
							{
								Main.mouseItem = this.inventory[this.selectedItem].Clone();
							}
							this.releaseUseItem = false;
							this.mouseInterface = true;
						}
					}
				}
			}
			if (this.controlUseItem && this.itemAnimation == 0 && this.releaseUseItem && this.inventory[this.selectedItem].useStyle > 0)
			{
				bool flag2 = true;
				if (this.inventory[this.selectedItem].shoot == 0)
				{
					this.itemRotation = 0f;
				}
				if (this.pulley && this.inventory[this.selectedItem].fishingPole > 0)
				{
					flag2 = false;
				}
				if (this.wet && (this.inventory[this.selectedItem].shoot == 85 || this.inventory[this.selectedItem].shoot == 15 || this.inventory[this.selectedItem].shoot == 34))
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].makeNPC > 0 && !NPC.CanReleaseNPCs(this.whoAmi))
				{
					flag2 = false;
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 603 && !Main.cEd)
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].type == 1071 || this.inventory[this.selectedItem].type == 1072)
				{
					bool flag3 = false;
					for (int n = 0; n < 58; n++)
					{
						if (this.inventory[n].paint > 0)
						{
							flag3 = true;
							break;
						}
					}
					if (!flag3)
					{
						flag2 = false;
					}
				}
				if (this.noItems)
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].tileWand > 0)
				{
					int tileWand = this.inventory[this.selectedItem].tileWand;
					flag2 = false;
					for (int num6 = 0; num6 < 58; num6++)
					{
						if (tileWand == this.inventory[num6].type && this.inventory[num6].stack > 0)
						{
							flag2 = true;
							break;
						}
					}
				}
				if (this.inventory[this.selectedItem].fishingPole > 0)
				{
					for (int num7 = 0; num7 < 1000; num7++)
					{
						if (Main.projectile[num7].active && Main.projectile[num7].owner == this.whoAmi && Main.projectile[num7].bobber)
						{
							flag2 = false;
							if (this.whoAmi == Main.myPlayer && Main.projectile[num7].ai[0] == 0f)
							{
								Main.projectile[num7].ai[0] = 1f;
								float num8 = -10f;
								if (Main.projectile[num7].wet && Main.projectile[num7].velocity.Y > num8)
								{
									Main.projectile[num7].velocity.Y = num8;
								}
								Main.projectile[num7].netUpdate2 = true;
								if (Main.projectile[num7].ai[1] < 0f && Main.projectile[num7].localAI[1] != 0f)
								{
									bool flag4 = false;
									int num9 = 0;
									for (int num10 = 0; num10 < 58; num10++)
									{
										if (this.inventory[num10].stack > 0 && this.inventory[num10].bait > 0)
										{
											bool flag5 = false;
											int num11 = this.inventory[num10].bait / 5;
											if (num11 < 1)
											{
												num11 = 1;
											}
											if (this.accTackleBox)
											{
												num11++;
											}
											if (Main.rand.Next(num11) == 0)
											{
												flag5 = true;
											}
											if (Main.projectile[num7].localAI[1] < 0f)
											{
												flag5 = true;
											}
											if (Main.projectile[num7].localAI[1] > 0f)
											{
												Item item = new Item();
												item.SetDefaults((int)Main.projectile[num7].localAI[1], false);
												if (item.rare < 0)
												{
													flag5 = false;
												}
											}
											if (flag5)
											{
												num9 = this.inventory[num10].type;
												this.inventory[num10].stack--;
												if (this.inventory[num10].stack <= 0)
												{
													this.inventory[num10].SetDefaults(0, false);
												}
											}
											flag4 = true;
											break;
										}
									}
									if (flag4)
									{
										if (num9 == 2673)
										{
											if (Main.netMode != 1)
											{
												NPC.SpawnOnPlayer(this.whoAmi, 370);
											}
											else
											{
												NetMessage.SendData(61, -1, -1, "", this.whoAmi, 370f, 0f, 0f, 0);
											}
											Main.projectile[num7].ai[0] = 2f;
										}
										else if (Main.rand.Next(7) == 0 && !this.accFishingLine)
										{
											Main.projectile[num7].ai[0] = 2f;
										}
										else
										{
											Main.projectile[num7].ai[1] = Main.projectile[num7].localAI[1];
										}
										Main.projectile[num7].netUpdate = true;
									}
								}
							}
						}
					}
				}
				if (this.inventory[this.selectedItem].shoot == 6 || this.inventory[this.selectedItem].shoot == 19 || this.inventory[this.selectedItem].shoot == 33 || this.inventory[this.selectedItem].shoot == 52 || this.inventory[this.selectedItem].shoot == 113 || this.inventory[this.selectedItem].shoot == 182 || this.inventory[this.selectedItem].shoot == 320 || this.inventory[this.selectedItem].shoot == 333 || this.inventory[this.selectedItem].shoot == 383)
				{
					for (int num12 = 0; num12 < 1000; num12++)
					{
						if (Main.projectile[num12].active && Main.projectile[num12].owner == Main.myPlayer && Main.projectile[num12].type == this.inventory[this.selectedItem].shoot)
						{
							flag2 = false;
						}
					}
				}
				if (this.inventory[this.selectedItem].shoot == 106)
				{
					int num13 = 0;
					for (int num14 = 0; num14 < 1000; num14++)
					{
						if (Main.projectile[num14].active && Main.projectile[num14].owner == Main.myPlayer && Main.projectile[num14].type == this.inventory[this.selectedItem].shoot)
						{
							num13++;
						}
					}
					if (num13 >= this.inventory[this.selectedItem].stack)
					{
						flag2 = false;
					}
				}
				if (this.inventory[this.selectedItem].shoot == 272)
				{
					int num15 = 0;
					for (int num16 = 0; num16 < 1000; num16++)
					{
						if (Main.projectile[num16].active && Main.projectile[num16].owner == Main.myPlayer && Main.projectile[num16].type == this.inventory[this.selectedItem].shoot)
						{
							num15++;
						}
					}
					if (num15 >= this.inventory[this.selectedItem].stack)
					{
						flag2 = false;
					}
				}
				if (this.inventory[this.selectedItem].shoot == 13 || this.inventory[this.selectedItem].shoot == 32 || (this.inventory[this.selectedItem].shoot >= 230 && this.inventory[this.selectedItem].shoot <= 235) || this.inventory[this.selectedItem].shoot == 315 || this.inventory[this.selectedItem].shoot == 331 || this.inventory[this.selectedItem].shoot == 372)
				{
					for (int num17 = 0; num17 < 1000; num17++)
					{
						if (Main.projectile[num17].active && Main.projectile[num17].owner == Main.myPlayer && Main.projectile[num17].type == this.inventory[this.selectedItem].shoot && Main.projectile[num17].ai[0] != 2f)
						{
							flag2 = false;
						}
					}
				}
				if (this.inventory[this.selectedItem].shoot == 332)
				{
					int num18 = 0;
					for (int num19 = 0; num19 < 1000; num19++)
					{
						if (Main.projectile[num19].active && Main.projectile[num19].owner == Main.myPlayer && Main.projectile[num19].type == this.inventory[this.selectedItem].shoot && Main.projectile[num19].ai[0] != 2f)
						{
							num18++;
						}
					}
					if (num18 >= 3)
					{
						flag2 = false;
					}
				}
				if (this.inventory[this.selectedItem].potion && flag2)
				{
					if (this.potionDelay <= 0)
					{
						this.potionDelay = this.potionDelayTime;
						this.AddBuff(21, this.potionDelay, true);
					}
					else
					{
						flag2 = false;
					}
				}
				if (this.inventory[this.selectedItem].mana > 0 && this.silence)
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].mana > 0 && flag2)
				{
					if (this.inventory[this.selectedItem].type != 127 || !this.spaceGun)
					{
						if (this.statMana >= (int)((float)this.inventory[this.selectedItem].mana * this.manaCost))
						{
							this.statMana -= (int)((float)this.inventory[this.selectedItem].mana * this.manaCost);
						}
						else if (this.manaFlower)
						{
							this.QuickMana();
							if (this.statMana >= (int)((float)this.inventory[this.selectedItem].mana * this.manaCost))
							{
								this.statMana -= (int)((float)this.inventory[this.selectedItem].mana * this.manaCost);
							}
							else
							{
								flag2 = false;
							}
						}
						else
						{
							flag2 = false;
						}
					}
					if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].buffType != 0 && flag2)
					{
						this.AddBuff(this.inventory[this.selectedItem].buffType, this.inventory[this.selectedItem].buffTime, true);
					}
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 603 && Main.cEd)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 669)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 115)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 425)
				{
					int num20 = Main.rand.Next(3);
					if (num20 == 0)
					{
						num20 = 27;
					}
					if (num20 == 1)
					{
						num20 = 101;
					}
					if (num20 == 2)
					{
						num20 = 102;
					}
					for (int num21 = 0; num21 < 22; num21++)
					{
						if (this.buffType[num21] == 27 || this.buffType[num21] == 101 || this.buffType[num21] == 102)
						{
							this.DelBuff(num21);
							num21--;
						}
					}
					this.AddBuff(num20, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 753)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 994)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1169)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1170)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1171)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1172)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1180)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1181)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1182)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1183)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1242)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1157)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1309)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1311)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1837)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1312)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1798)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1799)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1802)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1810)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1927)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1959)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 2364)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 2365)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 2420)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 2535)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 2551)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 2584)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 2587)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 2621)
				{
					this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
				}
				if (this.whoAmi == Main.myPlayer && this.gravDir == 1f && this.inventory[this.selectedItem].mountType != -1)
				{
					this.mount.SetMount(this.inventory[this.selectedItem].mountType, this, false);
				}
				if (this.inventory[this.selectedItem].type == 43 && Main.dayTime)
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].type == 544 && Main.dayTime)
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].type == 556 && Main.dayTime)
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].type == 557 && Main.dayTime)
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].type == 70 && !this.zoneEvil)
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].type == 1133 && !this.zoneJungle)
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].type == 1844 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon))
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].type == 1958 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon))
				{
					flag2 = false;
				}
				if (!this.SummonItemCheck())
				{
					flag2 = false;
				}
				if (this.inventory[this.selectedItem].shoot == 17 && flag2 && i == Main.myPlayer)
				{
					int num22 = (int)((float)Main.mouseX + Main.screenPosition.X) / 16;
					int num23 = (int)((float)Main.mouseY + Main.screenPosition.Y) / 16;
					if (this.gravDir == -1f)
					{
						num23 = (int)(Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16;
					}
					Tile tile = Main.tile[num22, num23];
					if (tile.active() && (tile.type == 0 || tile.type == 2 || tile.type == 23 || tile.type == 109 || tile.type == 199))
					{
						WorldGen.KillTile(num22, num23, false, false, true);
						if (!Main.tile[num22, num23].active())
						{
							if (Main.netMode == 1)
							{
								NetMessage.SendData(17, -1, -1, "", 4, (float)num22, (float)num23, 0f, 0);
							}
						}
						else
						{
							flag2 = false;
						}
					}
					else
					{
						flag2 = false;
					}
				}
				if (flag2 && this.inventory[this.selectedItem].useAmmo > 0)
				{
					flag2 = false;
					for (int num24 = 0; num24 < 58; num24++)
					{
						if (this.inventory[num24].ammo == this.inventory[this.selectedItem].useAmmo && this.inventory[num24].stack > 0)
						{
							flag2 = true;
							break;
						}
					}
				}
				if (flag2)
				{
					if (this.inventory[this.selectedItem].pick > 0 || this.inventory[this.selectedItem].axe > 0 || this.inventory[this.selectedItem].hammer > 0)
					{
						this.toolTime = 1;
					}
					if (this.grappling[0] > -1)
					{
						this.pulley = false;
						this.pulleyDir = 1;
						if (this.controlRight)
						{
							this.direction = 1;
						}
						else if (this.controlLeft)
						{
							this.direction = -1;
						}
					}
					this.channel = this.inventory[this.selectedItem].channel;
					this.attackCD = 0;
					if (this.inventory[this.selectedItem].melee)
					{
						this.itemAnimation = (int)((float)this.inventory[this.selectedItem].useAnimation * this.meleeSpeed);
						this.itemAnimationMax = (int)((float)this.inventory[this.selectedItem].useAnimation * this.meleeSpeed);
					}
					else if (this.inventory[this.selectedItem].createTile >= 0)
					{
						this.itemAnimation = (int)((float)this.inventory[this.selectedItem].useAnimation * this.tileSpeed);
						this.itemAnimationMax = (int)((float)this.inventory[this.selectedItem].useAnimation * this.tileSpeed);
					}
					else if (this.inventory[this.selectedItem].createWall >= 0)
					{
						this.itemAnimation = (int)((float)this.inventory[this.selectedItem].useAnimation * this.wallSpeed);
						this.itemAnimationMax = (int)((float)this.inventory[this.selectedItem].useAnimation * this.wallSpeed);
					}
					else
					{
						this.itemAnimation = this.inventory[this.selectedItem].useAnimation;
						this.itemAnimationMax = this.inventory[this.selectedItem].useAnimation;
						this.reuseDelay = this.inventory[this.selectedItem].reuseDelay;
					}
					if (this.inventory[this.selectedItem].useSound > 0)
					{
						Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, this.inventory[this.selectedItem].useSound);
					}
				}
				if (flag2 && this.whoAmi == Main.myPlayer && (this.inventory[this.selectedItem].shoot == 18 || this.inventory[this.selectedItem].shoot == 72 || this.inventory[this.selectedItem].shoot == 86 || this.inventory[this.selectedItem].shoot == 87 || Main.projPet[this.inventory[this.selectedItem].shoot]))
				{
					if ((this.inventory[this.selectedItem].shoot >= 191 && this.inventory[this.selectedItem].shoot <= 194) || this.inventory[this.selectedItem].shoot == 266 || this.inventory[this.selectedItem].shoot == 317 || this.inventory[this.selectedItem].shoot == 373 || this.inventory[this.selectedItem].shoot == 375 || this.inventory[this.selectedItem].shoot == 387 || this.inventory[this.selectedItem].shoot == 390 || this.inventory[this.selectedItem].shoot == 393 || this.inventory[this.selectedItem].shoot == 407)
					{
						List<int> list = new List<int>();
						float num25 = 0f;
						for (int num26 = 0; num26 < 1000; num26++)
						{
							if (Main.projectile[num26].active && Main.projectile[num26].owner == i && Main.projectile[num26].minion)
							{
								int num27;
								for (num27 = 0; num27 < list.Count; num27++)
								{
									if (Main.projectile[list[num27]].minionSlots > Main.projectile[num26].minionSlots)
									{
										list.Insert(num27, num26);
										break;
									}
								}
								if (num27 == list.Count)
								{
									list.Add(num26);
								}
								num25 += Main.projectile[num26].minionSlots;
							}
						}
						int arg_24AB_0 = this.inventory[this.selectedItem].shoot;
						float num28 = 1f;
						float num29 = 0f;
						int num30 = 388;
						int num31 = 0;
						while (num31 < list.Count && num25 - num29 > (float)this.maxMinions - num28)
						{
							int type = Main.projectile[list[num31]].type;
							if (type != num30)
							{
								num29 += Main.projectile[list[num31]].minionSlots;
								if (type == 388 && num30 == 387)
								{
									num30 = 388;
								}
								if (type == 387 && num30 == 388)
								{
									num30 = 387;
								}
								Main.projectile[list[num31]].Kill();
							}
							num31++;
						}
						list.Clear();
					}
					else
					{
						for (int num32 = 0; num32 < 1000; num32++)
						{
							if (Main.projectile[num32].active && Main.projectile[num32].owner == i && Main.projectile[num32].type == this.inventory[this.selectedItem].shoot)
							{
								Main.projectile[num32].Kill();
							}
							if (this.inventory[this.selectedItem].shoot == 72)
							{
								if (Main.projectile[num32].active && Main.projectile[num32].owner == i && Main.projectile[num32].type == 86)
								{
									Main.projectile[num32].Kill();
								}
								if (Main.projectile[num32].active && Main.projectile[num32].owner == i && Main.projectile[num32].type == 87)
								{
									Main.projectile[num32].Kill();
								}
							}
						}
					}
				}
			}
			if (!this.controlUseItem)
			{
				bool arg_267A_0 = this.channel;
				this.channel = false;
			}
			if (this.itemAnimation > 0)
			{
				if (this.inventory[this.selectedItem].melee)
				{
					this.itemAnimationMax = (int)((float)this.inventory[this.selectedItem].useAnimation * this.meleeSpeed);
				}
				else
				{
					this.itemAnimationMax = this.inventory[this.selectedItem].useAnimation;
				}
				if (this.inventory[this.selectedItem].mana > 0 && !flag && (this.inventory[this.selectedItem].type != 127 || !this.spaceGun))
				{
					this.manaRegenDelay = (int)this.maxRegenDelay;
				}
				this.itemHeight = this.inventory[this.selectedItem].height;
				this.itemWidth = this.inventory[this.selectedItem].width;
				this.itemAnimation--;
			}
			else if (this.inventory[this.selectedItem].holdStyle == 1 && !this.pulley && !this.mount.Active)
			{
				this.itemLocation.X = this.position.X + (float)this.width * 0.5f + 20f * (float)this.direction;
				this.itemLocation.Y = this.position.Y + 24f;
				if (this.inventory[this.selectedItem].type == 856)
				{
					this.itemLocation.Y = this.position.Y + 34f;
				}
				if (this.inventory[this.selectedItem].type == 930)
				{
					this.itemLocation.Y = this.position.Y + 9f;
				}
				if (this.inventory[this.selectedItem].fishingPole > 0)
				{
					this.itemLocation.Y = this.itemLocation.Y + 4f;
				}
				this.itemRotation = 0f;
				if (this.gravDir == -1f)
				{
					this.itemRotation = -this.itemRotation;
					this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y);
					if (this.inventory[this.selectedItem].type == 930)
					{
						this.itemLocation.Y = this.itemLocation.Y - 24f;
					}
				}
			}
			else if (this.inventory[this.selectedItem].holdStyle == 2 && !this.pulley && !this.mount.Active)
			{
				if (this.inventory[this.selectedItem].type == 946)
				{
					this.itemRotation = 0f;
					this.itemLocation.X = this.position.X + (float)this.width * 0.5f - (float)(16 * this.direction);
					this.itemLocation.Y = this.position.Y + 22f;
					this.fallStart = (int)(this.position.Y / 16f);
					if (this.gravDir == -1f)
					{
						this.itemRotation = -this.itemRotation;
						this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y);
						if (this.velocity.Y < -2f)
						{
							this.velocity.Y = -2f;
						}
					}
					else if (this.velocity.Y > 2f)
					{
						this.velocity.Y = 2f;
					}
				}
				else
				{
					this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)(6 * this.direction);
					this.itemLocation.Y = this.position.Y + 16f;
					this.itemRotation = 0.79f * (float)(-(float)this.direction);
					if (this.gravDir == -1f)
					{
						this.itemRotation = -this.itemRotation;
						this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y);
					}
				}
			}
			if ((((this.inventory[this.selectedItem].type == 974 || this.inventory[this.selectedItem].type == 8 || this.inventory[this.selectedItem].type == 1245 || this.inventory[this.selectedItem].type == 2274 || (this.inventory[this.selectedItem].type >= 427 && this.inventory[this.selectedItem].type <= 433)) && !this.wet) || this.inventory[this.selectedItem].type == 523 || this.inventory[this.selectedItem].type == 1333) && !this.pulley && !this.mount.Active)
			{
				float num49 = 1f;
				float num50 = 0.95f;
				float num51 = 0.8f;
				int num52 = 0;
				if (this.inventory[this.selectedItem].type == 523)
				{
					num52 = 8;
				}
				else if (this.inventory[this.selectedItem].type == 974)
				{
					num52 = 9;
				}
				else if (this.inventory[this.selectedItem].type == 1245)
				{
					num52 = 10;
				}
				else if (this.inventory[this.selectedItem].type == 1333)
				{
					num52 = 11;
				}
				else if (this.inventory[this.selectedItem].type == 2274)
				{
					num52 = 12;
				}
				else if (this.inventory[this.selectedItem].type >= 427)
				{
					num52 = this.inventory[this.selectedItem].type - 426;
				}
				if (num52 == 1)
				{
					num49 = 0f;
					num50 = 0.1f;
					num51 = 1.3f;
				}
				else if (num52 == 2)
				{
					num49 = 1f;
					num50 = 0.1f;
					num51 = 0.1f;
				}
				else if (num52 == 3)
				{
					num49 = 0f;
					num50 = 1f;
					num51 = 0.1f;
				}
				else if (num52 == 4)
				{
					num49 = 0.9f;
					num50 = 0f;
					num51 = 0.9f;
				}
				else if (num52 == 5)
				{
					num49 = 1.3f;
					num50 = 1.3f;
					num51 = 1.3f;
				}
				else if (num52 == 6)
				{
					num49 = 0.9f;
					num50 = 0.9f;
					num51 = 0f;
				}
				else if (num52 == 7)
				{
					num49 = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
					num50 = 0.3f;
					num51 = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch);
				}
				else if (num52 == 8)
				{
					num51 = 0.7f;
					num49 = 0.85f;
					num50 = 1f;
				}
				else if (num52 == 9)
				{
					num51 = 1f;
					num49 = 0.7f;
					num50 = 0.85f;
				}
				else if (num52 == 10)
				{
					num51 = 0f;
					num49 = 1f;
					num50 = 0.5f;
				}
				else if (num52 == 11)
				{
					num51 = 0.8f;
					num49 = 1.25f;
					num50 = 1.25f;
				}
				else if (num52 == 12)
				{
					num49 *= 0.75f;
					num50 *= 1.3499999f;
					num51 *= 1.5f;
				}
				int num53 = num52;
				if (num53 == 0)
				{
					num53 = 6;
				}
				else if (num53 == 8)
				{
					num53 = 75;
				}
				else if (num53 == 9)
				{
					num53 = 135;
				}
				else if (num53 == 10)
				{
					num53 = 158;
				}
				else if (num53 == 11)
				{
					num53 = 169;
				}
				else if (num53 == 12)
				{
					num53 = 156;
				}
				else
				{
					num53 = 58 + num53;
				}
				int maxValue = 30;
				if (this.itemAnimation > 0)
				{
					maxValue = 7;
				}
				if (this.direction == -1)
				{
					if (Main.rand.Next(maxValue) == 0)
					{
						int num54 = Dust.NewDust(new Vector2(this.itemLocation.X - 16f, this.itemLocation.Y - 14f * this.gravDir), 4, 4, num53, 0f, 0f, 100, default(Color), 1f);
						if (Main.rand.Next(3) != 0)
						{
							Main.dust[num54].noGravity = true;
						}
						Main.dust[num54].velocity *= 0.3f;
						Dust expr_457E_cp_0 = Main.dust[num54];
						expr_457E_cp_0.velocity.Y = expr_457E_cp_0.velocity.Y - 1.5f;
					}
					Lighting.addLight((int)((this.itemLocation.X - 12f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f + this.velocity.Y) / 16f), num49, num50, num51);
				}
				else
				{
					if (Main.rand.Next(maxValue) == 0)
					{
						int num55 = Dust.NewDust(new Vector2(this.itemLocation.X + 6f, this.itemLocation.Y - 14f * this.gravDir), 4, 4, num53, 0f, 0f, 100, default(Color), 1f);
						if (Main.rand.Next(3) != 0)
						{
							Main.dust[num55].noGravity = true;
						}
						Main.dust[num55].velocity *= 0.3f;
						Dust expr_4695_cp_0 = Main.dust[num55];
						expr_4695_cp_0.velocity.Y = expr_4695_cp_0.velocity.Y - 1.5f;
					}
					Lighting.addLight((int)((this.itemLocation.X + 12f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f + this.velocity.Y) / 16f), num49, num50, num51);
				}
			}
			if ((this.inventory[this.selectedItem].type == 105 || this.inventory[this.selectedItem].type == 713) && !this.wet && !this.pulley)
			{
				int maxValue2 = 20;
				if (this.itemAnimation > 0)
				{
					maxValue2 = 7;
				}
				if (this.direction == -1)
				{
					if (Main.rand.Next(maxValue2) == 0)
					{
						int num56 = Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 6, 0f, 0f, 100, default(Color), 1f);
						if (Main.rand.Next(3) != 0)
						{
							Main.dust[num56].noGravity = true;
						}
						Main.dust[num56].velocity *= 0.3f;
						Dust expr_480A_cp_0 = Main.dust[num56];
						expr_480A_cp_0.velocity.Y = expr_480A_cp_0.velocity.Y - 1.5f;
					}
					Lighting.addLight((int)((this.itemLocation.X - 16f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f) / 16f), 1f, 0.95f, 0.8f);
				}
				else
				{
					if (Main.rand.Next(maxValue2) == 0)
					{
						int num57 = Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 6, 0f, 0f, 100, default(Color), 1f);
						if (Main.rand.Next(3) != 0)
						{
							Main.dust[num57].noGravity = true;
						}
						Main.dust[num57].velocity *= 0.3f;
						Dust expr_491D_cp_0 = Main.dust[num57];
						expr_491D_cp_0.velocity.Y = expr_491D_cp_0.velocity.Y - 1.5f;
					}
					Lighting.addLight((int)((this.itemLocation.X + 6f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f) / 16f), 1f, 0.95f, 0.8f);
				}
			}
			else if (this.inventory[this.selectedItem].type == 148 && !this.wet)
			{
				int maxValue3 = 10;
				if (this.itemAnimation > 0)
				{
					maxValue3 = 7;
				}
				if (this.direction == -1)
				{
					if (Main.rand.Next(maxValue3) == 0)
					{
						int num58 = Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 172, 0f, 0f, 100, default(Color), 1f);
						if (Main.rand.Next(3) != 0)
						{
							Main.dust[num58].noGravity = true;
						}
						Main.dust[num58].velocity *= 0.3f;
						Dust expr_4A77_cp_0 = Main.dust[num58];
						expr_4A77_cp_0.velocity.Y = expr_4A77_cp_0.velocity.Y - 1.5f;
					}
					Lighting.addLight((int)((this.itemLocation.X - 16f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f) / 16f), 0f, 0.5f, 1f);
				}
				else
				{
					if (Main.rand.Next(maxValue3) == 0)
					{
						int num59 = Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 172, 0f, 0f, 100, default(Color), 1f);
						if (Main.rand.Next(3) != 0)
						{
							Main.dust[num59].noGravity = true;
						}
						Main.dust[num59].velocity *= 0.3f;
						Dust expr_4B8E_cp_0 = Main.dust[num59];
						expr_4B8E_cp_0.velocity.Y = expr_4B8E_cp_0.velocity.Y - 1.5f;
					}
					Lighting.addLight((int)((this.itemLocation.X + 6f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f) / 16f), 0f, 0.5f, 1f);
				}
			}
			if (this.inventory[this.selectedItem].type == 282 && !this.pulley)
			{
				if (this.direction == -1)
				{
					Lighting.addLight((int)((this.itemLocation.X - 16f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f) / 16f), 0.7f, 1f, 0.8f);
				}
				else
				{
					Lighting.addLight((int)((this.itemLocation.X + 6f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f) / 16f), 0.7f, 1f, 0.8f);
				}
			}
			if (this.inventory[this.selectedItem].type == 286 && !this.pulley)
			{
				if (this.direction == -1)
				{
					Lighting.addLight((int)((this.itemLocation.X - 16f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f) / 16f), 0.7f, 0.8f, 1f);
				}
				else
				{
					Lighting.addLight((int)((this.itemLocation.X + 6f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f) / 16f), 0.7f, 0.8f, 1f);
				}
			}
			if (this.controlUseItem)
			{
				this.releaseUseItem = false;
			}
			else
			{
				this.releaseUseItem = true;
			}
			if (this.itemTime > 0)
			{
				this.itemTime--;
				if (this.itemTime == 0 && this.whoAmi == Main.myPlayer)
				{
					int type2 = this.inventory[this.selectedItem].type;
					if (type2 == 65 || type2 == 676 || type2 == 723 || type2 == 724 || type2 == 989 || type2 == 1226 || type2 == 1227)
					{
						Main.PlaySound(25, -1, -1, 1);
						for (int num60 = 0; num60 < 5; num60++)
						{
							int num61 = Dust.NewDust(this.position, this.width, this.height, 45, 0f, 0f, 255, default(Color), (float)Main.rand.Next(20, 26) * 0.1f);
							Main.dust[num61].noLight = true;
							Main.dust[num61].noGravity = true;
							Main.dust[num61].velocity *= 0.5f;
						}
					}
				}
			}
			if (((this.inventory[this.selectedItem].damage >= 0 && this.inventory[this.selectedItem].type > 0 && !this.inventory[this.selectedItem].noMelee) || this.inventory[this.selectedItem].type == 1450 || this.inventory[this.selectedItem].type == 1991) && this.itemAnimation > 0)
			{
				bool flag15 = false;
				Rectangle rectangle = new Rectangle((int)this.itemLocation.X, (int)this.itemLocation.Y, 32, 32);
				rectangle.Width = (int)((float)rectangle.Width * this.inventory[this.selectedItem].scale);
				rectangle.Height = (int)((float)rectangle.Height * this.inventory[this.selectedItem].scale);
				if (this.direction == -1)
				{
					rectangle.X -= rectangle.Width;
				}
				if (this.gravDir == 1f)
				{
					rectangle.Y -= rectangle.Height;
				}
				if (this.inventory[this.selectedItem].useStyle == 1)
				{
					if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.333)
					{
						if (this.direction == -1)
						{
							rectangle.X -= (int)((double)rectangle.Width * 1.4 - (double)rectangle.Width);
						}
						rectangle.Width = (int)((double)rectangle.Width * 1.4);
						rectangle.Y += (int)((double)rectangle.Height * 0.5 * (double)this.gravDir);
						rectangle.Height = (int)((double)rectangle.Height * 1.1);
					}
					else if ((double)this.itemAnimation >= (double)this.itemAnimationMax * 0.666)
					{
						if (this.direction == 1)
						{
							rectangle.X -= (int)((double)rectangle.Width * 1.2);
						}
						rectangle.Width *= 2;
						rectangle.Y -= (int)(((double)rectangle.Height * 1.4 - (double)rectangle.Height) * (double)this.gravDir);
						rectangle.Height = (int)((double)rectangle.Height * 1.4);
					}
				}
				else if (this.inventory[this.selectedItem].useStyle == 3)
				{
					if ((double)this.itemAnimation > (double)this.itemAnimationMax * 0.666)
					{
						flag15 = true;
					}
					else
					{
						if (this.direction == -1)
						{
							rectangle.X -= (int)((double)rectangle.Width * 1.4 - (double)rectangle.Width);
						}
						rectangle.Width = (int)((double)rectangle.Width * 1.4);
						rectangle.Y += (int)((double)rectangle.Height * 0.6);
						rectangle.Height = (int)((double)rectangle.Height * 0.6);
					}
				}
				float arg_B0B8_0 = this.gravDir;
				if (this.inventory[this.selectedItem].type == 1450 && Main.rand.Next(3) == 0)
				{
					int num194 = -1;
					float x5 = (float)(rectangle.X + Main.rand.Next(rectangle.Width));
					float y5 = (float)(rectangle.Y + Main.rand.Next(rectangle.Height));
					if (Main.rand.Next(500) == 0)
					{
						num194 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 415, (float)Main.rand.Next(51, 101) * 0.01f);
					}
					else if (Main.rand.Next(250) == 0)
					{
						num194 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 414, (float)Main.rand.Next(51, 101) * 0.01f);
					}
					else if (Main.rand.Next(80) == 0)
					{
						num194 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 413, (float)Main.rand.Next(51, 101) * 0.01f);
					}
					else if (Main.rand.Next(10) == 0)
					{
						num194 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 412, (float)Main.rand.Next(51, 101) * 0.01f);
					}
					else if (Main.rand.Next(3) == 0)
					{
						num194 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 411, (float)Main.rand.Next(51, 101) * 0.01f);
					}
					if (num194 >= 0)
					{
						Gore expr_B2B2_cp_0 = Main.gore[num194];
						expr_B2B2_cp_0.velocity.X = expr_B2B2_cp_0.velocity.X + (float)(this.direction * 2);
						Gore expr_B2D4_cp_0 = Main.gore[num194];
						expr_B2D4_cp_0.velocity.Y = expr_B2D4_cp_0.velocity.Y * 0.3f;
					}
				}
				if (!flag15)
				{
					if (this.inventory[this.selectedItem].type == 989 && Main.rand.Next(5) == 0)
					{
						int num195 = Main.rand.Next(3);
						if (num195 == 0)
						{
							num195 = 15;
						}
						else if (num195 == 1)
						{
							num195 = 57;
						}
						else
						{
							num195 = 58;
						}
						int num196 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, num195, (float)(this.direction * 2), 0f, 150, default(Color), 1.3f);
						Main.dust[num196].velocity *= 0.2f;
					}
					if ((this.inventory[this.selectedItem].type == 44 || this.inventory[this.selectedItem].type == 45 || this.inventory[this.selectedItem].type == 46 || this.inventory[this.selectedItem].type == 103 || this.inventory[this.selectedItem].type == 104) && Main.rand.Next(15) == 0)
					{
						Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 14, (float)(this.direction * 2), 0f, 150, default(Color), 1.3f);
					}
					if (this.inventory[this.selectedItem].type == 273 || this.inventory[this.selectedItem].type == 675)
					{
						if (Main.rand.Next(5) == 0)
						{
							Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 14, (float)(this.direction * 2), 0f, 150, default(Color), 1.4f);
						}
						int num197 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 27, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.2f);
						Main.dust[num197].noGravity = true;
						Dust expr_B5AD_cp_0 = Main.dust[num197];
						expr_B5AD_cp_0.velocity.X = expr_B5AD_cp_0.velocity.X / 2f;
						Dust expr_B5CD_cp_0 = Main.dust[num197];
						expr_B5CD_cp_0.velocity.Y = expr_B5CD_cp_0.velocity.Y / 2f;
					}
					if (this.inventory[this.selectedItem].type == 723 && Main.rand.Next(2) == 0)
					{
						int num198 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 64, 0f, 0f, 150, default(Color), 1.2f);
						Main.dust[num198].noGravity = true;
					}
					if (this.inventory[this.selectedItem].type == 65)
					{
						if (Main.rand.Next(5) == 0)
						{
							Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 58, 0f, 0f, 150, default(Color), 1.2f);
						}
						if (Main.rand.Next(10) == 0)
						{
							Gore.NewGore(new Vector2((float)rectangle.X, (float)rectangle.Y), default(Vector2), Main.rand.Next(16, 18), 1f);
						}
					}
					if (this.inventory[this.selectedItem].type == 190 || this.inventory[this.selectedItem].type == 213)
					{
						int num199 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 40, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 0, default(Color), 1.2f);
						Main.dust[num199].noGravity = true;
					}
					if (this.inventory[this.selectedItem].type == 121)
					{
						for (int num200 = 0; num200 < 2; num200++)
						{
							int num201 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f);
							Main.dust[num201].noGravity = true;
							Dust expr_B881_cp_0 = Main.dust[num201];
							expr_B881_cp_0.velocity.X = expr_B881_cp_0.velocity.X * 2f;
							Dust expr_B8A1_cp_0 = Main.dust[num201];
							expr_B8A1_cp_0.velocity.Y = expr_B8A1_cp_0.velocity.Y * 2f;
						}
					}
					if (this.inventory[this.selectedItem].type == 122 || this.inventory[this.selectedItem].type == 217)
					{
						int num202 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.9f);
						Main.dust[num202].noGravity = true;
					}
					if (this.inventory[this.selectedItem].type == 155)
					{
						int num203 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 172, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 0.9f);
						Main.dust[num203].noGravity = true;
						Main.dust[num203].velocity *= 0.1f;
					}
					if (this.inventory[this.selectedItem].type == 676 && Main.rand.Next(3) == 0)
					{
						int num204 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 67, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 90, default(Color), 1.5f);
						Main.dust[num204].noGravity = true;
						Main.dust[num204].velocity *= 0.2f;
					}
					if (this.inventory[this.selectedItem].type == 724 && Main.rand.Next(5) == 0)
					{
						int num205 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 67, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 90, default(Color), 1.5f);
						Main.dust[num205].noGravity = true;
						Main.dust[num205].velocity *= 0.2f;
					}
					if (this.inventory[this.selectedItem].type >= 795 && this.inventory[this.selectedItem].type <= 802 && Main.rand.Next(3) == 0)
					{
						int num206 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 115, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 140, default(Color), 1.5f);
						Main.dust[num206].noGravity = true;
						Main.dust[num206].velocity *= 0.25f;
					}
					if (this.inventory[this.selectedItem].type == 367 || this.inventory[this.selectedItem].type == 368 || this.inventory[this.selectedItem].type == 674)
					{
						if (Main.rand.Next(3) == 0)
						{
							int num207 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 57, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.1f);
							Main.dust[num207].noGravity = true;
							Dust expr_BD9E_cp_0 = Main.dust[num207];
							expr_BD9E_cp_0.velocity.X = expr_BD9E_cp_0.velocity.X / 2f;
							Dust expr_BDBE_cp_0 = Main.dust[num207];
							expr_BDBE_cp_0.velocity.Y = expr_BDBE_cp_0.velocity.Y / 2f;
							Dust expr_BDDE_cp_0 = Main.dust[num207];
							expr_BDDE_cp_0.velocity.X = expr_BDDE_cp_0.velocity.X + (float)(this.direction * 2);
						}
						if (Main.rand.Next(4) == 0)
						{
							int num207 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 43, 0f, 0f, 254, default(Color), 0.3f);
							Main.dust[num207].velocity *= 0f;
						}
					}
					if (this.inventory[this.selectedItem].type >= 198 && this.inventory[this.selectedItem].type <= 203)
					{
						float num208 = 0.5f;
						float num209 = 0.5f;
						float num210 = 0.5f;
						if (this.inventory[this.selectedItem].type == 198)
						{
							num208 *= 0.1f;
							num209 *= 0.5f;
							num210 *= 1.2f;
						}
						else if (this.inventory[this.selectedItem].type == 199)
						{
							num208 *= 1f;
							num209 *= 0.2f;
							num210 *= 0.1f;
						}
						else if (this.inventory[this.selectedItem].type == 200)
						{
							num208 *= 0.1f;
							num209 *= 1f;
							num210 *= 0.2f;
						}
						else if (this.inventory[this.selectedItem].type == 201)
						{
							num208 *= 0.8f;
							num209 *= 0.1f;
							num210 *= 1f;
						}
						else if (this.inventory[this.selectedItem].type == 202)
						{
							num208 *= 0.8f;
							num209 *= 0.9f;
							num210 *= 1f;
						}
						else if (this.inventory[this.selectedItem].type == 203)
						{
							num208 *= 0.9f;
							num209 *= 0.9f;
							num210 *= 0.1f;
						}
						Lighting.addLight((int)((this.itemLocation.X + 6f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f) / 16f), num208, num209, num210);
					}
					if (this.frostBurn && this.inventory[this.selectedItem].melee && !this.inventory[this.selectedItem].noMelee && !this.inventory[this.selectedItem].noUseGraphic && Main.rand.Next(2) == 0)
					{
						int num211 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 135, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f);
						Main.dust[num211].noGravity = true;
						Main.dust[num211].velocity *= 0.7f;
						Dust expr_C1C7_cp_0 = Main.dust[num211];
						expr_C1C7_cp_0.velocity.Y = expr_C1C7_cp_0.velocity.Y - 0.5f;
					}
					if (this.inventory[this.selectedItem].melee && !this.inventory[this.selectedItem].noMelee && !this.inventory[this.selectedItem].noUseGraphic && this.meleeEnchant > 0)
					{
						if (this.meleeEnchant == 1)
						{
							if (Main.rand.Next(3) == 0)
							{
								int num212 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 171, 0f, 0f, 100, default(Color), 1f);
								Main.dust[num212].noGravity = true;
								Main.dust[num212].fadeIn = 1.5f;
								Main.dust[num212].velocity *= 0.25f;
							}
						}
						else if (this.meleeEnchant == 2)
						{
							if (Main.rand.Next(2) == 0)
							{
								int num213 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 75, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f);
								Main.dust[num213].noGravity = true;
								Main.dust[num213].velocity *= 0.7f;
								Dust expr_C3A6_cp_0 = Main.dust[num213];
								expr_C3A6_cp_0.velocity.Y = expr_C3A6_cp_0.velocity.Y - 0.5f;
							}
						}
						else if (this.meleeEnchant == 3)
						{
							if (Main.rand.Next(2) == 0)
							{
								int num214 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f);
								Main.dust[num214].noGravity = true;
								Main.dust[num214].velocity *= 0.7f;
								Dust expr_C484_cp_0 = Main.dust[num214];
								expr_C484_cp_0.velocity.Y = expr_C484_cp_0.velocity.Y - 0.5f;
							}
						}
						else if (this.meleeEnchant == 4)
						{
							if (Main.rand.Next(2) == 0)
							{
								int num215 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 57, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.1f);
								Main.dust[num215].noGravity = true;
								Dust expr_C549_cp_0 = Main.dust[num215];
								expr_C549_cp_0.velocity.X = expr_C549_cp_0.velocity.X / 2f;
								Dust expr_C569_cp_0 = Main.dust[num215];
								expr_C569_cp_0.velocity.Y = expr_C569_cp_0.velocity.Y / 2f;
							}
						}
						else if (this.meleeEnchant == 5)
						{
							if (Main.rand.Next(2) == 0)
							{
								int num216 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 169, 0f, 0f, 100, default(Color), 1f);
								Dust expr_C5FA_cp_0 = Main.dust[num216];
								expr_C5FA_cp_0.velocity.X = expr_C5FA_cp_0.velocity.X + (float)this.direction;
								Dust expr_C61C_cp_0 = Main.dust[num216];
								expr_C61C_cp_0.velocity.Y = expr_C61C_cp_0.velocity.Y + 0.2f;
								Main.dust[num216].noGravity = true;
							}
						}
						else if (this.meleeEnchant == 6)
						{
							if (Main.rand.Next(2) == 0)
							{
								int num217 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 135, 0f, 0f, 100, default(Color), 1f);
								Dust expr_C6BD_cp_0 = Main.dust[num217];
								expr_C6BD_cp_0.velocity.X = expr_C6BD_cp_0.velocity.X + (float)this.direction;
								Dust expr_C6DF_cp_0 = Main.dust[num217];
								expr_C6DF_cp_0.velocity.Y = expr_C6DF_cp_0.velocity.Y + 0.2f;
								Main.dust[num217].noGravity = true;
							}
						}
						else if (this.meleeEnchant == 7)
						{
							if (Main.rand.Next(20) == 0)
							{
								int type4 = Main.rand.Next(139, 143);
								int num218 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, type4, this.velocity.X, this.velocity.Y, 0, default(Color), 1.2f);
								Dust expr_C7A3_cp_0 = Main.dust[num218];
								expr_C7A3_cp_0.velocity.X = expr_C7A3_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f);
								Dust expr_C7D9_cp_0 = Main.dust[num218];
								expr_C7D9_cp_0.velocity.Y = expr_C7D9_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f);
								Dust expr_C80F_cp_0 = Main.dust[num218];
								expr_C80F_cp_0.velocity.X = expr_C80F_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f;
								Dust expr_C83F_cp_0 = Main.dust[num218];
								expr_C83F_cp_0.velocity.Y = expr_C83F_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f;
								Main.dust[num218].scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
							}
							if (Main.rand.Next(40) == 0)
							{
								int type5 = Main.rand.Next(276, 283);
								int num219 = Gore.NewGore(new Vector2((float)rectangle.X, (float)rectangle.Y), this.velocity, type5, 1f);
								Gore expr_C8F6_cp_0 = Main.gore[num219];
								expr_C8F6_cp_0.velocity.X = expr_C8F6_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f);
								Gore expr_C92C_cp_0 = Main.gore[num219];
								expr_C92C_cp_0.velocity.Y = expr_C92C_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f);
								Main.gore[num219].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
								Gore expr_C993_cp_0 = Main.gore[num219];
								expr_C993_cp_0.velocity.X = expr_C993_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f;
								Gore expr_C9C3_cp_0 = Main.gore[num219];
								expr_C9C3_cp_0.velocity.Y = expr_C9C3_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f;
							}
						}
						else if (this.meleeEnchant == 8 && Main.rand.Next(4) == 0)
						{
							int num220 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 46, 0f, 0f, 100, default(Color), 1f);
							Main.dust[num220].noGravity = true;
							Main.dust[num220].fadeIn = 1.5f;
							Main.dust[num220].velocity *= 0.25f;
						}
					}
					if (this.magmaStone && this.inventory[this.selectedItem].melee && !this.inventory[this.selectedItem].noMelee && !this.inventory[this.selectedItem].noUseGraphic && Main.rand.Next(3) != 0)
					{
						int num221 = Dust.NewDust(new Vector2((float)rectangle.X, (float)rectangle.Y), rectangle.Width, rectangle.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f);
						Main.dust[num221].noGravity = true;
						Dust expr_CB82_cp_0 = Main.dust[num221];
						expr_CB82_cp_0.velocity.X = expr_CB82_cp_0.velocity.X * 2f;
						Dust expr_CBA2_cp_0 = Main.dust[num221];
						expr_CBA2_cp_0.velocity.Y = expr_CBA2_cp_0.velocity.Y * 2f;
					}
					if (Main.myPlayer == i && this.inventory[this.selectedItem].type == 1991)
					{
						for (int num222 = 0; num222 < 200; num222++)
						{
							if (Main.npc[num222].active && Main.npc[num222].catchItem > 0)
							{
								Rectangle value = new Rectangle((int)Main.npc[num222].position.X, (int)Main.npc[num222].position.Y, Main.npc[num222].width, Main.npc[num222].height);
								if (rectangle.Intersects(value) && (Main.npc[num222].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[num222].position, Main.npc[num222].width, Main.npc[num222].height)))
								{
									NPC.CatchNPC(num222, i);
								}
							}
						}
					}
					else if (Main.myPlayer == i && this.inventory[this.selectedItem].damage > 0)
					{
						int num223 = (int)((float)this.inventory[this.selectedItem].damage * this.meleeDamage);
						float num224 = this.inventory[this.selectedItem].knockBack;
						float num225 = 1f;
						if (this.kbGlove)
						{
							num225 += 1f;
						}
						if (this.kbBuff)
						{
							num225 += 0.5f;
						}
						num224 *= num225;
						int num226 = rectangle.X / 16;
						int num227 = (rectangle.X + rectangle.Width) / 16 + 1;
						int num228 = rectangle.Y / 16;
						int num229 = (rectangle.Y + rectangle.Height) / 16 + 1;
						for (int num230 = num226; num230 < num227; num230++)
						{
							for (int num231 = num228; num231 < num229; num231++)
							{
								if (Main.tile[num230, num231] != null && Main.tileCut[(int)Main.tile[num230, num231].type] && Main.tile[num230, num231 + 1] != null && Main.tile[num230, num231 + 1].type != 78)
								{
									if (this.inventory[this.selectedItem].type == 1786)
									{
										int type6 = (int)Main.tile[num230, num231].type;
										WorldGen.KillTile(num230, num231, false, false, false);
										if (!Main.tile[num230, num231].active())
										{
											int num232 = 0;
											if (type6 == 3 || type6 == 24 || type6 == 61 || type6 == 110 || type6 == 201)
											{
												num232 = Main.rand.Next(1, 3);
											}
											if (type6 == 73 || type6 == 74 || type6 == 113)
											{
												num232 = Main.rand.Next(2, 5);
											}
											if (num232 > 0)
											{
												int number = Item.NewItem(num230 * 16, num231 * 16, 16, 16, 1727, num232, false, 0, false);
												if (Main.netMode == 1)
												{
													NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0);
												}
											}
										}
										if (Main.netMode == 1)
										{
											NetMessage.SendData(17, -1, -1, "", 0, (float)num230, (float)num231, 0f, 0);
										}
									}
									else
									{
										WorldGen.KillTile(num230, num231, false, false, false);
										if (Main.netMode == 1)
										{
											NetMessage.SendData(17, -1, -1, "", 0, (float)num230, (float)num231, 0f, 0);
										}
									}
								}
							}
						}
						for (int num233 = 0; num233 < 200; num233++)
						{
							if (Main.npc[num233].active && Main.npc[num233].immune[i] == 0 && this.attackCD == 0 && !Main.npc[num233].dontTakeDamage && (!Main.npc[num233].friendly || (Main.npc[num233].type == 22 && this.killGuide) || (Main.npc[num233].type == 54 && this.killClothier)))
							{
								Rectangle value2 = new Rectangle((int)Main.npc[num233].position.X, (int)Main.npc[num233].position.Y, Main.npc[num233].width, Main.npc[num233].height);
								if (rectangle.Intersects(value2) && (Main.npc[num233].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[num233].position, Main.npc[num233].width, Main.npc[num233].height)))
								{
									bool flag16 = false;
									if (Main.rand.Next(1, 101) <= this.meleeCrit)
									{
										flag16 = true;
									}
									int num234 = Main.DamageVar((float)num223);
									this.StatusNPC(this.inventory[this.selectedItem].type, num233);
									this.onHit(Main.npc[num233].center().X, Main.npc[num233].center().Y);
									int num235 = (int)Main.npc[num233].StrikeNPC(num234, num224, this.direction, flag16, false);
									if (this.beetleOffense)
									{
										this.beetleCounter += (float)num235;
										this.beetleCountdown = 0;
									}
									if (this.inventory[this.selectedItem].type == 1826)
									{
										this.pumpkinSword(num233, (int)((double)num223 * 1.5), num224);
									}
									if (this.meleeEnchant == 7)
									{
										Projectile.NewProjectile(Main.npc[num233].center().X, Main.npc[num233].center().Y, Main.npc[num233].velocity.X, Main.npc[num233].velocity.Y, 289, 0, 0f, this.whoAmi, 0f, 0f);
									}
									if (this.inventory[this.selectedItem].type == 1123)
									{
										int num236 = Main.rand.Next(1, 4);
										for (int num237 = 0; num237 < num236; num237++)
										{
											float num238 = (float)(this.direction * 2) + (float)Main.rand.Next(-35, 36) * 0.02f;
											float num239 = (float)Main.rand.Next(-35, 36) * 0.02f;
											num238 *= 0.2f;
											num239 *= 0.2f;
											Projectile.NewProjectile((float)(rectangle.X + rectangle.Width / 2), (float)(rectangle.Y + rectangle.Height / 2), num238, num239, 181, num234 / 3, 0f, i, 0f, 0f);
										}
									}
									if (Main.npc[num233].value > 0f && this.coins && Main.rand.Next(5) == 0)
									{
										int type7 = 71;
										if (Main.rand.Next(10) == 0)
										{
											type7 = 72;
										}
										if (Main.rand.Next(100) == 0)
										{
											type7 = 73;
										}
										int num240 = Item.NewItem((int)Main.npc[num233].position.X, (int)Main.npc[num233].position.Y, Main.npc[num233].width, Main.npc[num233].height, type7, 1, false, 0, false);
										Main.item[num240].stack = Main.rand.Next(1, 11);
										Main.item[num240].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
										Main.item[num240].velocity.X = (float)Main.rand.Next(10, 31) * 0.2f * (float)this.direction;
										if (Main.netMode == 1)
										{
											NetMessage.SendData(21, -1, -1, "", num240, 0f, 0f, 0f, 0);
										}
									}
									if (Main.netMode != 0)
									{
										if (flag16)
										{
											NetMessage.SendData(28, -1, -1, "", num233, (float)num234, num224, (float)this.direction, 1);
										}
										else
										{
											NetMessage.SendData(28, -1, -1, "", num233, (float)num234, num224, (float)this.direction, 0);
										}
									}
									Main.npc[num233].immune[i] = this.itemAnimation;
									this.attackCD = (int)((double)this.itemAnimationMax * 0.33);
								}
							}
						}
						if (this.hostile)
						{
							for (int num241 = 0; num241 < 255; num241++)
							{
								if (num241 != i && Main.player[num241].active && Main.player[num241].hostile && !Main.player[num241].immune && !Main.player[num241].dead && (Main.player[i].team == 0 || Main.player[i].team != Main.player[num241].team))
								{
									Rectangle value3 = new Rectangle((int)Main.player[num241].position.X, (int)Main.player[num241].position.Y, Main.player[num241].width, Main.player[num241].height);
									if (rectangle.Intersects(value3) && Collision.CanHit(this.position, this.width, this.height, Main.player[num241].position, Main.player[num241].width, Main.player[num241].height))
									{
										bool flag17 = false;
										if (Main.rand.Next(1, 101) <= 10)
										{
											flag17 = true;
										}
										int num242 = Main.DamageVar((float)num223);
										this.StatusPvP(this.inventory[this.selectedItem].type, num241);
										this.onHit(Main.player[num241].center().X, Main.player[num241].center().Y);
										Main.player[num241].Hurt(num242, this.direction, true, false, "", flag17);
										if (this.meleeEnchant == 7)
										{
											Projectile.NewProjectile(Main.player[num241].center().X, Main.player[num241].center().Y, Main.player[num241].velocity.X, Main.player[num241].velocity.Y, 289, 0, 0f, this.whoAmi, 0f, 0f);
										}
										if (this.inventory[this.selectedItem].type == 1123)
										{
											int num243 = Main.rand.Next(1, 4);
											for (int num244 = 0; num244 < num243; num244++)
											{
												float num245 = (float)(this.direction * 2) + (float)Main.rand.Next(-35, 36) * 0.02f;
												float num246 = (float)Main.rand.Next(-35, 36) * 0.02f;
												num245 *= 0.2f;
												num246 *= 0.2f;
												Projectile.NewProjectile((float)(rectangle.X + rectangle.Width / 2), (float)(rectangle.Y + rectangle.Height / 2), num245, num246, 181, num242 / 3, 0f, i, 0f, 0f);
											}
										}
										if (Main.netMode != 0)
										{
											if (flag17)
											{
												NetMessage.SendData(26, -1, -1, Lang.deathMsg(this.whoAmi, -1, -1, -1), num241, (float)this.direction, (float)num242, 1f, 1);
											}
											else
											{
												NetMessage.SendData(26, -1, -1, Lang.deathMsg(this.whoAmi, -1, -1, -1), num241, (float)this.direction, (float)num242, 1f, 0);
											}
										}
										this.attackCD = (int)((double)this.itemAnimationMax * 0.33);
									}
								}
							}
						}
						if (this.inventory[this.selectedItem].type == 787 && (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.5) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9)))
						{
							float num247 = 0f;
							float num248 = 0f;
							float num249 = 0f;
							float num250 = 0f;
							if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9))
							{
								num247 = -7f;
							}
							if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7))
							{
								num247 = -6f;
								num248 = 2f;
							}
							if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.5))
							{
								num247 = -4f;
								num248 = 4f;
							}
							if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3))
							{
								num247 = -2f;
								num248 = 6f;
							}
							if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1))
							{
								num248 = 7f;
							}
							if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7))
							{
								num250 = 26f;
							}
							if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3))
							{
								num250 -= 4f;
								num249 -= 20f;
							}
							if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1))
							{
								num249 += 6f;
							}
							if (this.direction == -1)
							{
								if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9))
								{
									num250 -= 8f;
								}
								if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7))
								{
									num250 -= 6f;
								}
							}
							num247 *= 1.5f;
							num248 *= 1.5f;
							num250 *= (float)this.direction;
							num249 *= this.gravDir;
							Projectile.NewProjectile((float)(rectangle.X + rectangle.Width / 2) + num250, (float)(rectangle.Y + rectangle.Height / 2) + num249, (float)this.direction * num248, num247 * this.gravDir, 131, num223 / 2, 0f, i, 0f, 0f);
						}
					}
				}
			}
			if (this.itemTime == 0 && this.itemAnimation > 0)
			{
				if (this.inventory[this.selectedItem].hairDye >= 0)
				{
					this.itemTime = this.inventory[this.selectedItem].useTime;
					if (this.whoAmi == Main.myPlayer)
					{
						this.hairDye = (byte)this.inventory[this.selectedItem].hairDye;
						NetMessage.SendData(4, -1, -1, Main.player[this.whoAmi].name, this.whoAmi, 0f, 0f, 0f, 0);
					}
				}
				if (this.inventory[this.selectedItem].healLife > 0)
				{
					this.statLife += this.inventory[this.selectedItem].healLife;
					this.itemTime = this.inventory[this.selectedItem].useTime;
					if (Main.myPlayer == this.whoAmi)
					{
						this.HealEffect(this.inventory[this.selectedItem].healLife, true);
					}
				}
				if (this.inventory[this.selectedItem].healMana > 0)
				{
					this.statMana += this.inventory[this.selectedItem].healMana;
					this.itemTime = this.inventory[this.selectedItem].useTime;
					if (Main.myPlayer == this.whoAmi)
					{
						this.AddBuff(94, Player.manaSickTime, true);
						this.ManaEffect(this.inventory[this.selectedItem].healMana);
					}
				}
				if (this.inventory[this.selectedItem].buffType > 0)
				{
					if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].buffType != 90)
					{
						this.AddBuff(this.inventory[this.selectedItem].buffType, this.inventory[this.selectedItem].buffTime, true);
					}
					this.itemTime = this.inventory[this.selectedItem].useTime;
				}
				if (this.inventory[this.selectedItem].type == 678)
				{
					this.itemTime = this.inventory[this.selectedItem].useTime;
					if (this.whoAmi == Main.myPlayer)
					{
						this.AddBuff(20, 216000, true);
						this.AddBuff(22, 216000, true);
						this.AddBuff(23, 216000, true);
						this.AddBuff(24, 216000, true);
						this.AddBuff(30, 216000, true);
						this.AddBuff(31, 216000, true);
						this.AddBuff(32, 216000, true);
						this.AddBuff(33, 216000, true);
						this.AddBuff(35, 216000, true);
						this.AddBuff(36, 216000, true);
						this.AddBuff(68, 216000, true);
					}
				}
			}
			if (this.whoAmi == Main.myPlayer)
			{
				if (this.itemTime == 0 && this.itemAnimation > 0 && this.inventory[this.selectedItem].type == 361 && Main.CanStartInvasion(1, true))
				{
					this.itemTime = this.inventory[this.selectedItem].useTime;
					Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
					if (Main.netMode != 1)
					{
						if (Main.invasionType == 0)
						{
							Main.invasionDelay = 0;
							Main.StartInvasion(1);
						}
					}
					else
					{
						NetMessage.SendData(61, -1, -1, "", this.whoAmi, -1f, 0f, 0f, 0);
					}
				}
				if (this.itemTime == 0 && this.itemAnimation > 0 && this.inventory[this.selectedItem].type == 602 && Main.CanStartInvasion(2, true))
				{
					this.itemTime = this.inventory[this.selectedItem].useTime;
					Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
					if (Main.netMode != 1)
					{
						if (Main.invasionType == 0)
						{
							Main.invasionDelay = 0;
							Main.StartInvasion(2);
						}
					}
					else
					{
						NetMessage.SendData(61, -1, -1, "", this.whoAmi, -2f, 0f, 0f, 0);
					}
				}
				if (this.itemTime == 0 && this.itemAnimation > 0 && this.inventory[this.selectedItem].type == 1315 && Main.CanStartInvasion(3, true))
				{
					this.itemTime = this.inventory[this.selectedItem].useTime;
					Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
					if (Main.netMode != 1)
					{
						if (Main.invasionType == 0)
						{
							Main.invasionDelay = 0;
							Main.StartInvasion(3);
						}
					}
					else
					{
						NetMessage.SendData(61, -1, -1, "", this.whoAmi, -3f, 0f, 0f, 0);
					}
				}
				if (this.itemTime == 0 && this.itemAnimation > 0 && this.inventory[this.selectedItem].type == 1844 && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon)
				{
					this.itemTime = this.inventory[this.selectedItem].useTime;
					Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
					if (Main.netMode != 1)
					{
						Main.NewText(Lang.misc[31], 50, 255, 130, false);
						Main.startPumpkinMoon();
					}
					else
					{
						NetMessage.SendData(61, -1, -1, "", this.whoAmi, -4f, 0f, 0f, 0);
					}
				}
				if (this.itemTime == 0 && this.itemAnimation > 0 && this.inventory[this.selectedItem].type == 1958 && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon)
				{
					this.itemTime = this.inventory[this.selectedItem].useTime;
					Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
					if (Main.netMode != 1)
					{
						Main.NewText(Lang.misc[34], 50, 255, 130, false);
						Main.startSnowMoon();
					}
					else
					{
						NetMessage.SendData(61, -1, -1, "", this.whoAmi, -5f, 0f, 0f, 0);
					}
				}
				if (this.itemTime == 0 && this.itemAnimation > 0 && this.inventory[this.selectedItem].makeNPC > 0 && this.controlUseItem && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f >= (float)Player.tileTargetY)
				{
					this.itemTime = this.inventory[this.selectedItem].useTime;
					int x6 = Main.mouseX + (int)Main.screenPosition.X;
					int y6 = Main.mouseY + (int)Main.screenPosition.Y;
					NPC.ReleaseNPC(x6, y6, (int)this.inventory[this.selectedItem].makeNPC, this.inventory[this.selectedItem].placeStyle, this.whoAmi);
				}
				if (this.itemTime == 0 && this.itemAnimation > 0 && (this.inventory[this.selectedItem].type == 43 || this.inventory[this.selectedItem].type == 70 || this.inventory[this.selectedItem].type == 544 || this.inventory[this.selectedItem].type == 556 || this.inventory[this.selectedItem].type == 557 || this.inventory[this.selectedItem].type == 560 || this.inventory[this.selectedItem].type == 1133 || this.inventory[this.selectedItem].type == 1331) && this.SummonItemCheck())
				{
					if (this.inventory[this.selectedItem].type == 560)
					{
						this.itemTime = this.inventory[this.selectedItem].useTime;
						Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
						if (Main.netMode != 1)
						{
							NPC.SpawnOnPlayer(i, 50);
						}
						else
						{
							NetMessage.SendData(61, -1, -1, "", this.whoAmi, 50f, 0f, 0f, 0);
						}
					}
					else if (this.inventory[this.selectedItem].type == 43)
					{
						if (!Main.dayTime)
						{
							this.itemTime = this.inventory[this.selectedItem].useTime;
							Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
							if (Main.netMode != 1)
							{
								NPC.SpawnOnPlayer(i, 4);
							}
							else
							{
								NetMessage.SendData(61, -1, -1, "", this.whoAmi, 4f, 0f, 0f, 0);
							}
						}
					}
					else if (this.inventory[this.selectedItem].type == 70)
					{
						if (this.zoneEvil)
						{
							this.itemTime = this.inventory[this.selectedItem].useTime;
							Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
							if (Main.netMode != 1)
							{
								NPC.SpawnOnPlayer(i, 13);
							}
							else
							{
								NetMessage.SendData(61, -1, -1, "", this.whoAmi, 13f, 0f, 0f, 0);
							}
						}
					}
					else if (this.inventory[this.selectedItem].type == 544)
					{
						if (!Main.dayTime)
						{
							this.itemTime = this.inventory[this.selectedItem].useTime;
							Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
							if (Main.netMode != 1)
							{
								NPC.SpawnOnPlayer(i, 125);
								NPC.SpawnOnPlayer(i, 126);
							}
							else
							{
								NetMessage.SendData(61, -1, -1, "", this.whoAmi, 125f, 0f, 0f, 0);
								NetMessage.SendData(61, -1, -1, "", this.whoAmi, 126f, 0f, 0f, 0);
							}
						}
					}
					else if (this.inventory[this.selectedItem].type == 556)
					{
						if (!Main.dayTime)
						{
							this.itemTime = this.inventory[this.selectedItem].useTime;
							Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
							if (Main.netMode != 1)
							{
								NPC.SpawnOnPlayer(i, 134);
							}
							else
							{
								NetMessage.SendData(61, -1, -1, "", this.whoAmi, 134f, 0f, 0f, 0);
							}
						}
					}
					else if (this.inventory[this.selectedItem].type == 557)
					{
						if (!Main.dayTime)
						{
							this.itemTime = this.inventory[this.selectedItem].useTime;
							Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
							if (Main.netMode != 1)
							{
								NPC.SpawnOnPlayer(i, 127);
							}
							else
							{
								NetMessage.SendData(61, -1, -1, "", this.whoAmi, 127f, 0f, 0f, 0);
							}
						}
					}
					else if (this.inventory[this.selectedItem].type == 1133)
					{
						this.itemTime = this.inventory[this.selectedItem].useTime;
						Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
						if (Main.netMode != 1)
						{
							NPC.SpawnOnPlayer(i, 222);
						}
						else
						{
							NetMessage.SendData(61, -1, -1, "", this.whoAmi, 222f, 0f, 0f, 0);
						}
					}
					else if (this.inventory[this.selectedItem].type == 1331 && this.zoneBlood)
					{
						this.itemTime = this.inventory[this.selectedItem].useTime;
						Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
						if (Main.netMode != 1)
						{
							NPC.SpawnOnPlayer(i, 266);
						}
						else
						{
							NetMessage.SendData(61, -1, -1, "", this.whoAmi, 266f, 0f, 0f, 0);
						}
					}
				}
			}
			if (this.inventory[this.selectedItem].type == 50 && this.itemAnimation > 0)
			{
				if (Main.rand.Next(2) == 0)
				{
					Dust.NewDust(this.position, this.width, this.height, 15, 0f, 0f, 150, default(Color), 1.1f);
				}
				if (this.itemTime == 0)
				{
					this.itemTime = this.inventory[this.selectedItem].useTime;
				}
				else if (this.itemTime == this.inventory[this.selectedItem].useTime / 2)
				{
					for (int num251 = 0; num251 < 70; num251++)
					{
						Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, default(Color), 1.5f);
					}
					this.grappling[0] = -1;
					this.grapCount = 0;
					for (int num252 = 0; num252 < 1000; num252++)
					{
						if (Main.projectile[num252].active && Main.projectile[num252].owner == i && Main.projectile[num252].aiStyle == 7)
						{
							Main.projectile[num252].Kill();
						}
					}
					this.Spawn();
					for (int num253 = 0; num253 < 70; num253++)
					{
						Dust.NewDust(this.position, this.width, this.height, 15, 0f, 0f, 150, default(Color), 1.5f);
					}
				}
			}
			if (this.inventory[this.selectedItem].type == 2350 && this.itemAnimation > 0)
			{
				if (this.itemTime == 0)
				{
					this.itemTime = this.inventory[this.selectedItem].useTime;
				}
				else if (this.itemTime == 2)
				{
					for (int num254 = 0; num254 < 70; num254++)
					{
						Main.dust[Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f;
					}
					this.grappling[0] = -1;
					this.grapCount = 0;
					for (int num255 = 0; num255 < 1000; num255++)
					{
						if (Main.projectile[num255].active && Main.projectile[num255].owner == i && Main.projectile[num255].aiStyle == 7)
						{
							Main.projectile[num255].Kill();
						}
					}
					bool flag18 = this.immune;
					int num256 = this.immuneTime;
					this.Spawn();
					this.immune = flag18;
					this.immuneTime = num256;
					for (int num257 = 0; num257 < 70; num257++)
					{
						Main.dust[Dust.NewDust(this.position, this.width, this.height, 15, 0f, 0f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f;
					}
					if (this.inventory[this.selectedItem].stack > 0)
					{
						this.inventory[this.selectedItem].stack--;
					}
				}
			}
			if (this.inventory[this.selectedItem].type == 2351 && this.itemAnimation > 0)
			{
				if (this.itemTime == 0)
				{
					this.itemTime = this.inventory[this.selectedItem].useTime;
				}
				else if (this.itemTime == 2)
				{
					if (Main.netMode == 0)
					{
						this.TeleportationPotion();
					}
					else if (Main.netMode == 1 && this.whoAmi == Main.myPlayer)
					{
						NetMessage.SendData(73, -1, -1, "", 0, 0f, 0f, 0f, 0);
					}
					if (this.inventory[this.selectedItem].stack > 0)
					{
						this.inventory[this.selectedItem].stack--;
					}
				}
			}
			if (i == Main.myPlayer)
			{
				if (this.itemTime == (int)((float)this.inventory[this.selectedItem].useTime * this.tileSpeed) && this.inventory[this.selectedItem].tileWand > 0)
				{
					int tileWand2 = this.inventory[this.selectedItem].tileWand;
					int num258 = 0;
					while (num258 < 58)
					{
						if (tileWand2 == this.inventory[num258].type && this.inventory[num258].stack > 0)
						{
							this.inventory[num258].stack--;
							if (this.inventory[num258].stack <= 0)
							{
								this.inventory[num258] = new Item();
								break;
							}
							break;
						}
						else
						{
							num258++;
						}
					}
				}
				int num259;
				if (this.inventory[this.selectedItem].createTile >= 0)
				{
					num259 = (int)((float)this.inventory[this.selectedItem].useTime * this.tileSpeed);
				}
				else if (this.inventory[this.selectedItem].createWall > 0)
				{
					num259 = (int)((float)this.inventory[this.selectedItem].useTime * this.wallSpeed);
				}
				else
				{
					num259 = this.inventory[this.selectedItem].useTime;
				}
				if (this.itemTime == num259 && this.inventory[this.selectedItem].consumable)
				{
					bool flag19 = true;
					if (this.inventory[this.selectedItem].type == 2350 || this.inventory[this.selectedItem].type == 2351)
					{
						flag19 = false;
					}
					if (this.inventory[this.selectedItem].ranged)
					{
						if (this.ammoCost80 && Main.rand.Next(5) == 0)
						{
							flag19 = false;
						}
						if (this.ammoCost75 && Main.rand.Next(4) == 0)
						{
							flag19 = false;
						}
					}
					if (this.inventory[this.selectedItem].type >= 71 && this.inventory[this.selectedItem].type <= 74)
					{
						flag19 = true;
					}
					if (flag19)
					{
						if (this.inventory[this.selectedItem].stack > 0)
						{
							this.inventory[this.selectedItem].stack--;
						}
						if (this.inventory[this.selectedItem].stack <= 0)
						{
							this.itemTime = this.itemAnimation;
						}
					}
				}
				if (this.inventory[this.selectedItem].stack <= 0 && this.itemAnimation == 0)
				{
					this.inventory[this.selectedItem] = new Item();
				}
				if (this.selectedItem == 58)
				{
					if (this.itemAnimation == 0)
					{
						return;
					}
					Main.mouseItem = this.inventory[this.selectedItem].Clone();
				}
			}
		}
示例#26
0
        public string GetTilesXml()
        {
            XDocument original = null;

            using (TextReader tr = new StreamReader("settings.xml"))
            {
                original = XDocument.Load(tr);
            }

            var origTiles = original.Element("Settings").Element("Tiles");

            XElement  root  = new XElement("Tiles");
            XDocument tiles = new XDocument(root);

            List <Terraria.Item> curItems = new List <Item>();

            for (int i = 0; i < maxItemTypes; i++)
            {
                try
                {
                    var curitem = new Terraria.Item();
                    curitem.SetDefaults(i);
                    curItems.Add(curitem);
                }
                catch
                {
                }
            }

            for (int i = 0; i < maxTileSets; i++)
            {
                string origName = origTiles.Elements().FirstOrDefault(e => e.Attribute("Id").Value == i.ToString())?.Attribute("Name").Value;

                var creatingItem = curItems.FirstOrDefault(x => x.createTile == i);
                //var creatingItems = curItems.Where(x => x.createTile == i).ToList();

                string itemName = creatingItem != null ? creatingItem.Name : string.Empty;
                if (string.IsNullOrWhiteSpace(itemName))
                {
                    itemName = origName ?? i.ToString();
                }

                var tile = new XElement(
                    "Tile",
                    new XAttribute("Id", i.ToString()),
                    new XAttribute("Name", itemName));
                root.Add(tile);

                if (tileLighted[i])
                {
                    tile.Add(new XAttribute("Light", "true"));
                }
                if (Terraria.ID.TileID.Sets.NonSolidSaveSlopes[i])
                {
                    tile.Add(new XAttribute("SaveSlope", "true"));
                }
                if (tileSolid[i])
                {
                    tile.Add(new XAttribute("Solid", "true"));
                }
                if (tileSolidTop[i])
                {
                    tile.Add(new XAttribute("SolidTop", "true"));
                }

                if (tileFrameImportant[i])
                {
                    tile.Add(new XAttribute("Framed", "true"));
                    var frames = new XElement("Frames");
                    tile.Add(frames);

                    TileObjectData data = TileObjectData.GetTileData(i, 0);

                    if (data == null)
                    {
                        string value = itemName;
                        frames.Add(new XElement("Frame",
                                                new XAttribute("Name", value),
                                                new XAttribute("UV", $"0, 0"))
                                   );
                    }
                    else
                    {
                        var tileWidth     = data.Width;
                        var tileHeight    = data.Height;
                        var textureWidth  = data.CoordinateWidth;
                        var textureHeight = data.CoordinateHeights.First();;
                        var shiftWidth    = data.CoordinateFullWidth;
                        var shiftHeight   = data.CoordinateFullHeight;
                        var anchor        = string.Empty;

                        var styleMultiplier = data.StyleMultiplier;
                        var styleWrapLimit  = data.StyleWrapLimit;

                        if (textureWidth != 16 || textureHeight != 16)
                        {
                            tile.Add(new XAttribute("TextureGrid", $"{textureWidth},{textureHeight}"));
                        }
                        tile.Add(new XAttribute("Size", $"{tileWidth},{tileHeight}"));


                        int style = 0;
                        while ((data = TileObjectData.GetTileData(i, style, 0)) != null)
                        {
                            var creatingSubItem = curItems.FirstOrDefault(x => x.createTile == i && x.placeStyle == style);
                            if (creatingSubItem == null)
                            {
                                if (style == 0)
                                {
                                    frames.Add(new XElement("Frame",
                                                            new XAttribute("Name", itemName),
                                                            new XAttribute("UV", $"0, 0"))
                                               );
                                }
                                break;
                            }

                            string subTypeName = creatingSubItem != null ? creatingSubItem.Name : string.Empty;
                            int    altCount    = data.AlternatesCount;
                            for (int alt = 0; alt < altCount || alt == 0; alt++)
                            {
                                data = TileObjectData.GetTileData(i, style, alt);
                                if (data == null)
                                {
                                    continue;
                                }

                                var frame = new XElement("Frame", new XAttribute("Name", subTypeName));
                                frames.Add(frame);
                                frame.Add(new XAttribute("UV", $"{shiftWidth * alt}, {shiftHeight * style}"));

                                //if (alt > 0 && data.AlternatesCount > 0) System.Diagnostics.Debugger.Break();

                                if (data.AnchorBottom.tileCount > 0)
                                {
                                    anchor = "Bottom";
                                }
                                if (data.AnchorLeft.tileCount > 0)
                                {
                                    anchor = "Left";
                                }
                                if (data.AnchorRight.tileCount > 0)
                                {
                                    anchor = "Right";
                                }
                                if (data.AnchorTop.tileCount > 0)
                                {
                                    anchor = "Top";
                                }

                                frame.Add(new XAttribute("Anchor", anchor));
                            }

                            style++;
                        }
                    }
                }
            }

            return(tiles.ToString());
        }
示例#27
0
        private bool UpdateRarity(On.Terraria.Item.orig_Prefix orig, Terraria.Item item, int pre)
        {
            orig(item, pre);
            Terraria.Item It = new Terraria.Item();
            It.SetDefaults(item.type);
            int baseRarity  = It.rare;
            int baseDamage  = It.damage;
            int baseUseTime = It.useTime;

            int   baseMana       = It.mana;
            float baseKnockback  = It.knockBack;
            float baseScale      = It.scale;
            float baseShootspeed = It.shootSpeed;
            int   baseCrit       = It.crit;

            item.rare = baseRarity;
            if (_isFixedRarity.Contains(item.rare))
            {
                return(true);
            }

            float DamageInc = 1;

            if (baseDamage != 0)
            {
                DamageInc = item.damage / baseDamage;
            }
            float KnockBack = 1;

            if (baseKnockback != 0)
            {
                KnockBack = item.knockBack / baseKnockback;
            }
            float UseTimeMult = 1;

            if (baseUseTime != 0)
            {
                UseTimeMult = item.useTime / baseUseTime;
            }
            float ScaleMult = 1;

            if (baseScale != 0)
            {
                ScaleMult = item.scale / baseScale;
            }
            float ShootspeedMult = 1;

            if (baseShootspeed != 0)
            {
                ShootspeedMult = item.shootSpeed / baseShootspeed;
            }
            float ManaMult = 1;

            if (baseMana != 0)
            {
                ManaMult = item.mana / baseMana;
            }
            float CritMult = 1;

            if (baseCrit != 0)
            {
                CritMult = item.crit / baseCrit;
            }
            ;



            int   i          = item.prefix;
            float TotalValue = 1f * DamageInc * (2f - UseTimeMult) * (2f - ManaMult) * ScaleMult * KnockBack * ShootspeedMult * (1f + (float)CritMult * 0.02f);

            if (i == 62 || i == 69 || i == 73 || i == 77)
            {
                TotalValue *= 1.05f;
            }
            if (i == 63 || i == 70 || i == 74 || i == 78 || i == 67)
            {
                TotalValue *= 1.1f;
            }
            if (i == 64 || i == 71 || i == 75 || i == 79 || i == 66)
            {
                TotalValue *= 1.15f;
            }
            if (i == PrefixID.Warding || i == PrefixID.Menacing || i == PrefixID.Lucky || i == PrefixID.Quick || i == PrefixID.Violent)
            {
                TotalValue *= 1.2f;
            }
            if (i == ModContent.PrefixType <Shielding>() || i == ModContent.PrefixType <Wrathful>() || i == ModContent.PrefixType <Weighted>() || i == ModContent.PrefixType <Rapid>() || i == ModContent.PrefixType <Beserk>())
            {
                TotalValue *= 1.5f;
            }
            if ((double)TotalValue >= 1.5)
            {
                item.rare += 3;
            }
            else if ((double)TotalValue >= 1.2)
            {
                item.rare += 2;
            }
            else if ((double)TotalValue >= 1.05)
            {
                item.rare++;
            }
            else if ((double)TotalValue <= 0.8)
            {
                item.rare -= 2;
            }
            else if ((double)TotalValue <= 0.95)
            {
                item.rare--;
            }

            if (item.rare > MaxRarity)
            {
                item.rare = MaxRarity;
            }
            return(true);
        }
示例#28
0
		public virtual bool IsVanitySet(int head, int body, int legs)
		{
			Item headItem = new Item();
			if (head >= 0)
			{
				headItem.SetDefaults(Item.headType[head], true);
			}
			Item bodyItem = new Item();
			if (body >= 0)
			{
				bodyItem.SetDefaults(Item.bodyType[body], true);
			}
			Item legItem = new Item();
			if (legs >= 0)
			{
				legItem.SetDefaults(Item.legType[legs], true);
			}
			return IsArmorSet(headItem, bodyItem, legItem);
		}
示例#29
0
文件: Lang.cs 项目: MEFBAEA/mefbaea
 public static void tTip()
 {
     for (int i = 1; i < 3602; i++)
     {
         Item item = new Item();
         item.SetDefaults(i, false);
         if (item.toolTip2 != "" && item.toolTip2 != null)
         {
             string.Concat(new object[]
             {
                 "case ",
                 i,
                 ": return \"",
                 item.toolTip2,
                 "\";"
             });
         }
     }
 }
示例#30
0
        public void AI()
        {
            if (ServerApi.Hooks.InvokeProjectileAIUpdate(this))
            {
                return;
            }
            if (this.aiStyle == 1)
            {
                this.AI_001();
                return;
            }
            if (this.aiStyle == 2)
            {
                if (this.type == ProjectileID.VampireKnife && this.localAI[0] == 0f)
                {
                    this.localAI[0] += 1f;
                    this.alpha = 0;
                }
                if (this.type == ProjectileID.OrnamentFriendly)
                {
                    this.frame = (int)this.ai[1];
                }
                if (this.type == ProjectileID.ToxicFlask)
                {
                    this.rotation += Math.Abs(this.velocity.X) * 0.04f * (float)this.direction;
                }
                else
                {
                    this.rotation += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.03f * (float)this.direction;
                }
                if (this.type == ProjectileID.CannonballFriendly)
                {
                    if (this.ai[1] == 0f)
                    {
                        this.ai[1] = 1f;
                    }
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 18f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.28f;
                        this.velocity.X = this.velocity.X * 0.99f;
                    }
                    if (this.ai[0] > 2f)
                    {
                        this.alpha = 0;
                    }
                }
                else if (this.type == ProjectileID.ExplosiveBunny)
                {
                    if (this.ai[1] == 0f)
                    {
                        this.ai[1] = 1f;
                    }
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 18f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.28f;
                        this.velocity.X = this.velocity.X * 0.99f;
                    }
                    if (this.ai[0] > 2f)
                    {
                        this.alpha = 0;
                    }
                }
                else if (this.type == ProjectileID.CannonballHostile)
                {
                    if (this.ai[1] == 0f)
                    {
                        this.ai[1] = 1f;
                    }
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 16f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.18f;
                        this.velocity.X = this.velocity.X * 0.991f;
                    }
                    if (this.ai[0] > 2f)
                    {
                        this.alpha = 0;
                    }
                }
                if (this.type == ProjectileID.ShadowFlameKnife)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 30f)
                    {
                        this.velocity.X = this.velocity.X * 0.99f;
                        this.velocity.Y = this.velocity.Y + 0.5f;
                    }
                    else
                    {
                        this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                    }
                }
                else if (this.type == ProjectileID.StyngerShrapnel)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 0f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.25f;
                    }
                }
                else if (this.type == ProjectileID.OrnamentHostileShrapnel)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 5f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.25f;
                    }
                }
                else if (this.type == ProjectileID.DrManFlyFlask)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 18f)
                    {
                        this.velocity.X = this.velocity.X * 0.995f;
                        this.velocity.Y = this.velocity.Y + 0.2f;
                    }
                }
                else if (this.type == ProjectileID.Spark)
                {
                    this.alpha = 255;
                    this.ai[0] += 1f;
                    if (this.ai[0] > 3f)
                    {
                        int num15 = 100;
                        if (this.ai[0] > 20f)
                        {
                            int num16 = 40;
                            float num17 = this.ai[0] - 20f;
                            num15 = (int)(100f * (1f - num17 / (float)num16));
                            if (num17 >= (float)num16)
                            {
                                this.Kill();
                            }
                        }
                        if (this.ai[0] <= 10f)
                        {
                            num15 = (int)this.ai[0] * 10;
                        }
                    }
                    if (this.ai[0] >= 20f)
                    {
                        this.velocity.X = this.velocity.X * 0.99f;
                        this.velocity.Y = this.velocity.Y + 0.1f;
                    }
                }
                else if (this.type == ProjectileID.HolyWater || this.type == ProjectileID.UnholyWater || this.type == ProjectileID.BloodWater)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 10f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.25f;
                        this.velocity.X = this.velocity.X * 0.99f;
                    }
                }
                else if (this.type == ProjectileID.SnowBallFriendly)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 20f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.3f;
                        this.velocity.X = this.velocity.X * 0.98f;
                    }
                }
                else if (this.type == ProjectileID.PaladinsHammerHostile)
                {
                    if (this.ai[0] == 0f)
                    {
                    }
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 60f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.2f;
                        this.velocity.X = this.velocity.X * 0.99f;
                    }
                }
                else if (this.type == ProjectileID.EatersBite)
                {
                    this.alpha -= 50;
                    if (this.alpha < 0)
                    {
                        this.alpha = 0;
                    }
                    this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 0.785f;
                }
                else if (this.type == ProjectileID.VampireKnife)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 30f)
                    {
                        this.alpha += 10;
                        this.damage = (int)((double)this.damage * 0.9);
                        this.knockBack = (float)((int)((double)this.knockBack * 0.9));
                        if (this.alpha >= 255)
                        {
                            this.active = false;
                        }
                    }
                    if (this.ai[0] < 30f)
                    {
                        this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                    }
                }
                else if (this.type == ProjectileID.LovePotion || this.type == ProjectileID.FoulPotion)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 15f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.3f;
                        this.velocity.X = this.velocity.X * 0.98f;
                    }
                }
                else
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 20f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.4f;
                        this.velocity.X = this.velocity.X * 0.97f;
                    }
                    else if (this.type == ProjectileID.ThrowingKnife || this.type == ProjectileID.PoisonedKnife || this.type == ProjectileID.MagicDagger || this.type == ProjectileID.FrostDaggerfish || this.type == ProjectileID.BoneDagger)
                    {
                        this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                    }
                }
                if (this.velocity.Y > 16f)
                {
                    this.velocity.Y = 16f;
                }
                if (this.type == ProjectileID.PoisonedKnife && Main.rand.Next(20) == 0)
                {
                    return;
                }
            }
            else if (this.aiStyle == 3)
            {
                if (this.ai[0] == 0f)
                {
                    this.ai[1] += 1f;
                    if (this.type == ProjectileID.LightDisc && this.ai[1] >= 45f)
                    {
                        this.ai[0] = 1f;
                        this.ai[1] = 0f;
                        this.netUpdate = true;
                    }
                    if (this.type == ProjectileID.BloodyMachete || this.type == ProjectileID.Anchor)
                    {
                        if (this.ai[1] >= 10f)
                        {
                            this.velocity.Y = this.velocity.Y + 0.5f;
                            if (this.type == ProjectileID.Anchor && this.velocity.Y < 0f)
                            {
                                this.velocity.Y = this.velocity.Y + 0.35f;
                            }
                            this.velocity.X = this.velocity.X * 0.95f;
                            if (this.velocity.Y > 16f)
                            {
                                this.velocity.Y = 16f;
                            }
                            if (this.type == ProjectileID.Anchor && Vector2.Distance(base.Center, Main.player[this.owner].Center) > 800f)
                            {
                                this.ai[0] = 1f;
                            }
                        }
                    }
                    else if (this.type == ProjectileID.PossessedHatchet)
                    {
                        if (this.velocity.X > 0f)
                        {
                            this.spriteDirection = 1;
                        }
                        else if (this.velocity.X < 0f)
                        {
                            this.spriteDirection = -1;
                        }
                        float num30 = this.position.X;
                        float num31 = this.position.Y;
                        bool flag = false;
                        if (this.ai[1] > 10f)
                        {
                            for (int num32 = 0; num32 < 200; num32++)
                            {
                                if (Main.npc[num32].CanBeChasedBy(this, false))
                                {
                                    float num33 = Main.npc[num32].position.X + (float)(Main.npc[num32].width / 2);
                                    float num34 = Main.npc[num32].position.Y + (float)(Main.npc[num32].height / 2);
                                    float num35 = Math.Abs(this.position.X + (float)(this.width / 2) - num33) + Math.Abs(this.position.Y + (float)(this.height / 2) - num34);
                                    if (num35 < 800f && Collision.CanHit(new Vector2(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2)), 1, 1, Main.npc[num32].position, Main.npc[num32].width, Main.npc[num32].height))
                                    {
                                        num30 = num33;
                                        num31 = num34;
                                        flag = true;
                                    }
                                }
                            }
                        }
                        if (!flag)
                        {
                            num30 = this.position.X + (float)(this.width / 2) + this.velocity.X * 100f;
                            num31 = this.position.Y + (float)(this.height / 2) + this.velocity.Y * 100f;
                            if (this.ai[1] >= 30f)
                            {
                                this.ai[0] = 1f;
                                this.ai[1] = 0f;
                                this.netUpdate = true;
                            }
                        }
                        float num36 = 12f;
                        float num37 = 0.25f;
                        Vector2 vector = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                        float num38 = num30 - vector.X;
                        float num39 = num31 - vector.Y;
                        float num40 = (float)Math.Sqrt((double)(num38 * num38 + num39 * num39));
                        num40 = num36 / num40;
                        num38 *= num40;
                        num39 *= num40;
                        if (this.velocity.X < num38)
                        {
                            this.velocity.X = this.velocity.X + num37;
                            if (this.velocity.X < 0f && num38 > 0f)
                            {
                                this.velocity.X = this.velocity.X + num37 * 2f;
                            }
                        }
                        else if (this.velocity.X > num38)
                        {
                            this.velocity.X = this.velocity.X - num37;
                            if (this.velocity.X > 0f && num38 < 0f)
                            {
                                this.velocity.X = this.velocity.X - num37 * 2f;
                            }
                        }
                        if (this.velocity.Y < num39)
                        {
                            this.velocity.Y = this.velocity.Y + num37;
                            if (this.velocity.Y < 0f && num39 > 0f)
                            {
                                this.velocity.Y = this.velocity.Y + num37 * 2f;
                            }
                        }
                        else if (this.velocity.Y > num39)
                        {
                            this.velocity.Y = this.velocity.Y - num37;
                            if (this.velocity.Y > 0f && num39 < 0f)
                            {
                                this.velocity.Y = this.velocity.Y - num37 * 2f;
                            }
                        }
                    }
                    else if (this.type == ProjectileID.PaladinsHammerFriendly)
                    {
                        if (this.ai[1] >= 20f)
                        {
                            this.ai[0] = 1f;
                            this.ai[1] = 0f;
                            this.netUpdate = true;
                        }
                    }
                    else if (this.ai[1] >= 30f)
                    {
                        this.ai[0] = 1f;
                        this.ai[1] = 0f;
                        this.netUpdate = true;
                    }
                }
                else
                {
                    this.tileCollide = false;
                    float num41 = 9f;
                    float num42 = 0.4f;
                    if (this.type == ProjectileID.Flamarang)
                    {
                        num41 = 13f;
                        num42 = 0.6f;
                    }
                    else if (this.type == ProjectileID.ThornChakram)
                    {
                        num41 = 15f;
                        num42 = 0.8f;
                    }
                    else if (this.type == ProjectileID.PossessedHatchet)
                    {
                        num41 = 16f;
                        num42 = 1.2f;
                    }
                    else if (this.type == ProjectileID.LightDisc)
                    {
                        num41 = 16f;
                        num42 = 1.2f;
                    }
                    else if (this.type == ProjectileID.Bananarang)
                    {
                        num41 = 15f;
                        num42 = 1f;
                    }
                    else if (this.type == ProjectileID.FruitcakeChakram)
                    {
                        num41 = 12f;
                        num42 = 0.6f;
                    }
                    else if (this.type == ProjectileID.PaladinsHammerFriendly)
                    {
                        num41 = 15f;
                        num42 = 3f;
                    }
                    else if (this.type == ProjectileID.BloodyMachete)
                    {
                        num41 = 15f;
                        num42 = 3f;
                    }
                    else if (this.type == ProjectileID.Anchor)
                    {
                        num41 = 16f;
                        num42 = 4f;
                    }
                    Vector2 vector2 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                    float num43 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector2.X;
                    float num44 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector2.Y;
                    float num45 = (float)Math.Sqrt((double)(num43 * num43 + num44 * num44));
                    if (num45 > 3000f)
                    {
                        this.Kill();
                    }
                    num45 = num41 / num45;
                    num43 *= num45;
                    num44 *= num45;
                    if (this.type == ProjectileID.Anchor)
                    {
                        Vector2 vector3 = new Vector2(num43, num44) - this.velocity;
                        if (vector3 != Vector2.Zero)
                        {
                            Vector2 vector4 = vector3;
                            vector4.Normalize();
                            this.velocity += vector4 * Math.Min(num42, vector3.Length());
                        }
                    }
                    else
                    {
                        if (this.velocity.X < num43)
                        {
                            this.velocity.X = this.velocity.X + num42;
                            if (this.velocity.X < 0f && num43 > 0f)
                            {
                                this.velocity.X = this.velocity.X + num42;
                            }
                        }
                        else if (this.velocity.X > num43)
                        {
                            this.velocity.X = this.velocity.X - num42;
                            if (this.velocity.X > 0f && num43 < 0f)
                            {
                                this.velocity.X = this.velocity.X - num42;
                            }
                        }
                        if (this.velocity.Y < num44)
                        {
                            this.velocity.Y = this.velocity.Y + num42;
                            if (this.velocity.Y < 0f && num44 > 0f)
                            {
                                this.velocity.Y = this.velocity.Y + num42;
                            }
                        }
                        else if (this.velocity.Y > num44)
                        {
                            this.velocity.Y = this.velocity.Y - num42;
                            if (this.velocity.Y > 0f && num44 < 0f)
                            {
                                this.velocity.Y = this.velocity.Y - num42;
                            }
                        }
                    }
                    if (Main.myPlayer == this.owner)
                    {
                        Rectangle rectangle = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
                        Rectangle rectangle2 = new Rectangle((int)Main.player[this.owner].position.X, (int)Main.player[this.owner].position.Y, Main.player[this.owner].width, Main.player[this.owner].height);
                        if (rectangle.Intersects(rectangle2))
                        {
                            this.Kill();
                        }
                    }
                }
                if (this.type == ProjectileID.LightDisc)
                {
                    this.rotation += 0.3f * (float)this.direction;
                    return;
                }
                if (this.type != ProjectileID.Anchor)
                {
                    this.rotation += 0.4f * (float)this.direction;
                    return;
                }
                if (this.ai[0] == 0f)
                {
                    Vector2 velocity = this.velocity;
                    velocity.Normalize();
                    this.rotation = (float)Math.Atan2((double)velocity.Y, (double)velocity.X) + 1.57f;
                    return;
                }
                Vector2 vector5 = base.Center - Main.player[this.owner].Center;
                vector5.Normalize();
                this.rotation = (float)Math.Atan2((double)vector5.Y, (double)vector5.X) + 1.57f;
                return;
            }
            else if (this.aiStyle == 4)
            {
                this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                if (this.ai[0] == 0f)
                {
                    if (this.type >= ProjectileID.NettleBurstRight && this.type <= ProjectileID.NettleBurstEnd && this.ai[1] == 0f && this.alpha == 255 && Main.rand.Next(2) == 0)
                    {
                        this.type++;
                        this.netUpdate = true;
                    }
                    this.alpha -= 50;
                    if (this.type >= ProjectileID.NettleBurstRight && this.type <= ProjectileID.NettleBurstEnd)
                    {
                        this.alpha -= 25;
                    }
                    else if (this.type == ProjectileID.CrystalVileShardHead || this.type == ProjectileID.CrystalVileShardShaft)
                    {
                        this.alpha -= 50;
                    }
                    if (this.alpha <= 0)
                    {
                        this.alpha = 0;
                        this.ai[0] = 1f;
                        if (this.ai[1] == 0f)
                        {
                            this.ai[1] += 1f;
                            this.position += this.velocity * 1f;
                        }
                        if (this.type == ProjectileID.VilethornBase && Main.myPlayer == this.owner)
                        {
                            int num46 = this.type;
                            if (this.ai[1] >= 6f)
                            {
                                num46++;
                            }
                            int num47 = Projectile.NewProjectile(this.position.X + this.velocity.X + (float)(this.width / 2), this.position.Y + this.velocity.Y + (float)(this.height / 2), this.velocity.X, this.velocity.Y, num46, this.damage, this.knockBack, this.owner, 0f, 0f);
                            Main.projectile[num47].damage = this.damage;
                            Main.projectile[num47].ai[1] = this.ai[1] + 1f;
                            NetMessage.SendData((int)PacketTypes.ProjectileNew, -1, -1, "", num47, 0f, 0f, 0f, 0, 0, 0);
                            return;
                        }
                        if (this.type == ProjectileID.CrystalVileShardShaft && Main.myPlayer == this.owner)
                        {
                            int num48 = this.type;
                            if (this.ai[1] >= (float)(7 + Main.rand.Next(2)))
                            {
                                num48--;
                            }
                            int num49 = this.damage;
                            float num50 = this.knockBack;
                            if (num48 == 493)
                            {
                                num49 = (int)((double)this.damage * 1.25);
                                num50 = this.knockBack * 1.25f;
                            }
                            int number = Projectile.NewProjectile(this.position.X + this.velocity.X + (float)(this.width / 2), this.position.Y + this.velocity.Y + (float)(this.height / 2), this.velocity.X, this.velocity.Y, num48, num49, num50, this.owner, 0f, this.ai[1] + 1f);
                            NetMessage.SendData((int)PacketTypes.ProjectileNew, -1, -1, "", number, 0f, 0f, 0f, 0, 0, 0);
                            return;
                        }
                        if ((this.type == ProjectileID.NettleBurstRight || this.type == ProjectileID.NettleBurstLeft) && Main.myPlayer == this.owner)
                        {
                            int num51 = this.type;
                            if (this.type == ProjectileID.NettleBurstRight)
                            {
                                num51 = 151;
                            }
                            else if (this.type == ProjectileID.NettleBurstLeft)
                            {
                                num51 = 150;
                            }
                            if (this.ai[1] >= 10f && this.type == ProjectileID.NettleBurstLeft)
                            {
                                num51 = 152;
                            }
                            int num52 = Projectile.NewProjectile(this.position.X + this.velocity.X + (float)(this.width / 2), this.position.Y + this.velocity.Y + (float)(this.height / 2), this.velocity.X, this.velocity.Y, num51, this.damage, this.knockBack, this.owner, 0f, 0f);
                            Main.projectile[num52].damage = this.damage;
                            Main.projectile[num52].ai[1] = this.ai[1] + 1f;
                            NetMessage.SendData((int)PacketTypes.ProjectileNew, -1, -1, "", num52, 0f, 0f, 0f, 0, 0, 0);
                            return;
                        }
                    }
                }
                else
                {
                    if (this.type >= ProjectileID.NettleBurstRight && this.type <= ProjectileID.NettleBurstEnd)
                    {
                        this.alpha += 3;
                    }
                    else if (this.type == ProjectileID.CrystalVileShardHead || this.type == ProjectileID.CrystalVileShardShaft)
                    {
                        this.alpha += 7;
                    }
                    else
                    {
                        this.alpha += 5;
                    }
                    if (this.alpha >= 255)
                    {
                        this.Kill();
                        return;
                    }
                }
            }
            else if (this.aiStyle == 5)
            {
                if (this.type == ProjectileID.StarWrath)
                {
                    if (base.Center.Y > this.ai[1])
                    {
                        this.tileCollide = true;
                    }
                }
                else if (this.type == ProjectileID.HallowStar)
                {
                    if (this.position.Y > this.ai[1])
                    {
                        this.tileCollide = true;
                    }
                }
                else
                {
                    if (this.ai[1] == 0f && !Collision.SolidCollision(this.position, this.width, this.height))
                    {
                        this.ai[1] = 1f;
                        this.netUpdate = true;
                    }
                    if (this.ai[1] != 0f)
                    {
                        this.tileCollide = true;
                    }
                }
                if (this.type == ProjectileID.StarWrath)
                {
                    this.alpha -= 15;
                    int num58 = 150;
                    if (base.Center.Y >= this.ai[1])
                    {
                        num58 = 0;
                    }
                    if (this.alpha < num58)
                    {
                        this.alpha = num58;
                    }
                    this.localAI[0] += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.01f * (float)this.direction;
                }
                else
                {
                    if (this.localAI[0] == 0f)
                    {
                        this.localAI[0] = 1f;
                    }
                    this.alpha += (int)(25f * this.localAI[0]);
                    if (this.alpha > 200)
                    {
                        this.alpha = 200;
                        this.localAI[0] = -1f;
                    }
                    if (this.alpha < 0)
                    {
                        this.alpha = 0;
                        this.localAI[0] = 1f;
                    }
                }
                if (this.type == ProjectileID.StarWrath)
                {
                    this.rotation = this.velocity.ToRotation() - 1.57079637f;
                }
                else
                {
                    this.rotation += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.01f * (float)this.direction;
                }
                if (this.ai[1] == 1f || this.type == ProjectileID.HallowStar)
                {
                    this.light = 0.9f;
                    if (Main.rand.Next(20) == 0)
                    {
                        return;
                    }
                }
            }
            else if (this.aiStyle == 6)
            {
                this.velocity *= 0.95f;
                this.ai[0] += 1f;
                if (this.ai[0] == 180f)
                {
                    this.Kill();
                }
                if (this.ai[1] == 0f)
                {
                    this.ai[1] = 1f;
                }
                if (this.type == ProjectileID.PurificationPowder || this.type == ProjectileID.VilePowder || this.type == ProjectileID.ViciousPowder)
                {
                    int num63 = (int)(this.position.X / 16f) - 1;
                    int num64 = (int)((this.position.X + (float)this.width) / 16f) + 2;
                    int num65 = (int)(this.position.Y / 16f) - 1;
                    int num66 = (int)((this.position.Y + (float)this.height) / 16f) + 2;
                    if (num63 < 0)
                    {
                        num63 = 0;
                    }
                    if (num64 > Main.maxTilesX)
                    {
                        num64 = Main.maxTilesX;
                    }
                    if (num65 < 0)
                    {
                        num65 = 0;
                    }
                    if (num66 > Main.maxTilesY)
                    {
                        num66 = Main.maxTilesY;
                    }
                    for (int num67 = num63; num67 < num64; num67++)
                    {
                        for (int num68 = num65; num68 < num66; num68++)
                        {
                            Vector2 vector7;
                            vector7.X = (float)(num67 * 16);
                            vector7.Y = (float)(num68 * 16);
                            if (this.position.X + (float)this.width > vector7.X && this.position.X < vector7.X + 16f && this.position.Y + (float)this.height > vector7.Y && this.position.Y < vector7.Y + 16f && Main.myPlayer == this.owner && Main.tile[num67, num68].active())
                            {
                                if (this.type == ProjectileID.PurificationPowder)
                                {
                                    if (Main.tile[num67, num68].type == TileID.CorruptGrass || Main.tile[num67, num68].type == TileID.FleshGrass)
                                    {
                                        Main.tile[num67, num68].type = 2;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                    if (Main.tile[num67, num68].type == TileID.Ebonstone || Main.tile[num67, num68].type == TileID.Crimstone)
                                    {
                                        Main.tile[num67, num68].type = 1;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                    if (Main.tile[num67, num68].type == TileID.Ebonsand || Main.tile[num67, num68].type == TileID.Crimsand)
                                    {
                                        Main.tile[num67, num68].type = 53;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                    if (Main.tile[num67, num68].type == TileID.CorruptIce || Main.tile[num67, num68].type == TileID.FleshIce)
                                    {
                                        Main.tile[num67, num68].type = 161;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                    if (Main.tile[num67, num68].type == TileID.CorruptSandstone || Main.tile[num67, num68].type == TileID.CrimsonSandstone)
                                    {
                                        Main.tile[num67, num68].type = 396;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                    if (Main.tile[num67, num68].type == TileID.CorruptHardenedSand || Main.tile[num67, num68].type == TileID.CrimsonHardenedSand)
                                    {
                                        Main.tile[num67, num68].type = 397;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                }
                                else if (this.type == ProjectileID.VilePowder || this.type == ProjectileID.ViciousPowder)
                                {
                                    if (Main.tile[num67, num68].type == TileID.HallowedGrass)
                                    {
                                        Main.tile[num67, num68].type = 2;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                    if (Main.tile[num67, num68].type == TileID.Pearlsand)
                                    {
                                        Main.tile[num67, num68].type = 53;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                    if (Main.tile[num67, num68].type == TileID.Pearlstone)
                                    {
                                        Main.tile[num67, num68].type = 1;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                    if (Main.tile[num67, num68].type == TileID.HallowedIce)
                                    {
                                        Main.tile[num67, num68].type = 161;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                    if (Main.tile[num67, num68].type == TileID.HallowSandstone)
                                    {
                                        Main.tile[num67, num68].type = 396;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                    if (Main.tile[num67, num68].type == TileID.HallowHardenedSand)
                                    {
                                        Main.tile[num67, num68].type = 397;
                                        WorldGen.SquareTileFrame(num67, num68, true);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendTileSquare(-1, num67, num68, 1);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    return;
                }
            }
            else if (this.aiStyle == 7)
            {
                if (Main.player[this.owner].dead || Main.player[this.owner].stoned || Main.player[this.owner].webbed || Main.player[this.owner].frozen)
                {
                    this.Kill();
                    return;
                }
                Vector2 mountedCenter = Main.player[this.owner].MountedCenter;
                Vector2 vector8 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                float num69 = mountedCenter.X - vector8.X;
                float num70 = mountedCenter.Y - vector8.Y;
                float num71 = (float)Math.Sqrt((double)(num69 * num69 + num70 * num70));
                this.rotation = (float)Math.Atan2((double)num70, (double)num69) - 1.57f;
                if (this.type == ProjectileID.SkeletronHand)
                {
                    this.rotation = (float)Math.Atan2((double)num70, (double)num69) + 3.92500019f;
                }
                if (this.type == ProjectileID.AntiGravityHook)
                {
                    this.localAI[0] += 1f;
                    if (this.localAI[0] >= 28f)
                    {
                        this.localAI[0] = 0f;
                    }
                    DelegateMethods.v3_1 = new Vector3(0f, 0.4f, 0.3f);
                }
                if (this.type >= ProjectileID.LunarHookSolar && this.type <= ProjectileID.LunarHookStardust)
                {
                    Vector3 zero = Vector3.Zero;
                    switch (this.type)
                    {
                        case 646:
                            zero = new Vector3(0.7f, 0.5f, 0.1f);
                            break;
                        case 647:
                            zero = new Vector3(0f, 0.6f, 0.7f);
                            break;
                        case 648:
                            zero = new Vector3(0.6f, 0.2f, 0.6f);
                            break;
                        case 649:
                            zero = new Vector3(0.6f, 0.6f, 0.9f);
                            break;
                    }
                    DelegateMethods.v3_1 = zero;
                }
                if (this.ai[0] == 0f)
                {
                    if ((num71 > 300f && this.type == ProjectileID.Hook) || (num71 > 400f && this.type == ProjectileID.IvyWhip) || (num71 > 440f && this.type == ProjectileID.DualHookBlue) || (num71 > 440f && this.type == ProjectileID.DualHookRed) || (num71 > 250f && this.type == ProjectileID.Web) || (num71 > 350f && this.type == ProjectileID.SkeletronHand) || (num71 > 500f && this.type == ProjectileID.BatHook) || (num71 > 550f && this.type == ProjectileID.WoodHook) || (num71 > 400f && this.type == ProjectileID.CandyCaneHook) || (num71 > 550f && this.type == ProjectileID.ChristmasHook) || (num71 > 400f && this.type == ProjectileID.FishHook) || (num71 > 300f && this.type == ProjectileID.SlimeHook) || (num71 > 550f && this.type >= ProjectileID.LunarHookSolar && this.type <= ProjectileID.LunarHookStardust) || (num71 > 480f && this.type >= ProjectileID.TendonHook && this.type <= ProjectileID.WormHook) || (num71 > 500f && this.type == ProjectileID.AntiGravityHook))
                    {
                        this.ai[0] = 1f;
                    }
                    else if (this.type >= ProjectileID.GemHookAmethyst && this.type <= ProjectileID.GemHookDiamond)
                    {
                        int num72 = 300 + (this.type - 230) * 30;
                        if (num71 > (float)num72)
                        {
                            this.ai[0] = 1f;
                        }
                    }
                    Vector2 vector9 = base.Center - new Vector2(5f);
                    Vector2 vector10 = base.Center + new Vector2(5f);
                    Point point = (vector9 - new Vector2(16f)).ToTileCoordinates();
                    Point point2 = (vector10 + new Vector2(32f)).ToTileCoordinates();
                    int num73 = point.X;
                    int num74 = point2.X;
                    int num75 = point.Y;
                    int num76 = point2.Y;
                    if (num73 < 0)
                    {
                        num73 = 0;
                    }
                    if (num74 > Main.maxTilesX)
                    {
                        num74 = Main.maxTilesX;
                    }
                    if (num75 < 0)
                    {
                        num75 = 0;
                    }
                    if (num76 > Main.maxTilesY)
                    {
                        num76 = Main.maxTilesY;
                    }
                    for (int num77 = num73; num77 < num74; num77++)
                    {
                        int num78 = num75;
                        while (num78 < num76)
                        {
                            if (Main.tile[num77, num78] == null)
                            {
                                Main.tile[num77, num78] = new Tile();
                            }
                            Vector2 vector11;
                            vector11.X = (float)(num77 * 16);
                            vector11.Y = (float)(num78 * 16);
                            if (vector9.X + 10f > vector11.X && vector9.X < vector11.X + 16f && vector9.Y + 10f > vector11.Y && vector9.Y < vector11.Y + 16f && Main.tile[num77, num78].nactive() && (Main.tileSolid[(int)Main.tile[num77, num78].type] || Main.tile[num77, num78].type == TileID.MinecartTrack) && (this.type != ProjectileID.TrackHook || Main.tile[num77, num78].type == TileID.MinecartTrack))
                            {
                                if (Main.player[this.owner].grapCount < 10)
                                {
                                    Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = this.whoAmI;
                                    Main.player[this.owner].grapCount++;
                                }
                                if (Main.myPlayer == this.owner)
                                {
                                    int num79 = 0;
                                    int num80 = -1;
                                    int num81 = 100000;
                                    if (this.type == ProjectileID.DualHookBlue || this.type == ProjectileID.DualHookRed)
                                    {
                                        for (int num82 = 0; num82 < 1000; num82++)
                                        {
                                            if (num82 != this.whoAmI && Main.projectile[num82].active && Main.projectile[num82].owner == this.owner && Main.projectile[num82].aiStyle == 7 && Main.projectile[num82].ai[0] == 2f)
                                            {
                                                Main.projectile[num82].Kill();
                                            }
                                        }
                                    }
                                    else
                                    {
                                        int num83 = 3;
                                        if (this.type == ProjectileID.Web)
                                        {
                                            num83 = 8;
                                        }
                                        if (this.type == ProjectileID.SkeletronHand)
                                        {
                                            num83 = 2;
                                        }
                                        if (this.type == ProjectileID.FishHook)
                                        {
                                            num83 = 2;
                                        }
                                        if (this.type >= ProjectileID.LunarHookSolar && this.type <= ProjectileID.LunarHookStardust)
                                        {
                                            num83 = 4;
                                        }
                                        for (int num84 = 0; num84 < 1000; num84++)
                                        {
                                            if (Main.projectile[num84].active && Main.projectile[num84].owner == this.owner && Main.projectile[num84].aiStyle == 7)
                                            {
                                                if (Main.projectile[num84].timeLeft < num81)
                                                {
                                                    num80 = num84;
                                                    num81 = Main.projectile[num84].timeLeft;
                                                }
                                                num79++;
                                            }
                                        }
                                        if (num79 > num83)
                                        {
                                            Main.projectile[num80].Kill();
                                        }
                                    }
                                }
                                WorldGen.KillTile(num77, num78, true, true, false);
                                this.velocity.X = 0f;
                                this.velocity.Y = 0f;
                                this.ai[0] = 2f;
                                this.position.X = (float)(num77 * 16 + 8 - this.width / 2);
                                this.position.Y = (float)(num78 * 16 + 8 - this.height / 2);
                                this.damage = 0;
                                this.netUpdate = true;
                                if (Main.myPlayer == this.owner)
                                {
                                    NetMessage.SendData((int)PacketTypes.PlayerUpdate, -1, -1, "", this.owner, 0f, 0f, 0f, 0, 0, 0);
                                    break;
                                }
                                break;
                            }
                            else
                            {
                                num78++;
                            }
                        }
                        if (this.ai[0] == 2f)
                        {
                            return;
                        }
                    }
                    return;
                }
                if (this.ai[0] == 1f)
                {
                    float num85 = 11f;
                    if (this.type == ProjectileID.IvyWhip)
                    {
                        num85 = 15f;
                    }
                    if (this.type == ProjectileID.DualHookBlue || this.type == ProjectileID.DualHookRed)
                    {
                        num85 = 17f;
                    }
                    if (this.type == ProjectileID.BatHook)
                    {
                        num85 = 20f;
                    }
                    if (this.type == ProjectileID.WoodHook)
                    {
                        num85 = 22f;
                    }
                    if (this.type >= ProjectileID.GemHookAmethyst && this.type <= ProjectileID.GemHookDiamond)
                    {
                        num85 = 11f + (float)(this.type - 230) * 0.75f;
                    }
                    if (this.type == ProjectileID.AntiGravityHook)
                    {
                        num85 = 20f;
                    }
                    if (this.type >= ProjectileID.TendonHook && this.type <= ProjectileID.WormHook)
                    {
                        num85 = 18f;
                    }
                    if (this.type >= ProjectileID.LunarHookSolar && this.type <= ProjectileID.LunarHookStardust)
                    {
                        num85 = 24f;
                    }
                    if (this.type == ProjectileID.ChristmasHook)
                    {
                        num85 = 17f;
                    }
                    if (num71 < 24f)
                    {
                        this.Kill();
                    }
                    num71 = num85 / num71;
                    num69 *= num71;
                    num70 *= num71;
                    this.velocity.X = num69;
                    this.velocity.Y = num70;
                    return;
                }
                if (this.ai[0] == 2f)
                {
                    int num86 = (int)(this.position.X / 16f) - 1;
                    int num87 = (int)((this.position.X + (float)this.width) / 16f) + 2;
                    int num88 = (int)(this.position.Y / 16f) - 1;
                    int num89 = (int)((this.position.Y + (float)this.height) / 16f) + 2;
                    if (num86 < 0)
                    {
                        num86 = 0;
                    }
                    if (num87 > Main.maxTilesX)
                    {
                        num87 = Main.maxTilesX;
                    }
                    if (num88 < 0)
                    {
                        num88 = 0;
                    }
                    if (num89 > Main.maxTilesY)
                    {
                        num89 = Main.maxTilesY;
                    }
                    bool flag2 = true;
                    for (int num90 = num86; num90 < num87; num90++)
                    {
                        for (int num91 = num88; num91 < num89; num91++)
                        {
                            if (Main.tile[num90, num91] == null)
                            {
                                Main.tile[num90, num91] = new Tile();
                            }
                            Vector2 vector12;
                            vector12.X = (float)(num90 * 16);
                            vector12.Y = (float)(num91 * 16);
                            if (this.position.X + (float)(this.width / 2) > vector12.X && this.position.X + (float)(this.width / 2) < vector12.X + 16f && this.position.Y + (float)(this.height / 2) > vector12.Y && this.position.Y + (float)(this.height / 2) < vector12.Y + 16f && Main.tile[num90, num91].nactive() && (Main.tileSolid[(int)Main.tile[num90, num91].type] || Main.tile[num90, num91].type == TileID.MinecartTrack || Main.tile[num90, num91].type == TileID.Trees))
                            {
                                flag2 = false;
                            }
                        }
                    }
                    if (flag2)
                    {
                        this.ai[0] = 1f;
                        return;
                    }
                    if (Main.player[this.owner].grapCount < 10)
                    {
                        Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = this.whoAmI;
                        Main.player[this.owner].grapCount++;
                        return;
                    }
                }
            }
            else if (this.aiStyle == 8)
            {
                if (this.type == ProjectileID.Fireball && this.localAI[0] == 0f)
                {
                    this.localAI[0] = 1f;
                }
                if (this.type == ProjectileID.CursedFlameHostile && this.localAI[0] == 0f)
                {
                    this.localAI[0] = 1f;
                }
                if (this.type != ProjectileID.WaterBolt && this.type != ProjectileID.CursedFlameHostile && this.type != ProjectileID.Fireball)
                {
                    this.ai[1] += 1f;
                }
                if (this.ai[1] >= 20f)
                {
                    this.velocity.Y = this.velocity.Y + 0.2f;
                }
                if (this.type == ProjectileID.Meowmere)
                {
                    this.rotation = this.velocity.ToRotation() + 1.57079637f;
                    if (this.velocity.X != 0f)
                    {
                        this.spriteDirection = (this.direction = Math.Sign(this.velocity.X));
                    }
                }
                else
                {
                    this.rotation += 0.3f * (float)this.direction;
                }
                if (this.velocity.Y > 16f)
                {
                    this.velocity.Y = 16f;
                    return;
                }
            }
            else if (this.aiStyle == 9)
            {
                if (Main.myPlayer == this.owner && this.ai[0] <= 0f)
                {
                    if (Main.player[this.owner].channel)
                    {
                        float num113 = 12f;
                        if (this.type == ProjectileID.MagicMissile)
                        {
                            num113 = 15f;
                        }
                        if (this.type == ProjectileID.FlyingKnife)
                        {
                            num113 = 20f;
                        }
                        Vector2 vector13 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                        float num114 = (float)Main.mouseX + Main.screenPosition.X - vector13.X;
                        float num115 = (float)Main.mouseY + Main.screenPosition.Y - vector13.Y;
                        if (Main.player[this.owner].gravDir == -1f)
                        {
                            num115 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector13.Y;
                        }
                        float num116 = (float)Math.Sqrt((double)(num114 * num114 + num115 * num115));
                        num116 = (float)Math.Sqrt((double)(num114 * num114 + num115 * num115));
                        if (this.ai[0] < 0f)
                        {
                            this.ai[0] += 1f;
                        }
                        if (this.type == ProjectileID.FlyingKnife && num116 < 100f)
                        {
                            if (this.velocity.Length() < num113)
                            {
                                this.velocity *= 1.1f;
                                if (this.velocity.Length() > num113)
                                {
                                    this.velocity.Normalize();
                                    this.velocity *= num113;
                                }
                            }
                            if (this.ai[0] == 0f)
                            {
                                this.ai[0] = -10f;
                            }
                        }
                        else if (num116 > num113)
                        {
                            num116 = num113 / num116;
                            num114 *= num116;
                            num115 *= num116;
                            int num117 = (int)(num114 * 1000f);
                            int num118 = (int)(this.velocity.X * 1000f);
                            int num119 = (int)(num115 * 1000f);
                            int num120 = (int)(this.velocity.Y * 1000f);
                            if (num117 != num118 || num119 != num120)
                            {
                                this.netUpdate = true;
                            }
                            if (this.type == ProjectileID.FlyingKnife)
                            {
                                Vector2 vector14 = new Vector2(num114, num115);
                                this.velocity = (this.velocity * 4f + vector14) / 5f;
                            }
                            else
                            {
                                this.velocity.X = num114;
                                this.velocity.Y = num115;
                            }
                        }
                        else
                        {
                            int num121 = (int)(num114 * 1000f);
                            int num122 = (int)(this.velocity.X * 1000f);
                            int num123 = (int)(num115 * 1000f);
                            int num124 = (int)(this.velocity.Y * 1000f);
                            if (num121 != num122 || num123 != num124)
                            {
                                this.netUpdate = true;
                            }
                            this.velocity.X = num114;
                            this.velocity.Y = num115;
                        }
                    }
                    else if (this.ai[0] <= 0f)
                    {
                        this.netUpdate = true;
                        if (this.type != ProjectileID.FlyingKnife)
                        {
                            float num125 = 12f;
                            Vector2 vector15 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                            float num126 = (float)Main.mouseX + Main.screenPosition.X - vector15.X;
                            float num127 = (float)Main.mouseY + Main.screenPosition.Y - vector15.Y;
                            if (Main.player[this.owner].gravDir == -1f)
                            {
                                num127 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector15.Y;
                            }
                            float num128 = (float)Math.Sqrt((double)(num126 * num126 + num127 * num127));
                            if (num128 == 0f || this.ai[0] < 0f)
                            {
                                vector15 = new Vector2(Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2), Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2));
                                num126 = this.position.X + (float)this.width * 0.5f - vector15.X;
                                num127 = this.position.Y + (float)this.height * 0.5f - vector15.Y;
                                num128 = (float)Math.Sqrt((double)(num126 * num126 + num127 * num127));
                            }
                            num128 = num125 / num128;
                            num126 *= num128;
                            num127 *= num128;
                            this.velocity.X = num126;
                            this.velocity.Y = num127;
                            if (this.velocity.X == 0f && this.velocity.Y == 0f)
                            {
                                this.Kill();
                            }
                        }
                        this.ai[0] = 1f;
                    }
                }
                if (this.type == ProjectileID.FlyingKnife)
                {
                    this.localAI[0] += 1f;
                    if (this.ai[0] > 0f && this.localAI[0] > 15f)
                    {
                        this.tileCollide = false;
                        Vector2 vector16 = Main.player[this.owner].Center - base.Center;
                        if (vector16.Length() < 20f)
                        {
                            this.Kill();
                        }
                        vector16.Normalize();
                        vector16 *= 25f;
                        this.velocity = (this.velocity * 5f + vector16) / 6f;
                    }
                    if (this.ai[0] < 0f || (this.velocity.X == 0f && this.velocity.Y == 0f))
                    {
                        this.rotation += 0.3f;
                    }
                    else if (this.ai[0] > 0f)
                    {
                        this.rotation += 0.3f * (float)this.direction;
                    }
                    else
                    {
                        this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                    }
                }
                else if (this.type == ProjectileID.Flamelash)
                {
                    this.rotation += 0.3f * (float)this.direction;
                }
                else if (this.velocity.X != 0f || this.velocity.Y != 0f)
                {
                    this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 2.355f;
                }
                if (this.velocity.Y > 16f)
                {
                    this.velocity.Y = 16f;
                    return;
                }
            }
            else if (this.aiStyle == 10)
            {
                this.tileCollide = true;
                this.localAI[1] = 0f;
                if (Main.myPlayer == this.owner && this.ai[0] == 0f)
                {
                    this.tileCollide = false;
                    if (Main.player[this.owner].channel)
                    {
                        this.localAI[1] = -1f;
                        float num140 = 12f;
                        Vector2 vector17 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                        float num141 = (float)Main.mouseX + Main.screenPosition.X - vector17.X;
                        float num142 = (float)Main.mouseY + Main.screenPosition.Y - vector17.Y;
                        if (Main.player[this.owner].gravDir == -1f)
                        {
                            num142 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector17.Y;
                        }
                        float num143 = (float)Math.Sqrt((double)(num141 * num141 + num142 * num142));
                        num143 = (float)Math.Sqrt((double)(num141 * num141 + num142 * num142));
                        if (num143 > num140)
                        {
                            num143 = num140 / num143;
                            num141 *= num143;
                            num142 *= num143;
                            if (num141 != this.velocity.X || num142 != this.velocity.Y)
                            {
                                this.netUpdate = true;
                            }
                            this.velocity.X = num141;
                            this.velocity.Y = num142;
                        }
                        else
                        {
                            if (num141 != this.velocity.X || num142 != this.velocity.Y)
                            {
                                this.netUpdate = true;
                            }
                            this.velocity.X = num141;
                            this.velocity.Y = num142;
                        }
                    }
                    else
                    {
                        this.ai[0] = 1f;
                        this.netUpdate = true;
                    }
                }
                if (this.ai[0] == 1f && this.type != ProjectileID.SnowBallHostile)
                {
                    if (this.type == ProjectileID.SandBallGun || this.type == ProjectileID.EbonsandBallGun || this.type == ProjectileID.PearlSandBallGun || this.type == ProjectileID.CrimsandBallGun)
                    {
                        this.ai[1] += 1f;
                        if (this.ai[1] >= 60f)
                        {
                            this.ai[1] = 60f;
                            this.velocity.Y = this.velocity.Y + 0.2f;
                        }
                    }
                    else
                    {
                        this.velocity.Y = this.velocity.Y + 0.41f;
                    }
                }
                else if (this.ai[0] == 2f && this.type != ProjectileID.SnowBallHostile)
                {
                    this.velocity.Y = this.velocity.Y + 0.2f;
                    if ((double)this.velocity.X < -0.04)
                    {
                        this.velocity.X = this.velocity.X + 0.04f;
                    }
                    else if ((double)this.velocity.X > 0.04)
                    {
                        this.velocity.X = this.velocity.X - 0.04f;
                    }
                    else
                    {
                        this.velocity.X = 0f;
                    }
                }
                this.rotation += 0.1f;
                if (this.velocity.Y > 10f)
                {
                    this.velocity.Y = 10f;
                    return;
                }
            }
            else if (this.aiStyle == 11)
            {
                if (this.type == ProjectileID.BlueFairy || this.type == ProjectileID.PinkFairy || this.type == ProjectileID.GreenFairy)
                {
                    if (this.velocity.X > 0f)
                    {
                        this.spriteDirection = -1;
                    }
                    else if (this.velocity.X < 0f)
                    {
                        this.spriteDirection = 1;
                    }
                    this.rotation = this.velocity.X * 0.1f;
                    this.frameCounter++;
                    if (this.frameCounter >= 4)
                    {
                        this.frame++;
                        this.frameCounter = 0;
                    }
                    if (this.frame >= 4)
                    {
                        this.frame = 0;
                    }
                }
                else
                {
                    this.rotation += 0.02f;
                }
                if (Main.myPlayer == this.owner)
                {
                    if (this.type == ProjectileID.BlueFairy)
                    {
                        if (Main.player[Main.myPlayer].blueFairy)
                        {
                            this.timeLeft = 2;
                        }
                    }
                    else if (this.type == ProjectileID.PinkFairy)
                    {
                        if (Main.player[Main.myPlayer].redFairy)
                        {
                            this.timeLeft = 2;
                        }
                    }
                    else if (this.type == ProjectileID.GreenFairy)
                    {
                        if (Main.player[Main.myPlayer].greenFairy)
                        {
                            this.timeLeft = 2;
                        }
                    }
                    else if (Main.player[Main.myPlayer].lightOrb)
                    {
                        this.timeLeft = 2;
                    }
                }
                if (Main.player[this.owner].dead)
                {
                    this.Kill();
                    return;
                }
                float num146 = 3f;
                if (this.type == ProjectileID.BlueFairy || this.type == ProjectileID.PinkFairy || this.type == ProjectileID.GreenFairy)
                {
                    num146 = 3.75f;
                }
                Vector2 vector18 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                float num147 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector18.X;
                float num148 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector18.Y;
                int num149 = 70;
                if (this.type == ProjectileID.ShadowOrb)
                {
                    if (Main.player[this.owner].controlUp)
                    {
                        num148 = Main.player[this.owner].position.Y - 40f - vector18.Y;
                        num147 -= 6f;
                        num149 = 4;
                    }
                    else if (Main.player[this.owner].controlDown)
                    {
                        num148 = Main.player[this.owner].position.Y + (float)Main.player[this.owner].height + 40f - vector18.Y;
                        num147 -= 6f;
                        num149 = 4;
                    }
                }
                float num150 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148));
                num150 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148));
                if (this.type == ProjectileID.BlueFairy || this.type == ProjectileID.PinkFairy || this.type == ProjectileID.GreenFairy)
                {
                    num149 = 40;
                }
                if (num150 > 800f)
                {
                    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);
                    return;
                }
                if (num150 > (float)num149)
                {
                    num150 = num146 / num150;
                    num147 *= num150;
                    num148 *= num150;
                    this.velocity.X = num147;
                    this.velocity.Y = num148;
                    return;
                }
                this.velocity.X = 0f;
                this.velocity.Y = 0f;
                return;
            }
            else if (this.aiStyle == 12)
            {
                if (this.type == ProjectileID.GoldenShowerHostile && this.localAI[0] == 0f)
                {
                    this.localAI[0] = 1f;
                }
                if (this.type == ProjectileID.GoldenShowerFriendly || this.type == ProjectileID.GoldenShowerHostile)
                {
                    this.scale -= 0.002f;
                    if (this.scale <= 0f)
                    {
                        this.Kill();
                    }
                    if (this.type == ProjectileID.GoldenShowerHostile)
                    {
                        this.ai[0] = 4f;
                    }
                    if (this.ai[0] <= 3f)
                    {
                        this.ai[0] += 1f;
                        return;
                    }
                    this.velocity.Y = this.velocity.Y + 0.075f;
                    if (Main.rand.Next(8) == 0)
                    {
                        return;
                    }
                }
                else
                {
                    this.scale -= 0.02f;
                    if (this.scale <= 0f)
                    {
                        this.Kill();
                    }
                    if (this.ai[0] > 3f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.2f;
                        return;
                    }
                    this.ai[0] += 1f;
                    return;
                }
            }
            else if (this.aiStyle == 13)
            {
                if (Main.player[this.owner].dead)
                {
                    this.Kill();
                    return;
                }
                if (this.type != ProjectileID.ChainGuillotine)
                {
                    Main.player[this.owner].itemAnimation = 5;
                    Main.player[this.owner].itemTime = 5;
                }
                if (this.alpha == 0)
                {
                    if (this.position.X + (float)(this.width / 2) > Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2))
                    {
                        Main.player[this.owner].ChangeDir(1);
                    }
                    else
                    {
                        Main.player[this.owner].ChangeDir(-1);
                    }
                }
                if (this.type == ProjectileID.ChainGuillotine)
                {
                    if (this.ai[0] == 0f)
                    {
                        this.extraUpdates = 0;
                    }
                    else
                    {
                        this.extraUpdates = 1;
                    }
                }
                Vector2 vector19 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                float num166 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector19.X;
                float num167 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector19.Y;
                float num168 = (float)Math.Sqrt((double)(num166 * num166 + num167 * num167));
                if (this.ai[0] == 0f)
                {
                    if (num168 > 700f)
                    {
                        this.ai[0] = 1f;
                    }
                    else if (this.type == ProjectileID.GolemFist && num168 > 500f)
                    {
                        this.ai[0] = 1f;
                    }
                    else if (this.type == ProjectileID.BoxingGlove && num168 > 200f)
                    {
                        this.ai[0] = 1f;
                    }
                    else if (this.type == ProjectileID.ChainKnife && num168 > 150f)
                    {
                        this.ai[0] = 1f;
                    }
                    else if (this.type == ProjectileID.ChainGuillotine && num168 > 350f)
                    {
                        this.ai[0] = 1f;
                    }
                    this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                    this.ai[1] += 1f;
                    if (this.ai[1] > 5f)
                    {
                        this.alpha = 0;
                    }
                    if (this.type == ProjectileID.GolemFist && this.ai[1] > 8f)
                    {
                        this.ai[1] = 8f;
                    }
                    if (this.type == ProjectileID.BoxingGlove && this.ai[1] > 8f)
                    {
                        this.ai[1] = 8f;
                    }
                    if (this.type == ProjectileID.ChainKnife && this.ai[1] > 8f)
                    {
                        this.ai[1] = 8f;
                    }
                    if (this.type == ProjectileID.ChainGuillotine && this.ai[1] > 8f)
                    {
                        this.ai[1] = 8f;
                    }
                    if (this.type == ProjectileID.Flairon && this.ai[1] > 8f)
                    {
                        this.ai[1] = 0f;
                    }
                    if (this.ai[1] >= 10f)
                    {
                        this.ai[1] = 15f;
                        this.velocity.Y = this.velocity.Y + 0.3f;
                    }
                    if (this.type == ProjectileID.GolemFist && this.velocity.X < 0f)
                    {
                        this.spriteDirection = -1;
                    }
                    else if (this.type == ProjectileID.GolemFist)
                    {
                        this.spriteDirection = 1;
                    }
                    if (this.type == ProjectileID.BoxingGlove && this.velocity.X < 0f)
                    {
                        this.spriteDirection = -1;
                        return;
                    }
                    if (this.type == ProjectileID.BoxingGlove)
                    {
                        this.spriteDirection = 1;
                        return;
                    }
                }
                else if (this.ai[0] == 1f)
                {
                    this.tileCollide = false;
                    this.rotation = (float)Math.Atan2((double)num167, (double)num166) - 1.57f;
                    float num169 = 20f;
                    if (this.type == ProjectileID.GolemFist)
                    {
                        num169 = 30f;
                    }
                    if (num168 < 50f)
                    {
                        this.Kill();
                    }
                    num168 = num169 / num168;
                    num166 *= num168;
                    num167 *= num168;
                    this.velocity.X = num166;
                    this.velocity.Y = num167;
                    if (this.type == ProjectileID.GolemFist && this.velocity.X < 0f)
                    {
                        this.spriteDirection = 1;
                    }
                    else if (this.type == ProjectileID.GolemFist)
                    {
                        this.spriteDirection = -1;
                    }
                    if (this.type == ProjectileID.BoxingGlove && this.velocity.X < 0f)
                    {
                        this.spriteDirection = 1;
                        return;
                    }
                    if (this.type == ProjectileID.BoxingGlove)
                    {
                        this.spriteDirection = -1;
                        return;
                    }
                }
            }
            else if (this.aiStyle == 14)
            {
                if (this.type == ProjectileID.SpelunkerGlowstick && Main.netMode != 2)
                {
                    this.localAI[0] += 1f;
                    if (this.localAI[0] >= 10f)
                    {
                        this.localAI[0] = 0f;
                    }
                }
                if (this.type == ProjectileID.Spike)
                {
                    if (this.localAI[1] == 0f)
                    {
                        this.localAI[1] = 1f;
                    }
                    this.alpha += (int)(25f * this.localAI[1]);
                    if (this.alpha <= 0)
                    {
                        this.alpha = 0;
                        this.localAI[1] = 1f;
                    }
                    else if (this.alpha >= 255)
                    {
                        this.alpha = 255;
                        this.localAI[1] = -1f;
                    }
                    this.scale += this.localAI[1] * 0.01f;
                }
                if (this.type == ProjectileID.OrnamentHostile)
                {
                    if (this.localAI[0] == 0f)
                    {
                        this.localAI[0] = 1f;
                    }
                    this.frame = (int)this.ai[1];
                    if (this.owner == Main.myPlayer && this.timeLeft == 1)
                    {
                        for (int num176 = 0; num176 < 5; num176++)
                        {
                            float num177 = 10f;
                            Vector2 vector21 = new Vector2(base.Center.X, base.Center.Y);
                            float num178 = (float)Main.rand.Next(-20, 21);
                            float num179 = (float)Main.rand.Next(-20, 0);
                            float num180 = (float)Math.Sqrt((double)(num178 * num178 + num179 * num179));
                            num180 = num177 / num180;
                            num178 *= num180;
                            num179 *= num180;
                            num178 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
                            num179 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
                            Projectile.NewProjectile(vector21.X, vector21.Y, num178, num179, 347, 40, 0f, Main.myPlayer, 0f, this.ai[1]);
                        }
                    }
                }
                if (this.type == ProjectileID.StickyGlowstick)
                {
                    try
                    {
                        Vector2 vector22 = Collision.TileCollision(this.position, this.velocity, this.width, this.height, false, false, 1);
                        int num184 = (int)(this.position.X / 16f) - 1;
                        int num185 = (int)((this.position.X + (float)this.width) / 16f) + 2;
                        int num186 = (int)(this.position.Y / 16f) - 1;
                        int num187 = (int)((this.position.Y + (float)this.height) / 16f) + 2;
                        if (num184 < 0)
                        {
                            num184 = 0;
                        }
                        if (num185 > Main.maxTilesX)
                        {
                            num185 = Main.maxTilesX;
                        }
                        if (num186 < 0)
                        {
                            num186 = 0;
                        }
                        if (num187 > Main.maxTilesY)
                        {
                            num187 = Main.maxTilesY;
                        }
                        for (int num188 = num184; num188 < num185; num188++)
                        {
                            for (int num189 = num186; num189 < num187; num189++)
                            {
                                if (Main.tile[num188, num189] != null && Main.tile[num188, num189].nactive() && (Main.tileSolid[(int)Main.tile[num188, num189].type] || (Main.tileSolidTop[(int)Main.tile[num188, num189].type] && Main.tile[num188, num189].frameY == 0)))
                                {
                                    Vector2 vector23;
                                    vector23.X = (float)(num188 * 16);
                                    vector23.Y = (float)(num189 * 16);
                                    if (this.position.X + (float)this.width > vector23.X && this.position.X < vector23.X + 16f && this.position.Y + (float)this.height > vector23.Y && this.position.Y < vector23.Y + 16f)
                                    {
                                        this.velocity.X = 0f;
                                        this.velocity.Y = -0.2f;
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
            #if DEBUG
                        Console.WriteLine(ex);
                        System.Diagnostics.Debugger.Break();

            #endif
                    }
                }
                if (this.type == ProjectileID.ThornBall)
                {
                    if (this.alpha > 0)
                    {
                        this.alpha -= 30;
                        if (this.alpha < 0)
                        {
                            this.alpha = 0;
                        }
                    }
                    if (Main.expertMode)
                    {
                        float num190 = 12f;
                        int num191 = (int)Player.FindClosest(base.Center, 1, 1);
                        Vector2 vector24 = Main.player[num191].Center - base.Center;
                        vector24.Normalize();
                        vector24 *= num190;
                        int num192 = 200;
                        this.velocity.X = (this.velocity.X * (float)(num192 - 1) + vector24.X) / (float)num192;
                        if (this.velocity.Length() > 16f)
                        {
                            this.velocity.Normalize();
                            this.velocity *= 16f;
                        }
                    }
                }
                if (this.type == ProjectileID.BoulderStaffOfEarth || this.type == ProjectileID.ThornBall)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] > 15f)
                    {
                        this.ai[0] = 15f;
                        if (this.velocity.Y == 0f && this.velocity.X != 0f)
                        {
                            this.velocity.X = this.velocity.X * 0.97f;
                            if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01)
                            {
                                this.Kill();
                            }
                        }
                        this.velocity.Y = this.velocity.Y + 0.2f;
                    }
                    this.rotation += this.velocity.X * 0.05f;
                }
                else if (this.type == ProjectileID.SpiderEgg)
                {
                    if (this.localAI[0] == 0f)
                    {
                        this.localAI[0] += 1f;
                    }
                    Rectangle rectangle3 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
                    for (int num193 = 0; num193 < 200; num193++)
                    {
                        if (Main.npc[num193].CanBeChasedBy(this, true))
                        {
                            Rectangle rectangle4 = new Rectangle((int)Main.npc[num193].position.X, (int)Main.npc[num193].position.Y, Main.npc[num193].width, Main.npc[num193].height);
                            if (rectangle3.Intersects(rectangle4))
                            {
                                this.Kill();
                                return;
                            }
                        }
                    }
                    this.ai[0] += 1f;
                    if (this.ai[0] > 10f)
                    {
                        this.ai[0] = 90f;
                        if (this.velocity.Y == 0f && this.velocity.X != 0f)
                        {
                            this.velocity.X = this.velocity.X * 0.96f;
                            if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01)
                            {
                                this.Kill();
                            }
                        }
                        this.velocity.Y = this.velocity.Y + 0.2f;
                    }
                    this.rotation += this.velocity.X * 0.1f;
                }
                else if (this.type == ProjectileID.SeedlerNut)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] > 5f)
                    {
                        if (this.owner == Main.myPlayer && this.ai[0] > (float)Main.rand.Next(20, 130))
                        {
                            this.Kill();
                        }
                        if (this.velocity.Y == 0f && this.velocity.X != 0f)
                        {
                            this.velocity.X = this.velocity.X * 0.97f;
                            if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01)
                            {
                                this.velocity.X = 0f;
                                this.netUpdate = true;
                            }
                        }
                        this.velocity.Y = this.velocity.Y + 0.3f;
                        this.velocity.X = this.velocity.X * 0.99f;
                    }
                    this.rotation += this.velocity.X * 0.05f;
                }
                else if (this.type == ProjectileID.Twinkle)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] > 60f || this.velocity.Y >= 0f)
                    {
                        this.alpha += 6;
                        this.velocity *= 0.5f;
                    }
                    else if (this.ai[0] > 5f)
                    {
                        this.velocity.Y = this.velocity.Y + 0.1f;
                        this.velocity.X = this.velocity.X * 1.025f;
                        this.alpha -= 23;
                        this.scale = 0.8f * (255f - (float)this.alpha) / 255f;
                        if (this.alpha < 0)
                        {
                            this.alpha = 0;
                        }
                    }
                    if (this.alpha >= 255 && this.ai[0] > 5f)
                    {
                        this.Kill();
                        return;
                    }
                }
                else
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] > 5f)
                    {
                        this.ai[0] = 5f;
                        if (this.velocity.Y == 0f && this.velocity.X != 0f)
                        {
                            this.velocity.X = this.velocity.X * 0.97f;
                            if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01)
                            {
                                this.velocity.X = 0f;
                                this.netUpdate = true;
                            }
                        }
                        this.velocity.Y = this.velocity.Y + 0.2f;
                    }
                    this.rotation += this.velocity.X * 0.1f;
                }
                if (this.type == ProjectileID.Twinkle)
                {
                    if (this.localAI[1] == 0f)
                    {
                        this.localAI[1] = 1f;
                    }
                }
                if (this.type == ProjectileID.SaucerScrap)
                {
                    if (this.ai[1] == 0f)
                    {
                        this.ai[1] = 1f;
                    }
                    if (++this.frameCounter >= 3)
                    {
                        this.frameCounter = 0;
                        if (++this.frame >= 5)
                        {
                            this.frame = 0;
                        }
                    }
                    if ((double)this.velocity.Y < 0.25 && (double)this.velocity.Y > 0.15)
                    {
                        this.velocity.X = this.velocity.X * 0.8f;
                    }
                    this.rotation = -this.velocity.X * 0.05f;
                }
                if (this.type == ProjectileID.CursedDartFlame)
                {
                    this.alpha = 255;
                }
                if ((this.type >= ProjectileID.GreekFire1 && this.type <= ProjectileID.GreekFire3) || (this.type >= ProjectileID.MolotovFire && this.type <= ProjectileID.MolotovFire3))
                {
                    if (this.wet)
                    {
                        this.Kill();
                    }
                    if (this.ai[1] == 0f && this.type >= ProjectileID.GreekFire1 && this.type <= ProjectileID.GreekFire3)
                    {
                        this.ai[1] = 1f;
                    }
                    if ((double)this.velocity.Y < 0.25 && (double)this.velocity.Y > 0.15)
                    {
                        this.velocity.X = this.velocity.X * 0.8f;
                    }
                    this.rotation = -this.velocity.X * 0.05f;
                }
                if (this.velocity.Y > 16f)
                {
                    this.velocity.Y = 16f;
                    return;
                }
            }
            else if (this.aiStyle == 15)
            {
                if (Main.player[this.owner].dead)
                {
                    this.Kill();
                    return;
                }
                Main.player[this.owner].itemAnimation = 10;
                Main.player[this.owner].itemTime = 10;
                if (this.position.X + (float)(this.width / 2) > Main.player[this.owner].position.X + (float)(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;
                }
                Vector2 mountedCenter2 = Main.player[this.owner].MountedCenter;
                Vector2 vector25 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                float num205 = mountedCenter2.X - vector25.X;
                float num206 = mountedCenter2.Y - vector25.Y;
                float num207 = (float)Math.Sqrt((double)(num205 * num205 + num206 * num206));
                if (this.ai[0] == 0f)
                {
                    float num208 = 160f;
                    if (this.type == ProjectileID.TheDaoofPow)
                    {
                        num208 *= 1.5f;
                    }
                    if (this.type == ProjectileID.FlowerPow)
                    {
                        num208 *= 1.5f;
                    }
                    this.tileCollide = true;
                    if (num207 > num208)
                    {
                        this.ai[0] = 1f;
                        this.netUpdate = true;
                    }
                    else if (!Main.player[this.owner].channel)
                    {
                        if (this.velocity.Y < 0f)
                        {
                            this.velocity.Y = this.velocity.Y * 0.9f;
                        }
                        this.velocity.Y = this.velocity.Y + 1f;
                        this.velocity.X = this.velocity.X * 0.9f;
                    }
                }
                else if (this.ai[0] == 1f)
                {
                    float num209 = 14f / Main.player[this.owner].meleeSpeed;
                    float num210 = 0.9f / Main.player[this.owner].meleeSpeed;
                    float num211 = 300f;
                    if (this.type == ProjectileID.TheDaoofPow)
                    {
                        num211 *= 1.5f;
                        num209 *= 1.5f;
                        num210 *= 1.5f;
                    }
                    if (this.type == ProjectileID.FlowerPow)
                    {
                        num211 *= 1.5f;
                        num209 = 15.9f;
                        num210 *= 2f;
                    }
                    Math.Abs(num205);
                    Math.Abs(num206);
                    if (this.ai[1] == 1f)
                    {
                        this.tileCollide = false;
                    }
                    if (!Main.player[this.owner].channel || num207 > num211 || !this.tileCollide)
                    {
                        this.ai[1] = 1f;
                        if (this.tileCollide)
                        {
                            this.netUpdate = true;
                        }
                        this.tileCollide = false;
                        if (num207 < 20f)
                        {
                            this.Kill();
                        }
                    }
                    if (!this.tileCollide)
                    {
                        num210 *= 2f;
                    }
                    int num212 = 60;
                    if (this.type == ProjectileID.FlowerPow)
                    {
                        num212 = 100;
                    }
                    if (num207 > (float)num212 || !this.tileCollide)
                    {
                        num207 = num209 / num207;
                        num205 *= num207;
                        num206 *= num207;
                        new Vector2(this.velocity.X, this.velocity.Y);
                        float num213 = num205 - this.velocity.X;
                        float num214 = num206 - this.velocity.Y;
                        float num215 = (float)Math.Sqrt((double)(num213 * num213 + num214 * num214));
                        num215 = num210 / num215;
                        num213 *= num215;
                        num214 *= num215;
                        this.velocity.X = this.velocity.X * 0.98f;
                        this.velocity.Y = this.velocity.Y * 0.98f;
                        this.velocity.X = this.velocity.X + num213;
                        this.velocity.Y = this.velocity.Y + num214;
                    }
                    else
                    {
                        if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 6f)
                        {
                            this.velocity.X = this.velocity.X * 0.96f;
                            this.velocity.Y = this.velocity.Y + 0.2f;
                        }
                        if (Main.player[this.owner].velocity.X == 0f)
                        {
                            this.velocity.X = this.velocity.X * 0.96f;
                        }
                    }
                }
                if (this.type != ProjectileID.FlowerPow)
                {
                    this.rotation = (float)Math.Atan2((double)num206, (double)num205) - this.velocity.X * 0.1f;
                    return;
                }
                if (this.velocity.X < 0f)
                {
                    this.rotation -= (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.01f;
                }
                else
                {
                    this.rotation += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.01f;
                }
                float num216 = this.position.X;
                float num217 = this.position.Y;
                float num218 = 600f;
                bool flag4 = false;
                if (this.owner == Main.myPlayer)
                {
                    this.localAI[1] += 1f;
                    if (this.localAI[1] > 20f)
                    {
                        this.localAI[1] = 20f;
                        for (int num219 = 0; num219 < 200; num219++)
                        {
                            if (Main.npc[num219].CanBeChasedBy(this, false))
                            {
                                float num220 = Main.npc[num219].position.X + (float)(Main.npc[num219].width / 2);
                                float num221 = Main.npc[num219].position.Y + (float)(Main.npc[num219].height / 2);
                                float num222 = Math.Abs(this.position.X + (float)(this.width / 2) - num220) + Math.Abs(this.position.Y + (float)(this.height / 2) - num221);
                                if (num222 < num218 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num219].position, Main.npc[num219].width, Main.npc[num219].height))
                                {
                                    num218 = num222;
                                    num216 = num220;
                                    num217 = num221;
                                    flag4 = true;
                                }
                            }
                        }
                    }
                }
                if (flag4)
                {
                    this.localAI[1] = 0f;
                    float num223 = 14f;
                    vector25 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                    num205 = num216 - vector25.X;
                    num206 = num217 - vector25.Y;
                    num207 = (float)Math.Sqrt((double)(num205 * num205 + num206 * num206));
                    num207 = num223 / num207;
                    num205 *= num207;
                    num206 *= num207;
                    Projectile.NewProjectile(vector25.X, vector25.Y, num205, num206, 248, (int)((double)this.damage / 1.5), this.knockBack / 2f, Main.myPlayer, 0f, 0f);
                    return;
                }
            }
            else if (this.aiStyle == 16)
            {
                if (this.type == ProjectileID.Explosives || this.type == ProjectileID.Landmine)
                {
                    this.ai[0] += 1f;
                    if (this.ai[0] > 3f)
                    {
                        this.Kill();
                    }
                }
                if (this.type != ProjectileID.StickyBomb && this.type != ProjectileID.StickyGrenade && this.type != ProjectileID.StickyDynamite)
                {
                    if (this.type != ProjectileID.BombFish)
                    {
                        goto IL_990C;
                    }
                }
                try
                {
                    int num224 = (int)(this.position.X / 16f) - 1;
                    int num225 = (int)((this.position.X + (float)this.width) / 16f) + 2;
                    int num226 = (int)(this.position.Y / 16f) - 1;
                    int num227 = (int)((this.position.Y + (float)this.height) / 16f) + 2;
                    if (num224 < 0)
                    {
                        num224 = 0;
                    }
                    if (num225 > Main.maxTilesX)
                    {
                        num225 = Main.maxTilesX;
                    }
                    if (num226 < 0)
                    {
                        num226 = 0;
                    }
                    if (num227 > Main.maxTilesY)
                    {
                        num227 = Main.maxTilesY;
                    }
                    for (int num228 = num224; num228 < num225; num228++)
                    {
                        for (int num229 = num226; num229 < num227; num229++)
                        {
                            if (Main.tile[num228, num229] != null && Main.tile[num228, num229].nactive() && (Main.tileSolid[(int)Main.tile[num228, num229].type] || (Main.tileSolidTop[(int)Main.tile[num228, num229].type] && Main.tile[num228, num229].frameY == 0)))
                            {
                                Vector2 vector26;
                                vector26.X = (float)(num228 * 16);
                                vector26.Y = (float)(num229 * 16);
                                if (this.position.X + (float)this.width - 4f > vector26.X && this.position.X + 4f < vector26.X + 16f && this.position.Y + (float)this.height - 4f > vector26.Y && this.position.Y + 4f < vector26.Y + 16f)
                                {
                                    this.velocity.X = 0f;
                                    this.velocity.Y = -0.2f;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
            #if DEBUG
                    Console.WriteLine(ex);
                    System.Diagnostics.Debugger.Break();

            #endif
                }
            IL_990C:
                if (this.type == ProjectileID.BombFish)
                {
                    this.localAI[1] += 1f;
                    float num230 = 180f - this.localAI[1];
                    if (num230 < 0f)
                    {
                        num230 = 0f;
                    }
                    this.frameCounter++;
                    if (num230 < 15f)
                    {
                        this.frameCounter++;
                    }
                    if ((float)this.frameCounter >= (num230 / 10f + 6f) / 2f)
                    {
                        this.frame++;
                        this.frameCounter = 0;
                        if (this.frame >= Main.projFrames[this.type])
                        {
                            this.frame = 0;
                        }
                    }
                }
                if (this.type == ProjectileID.BombSkeletronPrime)
                {
                    if (this.velocity.Y > 10f)
                    {
                        this.velocity.Y = 10f;
                    }
                    if (this.localAI[0] == 0f)
                    {
                        this.localAI[0] = 1f;
                    }
                    this.frameCounter++;
                    if (this.frameCounter > 3)
                    {
                        this.frame++;
                        this.frameCounter = 0;
                    }
                    if (this.frame > 1)
                    {
                        this.frame = 0;
                    }
                    if (this.velocity.Y == 0f)
                    {
                        this.position.X = this.position.X + (float)(this.width / 2);
                        this.position.Y = this.position.Y + (float)(this.height / 2);
                        this.width = 128;
                        this.height = 128;
                        this.position.X = this.position.X - (float)(this.width / 2);
                        this.position.Y = this.position.Y - (float)(this.height / 2);
                        this.damage = 40;
                        this.knockBack = 8f;
                        this.timeLeft = 3;
                        this.netUpdate = true;
                    }
                }
                if (this.type == ProjectileID.RocketSkeleton && this.timeLeft <= 3 && this.hostile)
                {
                    this.position.X = this.position.X + (float)(this.width / 2);
                    this.position.Y = this.position.Y + (float)(this.height / 2);
                    this.width = 128;
                    this.height = 128;
                    this.position.X = this.position.X - (float)(this.width / 2);
                    this.position.Y = this.position.Y - (float)(this.height / 2);
                }
                if (this.owner == Main.myPlayer && this.timeLeft <= 3)
                {
                    this.tileCollide = false;
                    this.ai[1] = 0f;
                    this.alpha = 255;
                    if (this.type == ProjectileID.Bomb || this.type == ProjectileID.StickyBomb || this.type == ProjectileID.HappyBomb || this.type == ProjectileID.BouncyBomb || this.type == ProjectileID.BombFish)
                    {
                        this.position.X = this.position.X + (float)(this.width / 2);
                        this.position.Y = this.position.Y + (float)(this.height / 2);
                        this.width = 128;
                        this.height = 128;
                        this.position.X = this.position.X - (float)(this.width / 2);
                        this.position.Y = this.position.Y - (float)(this.height / 2);
                        this.damage = 100;
                        this.knockBack = 8f;
                    }
                    else if (this.type == ProjectileID.Dynamite || this.type == ProjectileID.StickyDynamite || this.type == ProjectileID.BouncyDynamite)
                    {
                        this.position.X = this.position.X + (float)(this.width / 2);
                        this.position.Y = this.position.Y + (float)(this.height / 2);
                        this.width = 250;
                        this.height = 250;
                        this.position.X = this.position.X - (float)(this.width / 2);
                        this.position.Y = this.position.Y - (float)(this.height / 2);
                        this.damage = 250;
                        this.knockBack = 10f;
                    }
                    else if (this.type == ProjectileID.Grenade || this.type == ProjectileID.StickyGrenade || this.type == ProjectileID.BouncyGrenade || this.type == ProjectileID.PartyGirlGrenade)
                    {
                        this.position.X = this.position.X + (float)(this.width / 2);
                        this.position.Y = this.position.Y + (float)(this.height / 2);
                        this.width = 128;
                        this.height = 128;
                        this.position.X = this.position.X - (float)(this.width / 2);
                        this.position.Y = this.position.Y - (float)(this.height / 2);
                        this.knockBack = 8f;
                    }
                    else if (this.type == ProjectileID.GrenadeI || this.type == ProjectileID.RocketI || this.type == ProjectileID.ProximityMineI || this.type == ProjectileID.GrenadeII || this.type == ProjectileID.RocketII || this.type == ProjectileID.ProximityMineII || this.type == ProjectileID.RocketSnowmanI || this.type == ProjectileID.RocketSnowmanII)
                    {
                        this.position.X = this.position.X + (float)(this.width / 2);
                        this.position.Y = this.position.Y + (float)(this.height / 2);
                        this.width = 128;
                        this.height = 128;
                        this.position.X = this.position.X - (float)(this.width / 2);
                        this.position.Y = this.position.Y - (float)(this.height / 2);
                        this.knockBack = 8f;
                    }
                    else if (this.type == ProjectileID.GrenadeIII || this.type == ProjectileID.RocketIII || this.type == ProjectileID.ProximityMineIII || this.type == ProjectileID.GrenadeIV || this.type == ProjectileID.RocketIV || this.type == ProjectileID.ProximityMineIV || this.type == ProjectileID.RocketSnowmanIII || this.type == ProjectileID.RocketSnowmanIV)
                    {
                        this.position.X = this.position.X + (float)(this.width / 2);
                        this.position.Y = this.position.Y + (float)(this.height / 2);
                        this.width = 200;
                        this.height = 200;
                        this.position.X = this.position.X - (float)(this.width / 2);
                        this.position.Y = this.position.Y - (float)(this.height / 2);
                        this.knockBack = 10f;
                    }
                }
                else
                {
                    if (this.type != ProjectileID.Grenade && this.type != ProjectileID.BouncyGrenade && this.type != ProjectileID.PartyGirlGrenade && this.type != ProjectileID.StickyGrenade && this.type != ProjectileID.Explosives && this.type != ProjectileID.GrenadeI && this.type != ProjectileID.RocketI && this.type != ProjectileID.ProximityMineI && this.type != ProjectileID.GrenadeII && this.type != ProjectileID.RocketII && this.type != ProjectileID.ProximityMineII && this.type != ProjectileID.GrenadeIII && this.type != ProjectileID.RocketIII && this.type != ProjectileID.ProximityMineIII && this.type != ProjectileID.GrenadeIV && this.type != ProjectileID.RocketIV && this.type != ProjectileID.ProximityMineIV && this.type != ProjectileID.Landmine && this.type != ProjectileID.RocketSkeleton && this.type < 338 && this.type < 341)
                    {
                        this.damage = 0;
                    }
                    if (this.type == ProjectileID.RocketSnowmanI || this.type == ProjectileID.RocketSnowmanII || this.type == ProjectileID.RocketSnowmanIII || this.type == ProjectileID.RocketSnowmanIV)
                    {
                        this.localAI[1] += 1f;
                        if (this.localAI[1] > 6f)
                        {
                            this.alpha = 0;
                        }
                        else
                        {
                            this.alpha = (int)(255f - 42f * this.localAI[1]) + 100;
                            if (this.alpha > 255)
                            {
                                this.alpha = 255;
                            }
                        }
                        for (int num231 = 0; num231 < 2; num231++)
                        {
                            float num232 = 0f;
                            float num233 = 0f;
                            if (num231 == 1)
                            {
                                num232 = this.velocity.X * 0.5f;
                                num233 = this.velocity.Y * 0.5f;
                            }
                        }
                        float num236 = this.position.X;
                        float num237 = this.position.Y;
                        float num238 = 600f;
                        bool flag5 = false;
                        this.ai[0] += 1f;
                        if (this.ai[0] > 30f)
                        {
                            this.ai[0] = 30f;
                            for (int num239 = 0; num239 < 200; num239++)
                            {
                                if (Main.npc[num239].CanBeChasedBy(this, false))
                                {
                                    float num240 = Main.npc[num239].position.X + (float)(Main.npc[num239].width / 2);
                                    float num241 = Main.npc[num239].position.Y + (float)(Main.npc[num239].height / 2);
                                    float num242 = Math.Abs(this.position.X + (float)(this.width / 2) - num240) + Math.Abs(this.position.Y + (float)(this.height / 2) - num241);
                                    if (num242 < num238 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num239].position, Main.npc[num239].width, Main.npc[num239].height))
                                    {
                                        num238 = num242;
                                        num236 = num240;
                                        num237 = num241;
                                        flag5 = true;
                                    }
                                }
                            }
                        }
                        if (!flag5)
                        {
                            num236 = this.position.X + (float)(this.width / 2) + this.velocity.X * 100f;
                            num237 = this.position.Y + (float)(this.height / 2) + this.velocity.Y * 100f;
                        }
                        float num243 = 16f;
                        Vector2 vector27 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                        float num244 = num236 - vector27.X;
                        float num245 = num237 - vector27.Y;
                        float num246 = (float)Math.Sqrt((double)(num244 * num244 + num245 * num245));
                        num246 = num243 / num246;
                        num244 *= num246;
                        num245 *= num246;
                        this.velocity.X = (this.velocity.X * 11f + num244) / 12f;
                        this.velocity.Y = (this.velocity.Y * 11f + num245) / 12f;
                    }
                    else if (this.type == ProjectileID.RocketI || this.type == ProjectileID.RocketII || this.type == ProjectileID.RocketIII || this.type == ProjectileID.RocketIV || this.type == ProjectileID.RocketSkeleton)
                    {
                        if (Math.Abs(this.velocity.X) < 15f && Math.Abs(this.velocity.Y) < 15f)
                        {
                            this.velocity *= 1.1f;
                        }
                    }
                    else if (this.type == ProjectileID.ProximityMineI || this.type == ProjectileID.ProximityMineII || this.type == ProjectileID.ProximityMineIII || this.type == ProjectileID.ProximityMineIV)
                    {
                        if ((double)this.velocity.X > -0.2 && (double)this.velocity.X < 0.2 && (double)this.velocity.Y > -0.2 && (double)this.velocity.Y < 0.2)
                        {
                            this.alpha += 2;
                            if (this.alpha > 200)
                            {
                                this.alpha = 200;
                            }
                        }
                        else
                        {
                            this.alpha = 0;
                        }
                    }
                }
                this.ai[0] += 1f;
                if (this.type == ProjectileID.RocketSnowmanI || this.type == ProjectileID.RocketSnowmanII || this.type == ProjectileID.RocketSnowmanIII || this.type == ProjectileID.RocketSnowmanIV)
                {
                    if (this.velocity.X < 0f)
                    {
                        this.spriteDirection = -1;
                        this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(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 == ProjectileID.RocketI || this.type == ProjectileID.RocketII || this.type == ProjectileID.RocketIII || this.type == ProjectileID.RocketIV || this.type == ProjectileID.RocketSkeleton)
                {
                    this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                }
                else if (this.type == ProjectileID.ProximityMineI || this.type == ProjectileID.ProximityMineII || this.type == ProjectileID.ProximityMineIII || this.type == ProjectileID.ProximityMineIV)
                {
                    this.velocity.Y = this.velocity.Y + 0.2f;
                    this.velocity *= 0.97f;
                    if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
                    {
                        this.velocity.X = 0f;
                    }
                    if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
                    {
                        this.velocity.Y = 0f;
                    }
                }
                else if (this.type == ProjectileID.GrenadeI || this.type == ProjectileID.GrenadeII || this.type == ProjectileID.GrenadeIII || this.type == ProjectileID.GrenadeIV)
                {
                    if (this.ai[0] > 15f)
                    {
                        if (this.velocity.Y == 0f)
                        {
                            this.velocity.X = this.velocity.X * 0.95f;
                        }
                        this.velocity.Y = this.velocity.Y + 0.2f;
                    }
                }
                else if (((this.type == ProjectileID.Grenade || this.type == ProjectileID.StickyGrenade || this.type == ProjectileID.BouncyGrenade || this.type == ProjectileID.PartyGirlGrenade) && this.ai[0] > 10f) || (this.type != ProjectileID.Grenade && this.type != ProjectileID.StickyGrenade && this.type != ProjectileID.BouncyGrenade && this.type != ProjectileID.PartyGirlGrenade && this.ai[0] > 5f))
                {
                    this.ai[0] = 10f;
                    if (this.velocity.Y == 0f && this.velocity.X != 0f)
                    {
                        this.velocity.X = this.velocity.X * 0.97f;
                        if (this.type == ProjectileID.Dynamite || this.type == ProjectileID.StickyDynamite || this.type == ProjectileID.BouncyDynamite)
                        {
                            this.velocity.X = this.velocity.X * 0.99f;
                        }
                        if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01)
                        {
                            this.velocity.X = 0f;
                            this.netUpdate = true;
                        }
                    }
                    this.velocity.Y = this.velocity.Y + 0.2f;
                }
                if (this.type == ProjectileID.BombFish)
                {
                    this.rotation += this.velocity.X * 0.06f;
                    return;
                }
                if (this.type != ProjectileID.RocketI && this.type != ProjectileID.RocketII && this.type != ProjectileID.RocketIII && this.type != ProjectileID.RocketIV && this.type != ProjectileID.RocketSkeleton && (this.type < 338 || this.type > 341))
                {
                    this.rotation += this.velocity.X * 0.1f;
                    return;
                }
            }
            else if (this.aiStyle == 17)
            {
                if (this.velocity.Y == 0f)
                {
                    this.velocity.X = this.velocity.X * 0.98f;
                }
                this.rotation += this.velocity.X * 0.1f;
                this.velocity.Y = this.velocity.Y + 0.2f;
                if (this.owner == Main.myPlayer)
                {
                    int num254 = (int)((this.position.X + (float)(this.width / 2)) / 16f);
                    int num255 = (int)((this.position.Y + (float)this.height - 4f) / 16f);
                    if (Main.tile[num254, num255] != null && !Main.tile[num254, num255].active())
                    {
                        int num256 = 0;
                        if (this.type >= ProjectileID.GraveMarker && this.type <= ProjectileID.Obelisk)
                        {
                            num256 = this.type - 200;
                        }
                        if (this.type >= ProjectileID.RichGravestone1 && this.type <= ProjectileID.RichGravestone5)
                        {
                            num256 = this.type - 527 + 6;
                        }
                        WorldGen.PlaceTile(num254, num255, 85, false, false, this.owner, num256);
                        if (Main.tile[num254, num255].active())
                        {
                            if (Main.netMode != 0)
                            {
                                NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 1, (float)num254, (float)num255, 85f, num256, 0, 0);
                            }
                            int num257 = Sign.ReadSign(num254, num255, true);
                            if (num257 >= 0)
                            {
                                Sign.TextSign(num257, this.miscText);
                            }
                            this.Kill();
                            return;
                        }
                    }
                }
            }
            else if (this.aiStyle == 18)
            {
                if (this.ai[1] == 0f && this.type == ProjectileID.DemonSickle)
                {
                    this.ai[1] = 1f;
                }
                if (this.type != ProjectileID.IceSickle && this.type != ProjectileID.DeathSickle)
                {
                    this.rotation += (float)this.direction * 0.8f;
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 30f)
                    {
                        if (this.ai[0] < 100f)
                        {
                            this.velocity *= 1.06f;
                        }
                        else
                        {
                            this.ai[0] = 200f;
                        }
                    }
                    return;
                }
                if (this.type == ProjectileID.DeathSickle && this.velocity.X < 0f)
                {
                    this.spriteDirection = -1;
                }
                this.rotation += (float)this.direction * 0.05f;
                this.rotation += (float)this.direction * 0.5f * ((float)this.timeLeft / 180f);
                if (this.type == ProjectileID.DeathSickle)
                {
                    this.velocity *= 0.96f;
                    return;
                }
                this.velocity *= 0.95f;
                return;
            }
            else if (this.aiStyle == 19)
            {
                Vector2 vector28 = Main.player[this.owner].RotatedRelativePoint(Main.player[this.owner].MountedCenter, true);
                this.direction = Main.player[this.owner].direction;
                Main.player[this.owner].heldProj = this.whoAmI;
                Main.player[this.owner].itemTime = Main.player[this.owner].itemAnimation;
                this.position.X = vector28.X - (float)(this.width / 2);
                this.position.Y = vector28.Y - (float)(this.height / 2);
                if (!Main.player[this.owner].frozen)
                {
                    if (this.type == ProjectileID.DarkLance)
                    {
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 3f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 1.6f;
                        }
                        else
                        {
                            this.ai[0] += 1.4f;
                        }
                    }
                    else if (this.type == ProjectileID.Gungnir)
                    {
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 3f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 2.4f;
                        }
                        else
                        {
                            this.ai[0] += 2.1f;
                        }
                    }
                    else if (this.type == ProjectileID.ObsidianSwordfish)
                    {
                        this.spriteDirection = -this.direction;
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 3f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 1.6f;
                        }
                        else
                        {
                            this.ai[0] += 1.5f;
                        }
                    }
                    else if (this.type == ProjectileID.Swordfish)
                    {
                        this.spriteDirection = -this.direction;
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 3f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 1.5f;
                        }
                        else
                        {
                            this.ai[0] += 1.4f;
                        }
                    }
                    else if (this.type == ProjectileID.ChlorophytePartisan)
                    {
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 3f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 2.4f;
                            if (this.localAI[0] == 0f && Main.myPlayer == this.owner)
                            {
                                this.localAI[0] = 1f;
                                Projectile.NewProjectile(base.Center.X + this.velocity.X * this.ai[0], base.Center.Y + this.velocity.Y * this.ai[0], this.velocity.X, this.velocity.Y, 228, this.damage, this.knockBack, this.owner, 0f, 0f);
                            }
                        }
                        else
                        {
                            this.ai[0] += 2.1f;
                        }
                    }
                    else if (this.type == ProjectileID.NorthPoleWeapon)
                    {
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 3f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 2.4f;
                            if (this.localAI[0] == 0f && Main.myPlayer == this.owner)
                            {
                                this.localAI[0] = 1f;
                                if (Collision.CanHit(Main.player[this.owner].position, Main.player[this.owner].width, Main.player[this.owner].height, new Vector2(base.Center.X + this.velocity.X * this.ai[0], base.Center.Y + this.velocity.Y * this.ai[0]), this.width, this.height))
                                {
                                    Projectile.NewProjectile(base.Center.X + this.velocity.X * this.ai[0], base.Center.Y + this.velocity.Y * this.ai[0], this.velocity.X * 2.4f, this.velocity.Y * 2.4f, 343, (int)((double)this.damage * 0.8), this.knockBack * 0.85f, this.owner, 0f, 0f);
                                }
                            }
                        }
                        else
                        {
                            this.ai[0] += 2.1f;
                        }
                    }
                    else if (this.type == ProjectileID.Trident)
                    {
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 4f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 1.2f;
                        }
                        else
                        {
                            this.ai[0] += 0.9f;
                        }
                    }
                    else if (this.type == ProjectileID.TheRottedFork)
                    {
                        this.spriteDirection = -this.direction;
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 4f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 1.5f;
                        }
                        else
                        {
                            this.ai[0] += 1.3f;
                        }
                    }
                    else if (this.type == ProjectileID.Spear)
                    {
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 4f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 1.1f;
                        }
                        else
                        {
                            this.ai[0] += 0.85f;
                        }
                    }
                    else if (this.type == ProjectileID.MythrilHalberd || this.type == ProjectileID.OrichalcumHalberd)
                    {
                        this.spriteDirection = -this.direction;
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 3f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 1.9f;
                        }
                        else
                        {
                            this.ai[0] += 1.7f;
                        }
                    }
                    else if (this.type == ProjectileID.AdamantiteGlaive || this.type == ProjectileID.CobaltNaginata || this.type == ProjectileID.PalladiumPike || this.type == ProjectileID.TitaniumTrident)
                    {
                        this.spriteDirection = -this.direction;
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 3f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 2.1f;
                        }
                        else
                        {
                            this.ai[0] += 1.9f;
                        }
                    }
                    else if (this.type == ProjectileID.MushroomSpear)
                    {
                        this.spriteDirection = -this.direction;
                        if (this.ai[0] == 0f)
                        {
                            this.ai[0] = 3f;
                            this.netUpdate = true;
                        }
                        if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3)
                        {
                            this.ai[0] -= 1.3f;
                        }
                        else
                        {
                            this.ai[0] += 1f;
                        }
                    }
                }
                this.position += this.velocity * this.ai[0];
                if (this.type == ProjectileID.MushroomSpear)
                {
                    if (this.ai[1] == 0f || this.ai[1] == 4f || this.ai[1] == 8f || this.ai[1] == 12f || this.ai[1] == 16f || this.ai[1] == 20f || this.ai[1] == 24f)
                    {
                        Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), this.velocity.X, this.velocity.Y, 131, this.damage / 3, 0f, this.owner, 0f, 0f);
                    }
                    this.ai[1] += 1f;
                }
                if (Main.player[this.owner].itemAnimation == 0)
                {
                    this.Kill();
                }
                this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 2.355f;
                if (this.spriteDirection == -1)
                {
                    this.rotation -= 1.57f;
                }
                if (this.type == ProjectileID.DarkLance)
                {
                    return;
                }
                if (this.type == ProjectileID.Gungnir)
                {
                    if (Main.rand.Next(4) == 0)
                    {
                        return;
                    }
                }
                else if (this.type == ProjectileID.TheRottedFork)
                {
                    return;
                }
            }
            else if (this.aiStyle == 20)
            {
                if (this.type == ProjectileID.ChlorophyteJackhammer)
                {
                    this.frameCounter++;
                    if (this.frameCounter >= 4)
                    {
                        this.frameCounter = 0;
                        this.frame++;
                    }
                    if (this.frame > 3)
                    {
                        this.frame = 0;
                    }
                }
                if (this.type == ProjectileID.ButchersChainsaw)
                {
                    this.frameCounter++;
                    if (this.frameCounter >= 2)
                    {
                        this.frameCounter = 0;
                        this.frame++;
                    }
                    if (this.frame > 1)
                    {
                        this.frame = 0;
                    }
                }
                if (this.soundDelay <= 0)
                {
                    this.soundDelay = 30;
                }
                Vector2 vector29 = Main.player[this.owner].RotatedRelativePoint(Main.player[this.owner].MountedCenter, true);
                if (Main.myPlayer == this.owner)
                {
                    if (Main.player[this.owner].channel)
                    {
                        float num264 = Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].shootSpeed * this.scale;
                        Vector2 vector30 = vector29;
                        float num265 = (float)Main.mouseX + Main.screenPosition.X - vector30.X;
                        float num266 = (float)Main.mouseY + Main.screenPosition.Y - vector30.Y;
                        if (Main.player[this.owner].gravDir == -1f)
                        {
                            num266 = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector30.Y;
                        }
                        float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266));
                        num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266));
                        num267 = num264 / num267;
                        num265 *= num267;
                        num266 *= num267;
                        if (num265 != this.velocity.X || num266 != this.velocity.Y)
                        {
                            this.netUpdate = true;
                        }
                        this.velocity.X = num265;
                        this.velocity.Y = num266;
                    }
                    else
                    {
                        this.Kill();
                    }
                }
                if (this.velocity.X > 0f)
                {
                    Main.player[this.owner].ChangeDir(1);
                }
                else if (this.velocity.X < 0f)
                {
                    Main.player[this.owner].ChangeDir(-1);
                }
                this.spriteDirection = this.direction;
                Main.player[this.owner].ChangeDir(this.direction);
                Main.player[this.owner].heldProj = this.whoAmI;
                Main.player[this.owner].itemTime = 2;
                Main.player[this.owner].itemAnimation = 2;
                this.position.X = vector29.X - (float)(this.width / 2);
                this.position.Y = vector29.Y - (float)(this.height / 2);
                this.rotation = (float)(Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.5700000524520874);
                if (Main.player[this.owner].direction == 1)
                {
                    Main.player[this.owner].itemRotation = (float)Math.Atan2((double)(this.velocity.Y * (float)this.direction), (double)(this.velocity.X * (float)this.direction));
                }
                else
                {
                    Main.player[this.owner].itemRotation = (float)Math.Atan2((double)(this.velocity.Y * (float)this.direction), (double)(this.velocity.X * (float)this.direction));
                }
                this.velocity.X = this.velocity.X * (1f + (float)Main.rand.Next(-3, 4) * 0.01f);
                if (Main.rand.Next(6) == 0)
                {
                    return;
                }
            }
            else if (this.aiStyle == 21)
            {
                this.rotation = this.velocity.X * 0.1f;
                this.spriteDirection = -this.direction;
                if (this.ai[1] == 1f)
                {
                    this.ai[1] = 0f;
                    Main.harpNote = this.ai[0];
                    return;
                }
            }
            else if (this.aiStyle == 22)
            {
                if (this.velocity.X == 0f && this.velocity.Y == 0f)
                {
                    this.alpha = 255;
                }
                if (this.ai[1] < 0f)
                {
                    if (this.velocity.X > 0f)
                    {
                        this.rotation += 0.3f;
                    }
                    else
                    {
                        this.rotation -= 0.3f;
                    }
                    int num270 = (int)(this.position.X / 16f) - 1;
                    int num271 = (int)((this.position.X + (float)this.width) / 16f) + 2;
                    int num272 = (int)(this.position.Y / 16f) - 1;
                    int num273 = (int)((this.position.Y + (float)this.height) / 16f) + 2;
                    if (num270 < 0)
                    {
                        num270 = 0;
                    }
                    if (num271 > Main.maxTilesX)
                    {
                        num271 = Main.maxTilesX;
                    }
                    if (num272 < 0)
                    {
                        num272 = 0;
                    }
                    if (num273 > Main.maxTilesY)
                    {
                        num273 = Main.maxTilesY;
                    }
                    int num274 = (int)this.position.X + 4;
                    int num275 = (int)this.position.Y + 4;
                    for (int num276 = num270; num276 < num271; num276++)
                    {
                        for (int num277 = num272; num277 < num273; num277++)
                        {
                            if (Main.tile[num276, num277] != null && Main.tile[num276, num277].active() && Main.tile[num276, num277].type != TileID.MagicalIceBlock && Main.tileSolid[(int)Main.tile[num276, num277].type] && !Main.tileSolidTop[(int)Main.tile[num276, num277].type])
                            {
                                Vector2 vector31;
                                vector31.X = (float)(num276 * 16);
                                vector31.Y = (float)(num277 * 16);
                                if ((float)(num274 + 8) > vector31.X && (float)num274 < vector31.X + 16f && (float)(num275 + 8) > vector31.Y && (float)num275 < vector31.Y + 16f)
                                {
                                    this.Kill();
                                }
                            }
                        }
                    }
                    return;
                }
                if (this.ai[0] < 0f)
                {
                    int num282 = (int)this.position.X / 16;
                    int num283 = (int)this.position.Y / 16;
                    if (Main.tile[num282, num283] == null || !Main.tile[num282, num283].active())
                    {
                        this.Kill();
                    }
                    this.ai[0] -= 1f;
                    if (this.ai[0] <= -900f && (Main.myPlayer == this.owner || Main.netMode == 2) && Main.tile[num282, num283].active() && Main.tile[num282, num283].type == TileID.MagicalIceBlock)
                    {
                        WorldGen.KillTile(num282, num283, false, false, false);
                        if (Main.netMode == 1)
                        {
                            NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)num282, (float)num283, 0f, 0, 0, 0);
                        }
                        this.Kill();
                        return;
                    }
                }
                else
                {
                    int num284 = (int)(this.position.X / 16f) - 1;
                    int num285 = (int)((this.position.X + (float)this.width) / 16f) + 2;
                    int num286 = (int)(this.position.Y / 16f) - 1;
                    int num287 = (int)((this.position.Y + (float)this.height) / 16f) + 2;
                    if (num284 < 0)
                    {
                        num284 = 0;
                    }
                    if (num285 > Main.maxTilesX)
                    {
                        num285 = Main.maxTilesX;
                    }
                    if (num286 < 0)
                    {
                        num286 = 0;
                    }
                    if (num287 > Main.maxTilesY)
                    {
                        num287 = Main.maxTilesY;
                    }
                    int num288 = (int)this.position.X + 4;
                    int num289 = (int)this.position.Y + 4;
                    for (int num290 = num284; num290 < num285; num290++)
                    {
                        for (int num291 = num286; num291 < num287; num291++)
                        {
                            if (Main.tile[num290, num291] != null && Main.tile[num290, num291].nactive() && Main.tile[num290, num291].type != TileID.MagicalIceBlock && Main.tileSolid[(int)Main.tile[num290, num291].type] && !Main.tileSolidTop[(int)Main.tile[num290, num291].type])
                            {
                                Vector2 vector32;
                                vector32.X = (float)(num290 * 16);
                                vector32.Y = (float)(num291 * 16);
                                if ((float)(num288 + 8) > vector32.X && (float)num288 < vector32.X + 16f && (float)(num289 + 8) > vector32.Y && (float)num289 < vector32.Y + 16f)
                                {
                                    this.Kill();
                                }
                            }
                        }
                    }
                    if (this.lavaWet)
                    {
                        this.Kill();
                    }
                    if (this.active)
                    {
                        int num293 = (int)this.ai[0];
                        int num294 = (int)this.ai[1];
                        if (WorldGen.SolidTile(num293, num294))
                        {
                            if (Math.Abs(this.velocity.X) > Math.Abs(this.velocity.Y))
                            {
                                if (base.Center.Y < (float)(num294 * 16 + 8) && !WorldGen.SolidTile(num293, num294 - 1))
                                {
                                    num294--;
                                }
                                else if (!WorldGen.SolidTile(num293, num294 + 1))
                                {
                                    num294++;
                                }
                                else if (!WorldGen.SolidTile(num293, num294 - 1))
                                {
                                    num294--;
                                }
                                else if (base.Center.X < (float)(num293 * 16 + 8) && !WorldGen.SolidTile(num293 - 1, num294))
                                {
                                    num293--;
                                }
                                else if (!WorldGen.SolidTile(num293 + 1, num294))
                                {
                                    num293++;
                                }
                                else if (!WorldGen.SolidTile(num293 - 1, num294))
                                {
                                    num293--;
                                }
                            }
                            else if (base.Center.X < (float)(num293 * 16 + 8) && !WorldGen.SolidTile(num293 - 1, num294))
                            {
                                num293--;
                            }
                            else if (!WorldGen.SolidTile(num293 + 1, num294))
                            {
                                num293++;
                            }
                            else if (!WorldGen.SolidTile(num293 - 1, num294))
                            {
                                num293--;
                            }
                            else if (base.Center.Y < (float)(num294 * 16 + 8) && !WorldGen.SolidTile(num293, num294 - 1))
                            {
                                num294--;
                            }
                            else if (!WorldGen.SolidTile(num293, num294 + 1))
                            {
                                num294++;
                            }
                            else if (!WorldGen.SolidTile(num293, num294 - 1))
                            {
                                num294--;
                            }
                        }
                        if (this.velocity.X > 0f)
                        {
                            this.rotation += 0.3f;
                        }
                        else
                        {
                            this.rotation -= 0.3f;
                        }
                        if (Main.myPlayer == this.owner)
                        {
                            int num295 = (int)((this.position.X + (float)(this.width / 2)) / 16f);
                            int num296 = (int)((this.position.Y + (float)(this.height / 2)) / 16f);
                            bool flag6 = false;
                            if (num295 == num293 && num296 == num294)
                            {
                                flag6 = true;
                            }
                            if (((this.velocity.X <= 0f && num295 <= num293) || (this.velocity.X >= 0f && num295 >= num293)) && ((this.velocity.Y <= 0f && num296 <= num294) || (this.velocity.Y >= 0f && num296 >= num294)))
                            {
                                flag6 = true;
                            }
                            if (flag6)
                            {
                                if (WorldGen.PlaceTile(num293, num294, 127, false, false, this.owner, 0))
                                {
                                    if (Main.netMode == 1)
                                    {
                                        NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 1, (float)((int)this.ai[0]), (float)((int)this.ai[1]), 127f, 0, 0, 0);
                                    }
                                    this.damage = 0;
                                    this.ai[0] = -1f;
                                    this.velocity *= 0f;
                                    this.alpha = 255;
                                    this.position.X = (float)(num293 * 16);
                                    this.position.Y = (float)(num294 * 16);
                                    this.netUpdate = true;
                                    return;
                                }
                                this.ai[1] = -1f;
                                return;
                            }
                        }
                    }
                }
            }
            else
            {
                if (this.aiStyle == 23)
                {
                    if (this.type == ProjectileID.FlamesTrap && this.ai[0] < 8f)
                    {
                        this.ai[0] = 8f;
                    }
                    if (this.timeLeft > 60)
                    {
                        this.timeLeft = 60;
                    }
                    if (this.ai[0] > 7f)
                    {
                        this.ai[0] += 1f;
                    }
                    else
                    {
                        this.ai[0] += 1f;
                    }
                    this.rotation += 0.3f * (float)this.direction;
                    return;
                }
                if (this.aiStyle == 24)
                {
                    this.light = this.scale * 0.5f;
                    this.rotation += this.velocity.X * 0.2f;
                    this.ai[1] += 1f;
                    if (this.type == ProjectileID.CrystalStorm)
                    {
                        this.velocity *= 0.985f;
                        if (this.ai[1] > 130f)
                        {
                            this.scale -= 0.05f;
                            if ((double)this.scale <= 0.2)
                            {
                                this.scale = 0.2f;
                                this.Kill();
                                return;
                            }
                        }
                    }
                    else
                    {
                        this.velocity *= 0.96f;
                        if (this.ai[1] > 15f)
                        {
                            this.scale -= 0.05f;
                            if ((double)this.scale <= 0.2)
                            {
                                this.scale = 0.2f;
                                this.Kill();
                                return;
                            }
                        }
                    }
                }
                else
                {
                    if (this.aiStyle == 25)
                    {
                        if (this.ai[0] != 0f && this.velocity.Y <= 0f && this.velocity.X == 0f)
                        {
                            float num302 = 0.5f;
                            int i2 = (int)((this.position.X - 8f) / 16f);
                            int num303 = (int)(this.position.Y / 16f);
                            bool flag7 = false;
                            bool flag8 = false;
                            if (WorldGen.SolidTile(i2, num303) || WorldGen.SolidTile(i2, num303 + 1))
                            {
                                flag7 = true;
                            }
                            i2 = (int)((this.position.X + (float)this.width + 8f) / 16f);
                            if (WorldGen.SolidTile(i2, num303) || WorldGen.SolidTile(i2, num303 + 1))
                            {
                                flag8 = true;
                            }
                            if (flag7)
                            {
                                this.velocity.X = num302;
                            }
                            else if (flag8)
                            {
                                this.velocity.X = -num302;
                            }
                            else
                            {
                                i2 = (int)((this.position.X - 8f - 16f) / 16f);
                                num303 = (int)(this.position.Y / 16f);
                                flag7 = false;
                                flag8 = false;
                                if (WorldGen.SolidTile(i2, num303) || WorldGen.SolidTile(i2, num303 + 1))
                                {
                                    flag7 = true;
                                }
                                i2 = (int)((this.position.X + (float)this.width + 8f + 16f) / 16f);
                                if (WorldGen.SolidTile(i2, num303) || WorldGen.SolidTile(i2, num303 + 1))
                                {
                                    flag8 = true;
                                }
                                if (flag7)
                                {
                                    this.velocity.X = num302;
                                }
                                else if (flag8)
                                {
                                    this.velocity.X = -num302;
                                }
                                else
                                {
                                    i2 = (int)((this.position.X + 4f) / 16f);
                                    num303 = (int)((this.position.Y + (float)this.height + 8f) / 16f);
                                    if (WorldGen.SolidTile(i2, num303) || WorldGen.SolidTile(i2, num303 + 1))
                                    {
                                        flag7 = true;
                                    }
                                    if (!flag7)
                                    {
                                        this.velocity.X = num302;
                                    }
                                    else
                                    {
                                        this.velocity.X = -num302;
                                    }
                                }
                            }
                        }
                        this.rotation += this.velocity.X * 0.06f;
                        this.ai[0] = 1f;
                        if (this.velocity.Y > 16f)
                        {
                            this.velocity.Y = 16f;
                        }
                        if (this.velocity.Y <= 6f)
                        {
                            if (this.velocity.X > 0f && this.velocity.X < 7f)
                            {
                                this.velocity.X = this.velocity.X + 0.05f;
                            }
                            if (this.velocity.X < 0f && this.velocity.X > -7f)
                            {
                                this.velocity.X = this.velocity.X - 0.05f;
                            }
                        }
                        this.velocity.Y = this.velocity.Y + 0.3f;
                        return;
                    }
                    if (this.aiStyle == 26)
                    {
                        this.AI_026();
                        return;
                    }
                    if (this.aiStyle == 27)
                    {
                        if (this.type == ProjectileID.UnholyTridentHostile)
                        {
                            this.ai[0] += 1f;
                            if (this.ai[0] < 30f)
                            {
                                this.velocity *= 1.125f;
                            }
                        }
                        if (this.type == ProjectileID.UnholyTridentHostile && this.localAI[1] < 5f)
                        {
                            this.localAI[1] = 5f;
                        }
                        if (this.localAI[1] < 15f)
                        {
                            this.localAI[1] += 1f;
                        }
                        else
                        {
                            if (this.localAI[0] == 0f)
                            {
                                this.scale -= 0.02f;
                                this.alpha += 30;
                                if (this.alpha >= 250)
                                {
                                    this.alpha = 255;
                                    this.localAI[0] = 1f;
                                }
                            }
                            else if (this.localAI[0] == 1f)
                            {
                                this.scale += 0.02f;
                                this.alpha -= 30;
                                if (this.alpha <= 0)
                                {
                                    this.alpha = 0;
                                    this.localAI[0] = 0f;
                                }
                            }
                        }
                        if (this.ai[1] == 0f)
                        {
                            this.ai[1] = 1f;
                        }
                        if (this.type == ProjectileID.NightBeam)
                        {
                            this.rotation += (float)this.direction * 0.4f;
                            this.spriteDirection = this.direction;
                        }
                        else
                        {
                            this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 0.785f;
                        }
                        if (this.velocity.Y > 16f)
                        {
                            this.velocity.Y = 16f;
                            return;
                        }
                    }
                    else if (this.aiStyle == 28)
                    {
                        if (this.ai[1] == 0f)
                        {
                            this.ai[1] = 1f;
                            return;
                        }
                    }
                    else if (this.aiStyle == 29)
                    {
                        if (this.type == ProjectileID.NebulaArcanumExplosionShot)
                        {
                            int num323 = (int)this.ai[0];
                            return;
                        }
                        if (this.type == ProjectileID.NebulaArcanumExplosionShotShard)
                        {
                            int num327 = (int)this.ai[0];
                            this.ai[1] += 1f;
                            float num328 = (60f - this.ai[1]) / 60f;
                            if (this.ai[1] > 40f)
                            {
                                this.Kill();
                            }
                            this.velocity.Y = this.velocity.Y + 0.2f;
                            if (this.velocity.Y > 18f)
                            {
                                this.velocity.Y = 18f;
                            }
                            this.velocity.X = this.velocity.X * 0.98f;
                            return;
                        }
                        if (this.type == ProjectileID.CrystalPulse)
                        {
                            return;
                        }
                        if (this.type == ProjectileID.CrystalPulse2)
                        {
                            this.ai[1] += 1f;
                            float num335 = (60f - this.ai[1]) / 60f;
                            if (this.ai[1] > 40f)
                            {
                                this.Kill();
                            }
                            this.velocity.Y = this.velocity.Y + 0.2f;
                            if (this.velocity.Y > 18f)
                            {
                                this.velocity.Y = 18f;
                            }
                            this.velocity.X = this.velocity.X * 0.98f;
                            return;
                        }
                        int num339 = this.type - 121 + 86;
                        if (this.type == ProjectileID.EmberBolt)
                        {
                            num339 = 262;
                        }
                        if (this.ai[1] == 0f)
                        {
                            this.ai[1] = 1f;
                            return;
                        }
                    }
                    else if (this.aiStyle == 30)
                    {
                        this.velocity *= 0.8f;
                        this.rotation += 0.2f;
                        this.alpha += 4;
                        if (this.alpha >= 255)
                        {
                            this.Kill();
                            return;
                        }
                    }
                    else
                    {
                        if (this.aiStyle == 31)
                        {
                            int conversionType = 0;
                            if (this.type == ProjectileID.HallowSpray)
                            {
                                conversionType = 2;
                            }
                            if (this.type == ProjectileID.CorruptSpray)
                            {
                                conversionType = 1;
                            }
                            if (this.type == ProjectileID.MushroomSpray)
                            {
                                conversionType = 3;
                            }
                            if (this.type == ProjectileID.CrimsonSpray)
                            {
                                conversionType = 4;
                            }
                            if (this.owner == Main.myPlayer)
                            {
                                WorldGen.Convert((int)(this.position.X + (float)(this.width / 2)) / 16, (int)(this.position.Y + (float)(this.height / 2)) / 16, conversionType, 2);
                            }
                            if (this.timeLeft > 133)
                            {
                                this.timeLeft = 133;
                            }
                            if (this.ai[0] > 7f)
                            {
                                this.ai[0] += 1f;
                            }
                            else
                            {
                                this.ai[0] += 1f;
                            }
                            this.rotation += 0.3f * (float)this.direction;
                            return;
                        }
                        if (this.aiStyle == 32)
                        {
                            this.timeLeft = 10;
                            this.ai[0] += 1f;
                            if (this.ai[0] >= 20f)
                            {
                                this.ai[0] = 15f;
                                for (int num346 = 0; num346 < 255; num346++)
                                {
                                    Rectangle rectangle5 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
                                    if (Main.player[num346].active)
                                    {
                                        Rectangle rectangle6 = new Rectangle((int)Main.player[num346].position.X, (int)Main.player[num346].position.Y, Main.player[num346].width, Main.player[num346].height);
                                        if (rectangle5.Intersects(rectangle6))
                                        {
                                            this.ai[0] = 0f;
                                            this.velocity.Y = -4.5f;
                                            if (this.velocity.X > 2f)
                                            {
                                                this.velocity.X = 2f;
                                            }
                                            if (this.velocity.X < -2f)
                                            {
                                                this.velocity.X = -2f;
                                            }
                                            this.velocity.X = (this.velocity.X + (float)Main.player[num346].direction * 1.75f) / 2f;
                                            this.velocity.X = this.velocity.X + Main.player[num346].velocity.X * 3f;
                                            this.velocity.Y = this.velocity.Y + Main.player[num346].velocity.Y;
                                            if (this.velocity.X > 6f)
                                            {
                                                this.velocity.X = 6f;
                                            }
                                            if (this.velocity.X < -6f)
                                            {
                                                this.velocity.X = -6f;
                                            }
                                            this.netUpdate = true;
                                            this.ai[1] += 1f;
                                        }
                                    }
                                }
                            }
                            if (this.velocity.X == 0f && this.velocity.Y == 0f)
                            {
                                this.Kill();
                            }
                            this.rotation += 0.02f * this.velocity.X;
                            if (this.velocity.Y == 0f)
                            {
                                this.velocity.X = this.velocity.X * 0.98f;
                            }
                            else if (this.wet)
                            {
                                this.velocity.X = this.velocity.X * 0.99f;
                            }
                            else
                            {
                                this.velocity.X = this.velocity.X * 0.995f;
                            }
                            if ((double)this.velocity.X > -0.03 && (double)this.velocity.X < 0.03)
                            {
                                this.velocity.X = 0f;
                            }
                            if (this.wet)
                            {
                                this.ai[1] = 0f;
                                if (this.velocity.Y > 0f)
                                {
                                    this.velocity.Y = this.velocity.Y * 0.95f;
                                }
                                this.velocity.Y = this.velocity.Y - 0.1f;
                                if (this.velocity.Y < -4f)
                                {
                                    this.velocity.Y = -4f;
                                }
                                if (this.velocity.X == 0f)
                                {
                                    this.Kill();
                                }
                            }
                            else
                            {
                                this.velocity.Y = this.velocity.Y + 0.1f;
                            }
                            if (this.velocity.Y > 10f)
                            {
                                this.velocity.Y = 10f;
                                return;
                            }
                        }
                        else
                        {
                            if (this.aiStyle == 33)
                            {
                                if (this.alpha > 0)
                                {
                                    this.alpha -= 50;
                                    if (this.alpha < 0)
                                    {
                                        this.alpha = 0;
                                    }
                                }
                                float num347 = 4f;
                                float num348 = this.ai[0];
                                float num349 = this.ai[1];
                                if (num348 == 0f && num349 == 0f)
                                {
                                    num348 = 1f;
                                }
                                float num350 = (float)Math.Sqrt((double)(num348 * num348 + num349 * num349));
                                num350 = num347 / num350;
                                num348 *= num350;
                                num349 *= num350;
                                if (this.alpha < 70)
                                {
                                }
                                if (this.localAI[0] == 0f)
                                {
                                    this.ai[0] = this.velocity.X;
                                    this.ai[1] = this.velocity.Y;
                                    this.localAI[1] += 1f;
                                    if (this.localAI[1] >= 30f)
                                    {
                                        this.velocity.Y = this.velocity.Y + 0.09f;
                                        this.localAI[1] = 30f;
                                    }
                                }
                                else
                                {
                                    if (!Collision.SolidCollision(this.position, this.width, this.height))
                                    {
                                        this.localAI[0] = 0f;
                                        this.localAI[1] = 30f;
                                    }
                                    this.damage = 0;
                                }
                                if (this.velocity.Y > 16f)
                                {
                                    this.velocity.Y = 16f;
                                }
                                this.rotation = (float)Math.Atan2((double)this.ai[1], (double)this.ai[0]) + 1.57f;
                                return;
                            }
                            if (this.aiStyle == 34)
                            {
                                this.rotation = this.velocity.ToRotation() + 1.57079637f;
                                if (this.ai[1] == 1f)
                                {
                                    this.ai[0] += 1f;
                                    if (this.ai[0] > 2f)
                                    {
                                        return;
                                    }
                                }
                                else
                                {
                                    if (this.type < 415 || this.type > 418)
                                    {
                                        return;
                                    }
                                    this.ai[0] += 1f;
                                    if (this.ai[0] > 4f)
                                    {
                                        return;
                                    }
                                }
                            }
                            else if (this.aiStyle == 35)
                            {
                                this.ai[0] += 1f;
                                if (this.ai[0] > 30f)
                                {
                                    this.velocity.Y = this.velocity.Y + 0.2f;
                                    this.velocity.X = this.velocity.X * 0.985f;
                                    if (this.velocity.Y > 14f)
                                    {
                                        this.velocity.Y = 14f;
                                    }
                                }
                                this.rotation += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * (float)this.direction * 0.02f;
                                if (this.owner == Main.myPlayer)
                                {
                                    Vector2 vector33 = Collision.TileCollision(this.position, this.velocity, this.width, this.height, true, true, 1);
                                    bool flag9 = false;
                                    if (vector33 != this.velocity)
                                    {
                                        flag9 = true;
                                    }
                                    else
                                    {
                                        int num358 = (int)(base.Center.X + this.velocity.X) / 16;
                                        int num359 = (int)(base.Center.Y + this.velocity.Y) / 16;
                                        if (Main.tile[num358, num359] != null && Main.tile[num358, num359].active() && Main.tile[num358, num359].bottomSlope())
                                        {
                                            flag9 = true;
                                            this.position.Y = (float)(num359 * 16 + 16 + 8);
                                            this.position.X = (float)(num358 * 16 + 8);
                                        }
                                    }
                                    if (flag9)
                                    {
                                        int num360 = 213;
                                        if (this.type == ProjectileID.VineRopeCoil)
                                        {
                                            num360 = 353;
                                        }
                                        if (this.type == ProjectileID.WebRopeCoil)
                                        {
                                            num360 = 366;
                                        }
                                        if (this.type == ProjectileID.SilkRopeCoil)
                                        {
                                            num360 = 365;
                                        }
                                        int num361 = (int)(this.position.X + (float)(this.width / 2)) / 16;
                                        int num362 = (int)(this.position.Y + (float)(this.height / 2)) / 16;
                                        this.position += vector33;
                                        int num363 = 10;
                                        if (Main.tile[num361, num362] != null)
                                        {
                                            while (Main.tile[num361, num362] != null && Main.tile[num361, num362].active())
                                            {
                                                if (!Main.tileRope[(int)Main.tile[num361, num362].type])
                                                {
                                                    break;
                                                }
                                                num362++;
                                            }
                                            while (num363 > 0)
                                            {
                                                num363--;
                                                if (Main.tile[num361, num362] == null)
                                                {
                                                    break;
                                                }
                                                if (Main.tile[num361, num362].active() && (Main.tileCut[(int)Main.tile[num361, num362].type] || Main.tile[num361, num362].type == TileID.Stalactite))
                                                {
                                                    WorldGen.KillTile(num361, num362, false, false, false);
                                                    NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)num361, (float)num362, 0f, 0, 0, 0);
                                                }
                                                if (!Main.tile[num361, num362].active())
                                                {
                                                    WorldGen.PlaceTile(num361, num362, num360, false, false, -1, 0);
                                                    NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 1, (float)num361, (float)num362, (float)num360, 0, 0, 0);
                                                    this.ai[1] += 1f;
                                                }
                                                else
                                                {
                                                    num363 = 0;
                                                }
                                                num362++;
                                            }
                                            this.Kill();
                                            return;
                                        }
                                    }
                                }
                            }
                            else if (this.aiStyle == 36)
                            {
                                if (this.type != ProjectileID.TinyEater && this.wet && !this.honeyWet)
                                {
                                    this.Kill();
                                }
                                if (this.alpha > 0)
                                {
                                    this.alpha -= 50;
                                }
                                else
                                {
                                    this.extraUpdates = 0;
                                }
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                                if (this.type == ProjectileID.TinyEater)
                                {
                                    this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f;
                                    this.frameCounter++;
                                    if (this.frameCounter >= 6)
                                    {
                                        this.frame++;
                                        this.frameCounter = 0;
                                    }
                                    if (this.frame >= 2)
                                    {
                                        this.frame = 0;
                                    }
                                }
                                else
                                {
                                    if (this.type == ProjectileID.Bat)
                                    {
                                        if (this.velocity.X > 0f)
                                        {
                                            this.spriteDirection = -1;
                                        }
                                        else if (this.velocity.X < 0f)
                                        {
                                            this.spriteDirection = 1;
                                        }
                                    }
                                    else if (this.velocity.X > 0f)
                                    {
                                        this.spriteDirection = 1;
                                    }
                                    else if (this.velocity.X < 0f)
                                    {
                                        this.spriteDirection = -1;
                                    }
                                    this.rotation = this.velocity.X * 0.1f;
                                    this.frameCounter++;
                                    if (this.frameCounter >= 3)
                                    {
                                        this.frame++;
                                        this.frameCounter = 0;
                                    }
                                    if (this.frame >= 3)
                                    {
                                        this.frame = 0;
                                    }
                                }
                                float num368 = this.position.X;
                                float num369 = this.position.Y;
                                float num370 = 100000f;
                                bool flag10 = false;
                                this.ai[0] += 1f;
                                if (this.ai[0] > 30f)
                                {
                                    this.ai[0] = 30f;
                                    for (int num371 = 0; num371 < 200; num371++)
                                    {
                                        if (Main.npc[num371].CanBeChasedBy(this, false) && (!Main.npc[num371].wet || this.type == ProjectileID.TinyEater))
                                        {
                                            float num372 = Main.npc[num371].position.X + (float)(Main.npc[num371].width / 2);
                                            float num373 = Main.npc[num371].position.Y + (float)(Main.npc[num371].height / 2);
                                            float num374 = Math.Abs(this.position.X + (float)(this.width / 2) - num372) + Math.Abs(this.position.Y + (float)(this.height / 2) - num373);
                                            if (num374 < 800f && num374 < num370 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num371].position, Main.npc[num371].width, Main.npc[num371].height))
                                            {
                                                num370 = num374;
                                                num368 = num372;
                                                num369 = num373;
                                                flag10 = true;
                                            }
                                        }
                                    }
                                }
                                if (!flag10)
                                {
                                    num368 = this.position.X + (float)(this.width / 2) + this.velocity.X * 100f;
                                    num369 = this.position.Y + (float)(this.height / 2) + this.velocity.Y * 100f;
                                }
                                else if (this.type == ProjectileID.TinyEater)
                                {
                                    this.friendly = true;
                                }
                                float num375 = 6f;
                                float num376 = 0.1f;
                                if (this.type == ProjectileID.Wasp)
                                {
                                    num375 = 7f;
                                    num376 = 0.15f;
                                }
                                if (this.type == ProjectileID.TinyEater)
                                {
                                    num375 = 9f;
                                    num376 = 0.2f;
                                }
                                if (this.type == ProjectileID.Bat)
                                {
                                    num375 = 10f;
                                    num376 = 0.25f;
                                }
                                if (this.type == ProjectileID.GiantBee)
                                {
                                    num375 = 6.8f;
                                    num376 = 0.14f;
                                }
                                Vector2 vector34 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                float num377 = num368 - vector34.X;
                                float num378 = num369 - vector34.Y;
                                float num379 = (float)Math.Sqrt((double)(num377 * num377 + num378 * num378));
                                num379 = num375 / num379;
                                num377 *= num379;
                                num378 *= num379;
                                if (this.velocity.X < num377)
                                {
                                    this.velocity.X = this.velocity.X + num376;
                                    if (this.velocity.X < 0f && num377 > 0f)
                                    {
                                        this.velocity.X = this.velocity.X + num376 * 2f;
                                    }
                                }
                                else if (this.velocity.X > num377)
                                {
                                    this.velocity.X = this.velocity.X - num376;
                                    if (this.velocity.X > 0f && num377 < 0f)
                                    {
                                        this.velocity.X = this.velocity.X - num376 * 2f;
                                    }
                                }
                                if (this.velocity.Y < num378)
                                {
                                    this.velocity.Y = this.velocity.Y + num376;
                                    if (this.velocity.Y < 0f && num378 > 0f)
                                    {
                                        this.velocity.Y = this.velocity.Y + num376 * 2f;
                                        return;
                                    }
                                }
                                else if (this.velocity.Y > num378)
                                {
                                    this.velocity.Y = this.velocity.Y - num376;
                                    if (this.velocity.Y > 0f && num378 < 0f)
                                    {
                                        this.velocity.Y = this.velocity.Y - num376 * 2f;
                                        return;
                                    }
                                }
                            }
                            else if (this.aiStyle == 37)
                            {
                                if (this.ai[1] == 0f)
                                {
                                    this.ai[1] = this.position.Y - 5f;
                                }
                                if (this.ai[0] == 0f)
                                {
                                    if (Collision.SolidCollision(this.position, this.width, this.height))
                                    {
                                        this.velocity.Y = this.velocity.Y * -1f;
                                        this.ai[0] += 1f;
                                        return;
                                    }
                                    float num380 = this.position.Y - this.ai[1];
                                    if (num380 > 300f)
                                    {
                                        this.velocity.Y = this.velocity.Y * -1f;
                                        this.ai[0] += 1f;
                                        return;
                                    }
                                }
                                else if (Collision.SolidCollision(this.position, this.width, this.height) || this.position.Y < this.ai[1])
                                {
                                    this.Kill();
                                    return;
                                }
                            }
                            else if (this.aiStyle == 38)
                            {
                                this.ai[0] += 1f;
                                if (this.ai[0] >= 6f)
                                {
                                    this.ai[0] = 0f;
                                    if (Main.myPlayer == this.owner)
                                    {
                                        Projectile.NewProjectile(this.position.X, this.position.Y, this.velocity.X, this.velocity.Y, 188, this.damage, this.knockBack, this.owner, 0f, 0f);
                                        return;
                                    }
                                }
                            }
                            else if (this.aiStyle == 39)
                            {
                                this.alpha -= 50;
                                if (this.alpha < 0)
                                {
                                    this.alpha = 0;
                                }
                                if (Main.player[this.owner].dead)
                                {
                                    this.Kill();
                                    return;
                                }
                                if (this.alpha == 0)
                                {
                                    Main.player[this.owner].itemAnimation = 5;
                                    Main.player[this.owner].itemTime = 5;
                                    if (this.position.X + (float)(this.width / 2) > Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2))
                                    {
                                        Main.player[this.owner].ChangeDir(1);
                                    }
                                    else
                                    {
                                        Main.player[this.owner].ChangeDir(-1);
                                    }
                                }
                                Vector2 vector35 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                float num381 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector35.X;
                                float num382 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector35.Y;
                                float num383 = (float)Math.Sqrt((double)(num381 * num381 + num382 * num382));
                                if (!Main.player[this.owner].channel && this.alpha == 0)
                                {
                                    this.ai[0] = 1f;
                                    this.ai[1] = -1f;
                                }
                                if (this.ai[1] > 0f && num383 > 1500f)
                                {
                                    this.ai[1] = 0f;
                                    this.ai[0] = 1f;
                                }
                                if (this.ai[1] > 0f)
                                {
                                    this.tileCollide = false;
                                    int num384 = (int)this.ai[1] - 1;
                                    if (Main.npc[num384].active && Main.npc[num384].life > 0)
                                    {
                                        float num385 = 16f;
                                        vector35 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                        num381 = Main.npc[num384].position.X + (float)(Main.npc[num384].width / 2) - vector35.X;
                                        num382 = Main.npc[num384].position.Y + (float)(Main.npc[num384].height / 2) - vector35.Y;
                                        num383 = (float)Math.Sqrt((double)(num381 * num381 + num382 * num382));
                                        if (num383 < num385)
                                        {
                                            this.velocity.X = num381;
                                            this.velocity.Y = num382;
                                            if (num383 > num385 / 2f)
                                            {
                                                if (this.velocity.X < 0f)
                                                {
                                                    this.spriteDirection = -1;
                                                    this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X));
                                                }
                                                else
                                                {
                                                    this.spriteDirection = 1;
                                                    this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            num383 = num385 / num383;
                                            num381 *= num383;
                                            num382 *= num383;
                                            this.velocity.X = num381;
                                            this.velocity.Y = num382;
                                            if (this.velocity.X < 0f)
                                            {
                                                this.spriteDirection = -1;
                                                this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X));
                                            }
                                            else
                                            {
                                                this.spriteDirection = 1;
                                                this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                            }
                                        }
                                        this.ai[0] = 1f;
                                    }
                                    else
                                    {
                                        this.ai[1] = 0f;
                                        float num386 = this.position.X;
                                        float num387 = this.position.Y;
                                        float num388 = 3000f;
                                        int num389 = -1;
                                        for (int num390 = 0; num390 < 200; num390++)
                                        {
                                            if (Main.npc[num390].CanBeChasedBy(this, false))
                                            {
                                                float num391 = Main.npc[num390].position.X + (float)(Main.npc[num390].width / 2);
                                                float num392 = Main.npc[num390].position.Y + (float)(Main.npc[num390].height / 2);
                                                float num393 = Math.Abs(this.position.X + (float)(this.width / 2) - num391) + Math.Abs(this.position.Y + (float)(this.height / 2) - num392);
                                                if (num393 < num388 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num390].position, Main.npc[num390].width, Main.npc[num390].height))
                                                {
                                                    num388 = num393;
                                                    num386 = num391;
                                                    num387 = num392;
                                                    num389 = num390;
                                                }
                                            }
                                        }
                                        if (num389 >= 0)
                                        {
                                            float num394 = 16f;
                                            vector35 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                            num381 = num386 - vector35.X;
                                            num382 = num387 - vector35.Y;
                                            num383 = (float)Math.Sqrt((double)(num381 * num381 + num382 * num382));
                                            num383 = num394 / num383;
                                            num381 *= num383;
                                            num382 *= num383;
                                            this.velocity.X = num381;
                                            this.velocity.Y = num382;
                                            this.ai[0] = 0f;
                                            this.ai[1] = (float)(num389 + 1);
                                        }
                                    }
                                }
                                else if (this.ai[0] == 0f)
                                {
                                    if (num383 > 700f)
                                    {
                                        this.ai[0] = 1f;
                                    }
                                    if (this.velocity.X < 0f)
                                    {
                                        this.spriteDirection = -1;
                                        this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X));
                                    }
                                    else
                                    {
                                        this.spriteDirection = 1;
                                        this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                    }
                                }
                                else if (this.ai[0] == 1f)
                                {
                                    this.tileCollide = false;
                                    if (this.velocity.X < 0f)
                                    {
                                        this.spriteDirection = 1;
                                        this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X));
                                    }
                                    else
                                    {
                                        this.spriteDirection = -1;
                                        this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                    }
                                    if (this.velocity.X < 0f)
                                    {
                                        this.spriteDirection = -1;
                                        this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X));
                                    }
                                    else
                                    {
                                        this.spriteDirection = 1;
                                        this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                    }
                                    float num395 = 20f;
                                    if (num383 < 70f)
                                    {
                                        this.Kill();
                                    }
                                    num383 = num395 / num383;
                                    num381 *= num383;
                                    num382 *= num383;
                                    this.velocity.X = num381;
                                    this.velocity.Y = num382;
                                }
                                this.frameCounter++;
                                if (this.frameCounter >= 4)
                                {
                                    this.frame++;
                                    this.frameCounter = 0;
                                }
                                if (this.frame >= 4)
                                {
                                    this.frame = 0;
                                    return;
                                }
                            }
                            else
                            {
                                if (this.aiStyle == 40)
                                {
                                    this.localAI[0] += 1f;
                                    if (this.localAI[0] > 3f)
                                    {
                                        this.localAI[0] = 100f;
                                        this.alpha -= 50;
                                        if (this.alpha < 0)
                                        {
                                            this.alpha = 0;
                                        }
                                    }
                                    this.frameCounter++;
                                    if (this.frameCounter >= 3)
                                    {
                                        this.frame++;
                                        this.frameCounter = 0;
                                    }
                                    if (this.frame >= 5)
                                    {
                                        this.frame = 0;
                                    }
                                    this.velocity.X = this.velocity.X + this.ai[0];
                                    this.velocity.Y = this.velocity.Y + this.ai[1];
                                    this.localAI[1] += 1f;
                                    if (this.localAI[1] == 50f)
                                    {
                                        this.localAI[1] = 51f;
                                        this.ai[0] = (float)Main.rand.Next(-100, 101) * 6E-05f;
                                        this.ai[1] = (float)Main.rand.Next(-100, 101) * 6E-05f;
                                    }
                                    if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > 16f)
                                    {
                                        this.velocity.X = this.velocity.X * 0.95f;
                                        this.velocity.Y = this.velocity.Y * 0.95f;
                                    }
                                    if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 12f)
                                    {
                                        this.velocity.X = this.velocity.X * 1.05f;
                                        this.velocity.Y = this.velocity.Y * 1.05f;
                                    }
                                    this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 3.14f;
                                    return;
                                }
                                if (this.aiStyle == 41)
                                {
                                    if (this.localAI[0] == 0f)
                                    {
                                        this.localAI[0] = 1f;
                                        this.frame = Main.rand.Next(3);
                                    }
                                    this.rotation += this.velocity.X * 0.01f;
                                    return;
                                }
                                if (this.aiStyle == 42)
                                {
                                    if (!Main.player[this.owner].crystalLeaf)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    this.position.X = Main.player[this.owner].Center.X - (float)(this.width / 2);
                                    this.position.Y = Main.player[this.owner].Center.Y - (float)(this.height / 2) + Main.player[this.owner].gfxOffY - 60f;
                                    if (Main.player[this.owner].gravDir == -1f)
                                    {
                                        this.position.Y = this.position.Y + 120f;
                                        this.rotation = 3.14f;
                                    }
                                    else
                                    {
                                        this.rotation = 0f;
                                    }
                                    this.position.X = (float)((int)this.position.X);
                                    this.position.Y = (float)((int)this.position.Y);
                                    float num396 = (float)Main.mouseTextColor / 200f - 0.35f;
                                    num396 *= 0.2f;
                                    this.scale = num396 + 0.95f;
                                    if (this.owner == Main.myPlayer)
                                    {
                                        if (this.ai[0] != 0f)
                                        {
                                            this.ai[0] -= 1f;
                                            return;
                                        }
                                        float num397 = this.position.X;
                                        float num398 = this.position.Y;
                                        float num399 = 700f;
                                        bool flag11 = false;
                                        for (int num400 = 0; num400 < 200; num400++)
                                        {
                                            if (Main.npc[num400].CanBeChasedBy(this, true))
                                            {
                                                float num401 = Main.npc[num400].position.X + (float)(Main.npc[num400].width / 2);
                                                float num402 = Main.npc[num400].position.Y + (float)(Main.npc[num400].height / 2);
                                                float num403 = Math.Abs(this.position.X + (float)(this.width / 2) - num401) + Math.Abs(this.position.Y + (float)(this.height / 2) - num402);
                                                if (num403 < num399 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num400].position, Main.npc[num400].width, Main.npc[num400].height))
                                                {
                                                    num399 = num403;
                                                    num397 = num401;
                                                    num398 = num402;
                                                    flag11 = true;
                                                }
                                            }
                                        }
                                        if (flag11)
                                        {
                                            float num404 = 12f;
                                            Vector2 vector36 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                            float num405 = num397 - vector36.X;
                                            float num406 = num398 - vector36.Y;
                                            float num407 = (float)Math.Sqrt((double)(num405 * num405 + num406 * num406));
                                            num407 = num404 / num407;
                                            num405 *= num407;
                                            num406 *= num407;
                                            Projectile.NewProjectile(base.Center.X - 4f, base.Center.Y, num405, num406, 227, Player.crystalLeafDamage, (float)Player.crystalLeafKB, this.owner, 0f, 0f);
                                            this.ai[0] = 50f;
                                            return;
                                        }
                                    }
                                }
                                else
                                {
                                    if (this.aiStyle == 43)
                                    {
                                        if (this.localAI[1] == 0f)
                                        {
                                            this.localAI[1] += 1f;
                                        }
                                        this.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f;
                                        this.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f;
                                        if (this.localAI[0] == 0f)
                                        {
                                            this.scale += 0.05f;
                                            if ((double)this.scale > 1.2)
                                            {
                                                this.localAI[0] = 1f;
                                            }
                                        }
                                        else
                                        {
                                            this.scale -= 0.05f;
                                            if ((double)this.scale < 0.8)
                                            {
                                                this.localAI[0] = 0f;
                                            }
                                        }
                                        this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 3.14f;
                                        return;
                                    }
                                    if (this.aiStyle == 44)
                                    {
                                        if (this.type == ProjectileID.SporeCloud)
                                        {
                                            this.velocity *= 0.96f;
                                            this.alpha += 4;
                                            if (this.alpha > 255)
                                            {
                                                this.Kill();
                                            }
                                        }
                                        else if (this.type == ProjectileID.ChlorophyteOrb)
                                        {
                                            this.ai[0] += 1f;
                                            if (this.ai[0] > 20f)
                                            {
                                                this.velocity.Y = this.velocity.Y + 0.3f;
                                                this.velocity.X = this.velocity.X * 0.98f;
                                            }
                                        }
                                        this.frameCounter++;
                                        if (this.frameCounter > 5)
                                        {
                                            this.frame++;
                                            this.frameCounter = 0;
                                        }
                                        if (this.frame >= Main.projFrames[this.type])
                                        {
                                            this.frame = 0;
                                            return;
                                        }
                                    }
                                    else if (this.aiStyle == 45)
                                    {
                                        if (this.type == ProjectileID.RainCloudMoving || this.type == ProjectileID.BloodCloudMoving)
                                        {
                                            float num411 = this.ai[0];
                                            float num412 = this.ai[1];
                                            if (num411 != 0f && num412 != 0f)
                                            {
                                                bool flag12 = false;
                                                bool flag13 = false;
                                                if ((this.velocity.X < 0f && base.Center.X < num411) || (this.velocity.X > 0f && base.Center.X > num411))
                                                {
                                                    flag12 = true;
                                                }
                                                if ((this.velocity.Y < 0f && base.Center.Y < num412) || (this.velocity.Y > 0f && base.Center.Y > num412))
                                                {
                                                    flag13 = true;
                                                }
                                                if (flag12 && flag13)
                                                {
                                                    this.Kill();
                                                }
                                            }
                                            this.rotation += this.velocity.X * 0.02f;
                                            this.frameCounter++;
                                            if (this.frameCounter > 4)
                                            {
                                                this.frameCounter = 0;
                                                this.frame++;
                                                if (this.frame > 3)
                                                {
                                                    this.frame = 0;
                                                    return;
                                                }
                                            }
                                        }
                                        else if (this.type == ProjectileID.RainCloudRaining || this.type == ProjectileID.BloodCloudRaining)
                                        {
                                            this.frameCounter++;
                                            if (this.frameCounter > 8)
                                            {
                                                this.frameCounter = 0;
                                                this.frame++;
                                                if (this.frame > 5)
                                                {
                                                    this.frame = 0;
                                                }
                                            }
                                            this.ai[1] += 1f;
                                            if (this.type == ProjectileID.BloodCloudRaining && this.ai[1] >= 3600f)
                                            {
                                                this.alpha += 5;
                                                if (this.alpha > 255)
                                                {
                                                    this.alpha = 255;
                                                    this.Kill();
                                                }
                                            }
                                            else if (this.type == ProjectileID.RainCloudRaining && this.ai[1] >= 7200f)
                                            {
                                                this.alpha += 5;
                                                if (this.alpha > 255)
                                                {
                                                    this.alpha = 255;
                                                    this.Kill();
                                                }
                                            }
                                            else
                                            {
                                                this.ai[0] += 1f;
                                                if (this.type == ProjectileID.BloodCloudRaining)
                                                {
                                                    if (this.ai[0] > 10f)
                                                    {
                                                        this.ai[0] = 0f;
                                                        if (this.owner == Main.myPlayer)
                                                        {
                                                            int num413 = (int)(this.position.X + 14f + (float)Main.rand.Next(this.width - 28));
                                                            int num414 = (int)(this.position.Y + (float)this.height + 4f);
                                                            Projectile.NewProjectile((float)num413, (float)num414, 0f, 5f, 245, this.damage, 0f, this.owner, 0f, 0f);
                                                        }
                                                    }
                                                }
                                                else if (this.ai[0] > 8f)
                                                {
                                                    this.ai[0] = 0f;
                                                    if (this.owner == Main.myPlayer)
                                                    {
                                                        int num415 = (int)(this.position.X + 14f + (float)Main.rand.Next(this.width - 28));
                                                        int num416 = (int)(this.position.Y + (float)this.height + 4f);
                                                        Projectile.NewProjectile((float)num415, (float)num416, 0f, 5f, 239, this.damage, 0f, this.owner, 0f, 0f);
                                                    }
                                                }
                                            }
                                            this.localAI[0] += 1f;
                                            if (this.localAI[0] >= 10f)
                                            {
                                                this.localAI[0] = 0f;
                                                int num417 = 0;
                                                int num418 = 0;
                                                float num419 = 0f;
                                                int num420 = this.type;
                                                for (int num421 = 0; num421 < 1000; num421++)
                                                {
                                                    if (Main.projectile[num421].active && Main.projectile[num421].owner == this.owner && Main.projectile[num421].type == num420 && Main.projectile[num421].ai[1] < 3600f)
                                                    {
                                                        num417++;
                                                        if (Main.projectile[num421].ai[1] > num419)
                                                        {
                                                            num418 = num421;
                                                            num419 = Main.projectile[num421].ai[1];
                                                        }
                                                    }
                                                }
                                                if (this.type == ProjectileID.BloodCloudRaining)
                                                {
                                                    if (num417 > 1)
                                                    {
                                                        Main.projectile[num418].netUpdate = true;
                                                        Main.projectile[num418].ai[1] = 36000f;
                                                        return;
                                                    }
                                                }
                                                else if (num417 > 2)
                                                {
                                                    Main.projectile[num418].netUpdate = true;
                                                    Main.projectile[num418].ai[1] = 36000f;
                                                    return;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (this.type == ProjectileID.RainFriendly)
                                            {
                                                this.alpha = 50;
                                                return;
                                            }
                                            if (this.type == ProjectileID.BloodRain)
                                            {
                                                this.alpha = 100;
                                                return;
                                            }
                                            if (this.type == ProjectileID.RainNimbus)
                                            {
                                                this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                                                return;
                                            }
                                        }
                                    }
                                    else if (this.aiStyle == 46)
                                    {
                                        int num422 = 1200;
                                        if (this.type == ProjectileID.RainbowFront)
                                        {
                                            if (this.owner == Main.myPlayer)
                                            {
                                                this.localAI[0] += 1f;
                                                if (this.localAI[0] > 4f)
                                                {
                                                    this.localAI[0] = 3f;
                                                    Projectile.NewProjectile(base.Center.X, base.Center.Y, this.velocity.X * 0.001f, this.velocity.Y * 0.001f, 251, this.damage, this.knockBack, this.owner, 0f, 0f);
                                                }
                                                if (this.timeLeft > num422)
                                                {
                                                    this.timeLeft = num422;
                                                }
                                            }
                                            float num423 = 1f;
                                            if (this.velocity.Y < 0f)
                                            {
                                                num423 -= this.velocity.Y / 3f;
                                            }
                                            this.ai[0] += num423;
                                            if (this.ai[0] > 30f)
                                            {
                                                this.velocity.Y = this.velocity.Y + 0.5f;
                                                if (this.velocity.Y > 0f)
                                                {
                                                    this.velocity.X = this.velocity.X * 0.95f;
                                                }
                                                else
                                                {
                                                    this.velocity.X = this.velocity.X * 1.05f;
                                                }
                                            }
                                            float num424 = this.velocity.X;
                                            float num425 = this.velocity.Y;
                                            float num426 = (float)Math.Sqrt((double)(num424 * num424 + num425 * num425));
                                            num426 = 15.95f * this.scale / num426;
                                            num424 *= num426;
                                            num425 *= num426;
                                            this.velocity.X = num424;
                                            this.velocity.Y = num425;
                                            this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f;
                                            return;
                                        }
                                        if (this.localAI[0] == 0f)
                                        {
                                            if (this.velocity.X > 0f)
                                            {
                                                this.spriteDirection = -1;
                                                this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f;
                                            }
                                            else
                                            {
                                                this.spriteDirection = 1;
                                                this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f;
                                            }
                                            this.localAI[0] = 1f;
                                            this.timeLeft = num422;
                                        }
                                        this.velocity.X = this.velocity.X * 0.98f;
                                        this.velocity.Y = this.velocity.Y * 0.98f;
                                        if (this.rotation == 0f)
                                        {
                                            this.alpha = 255;
                                            return;
                                        }
                                        if (this.timeLeft < 10)
                                        {
                                            this.alpha = 255 - (int)(255f * (float)this.timeLeft / 10f);
                                            return;
                                        }
                                        if (this.timeLeft > num422 - 10)
                                        {
                                            int num427 = num422 - this.timeLeft;
                                            this.alpha = 255 - (int)(255f * (float)num427 / 10f);
                                            return;
                                        }
                                        this.alpha = 0;
                                        return;
                                    }
                                    else if (this.aiStyle == 47)
                                    {
                                        if (this.ai[0] == 0f)
                                        {
                                            this.ai[0] = this.velocity.X;
                                            this.ai[1] = this.velocity.Y;
                                        }
                                        if (this.velocity.X > 0f)
                                        {
                                            this.rotation += (Math.Abs(this.velocity.Y) + Math.Abs(this.velocity.X)) * 0.001f;
                                        }
                                        else
                                        {
                                            this.rotation -= (Math.Abs(this.velocity.Y) + Math.Abs(this.velocity.X)) * 0.001f;
                                        }
                                        this.frameCounter++;
                                        if (this.frameCounter > 6)
                                        {
                                            this.frameCounter = 0;
                                            this.frame++;
                                            if (this.frame > 4)
                                            {
                                                this.frame = 0;
                                            }
                                        }
                                        if (Math.Sqrt((double)(this.velocity.X * this.velocity.X + this.velocity.Y * this.velocity.Y)) > 2.0)
                                        {
                                            this.velocity *= 0.98f;
                                        }
                                        for (int num428 = 0; num428 < 1000; num428++)
                                        {
                                            if (num428 != this.whoAmI && Main.projectile[num428].active && Main.projectile[num428].owner == this.owner && Main.projectile[num428].type == this.type && this.timeLeft > Main.projectile[num428].timeLeft && Main.projectile[num428].timeLeft > 30)
                                            {
                                                Main.projectile[num428].timeLeft = 30;
                                            }
                                        }
                                        int[] array = new int[20];
                                        int num429 = 0;
                                        float num430 = 300f;
                                        bool flag14 = false;
                                        for (int num431 = 0; num431 < 200; num431++)
                                        {
                                            if (Main.npc[num431].CanBeChasedBy(this, false))
                                            {
                                                float num432 = Main.npc[num431].position.X + (float)(Main.npc[num431].width / 2);
                                                float num433 = Main.npc[num431].position.Y + (float)(Main.npc[num431].height / 2);
                                                float num434 = Math.Abs(this.position.X + (float)(this.width / 2) - num432) + Math.Abs(this.position.Y + (float)(this.height / 2) - num433);
                                                if (num434 < num430 && Collision.CanHit(base.Center, 1, 1, Main.npc[num431].Center, 1, 1))
                                                {
                                                    if (num429 < 20)
                                                    {
                                                        array[num429] = num431;
                                                        num429++;
                                                    }
                                                    flag14 = true;
                                                }
                                            }
                                        }
                                        if (this.timeLeft < 30)
                                        {
                                            flag14 = false;
                                        }
                                        if (flag14)
                                        {
                                            int num435 = Main.rand.Next(num429);
                                            num435 = array[num435];
                                            float num436 = Main.npc[num435].position.X + (float)(Main.npc[num435].width / 2);
                                            float num437 = Main.npc[num435].position.Y + (float)(Main.npc[num435].height / 2);
                                            this.localAI[0] += 1f;
                                            if (this.localAI[0] > 8f)
                                            {
                                                this.localAI[0] = 0f;
                                                float num438 = 6f;
                                                Vector2 vector37 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                                vector37 += this.velocity * 4f;
                                                float num439 = num436 - vector37.X;
                                                float num440 = num437 - vector37.Y;
                                                float num441 = (float)Math.Sqrt((double)(num439 * num439 + num440 * num440));
                                                num441 = num438 / num441;
                                                num439 *= num441;
                                                num440 *= num441;
                                                Projectile.NewProjectile(vector37.X, vector37.Y, num439, num440, 255, this.damage, this.knockBack, this.owner, 0f, 0f);
                                                return;
                                            }
                                        }
                                    }
                                    else if (this.aiStyle == 48)
                                    {
                                        if (this.type == ProjectileID.MagnetSphereBolt)
                                        {
                                            this.alpha = 255;
                                            return;
                                        }
                                        if (this.type == ProjectileID.UFOLaser)
                                        {
                                            this.alpha = 255;
                                            return;
                                        }
                                        if (this.type == ProjectileID.ShadowBeamHostile)
                                        {
                                            this.localAI[0] += 1f;
                                            if (this.localAI[0] > 3f)
                                            {
                                                this.alpha = 255;
                                                return;
                                            }
                                        }
                                        else if (this.type == ProjectileID.ShadowBeamFriendly)
                                        {
                                            this.localAI[0] += 1f;
                                            if (this.localAI[0] > 9f)
                                            {
                                                this.alpha = 255;
                                                return;
                                            }
                                        }
                                        else
                                        {
                                            this.localAI[0] += 1f;
                                            if (this.localAI[0] > 3f)
                                            {
                                                this.alpha = 255;
                                                return;
                                            }
                                        }
                                    }
                                    else if (this.aiStyle == 49)
                                    {
                                        if (this.ai[1] == 0f)
                                        {
                                            this.ai[1] = 1f;
                                        }
                                        if (this.ai[1] == 1f)
                                        {
                                            if (this.velocity.X > 0f)
                                            {
                                                this.direction = 1;
                                            }
                                            else if (this.velocity.X < 0f)
                                            {
                                                this.direction = -1;
                                            }
                                            this.spriteDirection = this.direction;
                                            this.ai[0] += 1f;
                                            this.rotation += this.velocity.X * 0.05f + (float)this.direction * 0.05f;
                                            if (this.ai[0] >= 18f)
                                            {
                                                this.velocity.Y = this.velocity.Y + 0.28f;
                                                this.velocity.X = this.velocity.X * 0.99f;
                                            }
                                            if ((double)this.velocity.Y > 15.9)
                                            {
                                                this.velocity.Y = 15.9f;
                                            }
                                            if (this.ai[0] > 2f)
                                            {
                                                this.alpha = 0;
                                                if (this.ai[0] == 3f)
                                                {
                                                    return;
                                                }
                                            }
                                        }
                                        else if (this.ai[1] == 2f)
                                        {
                                            this.rotation = 0f;
                                            this.velocity.X = this.velocity.X * 0.95f;
                                            this.velocity.Y = this.velocity.Y + 0.2f;
                                            return;
                                        }
                                    }
                                    else if (this.aiStyle == 50)
                                    {
                                        if (this.type == ProjectileID.InfernoHostileBolt)
                                        {
                                            if (this.localAI[0] == 0f)
                                            {
                                                this.localAI[0] += 1f;
                                            }
                                            bool flag15 = false;
                                            bool flag16 = false;
                                            if (this.velocity.X < 0f && this.position.X < this.ai[0])
                                            {
                                                flag15 = true;
                                            }
                                            if (this.velocity.X > 0f && this.position.X > this.ai[0])
                                            {
                                                flag15 = true;
                                            }
                                            if (this.velocity.Y < 0f && this.position.Y < this.ai[1])
                                            {
                                                flag16 = true;
                                            }
                                            if (this.velocity.Y > 0f && this.position.Y > this.ai[1])
                                            {
                                                flag16 = true;
                                            }
                                            if (flag15 && flag16)
                                            {
                                                this.Kill();
                                            }
                                            return;
                                        }
                                        if (this.type == ProjectileID.InfernoFriendlyBolt)
                                        {
                                            return;
                                        }
                                        if (this.localAI[0] == 0f)
                                        {
                                            this.localAI[0] += 1f;
                                        }
                                        this.ai[0] += 1f;
                                        if (this.type == ProjectileID.InfernoFriendlyBlast)
                                        {
                                            this.ai[0] += 3f;
                                        }
                                        float num462 = 25f;
                                        if (this.ai[0] > 180f)
                                        {
                                            num462 -= (this.ai[0] - 180f) / 2f;
                                        }
                                        if (num462 <= 0f)
                                        {
                                            num462 = 0f;
                                            this.Kill();
                                        }
                                        if (this.type == ProjectileID.InfernoFriendlyBlast)
                                        {
                                            num462 *= 0.7f;
                                        }
                                        return;
                                    }
                                    else if (this.aiStyle == 51)
                                    {
                                        if (this.type == ProjectileID.LostSoulFriendly)
                                        {
                                            this.localAI[0] += 1f;
                                        }
                                        else
                                        {
                                            if (this.localAI[0] == 0f)
                                            {
                                                this.localAI[0] += 1f;
                                            }
                                        }
                                        float num473 = base.Center.X;
                                        float num474 = base.Center.Y;
                                        float num475 = 400f;
                                        bool flag17 = false;
                                        if (this.type == ProjectileID.LostSoulFriendly)
                                        {
                                            for (int num476 = 0; num476 < 200; num476++)
                                            {
                                                if (Main.npc[num476].CanBeChasedBy(this, false) && Collision.CanHit(base.Center, 1, 1, Main.npc[num476].Center, 1, 1))
                                                {
                                                    float num477 = Main.npc[num476].position.X + (float)(Main.npc[num476].width / 2);
                                                    float num478 = Main.npc[num476].position.Y + (float)(Main.npc[num476].height / 2);
                                                    float num479 = Math.Abs(this.position.X + (float)(this.width / 2) - num477) + Math.Abs(this.position.Y + (float)(this.height / 2) - num478);
                                                    if (num479 < num475)
                                                    {
                                                        num475 = num479;
                                                        num473 = num477;
                                                        num474 = num478;
                                                        flag17 = true;
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            num475 = 200f;
                                            for (int num480 = 0; num480 < 255; num480++)
                                            {
                                                if (Main.player[num480].active && !Main.player[num480].dead)
                                                {
                                                    float num481 = Main.player[num480].position.X + (float)(Main.player[num480].width / 2);
                                                    float num482 = Main.player[num480].position.Y + (float)(Main.player[num480].height / 2);
                                                    float num483 = Math.Abs(this.position.X + (float)(this.width / 2) - num481) + Math.Abs(this.position.Y + (float)(this.height / 2) - num482);
                                                    if (num483 < num475)
                                                    {
                                                        num475 = num483;
                                                        num473 = num481;
                                                        num474 = num482;
                                                        flag17 = true;
                                                    }
                                                }
                                            }
                                        }
                                        if (flag17)
                                        {
                                            float num484 = 3f;
                                            if (this.type == ProjectileID.LostSoulFriendly)
                                            {
                                                num484 = 6f;
                                            }
                                            Vector2 vector43 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                            float num485 = num473 - vector43.X;
                                            float num486 = num474 - vector43.Y;
                                            float num487 = (float)Math.Sqrt((double)(num485 * num485 + num486 * num486));
                                            num487 = num484 / num487;
                                            num485 *= num487;
                                            num486 *= num487;
                                            if (this.type == ProjectileID.LostSoulFriendly)
                                            {
                                                this.velocity.X = (this.velocity.X * 20f + num485) / 21f;
                                                this.velocity.Y = (this.velocity.Y * 20f + num486) / 21f;
                                                return;
                                            }
                                            this.velocity.X = (this.velocity.X * 100f + num485) / 101f;
                                            this.velocity.Y = (this.velocity.Y * 100f + num486) / 101f;
                                            return;
                                        }
                                    }
                                    else if (this.aiStyle == 52)
                                    {
                                        int num488 = (int)this.ai[0];
                                        float num489 = 4f;
                                        Vector2 vector44 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                        float num490 = Main.player[num488].Center.X - vector44.X;
                                        float num491 = Main.player[num488].Center.Y - vector44.Y;
                                        float num492 = (float)Math.Sqrt((double)(num490 * num490 + num491 * num491));
                                        if (num492 < 50f && this.position.X < Main.player[num488].position.X + (float)Main.player[num488].width && this.position.X + (float)this.width > Main.player[num488].position.X && this.position.Y < Main.player[num488].position.Y + (float)Main.player[num488].height && this.position.Y + (float)this.height > Main.player[num488].position.Y)
                                        {
                                            if (this.owner == Main.myPlayer)
                                            {
                                                int num493 = (int)this.ai[1];
                                                Main.player[num488].HealEffect(num493, false);
                                                Main.player[num488].statLife += num493;
                                                if (Main.player[num488].statLife > Main.player[num488].statLifeMax2)
                                                {
                                                    Main.player[num488].statLife = Main.player[num488].statLifeMax2;
                                                }
                                                NetMessage.SendData((int)PacketTypes.PlayerHealOther, -1, -1, "", num488, (float)num493, 0f, 0f, 0, 0, 0);
                                            }
                                            this.Kill();
                                        }
                                        num492 = num489 / num492;
                                        num490 *= num492;
                                        num491 *= num492;
                                        this.velocity.X = (this.velocity.X * 15f + num490) / 16f;
                                        this.velocity.Y = (this.velocity.Y * 15f + num491) / 16f;
                                        if (this.type == ProjectileID.VampireHeal)
                                        {
                                            return;
                                        }
                                        return;
                                    }
                                    else if (this.aiStyle == 53)
                                    {
                                        if (this.localAI[0] == 0f)
                                        {
                                            this.localAI[1] = 1f;
                                            this.localAI[0] = 1f;
                                            this.ai[0] = 120f;
                                            if (this.type == ProjectileID.SpiderHiver)
                                            {
                                                this.frame = 4;
                                            }
                                        }
                                        this.velocity.X = 0f;
                                        this.velocity.Y = this.velocity.Y + 0.2f;
                                        if (this.velocity.Y > 16f)
                                        {
                                            this.velocity.Y = 16f;
                                        }
                                        bool flag18 = false;
                                        float num507 = base.Center.X;
                                        float num508 = base.Center.Y;
                                        float num509 = 1000f;
                                        for (int num510 = 0; num510 < 200; num510++)
                                        {
                                            if (Main.npc[num510].CanBeChasedBy(this, false))
                                            {
                                                float num511 = Main.npc[num510].position.X + (float)(Main.npc[num510].width / 2);
                                                float num512 = Main.npc[num510].position.Y + (float)(Main.npc[num510].height / 2);
                                                float num513 = Math.Abs(this.position.X + (float)(this.width / 2) - num511) + Math.Abs(this.position.Y + (float)(this.height / 2) - num512);
                                                if (num513 < num509 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num510].position, Main.npc[num510].width, Main.npc[num510].height))
                                                {
                                                    num509 = num513;
                                                    num507 = num511;
                                                    num508 = num512;
                                                    flag18 = true;
                                                }
                                            }
                                        }
                                        if (flag18)
                                        {
                                            float num514 = num507;
                                            float num515 = num508;
                                            num507 -= base.Center.X;
                                            num508 -= base.Center.Y;
                                            if (num507 < 0f)
                                            {
                                                this.spriteDirection = -1;
                                            }
                                            else
                                            {
                                                this.spriteDirection = 1;
                                            }
                                            int num516;
                                            if (num508 > 0f)
                                            {
                                                num516 = 0;
                                            }
                                            else if (Math.Abs(num508) > Math.Abs(num507) * 3f)
                                            {
                                                num516 = 4;
                                            }
                                            else if (Math.Abs(num508) > Math.Abs(num507) * 2f)
                                            {
                                                num516 = 3;
                                            }
                                            else if (Math.Abs(num507) > Math.Abs(num508) * 3f)
                                            {
                                                num516 = 0;
                                            }
                                            else if (Math.Abs(num507) > Math.Abs(num508) * 2f)
                                            {
                                                num516 = 1;
                                            }
                                            else
                                            {
                                                num516 = 2;
                                            }
                                            if (this.type == ProjectileID.FrostHydra)
                                            {
                                                this.frame = num516 * 2;
                                            }
                                            else if (this.type == ProjectileID.SpiderHiver)
                                            {
                                                this.frame = num516;
                                            }
                                            if (this.ai[0] > 40f && this.localAI[1] == 0f && this.type == ProjectileID.FrostHydra)
                                            {
                                                this.frame++;
                                            }
                                            if (this.ai[0] <= 0f)
                                            {
                                                this.localAI[1] = 0f;
                                                this.ai[0] = 60f;
                                                if (Main.myPlayer == this.owner)
                                                {
                                                    float num517 = 6f;
                                                    int num518 = 309;
                                                    if (this.type == ProjectileID.SpiderHiver)
                                                    {
                                                        num518 = 378;
                                                        num517 = 9f;
                                                    }
                                                    Vector2 vector45 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                                    if (num516 == 0)
                                                    {
                                                        vector45.Y += 12f;
                                                        vector45.X += (float)(24 * this.spriteDirection);
                                                    }
                                                    else if (num516 == 1)
                                                    {
                                                        vector45.Y += 0f;
                                                        vector45.X += (float)(24 * this.spriteDirection);
                                                    }
                                                    else if (num516 == 2)
                                                    {
                                                        vector45.Y -= 2f;
                                                        vector45.X += (float)(24 * this.spriteDirection);
                                                    }
                                                    else if (num516 == 3)
                                                    {
                                                        vector45.Y -= 6f;
                                                        vector45.X += (float)(14 * this.spriteDirection);
                                                    }
                                                    else if (num516 == 4)
                                                    {
                                                        vector45.Y -= 14f;
                                                        vector45.X += (float)(2 * this.spriteDirection);
                                                    }
                                                    if (this.spriteDirection < 0)
                                                    {
                                                        vector45.X += 10f;
                                                    }
                                                    float num519 = num514 - vector45.X;
                                                    float num520 = num515 - vector45.Y;
                                                    float num521 = (float)Math.Sqrt((double)(num519 * num519 + num520 * num520));
                                                    num521 = num517 / num521;
                                                    num519 *= num521;
                                                    num520 *= num521;
                                                    int num522 = this.damage;
                                                    Projectile.NewProjectile(vector45.X, vector45.Y, num519, num520, num518, num522, this.knockBack, Main.myPlayer, 0f, 0f);
                                                }
                                            }
                                        }
                                        else if (this.ai[0] <= 60f && (this.frame == 1 || this.frame == 3 || this.frame == 5 || this.frame == 7 || this.frame == 9))
                                        {
                                            this.frame--;
                                        }
                                        if (this.ai[0] > 0f)
                                        {
                                            this.ai[0] -= 1f;
                                            return;
                                        }
                                    }
                                    else if (this.aiStyle == 54)
                                    {
                                        if (this.type == ProjectileID.Raven)
                                        {
                                            if (Main.player[Main.myPlayer].dead)
                                            {
                                                Main.player[Main.myPlayer].raven = false;
                                            }
                                            if (Main.player[Main.myPlayer].raven)
                                            {
                                                this.timeLeft = 2;
                                            }
                                        }
                                        for (int num523 = 0; num523 < 1000; num523++)
                                        {
                                            if (num523 != this.whoAmI && Main.projectile[num523].active && Main.projectile[num523].owner == this.owner && Main.projectile[num523].type == this.type && Math.Abs(this.position.X - Main.projectile[num523].position.X) + Math.Abs(this.position.Y - Main.projectile[num523].position.Y) < (float)this.width)
                                            {
                                                if (this.position.X < Main.projectile[num523].position.X)
                                                {
                                                    this.velocity.X = this.velocity.X - 0.05f;
                                                }
                                                else
                                                {
                                                    this.velocity.X = this.velocity.X + 0.05f;
                                                }
                                                if (this.position.Y < Main.projectile[num523].position.Y)
                                                {
                                                    this.velocity.Y = this.velocity.Y - 0.05f;
                                                }
                                                else
                                                {
                                                    this.velocity.Y = this.velocity.Y + 0.05f;
                                                }
                                            }
                                        }
                                        float num524 = this.position.X;
                                        float num525 = this.position.Y;
                                        float num526 = 900f;
                                        bool flag19 = false;
                                        int num527 = 500;
                                        if (this.ai[1] != 0f || this.friendly)
                                        {
                                            num527 = 1400;
                                        }
                                        if (Math.Abs(base.Center.X - Main.player[this.owner].Center.X) + Math.Abs(base.Center.Y - Main.player[this.owner].Center.Y) > (float)num527)
                                        {
                                            this.ai[0] = 1f;
                                        }
                                        if (this.ai[0] == 0f)
                                        {
                                            this.tileCollide = true;
                                            for (int num528 = 0; num528 < 200; num528++)
                                            {
                                                if (Main.npc[num528].CanBeChasedBy(this, false))
                                                {
                                                    float num529 = Main.npc[num528].position.X + (float)(Main.npc[num528].width / 2);
                                                    float num530 = Main.npc[num528].position.Y + (float)(Main.npc[num528].height / 2);
                                                    float num531 = Math.Abs(this.position.X + (float)(this.width / 2) - num529) + Math.Abs(this.position.Y + (float)(this.height / 2) - num530);
                                                    if (num531 < num526 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num528].position, Main.npc[num528].width, Main.npc[num528].height))
                                                    {
                                                        num526 = num531;
                                                        num524 = num529;
                                                        num525 = num530;
                                                        flag19 = true;
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            this.tileCollide = false;
                                        }
                                        if (!flag19)
                                        {
                                            this.friendly = true;
                                            float num532 = 8f;
                                            if (this.ai[0] == 1f)
                                            {
                                                num532 = 12f;
                                            }
                                            Vector2 vector46 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                            float num533 = Main.player[this.owner].Center.X - vector46.X;
                                            float num534 = Main.player[this.owner].Center.Y - vector46.Y - 60f;
                                            float num535 = (float)Math.Sqrt((double)(num533 * num533 + num534 * num534));
                                            if (num535 < 100f && this.ai[0] == 1f && !Collision.SolidCollision(this.position, this.width, this.height))
                                            {
                                                this.ai[0] = 0f;
                                            }
                                            if (num535 > 2000f)
                                            {
                                                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 (num535 > 70f)
                                            {
                                                num535 = num532 / num535;
                                                num533 *= num535;
                                                num534 *= num535;
                                                this.velocity.X = (this.velocity.X * 20f + num533) / 21f;
                                                this.velocity.Y = (this.velocity.Y * 20f + num534) / 21f;
                                            }
                                            else
                                            {
                                                if (this.velocity.X == 0f && this.velocity.Y == 0f)
                                                {
                                                    this.velocity.X = -0.15f;
                                                    this.velocity.Y = -0.05f;
                                                }
                                                this.velocity *= 1.01f;
                                            }
                                            this.friendly = false;
                                            this.rotation = this.velocity.X * 0.05f;
                                            this.frameCounter++;
                                            if (this.frameCounter >= 4)
                                            {
                                                this.frameCounter = 0;
                                                this.frame++;
                                            }
                                            if (this.frame > 3)
                                            {
                                                this.frame = 0;
                                            }
                                            if ((double)Math.Abs(this.velocity.X) > 0.2)
                                            {
                                                this.spriteDirection = -this.direction;
                                                return;
                                            }
                                        }
                                        else
                                        {
                                            if (this.ai[1] == -1f)
                                            {
                                                this.ai[1] = 17f;
                                            }
                                            if (this.ai[1] > 0f)
                                            {
                                                this.ai[1] -= 1f;
                                            }
                                            if (this.ai[1] == 0f)
                                            {
                                                this.friendly = true;
                                                float num536 = 8f;
                                                Vector2 vector47 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                                float num537 = num524 - vector47.X;
                                                float num538 = num525 - vector47.Y;
                                                float num539 = (float)Math.Sqrt((double)(num537 * num537 + num538 * num538));
                                                if (num539 < 100f)
                                                {
                                                    num536 = 10f;
                                                }
                                                num539 = num536 / num539;
                                                num537 *= num539;
                                                num538 *= num539;
                                                this.velocity.X = (this.velocity.X * 14f + num537) / 15f;
                                                this.velocity.Y = (this.velocity.Y * 14f + num538) / 15f;
                                            }
                                            else
                                            {
                                                this.friendly = false;
                                                if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 10f)
                                                {
                                                    this.velocity *= 1.05f;
                                                }
                                            }
                                            this.rotation = this.velocity.X * 0.05f;
                                            this.frameCounter++;
                                            if (this.frameCounter >= 4)
                                            {
                                                this.frameCounter = 0;
                                                this.frame++;
                                            }
                                            if (this.frame < 4)
                                            {
                                                this.frame = 4;
                                            }
                                            if (this.frame > 7)
                                            {
                                                this.frame = 4;
                                            }
                                            if ((double)Math.Abs(this.velocity.X) > 0.2)
                                            {
                                                this.spriteDirection = -this.direction;
                                                return;
                                            }
                                        }
                                    }
                                    else if (this.aiStyle == 55)
                                    {
                                        this.frameCounter++;
                                        if (this.frameCounter > 0)
                                        {
                                            this.frame++;
                                            this.frameCounter = 0;
                                            if (this.frame > 2)
                                            {
                                                this.frame = 0;
                                            }
                                        }
                                        if (this.velocity.X < 0f)
                                        {
                                            this.spriteDirection = -1;
                                            this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X));
                                        }
                                        else
                                        {
                                            this.spriteDirection = 1;
                                            this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
                                        }
                                        if (this.ai[0] >= 0f && this.ai[0] < 200f)
                                        {
                                            int num540 = (int)this.ai[0];
                                            if (Main.npc[num540].active)
                                            {
                                                float num541 = 8f;
                                                Vector2 vector48 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                                float num542 = Main.npc[num540].position.X - vector48.X;
                                                float num543 = Main.npc[num540].position.Y - vector48.Y;
                                                float num544 = (float)Math.Sqrt((double)(num542 * num542 + num543 * num543));
                                                num544 = num541 / num544;
                                                num542 *= num544;
                                                num543 *= num544;
                                                this.velocity.X = (this.velocity.X * 14f + num542) / 15f;
                                                this.velocity.Y = (this.velocity.Y * 14f + num543) / 15f;
                                            }
                                            else
                                            {
                                                float num545 = 1000f;
                                                for (int num546 = 0; num546 < 200; num546++)
                                                {
                                                    if (Main.npc[num546].CanBeChasedBy(this, false))
                                                    {
                                                        float num547 = Main.npc[num546].position.X + (float)(Main.npc[num546].width / 2);
                                                        float num548 = Main.npc[num546].position.Y + (float)(Main.npc[num546].height / 2);
                                                        float num549 = Math.Abs(this.position.X + (float)(this.width / 2) - num547) + Math.Abs(this.position.Y + (float)(this.height / 2) - num548);
                                                        if (num549 < num545 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num546].position, Main.npc[num546].width, Main.npc[num546].height))
                                                        {
                                                            num545 = num549;
                                                            this.ai[0] = (float)num546;
                                                        }
                                                    }
                                                }
                                            }
                                            return;
                                        }
                                        this.Kill();
                                        return;
                                    }
                                    else
                                    {
                                        if (this.aiStyle == 56)
                                        {
                                            if (this.localAI[0] == 0f)
                                            {
                                                this.localAI[0] = 1f;
                                                this.rotation = this.ai[0];
                                                this.spriteDirection = -(int)this.ai[1];
                                            }
                                            if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 16f)
                                            {
                                                this.velocity *= 1.05f;
                                            }
                                            if (this.velocity.X < 0f)
                                            {
                                                this.direction = -1;
                                            }
                                            else
                                            {
                                                this.direction = 1;
                                            }
                                            this.rotation += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.025f * (float)this.direction;
                                            return;
                                        }
                                        if (this.aiStyle == 57)
                                        {
                                            this.ai[0] += 1f;
                                            if (this.ai[0] > 30f)
                                            {
                                                this.ai[0] = 30f;
                                                this.velocity.Y = this.velocity.Y + 0.25f;
                                                if (this.velocity.Y > 16f)
                                                {
                                                    this.velocity.Y = 16f;
                                                }
                                                this.velocity.X = this.velocity.X * 0.995f;
                                            }
                                            this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                                            this.alpha -= 50;
                                            if (this.alpha < 0)
                                            {
                                                this.alpha = 0;
                                            }
                                            if (this.owner == Main.myPlayer)
                                            {
                                                this.localAI[0] += 1f;
                                                if (this.localAI[0] >= 4f)
                                                {
                                                    this.localAI[0] = 0f;
                                                    int num552 = 0;
                                                    for (int num553 = 0; num553 < 1000; num553++)
                                                    {
                                                        if (Main.projectile[num553].active && Main.projectile[num553].owner == this.owner && Main.projectile[num553].type == ProjectileID.NorthPoleSnowflake)
                                                        {
                                                            num552++;
                                                        }
                                                    }
                                                    float num554 = (float)this.damage * 0.8f;
                                                    if (num552 > 100)
                                                    {
                                                        float num555 = (float)(num552 - 100);
                                                        num555 = 1f - num555 / 100f;
                                                        num554 *= num555;
                                                    }
                                                    if (num552 > 100)
                                                    {
                                                        this.localAI[0] -= 1f;
                                                    }
                                                    if (num552 > 120)
                                                    {
                                                        this.localAI[0] -= 1f;
                                                    }
                                                    if (num552 > 140)
                                                    {
                                                        this.localAI[0] -= 1f;
                                                    }
                                                    if (num552 > 150)
                                                    {
                                                        this.localAI[0] -= 1f;
                                                    }
                                                    if (num552 > 160)
                                                    {
                                                        this.localAI[0] -= 1f;
                                                    }
                                                    if (num552 > 165)
                                                    {
                                                        this.localAI[0] -= 1f;
                                                    }
                                                    if (num552 > 170)
                                                    {
                                                        this.localAI[0] -= 2f;
                                                    }
                                                    if (num552 > 175)
                                                    {
                                                        this.localAI[0] -= 3f;
                                                    }
                                                    if (num552 > 180)
                                                    {
                                                        this.localAI[0] -= 4f;
                                                    }
                                                    if (num552 > 185)
                                                    {
                                                        this.localAI[0] -= 5f;
                                                    }
                                                    if (num552 > 190)
                                                    {
                                                        this.localAI[0] -= 6f;
                                                    }
                                                    if (num552 > 195)
                                                    {
                                                        this.localAI[0] -= 7f;
                                                    }
                                                    if (num554 > (float)this.damage * 0.1f)
                                                    {
                                                        Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 344, (int)num554, this.knockBack * 0.55f, this.owner, 0f, (float)Main.rand.Next(3));
                                                        return;
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (this.aiStyle == 58)
                                            {
                                                this.alpha -= 50;
                                                if (this.alpha < 0)
                                                {
                                                    this.alpha = 0;
                                                }
                                                if (this.ai[0] == 0f)
                                                {
                                                    this.frame = 0;
                                                    this.ai[1] += 1f;
                                                    if (this.ai[1] > 30f)
                                                    {
                                                        this.velocity.Y = this.velocity.Y + 0.1f;
                                                    }
                                                    if (this.velocity.Y >= 0f)
                                                    {
                                                        this.ai[0] = 1f;
                                                    }
                                                }
                                                if (this.ai[0] == 1f)
                                                {
                                                    this.frame = 1;
                                                    this.velocity.Y = this.velocity.Y + 0.1f;
                                                    if (this.velocity.Y > 3f)
                                                    {
                                                        this.velocity.Y = 3f;
                                                    }
                                                    this.velocity.X = this.velocity.X * 0.99f;
                                                }
                                                this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                                                return;
                                            }
                                            if (this.aiStyle == 59)
                                            {
                                                this.ai[1] += 1f;
                                                if (this.ai[1] >= 60f)
                                                {
                                                    this.friendly = true;
                                                    int num556 = (int)this.ai[0];
                                                    if (!Main.npc[num556].active)
                                                    {
                                                        int[] array2 = new int[200];
                                                        int num557 = 0;
                                                        for (int num558 = 0; num558 < 200; num558++)
                                                        {
                                                            if (Main.npc[num558].CanBeChasedBy(this, false))
                                                            {
                                                                float num559 = Math.Abs(Main.npc[num558].position.X + (float)(Main.npc[num558].width / 2) - this.position.X + (float)(this.width / 2)) + Math.Abs(Main.npc[num558].position.Y + (float)(Main.npc[num558].height / 2) - this.position.Y + (float)(this.height / 2));
                                                                if (num559 < 800f)
                                                                {
                                                                    array2[num557] = num558;
                                                                    num557++;
                                                                }
                                                            }
                                                        }
                                                        if (num557 == 0)
                                                        {
                                                            this.Kill();
                                                            return;
                                                        }
                                                        num556 = array2[Main.rand.Next(num557)];
                                                        this.ai[0] = (float)num556;
                                                    }
                                                    float num560 = 4f;
                                                    Vector2 vector49 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                                    float num561 = Main.npc[num556].Center.X - vector49.X;
                                                    float num562 = Main.npc[num556].Center.Y - vector49.Y;
                                                    float num563 = (float)Math.Sqrt((double)(num561 * num561 + num562 * num562));
                                                    num563 = num560 / num563;
                                                    num561 *= num563;
                                                    num562 *= num563;
                                                    int num564 = 30;
                                                    this.velocity.X = (this.velocity.X * (float)(num564 - 1) + num561) / (float)num564;
                                                    this.velocity.Y = (this.velocity.Y * (float)(num564 - 1) + num562) / (float)num564;
                                                }
                                                return;
                                            }
                                            if (this.aiStyle == 60)
                                            {
                                                this.scale -= 0.015f;
                                                if (this.scale <= 0f)
                                                {
                                                    this.velocity *= 5f;
                                                    this.oldVelocity = this.velocity;
                                                    this.Kill();
                                                }
                                                if (this.ai[0] <= 3f)
                                                {
                                                    this.ai[0] += 1f;
                                                    return;
                                                }
                                                int num569 = 103;
                                                if (this.type == ProjectileID.SlimeGun)
                                                {
                                                    num569 = 137;
                                                }
                                                if (this.owner == Main.myPlayer)
                                                {
                                                    Rectangle rectangle7 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
                                                    for (int num570 = 0; num570 < 200; num570++)
                                                    {
                                                        if (Main.npc[num570].active && !Main.npc[num570].dontTakeDamage && Main.npc[num570].lifeMax > 1)
                                                        {
                                                            Rectangle rectangle8 = new Rectangle((int)Main.npc[num570].position.X, (int)Main.npc[num570].position.Y, Main.npc[num570].width, Main.npc[num570].height);
                                                            if (rectangle7.Intersects(rectangle8))
                                                            {
                                                                Main.npc[num570].AddBuff(num569, 1500, false);
                                                                this.Kill();
                                                            }
                                                        }
                                                    }
                                                    for (int num571 = 0; num571 < 255; num571++)
                                                    {
                                                        if (num571 != this.owner && Main.player[num571].active && !Main.player[num571].dead)
                                                        {
                                                            Rectangle rectangle9 = new Rectangle((int)Main.player[num571].position.X, (int)Main.player[num571].position.Y, Main.player[num571].width, Main.player[num571].height);
                                                            if (rectangle7.Intersects(rectangle9))
                                                            {
                                                                Main.player[num571].AddBuff(num569, 1500, false);
                                                                this.Kill();
                                                            }
                                                        }
                                                    }
                                                }
                                                this.ai[0] += this.ai[1];
                                                if (this.ai[0] > 30f)
                                                {
                                                    this.velocity.Y = this.velocity.Y + 0.1f;
                                                }
                                            }
                                            else if (this.aiStyle == 61)
                                            {
                                                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 (this.ai[1] > 0f && this.localAI[1] >= 0f)
                                                {
                                                    this.localAI[1] = -1f;
                                                }
                                                if (this.ai[0] >= 1f)
                                                {
                                                    if (this.ai[0] == 2f)
                                                    {
                                                        this.ai[0] += 1f;
                                                    }
                                                    if (this.localAI[0] < 100f)
                                                    {
                                                        this.localAI[0] += 1f;
                                                    }
                                                    this.tileCollide = false;
                                                    float num590 = 15.9f;
                                                    int num591 = 10;
                                                    Vector2 vector51 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                                    float num592 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector51.X;
                                                    float num593 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector51.Y;
                                                    float num594 = (float)Math.Sqrt((double)(num592 * num592 + num593 * num593));
                                                    if (num594 > 3000f)
                                                    {
                                                        this.Kill();
                                                    }
                                                    num594 = num590 / num594;
                                                    num592 *= num594;
                                                    num593 *= num594;
                                                    this.velocity.X = (this.velocity.X * (float)(num591 - 1) + num592) / (float)num591;
                                                    this.velocity.Y = (this.velocity.Y * (float)(num591 - 1) + num593) / (float)num591;
                                                    if (Main.myPlayer == this.owner)
                                                    {
                                                        Rectangle rectangle10 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
                                                        Rectangle rectangle11 = new Rectangle((int)Main.player[this.owner].position.X, (int)Main.player[this.owner].position.Y, Main.player[this.owner].width, Main.player[this.owner].height);
                                                        if (rectangle10.Intersects(rectangle11))
                                                        {
                                                            if (this.ai[1] > 0f && this.ai[1] < 3602f)
                                                            {
                                                                int num595 = (int)this.ai[1];
                                                                Item item = new Item();
                                                                item.SetDefaults(num595, false);
                                                                if (num595 == 3196)
                                                                {
                                                                    int num596 = Main.player[this.owner].FishingLevel();
                                                                    int minValue = (num596 / 20 + 3) / 2;
                                                                    int num597 = (num596 / 10 + 6) / 2;
                                                                    if (Main.rand.Next(50) < num596)
                                                                    {
                                                                        num597++;
                                                                    }
                                                                    if (Main.rand.Next(100) < num596)
                                                                    {
                                                                        num597++;
                                                                    }
                                                                    if (Main.rand.Next(150) < num596)
                                                                    {
                                                                        num597++;
                                                                    }
                                                                    if (Main.rand.Next(200) < num596)
                                                                    {
                                                                        num597++;
                                                                    }
                                                                    int stack = Main.rand.Next(minValue, num597 + 1);
                                                                    item.stack = stack;
                                                                }
                                                                if (num595 == 3197)
                                                                {
                                                                    int num598 = Main.player[this.owner].FishingLevel();
                                                                    int minValue2 = (num598 / 4 + 15) / 2;
                                                                    int num599 = (num598 / 2 + 30) / 2;
                                                                    if (Main.rand.Next(50) < num598)
                                                                    {
                                                                        num599 += 4;
                                                                    }
                                                                    if (Main.rand.Next(100) < num598)
                                                                    {
                                                                        num599 += 4;
                                                                    }
                                                                    if (Main.rand.Next(150) < num598)
                                                                    {
                                                                        num599 += 4;
                                                                    }
                                                                    if (Main.rand.Next(200) < num598)
                                                                    {
                                                                        num599 += 4;
                                                                    }
                                                                    int stack2 = Main.rand.Next(minValue2, num599 + 1);
                                                                    item.stack = stack2;
                                                                }
                                                                Item item2 = Main.player[this.owner].GetItem(this.owner, item, false, false);
                                                                if (item2.stack > 0)
                                                                {
                                                                    int number2 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num595, 1, false, 0, true);
                                                                    if (Main.netMode == 1)
                                                                    {
                                                                        NetMessage.SendData((int)PacketTypes.ItemDrop, -1, -1, "", number2, 1f, 0f, 0f, 0, 0, 0);
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    item.position.X = base.Center.X - (float)(item.width / 2);
                                                                    item.position.Y = base.Center.Y - (float)(item.height / 2);
                                                                    item.active = true;
                                                                    ItemText.NewText(item, 0, false, false);
                                                                }
                                                            }
                                                            this.Kill();
                                                        }
                                                    }
                                                    this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                                                    return;
                                                }
                                                bool flag20 = false;
                                                Vector2 vector52 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                                float num600 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector52.X;
                                                float num601 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector52.Y;
                                                this.rotation = (float)Math.Atan2((double)num601, (double)num600) + 1.57f;
                                                float num602 = (float)Math.Sqrt((double)(num600 * num600 + num601 * num601));
                                                if (num602 > 900f)
                                                {
                                                    this.ai[0] = 1f;
                                                }
                                                if (this.wet)
                                                {
                                                    this.rotation = 0f;
                                                    this.velocity.X = this.velocity.X * 0.9f;
                                                    int num603 = (int)(base.Center.X + (float)((this.width / 2 + 8) * this.direction)) / 16;
                                                    int num604 = (int)(base.Center.Y / 16f);
                                                    float arg_18826_0 = this.position.Y / 16f;
                                                    int num605 = (int)((this.position.Y + (float)this.height) / 16f);
                                                    if (Main.tile[num603, num604] == null)
                                                    {
                                                        Main.tile[num603, num604] = new Tile();
                                                    }
                                                    if (Main.tile[num603, num605] == null)
                                                    {
                                                        Main.tile[num603, num605] = new Tile();
                                                    }
                                                    if (this.velocity.Y > 0f)
                                                    {
                                                        this.velocity.Y = this.velocity.Y * 0.5f;
                                                    }
                                                    num603 = (int)(base.Center.X / 16f);
                                                    num604 = (int)(base.Center.Y / 16f);
                                                    float num606 = this.position.Y + (float)this.height;
                                                    if (Main.tile[num603, num604 - 1] == null)
                                                    {
                                                        Main.tile[num603, num604 - 1] = new Tile();
                                                    }
                                                    if (Main.tile[num603, num604] == null)
                                                    {
                                                        Main.tile[num603, num604] = new Tile();
                                                    }
                                                    if (Main.tile[num603, num604 + 1] == null)
                                                    {
                                                        Main.tile[num603, num604 + 1] = new Tile();
                                                    }
                                                    if (Main.tile[num603, num604 - 1].liquid > 0)
                                                    {
                                                        num606 = (float)(num604 * 16);
                                                        num606 -= (float)(Main.tile[num603, num604 - 1].liquid / 16);
                                                    }
                                                    else if (Main.tile[num603, num604].liquid > 0)
                                                    {
                                                        num606 = (float)((num604 + 1) * 16);
                                                        num606 -= (float)(Main.tile[num603, num604].liquid / 16);
                                                    }
                                                    else if (Main.tile[num603, num604 + 1].liquid > 0)
                                                    {
                                                        num606 = (float)((num604 + 2) * 16);
                                                        num606 -= (float)(Main.tile[num603, num604 + 1].liquid / 16);
                                                    }
                                                    if (base.Center.Y > num606)
                                                    {
                                                        this.velocity.Y = this.velocity.Y - 0.1f;
                                                        if (this.velocity.Y < -8f)
                                                        {
                                                            this.velocity.Y = -8f;
                                                        }
                                                        if (base.Center.Y + this.velocity.Y < num606)
                                                        {
                                                            this.velocity.Y = num606 - base.Center.Y;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        this.velocity.Y = num606 - base.Center.Y;
                                                    }
                                                    if ((double)this.velocity.Y >= -0.01 && (double)this.velocity.Y <= 0.01)
                                                    {
                                                        flag20 = true;
                                                    }
                                                }
                                                else
                                                {
                                                    if (this.velocity.Y == 0f)
                                                    {
                                                        this.velocity.X = this.velocity.X * 0.95f;
                                                    }
                                                    this.velocity.X = this.velocity.X * 0.98f;
                                                    this.velocity.Y = this.velocity.Y + 0.2f;
                                                    if (this.velocity.Y > 15.9f)
                                                    {
                                                        this.velocity.Y = 15.9f;
                                                    }
                                                }
                                                if (this.ai[1] != 0f)
                                                {
                                                    flag20 = true;
                                                }
                                                if (flag20)
                                                {
                                                    if (this.ai[1] == 0f && Main.myPlayer == this.owner)
                                                    {
                                                        int num607 = Main.player[this.owner].FishingLevel();
                                                        if (num607 == -9000)
                                                        {
                                                            this.localAI[1] += 5f;
                                                            this.localAI[1] += (float)Main.rand.Next(1, 3);
                                                            if (this.localAI[1] > 660f)
                                                            {
                                                                this.localAI[1] = 0f;
                                                                this.FishingCheck();
                                                                return;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (Main.rand.Next(300) < num607)
                                                            {
                                                                this.localAI[1] += (float)Main.rand.Next(1, 3);
                                                            }
                                                            this.localAI[1] += (float)(num607 / 30);
                                                            this.localAI[1] += (float)Main.rand.Next(1, 3);
                                                            if (Main.rand.Next(60) == 0)
                                                            {
                                                                this.localAI[1] += 60f;
                                                            }
                                                            if (this.localAI[1] > 660f)
                                                            {
                                                                this.localAI[1] = 0f;
                                                                this.FishingCheck();
                                                                return;
                                                            }
                                                        }
                                                    }
                                                    else if (this.ai[1] < 0f)
                                                    {
                                                        if (this.velocity.Y == 0f || (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 (this.ai[1] >= 0f)
                                                        {
                                                            this.ai[1] = 0f;
                                                            this.localAI[1] = 0f;
                                                            this.netUpdate = true;
                                                            return;
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (this.aiStyle == 62)
                                                {
                                                    this.AI_062();
                                                    return;
                                                }
                                                if (this.aiStyle == 63)
                                                {
                                                    if (!Main.player[this.owner].active)
                                                    {
                                                        this.active = false;
                                                        return;
                                                    }
                                                    Vector2 vector53 = this.position;
                                                    bool flag21 = false;
                                                    float num608 = 500f;
                                                    for (int num609 = 0; num609 < 200; num609++)
                                                    {
                                                        NPC nPC = Main.npc[num609];
                                                        if (nPC.CanBeChasedBy(this, false))
                                                        {
                                                            float num610 = Vector2.Distance(nPC.Center, base.Center);
                                                            if (((Vector2.Distance(base.Center, vector53) > num610 && num610 < num608) || !flag21) && Collision.CanHit(this.position, this.width, this.height, nPC.position, nPC.width, nPC.height))
                                                            {
                                                                num608 = num610;
                                                                vector53 = nPC.Center;
                                                                flag21 = true;
                                                            }
                                                        }
                                                    }
                                                    if (!flag21)
                                                    {
                                                        this.velocity.X = this.velocity.X * 0.95f;
                                                    }
                                                    else
                                                    {
                                                        float num611 = 5f;
                                                        float num612 = 0.08f;
                                                        if (this.velocity.Y == 0f)
                                                        {
                                                            bool flag22 = false;
                                                            if (base.Center.Y - 50f > vector53.Y)
                                                            {
                                                                flag22 = true;
                                                            }
                                                            if (flag22)
                                                            {
                                                                this.velocity.Y = -6f;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            num611 = 8f;
                                                            num612 = 0.12f;
                                                        }
                                                        this.velocity.X = this.velocity.X + (float)Math.Sign(vector53.X - base.Center.X) * num612;
                                                        if (this.velocity.X < -num611)
                                                        {
                                                            this.velocity.X = -num611;
                                                        }
                                                        if (this.velocity.X > num611)
                                                        {
                                                            this.velocity.X = num611;
                                                        }
                                                    }
                                                    float num613 = 0f;
                                                    Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref num613, ref this.gfxOffY, 1, false, 0);
                                                    if (this.velocity.Y != 0f)
                                                    {
                                                        this.frame = 3;
                                                    }
                                                    else
                                                    {
                                                        if (Math.Abs(this.velocity.X) > 0.2f)
                                                        {
                                                            this.frameCounter++;
                                                        }
                                                        if (this.frameCounter >= 9)
                                                        {
                                                            this.frameCounter = 0;
                                                        }
                                                        if (this.frameCounter >= 6)
                                                        {
                                                            this.frame = 2;
                                                        }
                                                        else if (this.frameCounter >= 3)
                                                        {
                                                            this.frame = 1;
                                                        }
                                                        else
                                                        {
                                                            this.frame = 0;
                                                        }
                                                    }
                                                    if (this.velocity.X != 0f)
                                                    {
                                                        this.direction = Math.Sign(this.velocity.X);
                                                    }
                                                    this.spriteDirection = -this.direction;
                                                    this.velocity.Y = this.velocity.Y + 0.2f;
                                                    if (this.velocity.Y > 16f)
                                                    {
                                                        this.velocity.Y = 16f;
                                                        return;
                                                    }
                                                }
                                                else if (this.aiStyle == 64)
                                                {
                                                    int num614 = 10;
                                                    int num615 = 15;
                                                    float num616 = 1f;
                                                    int num617 = 150;
                                                    int num618 = 42;
                                                    if (this.type == ProjectileID.Cthulunado)
                                                    {
                                                        num614 = 16;
                                                        num615 = 16;
                                                        num616 = 1.5f;
                                                    }
                                                    if (this.velocity.X != 0f)
                                                    {
                                                        this.direction = (this.spriteDirection = -Math.Sign(this.velocity.X));
                                                    }
                                                    this.frameCounter++;
                                                    if (this.frameCounter > 2)
                                                    {
                                                        this.frame++;
                                                        this.frameCounter = 0;
                                                    }
                                                    if (this.frame >= 6)
                                                    {
                                                        this.frame = 0;
                                                    }
                                                    if (this.localAI[0] == 0f && Main.myPlayer == this.owner)
                                                    {
                                                        this.localAI[0] = 1f;
                                                        this.position.X = this.position.X + (float)(this.width / 2);
                                                        this.position.Y = this.position.Y + (float)(this.height / 2);
                                                        this.scale = ((float)(num614 + num615) - this.ai[1]) * num616 / (float)(num615 + num614);
                                                        this.width = (int)((float)num617 * this.scale);
                                                        this.height = (int)((float)num618 * this.scale);
                                                        this.position.X = this.position.X - (float)(this.width / 2);
                                                        this.position.Y = this.position.Y - (float)(this.height / 2);
                                                        this.netUpdate = true;
                                                    }
                                                    if (this.ai[1] != -1f)
                                                    {
                                                        this.scale = ((float)(num614 + num615) - this.ai[1]) * num616 / (float)(num615 + num614);
                                                        this.width = (int)((float)num617 * this.scale);
                                                        this.height = (int)((float)num618 * this.scale);
                                                    }
                                                    if (!Collision.SolidCollision(this.position, this.width, this.height))
                                                    {
                                                        this.alpha -= 30;
                                                        if (this.alpha < 60)
                                                        {
                                                            this.alpha = 60;
                                                        }
                                                        if (this.type == ProjectileID.Cthulunado && this.alpha < 100)
                                                        {
                                                            this.alpha = 100;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        this.alpha += 30;
                                                        if (this.alpha > 150)
                                                        {
                                                            this.alpha = 150;
                                                        }
                                                    }
                                                    if (this.ai[0] > 0f)
                                                    {
                                                        this.ai[0] -= 1f;
                                                    }
                                                    if (this.ai[0] == 1f && this.ai[1] > 0f && this.owner == Main.myPlayer)
                                                    {
                                                        this.netUpdate = true;
                                                        Vector2 center = base.Center;
                                                        center.Y -= (float)num618 * this.scale / 2f;
                                                        float num619 = ((float)(num614 + num615) - this.ai[1] + 1f) * num616 / (float)(num615 + num614);
                                                        center.Y -= (float)num618 * num619 / 2f;
                                                        center.Y += 2f;
                                                        Projectile.NewProjectile(center.X, center.Y, this.velocity.X, this.velocity.Y, this.type, this.damage, this.knockBack, this.owner, 10f, this.ai[1] - 1f);
                                                        int num620 = 4;
                                                        if (this.type == ProjectileID.Cthulunado)
                                                        {
                                                            num620 = 2;
                                                        }
                                                        if ((int)this.ai[1] % num620 == 0 && this.ai[1] != 0f)
                                                        {
                                                            int num621 = 372;
                                                            if (this.type == ProjectileID.Cthulunado)
                                                            {
                                                                num621 = 373;
                                                            }
                                                            int num622 = NPC.NewNPC((int)center.X, (int)center.Y, num621, 0, 0f, 0f, 0f, 0f, 255);
                                                            Main.npc[num622].velocity = this.velocity;
                                                            Main.npc[num622].netUpdate = true;
                                                            if (this.type == ProjectileID.Cthulunado)
                                                            {
                                                                Main.npc[num622].ai[2] = (float)this.width;
                                                                Main.npc[num622].ai[3] = -1.5f;
                                                            }
                                                        }
                                                    }
                                                    if (this.ai[0] <= 0f)
                                                    {
                                                        float num623 = 0.104719758f;
                                                        float num624 = (float)this.width / 5f;
                                                        if (this.type == ProjectileID.Cthulunado)
                                                        {
                                                            num624 *= 2f;
                                                        }
                                                        float num625 = (float)(Math.Cos((double)(num623 * -(double)this.ai[0])) - 0.5) * num624;
                                                        this.position.X = this.position.X - num625 * (float)(-(float)this.direction);
                                                        this.ai[0] -= 1f;
                                                        num625 = (float)(Math.Cos((double)(num623 * -(double)this.ai[0])) - 0.5) * num624;
                                                        this.position.X = this.position.X + num625 * (float)(-(float)this.direction);
                                                        return;
                                                    }
                                                }
                                                else if (this.aiStyle == 65)
                                                {
                                                    if (this.ai[1] > 0f)
                                                    {
                                                        int num626 = (int)this.ai[1] - 1;
                                                        if (num626 < 255)
                                                        {
                                                            this.localAI[0] += 1f;
                                                            if (this.localAI[0] > 10f)
                                                            {
                                                                this.alpha -= 5;
                                                                if (this.alpha < 100)
                                                                {
                                                                    this.alpha = 100;
                                                                }
                                                                this.rotation += this.velocity.X * 0.1f;
                                                                this.frame = (int)(this.localAI[0] / 3f) % 3;
                                                            }
                                                            Vector2 vector56 = Main.player[num626].Center - base.Center;
                                                            float num630 = 4f;
                                                            num630 += this.localAI[0] / 20f;
                                                            this.velocity = Vector2.Normalize(vector56) * num630;
                                                            if (vector56.Length() < 50f)
                                                            {
                                                                this.Kill();
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        float num631 = 0.209439516f;
                                                        float num632 = 4f;
                                                        float num633 = (float)(Math.Cos((double)(num631 * this.ai[0])) - 0.5) * num632;
                                                        this.velocity.Y = this.velocity.Y - num633;
                                                        this.ai[0] += 1f;
                                                        num633 = (float)(Math.Cos((double)(num631 * this.ai[0])) - 0.5) * num632;
                                                        this.velocity.Y = this.velocity.Y + num633;
                                                        this.localAI[0] += 1f;
                                                        if (this.localAI[0] > 10f)
                                                        {
                                                            this.alpha -= 5;
                                                            if (this.alpha < 100)
                                                            {
                                                                this.alpha = 100;
                                                            }
                                                            this.rotation += this.velocity.X * 0.1f;
                                                            this.frame = (int)(this.localAI[0] / 3f) % 3;
                                                        }
                                                    }
                                                    if (this.wet)
                                                    {
                                                        this.position.Y = this.position.Y - 16f;
                                                        this.Kill();
                                                        return;
                                                    }
                                                }
                                                else if (this.aiStyle == 66)
                                                {
                                                    float num634 = 0f;
                                                    float num635 = 0f;
                                                    float num636 = 0f;
                                                    float num637 = 0f;
                                                    if (this.type == ProjectileID.Retanimini || this.type == ProjectileID.Spazmamini)
                                                    {
                                                        num634 = 700f;
                                                        num635 = 800f;
                                                        num636 = 1200f;
                                                        num637 = 150f;
                                                        if (Main.player[this.owner].dead)
                                                        {
                                                            Main.player[this.owner].twinsMinion = false;
                                                        }
                                                        if (Main.player[this.owner].twinsMinion)
                                                        {
                                                            this.timeLeft = 2;
                                                        }
                                                    }
                                                    if (this.type == ProjectileID.DeadlySphere)
                                                    {
                                                        num634 = 1500f;
                                                        num635 = 900f;
                                                        num636 = 1500f;
                                                        num637 = 450f;
                                                        if (Main.player[this.owner].dead)
                                                        {
                                                            Main.player[this.owner].DeadlySphereMinion = false;
                                                        }
                                                        if (Main.player[this.owner].DeadlySphereMinion)
                                                        {
                                                            this.timeLeft = 2;
                                                        }
                                                    }
                                                    float num638 = 0.05f;
                                                    for (int num639 = 0; num639 < 1000; num639++)
                                                    {
                                                        bool flag23 = (Main.projectile[num639].type == ProjectileID.Retanimini || Main.projectile[num639].type == ProjectileID.Spazmamini) && (this.type == ProjectileID.Retanimini || this.type == ProjectileID.Spazmamini);
                                                        if (!flag23)
                                                        {
                                                            flag23 = (this.type == ProjectileID.DeadlySphere && Main.projectile[num639].type == ProjectileID.DeadlySphere);
                                                        }
                                                        if (num639 != this.whoAmI && Main.projectile[num639].active && Main.projectile[num639].owner == this.owner && flag23 && Math.Abs(this.position.X - Main.projectile[num639].position.X) + Math.Abs(this.position.Y - Main.projectile[num639].position.Y) < (float)this.width)
                                                        {
                                                            if (this.position.X < Main.projectile[num639].position.X)
                                                            {
                                                                this.velocity.X = this.velocity.X - num638;
                                                            }
                                                            else
                                                            {
                                                                this.velocity.X = this.velocity.X + num638;
                                                            }
                                                            if (this.position.Y < Main.projectile[num639].position.Y)
                                                            {
                                                                this.velocity.Y = this.velocity.Y - num638;
                                                            }
                                                            else
                                                            {
                                                                this.velocity.Y = this.velocity.Y + num638;
                                                            }
                                                        }
                                                    }
                                                    bool flag24 = false;
                                                    if (this.ai[0] == 2f && this.type == ProjectileID.Spazmamini)
                                                    {
                                                        this.ai[1] += 1f;
                                                        this.extraUpdates = 1;
                                                        this.rotation = this.velocity.ToRotation() + 3.14159274f;
                                                        this.frameCounter++;
                                                        if (this.frameCounter > 1)
                                                        {
                                                            this.frame++;
                                                            this.frameCounter = 0;
                                                        }
                                                        if (this.frame > 2)
                                                        {
                                                            this.frame = 0;
                                                        }
                                                        if (this.ai[1] > 40f)
                                                        {
                                                            this.ai[1] = 1f;
                                                            this.ai[0] = 0f;
                                                            this.extraUpdates = 0;
                                                            this.numUpdates = 0;
                                                            this.netUpdate = true;
                                                        }
                                                        else
                                                        {
                                                            flag24 = true;
                                                        }
                                                    }
                                                    if (this.type == ProjectileID.DeadlySphere && this.ai[0] >= 3f && this.ai[0] <= 5f)
                                                    {
                                                        int num640 = 2;
                                                        flag24 = true;
                                                        this.velocity *= 0.9f;
                                                        this.ai[1] += 1f;
                                                        int num641 = (int)this.ai[1] / num640 + (int)(this.ai[0] - 3f) * 8;
                                                        if (num641 < 4)
                                                        {
                                                            this.frame = 17 + num641;
                                                        }
                                                        else if (num641 < 5)
                                                        {
                                                            this.frame = 0;
                                                        }
                                                        else if (num641 < 8)
                                                        {
                                                            this.frame = 1 + num641 - 5;
                                                        }
                                                        else if (num641 < 11)
                                                        {
                                                            this.frame = 11 - num641;
                                                        }
                                                        else if (num641 < 12)
                                                        {
                                                            this.frame = 0;
                                                        }
                                                        else if (num641 < 16)
                                                        {
                                                            this.frame = num641 - 2;
                                                        }
                                                        else if (num641 < 20)
                                                        {
                                                            this.frame = 29 - num641;
                                                        }
                                                        else if (num641 < 21)
                                                        {
                                                            this.frame = 0;
                                                        }
                                                        else
                                                        {
                                                            this.frame = num641 - 4;
                                                        }
                                                        if (this.ai[1] > (float)(num640 * 8))
                                                        {
                                                            this.ai[0] -= 3f;
                                                            this.ai[1] = 0f;
                                                        }
                                                    }
                                                    if (this.type == ProjectileID.DeadlySphere && this.ai[0] >= 6f && this.ai[0] <= 8f)
                                                    {
                                                        this.ai[1] += 1f;
                                                        this.MaxUpdates = 2;
                                                        if (this.ai[0] == 7f)
                                                        {
                                                            this.rotation = this.velocity.ToRotation() + 3.14159274f;
                                                        }
                                                        else
                                                        {
                                                            this.rotation += 0.5235988f;
                                                        }
                                                        int num642 = 0;
                                                        switch ((int)this.ai[0])
                                                        {
                                                            case 6:
                                                                this.frame = 5;
                                                                num642 = 40;
                                                                break;
                                                            case 7:
                                                                this.frame = 13;
                                                                num642 = 30;
                                                                break;
                                                            case 8:
                                                                this.frame = 17;
                                                                num642 = 30;
                                                                break;
                                                        }
                                                        if (this.ai[1] > (float)num642)
                                                        {
                                                            this.ai[1] = 1f;
                                                            this.ai[0] -= 6f;
                                                            this.localAI[0] += 1f;
                                                            this.extraUpdates = 0;
                                                            this.numUpdates = 0;
                                                            this.netUpdate = true;
                                                        }
                                                        else
                                                        {
                                                            flag24 = true;
                                                        }
                                                    }
                                                    if (flag24)
                                                    {
                                                        return;
                                                    }
                                                    Vector2 vector58 = this.position;
                                                    bool flag25 = false;
                                                    if (this.ai[0] != 1f && (this.type == ProjectileID.Retanimini || this.type == ProjectileID.Spazmamini))
                                                    {
                                                        this.tileCollide = true;
                                                    }
                                                    if (this.type == ProjectileID.DeadlySphere && this.ai[0] < 9f)
                                                    {
                                                        this.tileCollide = true;
                                                    }
                                                    if (this.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)base.Center.X / 16, (int)base.Center.Y / 16)))
                                                    {
                                                        this.tileCollide = false;
                                                    }
                                                    for (int num646 = 0; num646 < 200; num646++)
                                                    {
                                                        NPC nPC2 = Main.npc[num646];
                                                        if (nPC2.CanBeChasedBy(this, false))
                                                        {
                                                            float num647 = Vector2.Distance(nPC2.Center, base.Center);
                                                            if (((Vector2.Distance(base.Center, vector58) > num647 && num647 < num634) || !flag25) && Collision.CanHitLine(this.position, this.width, this.height, nPC2.position, nPC2.width, nPC2.height))
                                                            {
                                                                num634 = num647;
                                                                vector58 = nPC2.Center;
                                                                flag25 = true;
                                                            }
                                                        }
                                                    }
                                                    float num648 = num635;
                                                    if (flag25)
                                                    {
                                                        num648 = num636;
                                                    }
                                                    Player player = Main.player[this.owner];
                                                    if (Vector2.Distance(player.Center, base.Center) > num648)
                                                    {
                                                        if (this.type == ProjectileID.Retanimini || this.type == ProjectileID.Spazmamini)
                                                        {
                                                            this.ai[0] = 1f;
                                                        }
                                                        if (this.type == ProjectileID.DeadlySphere && this.ai[0] < 9f)
                                                        {
                                                            this.ai[0] += (float)(3 * (3 - (int)(this.ai[0] / 3f)));
                                                        }
                                                        this.tileCollide = false;
                                                        this.netUpdate = true;
                                                    }
                                                    if ((this.type == ProjectileID.Spazmamini || this.type == ProjectileID.Retanimini) && flag25 && this.ai[0] == 0f)
                                                    {
                                                        Vector2 vector59 = vector58 - base.Center;
                                                        float num649 = vector59.Length();
                                                        vector59.Normalize();
                                                        if (num649 > 200f)
                                                        {
                                                            float num650 = 6f;
                                                            if (this.type == ProjectileID.Spazmamini)
                                                            {
                                                                num650 = 8f;
                                                            }
                                                            vector59 *= num650;
                                                            this.velocity = (this.velocity * 40f + vector59) / 41f;
                                                        }
                                                        else
                                                        {
                                                            float num651 = 4f;
                                                            vector59 *= -num651;
                                                            this.velocity = (this.velocity * 40f + vector59) / 41f;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        bool flag26 = false;
                                                        if (!flag26)
                                                        {
                                                            flag26 = (this.ai[0] == 1f && (this.type == ProjectileID.Retanimini || this.type == ProjectileID.Spazmamini));
                                                        }
                                                        if (!flag26)
                                                        {
                                                            flag26 = (this.ai[0] >= 9f && this.type == ProjectileID.DeadlySphere);
                                                        }
                                                        float num652 = 6f;
                                                        if (this.type == ProjectileID.DeadlySphere)
                                                        {
                                                            num652 = 12f;
                                                        }
                                                        if (flag26)
                                                        {
                                                            num652 = 15f;
                                                        }
                                                        Vector2 center2 = base.Center;
                                                        Vector2 vector60 = player.Center - center2 + new Vector2(0f, -60f);
                                                        float num653 = vector60.Length();
                                                        if (num653 > 200f && num652 < 8f)
                                                        {
                                                            num652 = 8f;
                                                        }
                                                        if (num653 < num637 && flag26 && !Collision.SolidCollision(this.position, this.width, this.height))
                                                        {
                                                            if (this.type == ProjectileID.Retanimini || this.type == ProjectileID.Spazmamini)
                                                            {
                                                                this.ai[0] = 0f;
                                                            }
                                                            if (this.type == ProjectileID.DeadlySphere)
                                                            {
                                                                this.ai[0] -= 9f;
                                                            }
                                                            this.netUpdate = true;
                                                        }
                                                        if (num653 > 2000f)
                                                        {
                                                            this.position.X = Main.player[this.owner].Center.X - (float)(this.width / 2);
                                                            this.position.Y = Main.player[this.owner].Center.Y - (float)(this.height / 2);
                                                            this.netUpdate = true;
                                                        }
                                                        if (num653 > 70f)
                                                        {
                                                            vector60.Normalize();
                                                            vector60 *= num652;
                                                            this.velocity = (this.velocity * 40f + vector60) / 41f;
                                                        }
                                                        else if (this.velocity.X == 0f && this.velocity.Y == 0f)
                                                        {
                                                            this.velocity.X = -0.15f;
                                                            this.velocity.Y = -0.05f;
                                                        }
                                                    }
                                                    if (this.type == ProjectileID.Spazmamini)
                                                    {
                                                        this.rotation = this.velocity.ToRotation() + 3.14159274f;
                                                    }
                                                    if (this.type == ProjectileID.Retanimini)
                                                    {
                                                        if (flag25)
                                                        {
                                                            this.rotation = (vector58 - base.Center).ToRotation() + 3.14159274f;
                                                        }
                                                        else
                                                        {
                                                            this.rotation = this.velocity.ToRotation() + 3.14159274f;
                                                        }
                                                    }
                                                    if (this.type == ProjectileID.DeadlySphere && (this.ai[0] < 3f || this.ai[0] >= 9f))
                                                    {
                                                        this.rotation += this.velocity.X * 0.04f;
                                                    }
                                                    if (this.type == ProjectileID.Spazmamini || this.type == ProjectileID.Retanimini)
                                                    {
                                                        this.frameCounter++;
                                                        if (this.frameCounter > 3)
                                                        {
                                                            this.frame++;
                                                            this.frameCounter = 0;
                                                        }
                                                        if (this.frame > 2)
                                                        {
                                                            this.frame = 0;
                                                        }
                                                    }
                                                    else if (this.type == ProjectileID.DeadlySphere)
                                                    {
                                                        if (this.ai[0] < 3f || this.ai[0] >= 9f)
                                                        {
                                                            this.frameCounter++;
                                                            if (this.frameCounter >= 24)
                                                            {
                                                                this.frameCounter = 0;
                                                            }
                                                            int num654 = this.frameCounter / 4;
                                                            this.frame = 4 + num654;
                                                            int num655 = (int)this.ai[0];
                                                            switch (num655)
                                                            {
                                                                case 0:
                                                                    break;
                                                                case 1:
                                                                    goto IL_1AB7D;
                                                                case 2:
                                                                    goto IL_1AB98;
                                                                default:
                                                                    switch (num655)
                                                                    {
                                                                        case 9:
                                                                            break;
                                                                        case 10:
                                                                            goto IL_1AB7D;
                                                                        case 11:
                                                                            goto IL_1AB98;
                                                                        default:
                                                                            goto IL_1ABC2;
                                                                    }
                                                                    break;
                                                            }
                                                            this.frame = 4 + num654;
                                                            goto IL_1ABC2;
                                                        IL_1AB7D:
                                                            num654 = this.frameCounter / 8;
                                                            this.frame = 14 + num654;
                                                            goto IL_1ABC2;
                                                        IL_1AB98:
                                                            num654 = this.frameCounter / 3;
                                                            if (num654 >= 4)
                                                            {
                                                                num654 -= 4;
                                                            }
                                                            this.frame = 17 + num654;
                                                        }
                                                    IL_1ABC2:

                                                        if (this.ai[1] > 0f && (this.type == ProjectileID.Retanimini || this.type == ProjectileID.Spazmamini))
                                                        {
                                                            this.ai[1] += (float)Main.rand.Next(1, 4);
                                                        }
                                                        if (this.ai[1] > 90f && this.type == ProjectileID.Retanimini)
                                                        {
                                                            this.ai[1] = 0f;
                                                            this.netUpdate = true;
                                                        }
                                                        if (this.ai[1] > 40f && this.type == ProjectileID.Spazmamini)
                                                        {
                                                            this.ai[1] = 0f;
                                                            this.netUpdate = true;
                                                        }
                                                        if (this.ai[1] > 0f && this.type == ProjectileID.DeadlySphere)
                                                        {
                                                            this.ai[1] += 1f;
                                                            int num659 = 10;
                                                            if (this.ai[1] > (float)num659)
                                                            {
                                                                this.ai[1] = 0f;
                                                                this.netUpdate = true;
                                                            }
                                                        }
                                                        if (this.ai[0] == 0f && (this.type == ProjectileID.Retanimini || this.type == ProjectileID.Spazmamini))
                                                        {
                                                            if (this.type == ProjectileID.Retanimini)
                                                            {
                                                                float num660 = 8f;
                                                                int num661 = 389;
                                                                if (flag25 && this.ai[1] == 0f)
                                                                {
                                                                    this.ai[1] += 1f;
                                                                    if (Main.myPlayer == this.owner && Collision.CanHitLine(this.position, this.width, this.height, vector58, 0, 0))
                                                                    {
                                                                        Vector2 vector62 = vector58 - base.Center;
                                                                        vector62.Normalize();
                                                                        vector62 *= num660;
                                                                        int num662 = Projectile.NewProjectile(base.Center.X, base.Center.Y, vector62.X, vector62.Y, num661, (int)((float)this.damage * 0.8f), 0f, Main.myPlayer, 0f, 0f);
                                                                        Main.projectile[num662].timeLeft = 300;
                                                                        this.netUpdate = true;
                                                                    }
                                                                }
                                                            }
                                                            if (this.type == ProjectileID.Spazmamini && this.ai[1] == 0f && flag25 && num634 < 500f)
                                                            {
                                                                this.ai[1] += 1f;
                                                                if (Main.myPlayer == this.owner)
                                                                {
                                                                    this.ai[0] = 2f;
                                                                    Vector2 vector63 = vector58 - base.Center;
                                                                    vector63.Normalize();
                                                                    this.velocity = vector63 * 8f;
                                                                    this.netUpdate = true;
                                                                    return;
                                                                }
                                                            }
                                                        }
                                                        else if (this.type == ProjectileID.DeadlySphere && this.ai[0] < 3f)
                                                        {
                                                            int num663 = 0;
                                                            switch ((int)this.ai[0])
                                                            {
                                                                case 0:
                                                                case 3:
                                                                case 6:
                                                                    num663 = 400;
                                                                    break;
                                                                case 1:
                                                                case 4:
                                                                case 7:
                                                                    num663 = 400;
                                                                    break;
                                                                case 2:
                                                                case 5:
                                                                case 8:
                                                                    num663 = 600;
                                                                    break;
                                                            }
                                                            if (this.ai[1] == 0f && flag25 && num634 < (float)num663)
                                                            {
                                                                this.ai[1] += 1f;
                                                                if (Main.myPlayer == this.owner)
                                                                {
                                                                    if (this.localAI[0] >= 3f)
                                                                    {
                                                                        this.ai[0] += 4f;
                                                                        if (this.ai[0] == 6f)
                                                                        {
                                                                            this.ai[0] = 3f;
                                                                        }
                                                                        this.localAI[0] = 0f;
                                                                        return;
                                                                    }
                                                                    this.ai[0] += 6f;
                                                                    Vector2 vector64 = vector58 - base.Center;
                                                                    vector64.Normalize();
                                                                    float num664 = (this.ai[0] == 8f) ? 12f : 10f;
                                                                    this.velocity = vector64 * num664;
                                                                    this.netUpdate = true;
                                                                    return;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                    else if (this.aiStyle == 67)
                                                    {
                                                        Player player2 = Main.player[this.owner];
                                                        if (!player2.active)
                                                        {
                                                            this.active = false;
                                                            return;
                                                        }
                                                        bool flag27 = this.type == ProjectileID.OneEyedPirate || this.type == ProjectileID.SoulscourgePirate || this.type == ProjectileID.PirateCaptain;
                                                        if (flag27)
                                                        {
                                                            if (player2.dead)
                                                            {
                                                                player2.pirateMinion = false;
                                                            }
                                                            if (player2.pirateMinion)
                                                            {
                                                                this.timeLeft = 2;
                                                            }
                                                        }
                                                        if (this.type == ProjectileID.CrimsonHeart)
                                                        {
                                                            if (player2.dead)
                                                            {
                                                                player2.crimsonHeart = false;
                                                            }
                                                            if (player2.crimsonHeart)
                                                            {
                                                                this.timeLeft = 2;
                                                            }
                                                        }
                                                        Vector2 vector65 = player2.Center;
                                                        if (flag27)
                                                        {
                                                            vector65.X -= (float)((15 + player2.width / 2) * player2.direction);
                                                            vector65.X -= (float)(this.minionPos * 40 * player2.direction);
                                                        }
                                                        if (this.type == ProjectileID.CrimsonHeart)
                                                        {
                                                            vector65.X -= (float)((15 + player2.width / 2) * player2.direction);
                                                            vector65.X -= (float)(40 * player2.direction);
                                                        }
                                                        if (this.type == ProjectileID.CrimsonHeart)
                                                        {
                                                            int num665 = 6;
                                                            if (this.frame == 0 || this.frame == 2)
                                                            {
                                                                num665 = 12;
                                                            }
                                                            if (++this.frameCounter >= num665)
                                                            {
                                                                this.frameCounter = 0;
                                                                if (++this.frame >= Main.projFrames[this.type])
                                                                {
                                                                    this.frame = 0;
                                                                }
                                                            }
                                                            this.rotation += this.velocity.X / 20f;
                                                            Vector2 vector66 = (-Vector2.UnitY).RotatedBy((double)this.rotation, default(Vector2)).RotatedBy((double)((float)this.direction * 0.2f), default(Vector2));
                                                        }
                                                        bool flag28 = true;
                                                        if (this.type == ProjectileID.CrimsonHeart)
                                                        {
                                                            flag28 = false;
                                                        }
                                                        int num667 = -1;
                                                        float num668 = 450f;
                                                        if (flag27)
                                                        {
                                                            num668 = 800f;
                                                        }
                                                        int num669 = 15;
                                                        if (this.ai[0] == 0f && flag28)
                                                        {
                                                            for (int num670 = 0; num670 < 200; num670++)
                                                            {
                                                                NPC nPC3 = Main.npc[num670];
                                                                if (nPC3.CanBeChasedBy(this, false))
                                                                {
                                                                    float num671 = (nPC3.Center - base.Center).Length();
                                                                    if (num671 < num668)
                                                                    {
                                                                        num667 = num670;
                                                                        num668 = num671;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        if (this.ai[0] == 1f)
                                                        {
                                                            this.tileCollide = false;
                                                            float num672 = 0.2f;
                                                            float num673 = 10f;
                                                            int num674 = 200;
                                                            if (num673 < Math.Abs(player2.velocity.X) + Math.Abs(player2.velocity.Y))
                                                            {
                                                                num673 = Math.Abs(player2.velocity.X) + Math.Abs(player2.velocity.Y);
                                                            }
                                                            Vector2 vector67 = player2.Center - base.Center;
                                                            float num675 = vector67.Length();
                                                            if (num675 > 2000f)
                                                            {
                                                                this.position = player2.Center - new Vector2((float)this.width, (float)this.height) / 2f;
                                                            }
                                                            if (num675 < (float)num674 && player2.velocity.Y == 0f && this.position.Y + (float)this.height <= player2.position.Y + (float)player2.height && !Collision.SolidCollision(this.position, this.width, this.height))
                                                            {
                                                                this.ai[0] = 0f;
                                                                this.netUpdate = true;
                                                                if (this.velocity.Y < -6f)
                                                                {
                                                                    this.velocity.Y = -6f;
                                                                }
                                                            }
                                                            if (num675 >= 60f)
                                                            {
                                                                vector67.Normalize();
                                                                vector67 *= num673;
                                                                if (this.velocity.X < vector67.X)
                                                                {
                                                                    this.velocity.X = this.velocity.X + num672;
                                                                    if (this.velocity.X < 0f)
                                                                    {
                                                                        this.velocity.X = this.velocity.X + num672 * 1.5f;
                                                                    }
                                                                }
                                                                if (this.velocity.X > vector67.X)
                                                                {
                                                                    this.velocity.X = this.velocity.X - num672;
                                                                    if (this.velocity.X > 0f)
                                                                    {
                                                                        this.velocity.X = this.velocity.X - num672 * 1.5f;
                                                                    }
                                                                }
                                                                if (this.velocity.Y < vector67.Y)
                                                                {
                                                                    this.velocity.Y = this.velocity.Y + num672;
                                                                    if (this.velocity.Y < 0f)
                                                                    {
                                                                        this.velocity.Y = this.velocity.Y + num672 * 1.5f;
                                                                    }
                                                                }
                                                                if (this.velocity.Y > vector67.Y)
                                                                {
                                                                    this.velocity.Y = this.velocity.Y - num672;
                                                                    if (this.velocity.Y > 0f)
                                                                    {
                                                                        this.velocity.Y = this.velocity.Y - num672 * 1.5f;
                                                                    }
                                                                }
                                                            }
                                                            if (this.velocity.X != 0f)
                                                            {
                                                                this.spriteDirection = Math.Sign(this.velocity.X);
                                                            }
                                                            if (flag27)
                                                            {
                                                                this.frameCounter++;
                                                                if (this.frameCounter > 3)
                                                                {
                                                                    this.frame++;
                                                                    this.frameCounter = 0;
                                                                }
                                                                if (this.frame < 10 | this.frame > 13)
                                                                {
                                                                    this.frame = 10;
                                                                }
                                                                this.rotation = this.velocity.X * 0.1f;
                                                            }
                                                        }
                                                        if (this.ai[0] == 2f)
                                                        {
                                                            this.friendly = true;
                                                            this.spriteDirection = this.direction;
                                                            this.rotation = 0f;
                                                            this.frame = 4 + (int)((float)num669 - this.ai[1]) / (num669 / 3);
                                                            if (this.velocity.Y != 0f)
                                                            {
                                                                this.frame += 3;
                                                            }
                                                            this.velocity.Y = this.velocity.Y + 0.4f;
                                                            if (this.velocity.Y > 10f)
                                                            {
                                                                this.velocity.Y = 10f;
                                                            }
                                                            this.ai[1] -= 1f;
                                                            if (this.ai[1] <= 0f)
                                                            {
                                                                this.ai[1] = 0f;
                                                                this.ai[0] = 0f;
                                                                this.friendly = false;
                                                                this.netUpdate = true;
                                                                return;
                                                            }
                                                        }
                                                        if (num667 >= 0)
                                                        {
                                                            float num676 = 400f;
                                                            float num677 = 20f;
                                                            if (flag27)
                                                            {
                                                                num676 = 700f;
                                                            }
                                                            if ((double)this.position.Y > Main.worldSurface * 16.0)
                                                            {
                                                                num676 *= 0.7f;
                                                            }
                                                            NPC nPC4 = Main.npc[num667];
                                                            Vector2 center3 = nPC4.Center;
                                                            float num678 = (center3 - base.Center).Length();
                                                            Collision.CanHit(this.position, this.width, this.height, nPC4.position, nPC4.width, nPC4.height);
                                                            if (num678 < num676)
                                                            {
                                                                vector65 = center3;
                                                                if (center3.Y < base.Center.Y - 30f && this.velocity.Y == 0f)
                                                                {
                                                                    float num679 = Math.Abs(center3.Y - base.Center.Y);
                                                                    if (num679 < 120f)
                                                                    {
                                                                        this.velocity.Y = -10f;
                                                                    }
                                                                    else if (num679 < 210f)
                                                                    {
                                                                        this.velocity.Y = -13f;
                                                                    }
                                                                    else if (num679 < 270f)
                                                                    {
                                                                        this.velocity.Y = -15f;
                                                                    }
                                                                    else if (num679 < 310f)
                                                                    {
                                                                        this.velocity.Y = -17f;
                                                                    }
                                                                    else if (num679 < 380f)
                                                                    {
                                                                        this.velocity.Y = -18f;
                                                                    }
                                                                }
                                                            }
                                                            if (num678 < num677)
                                                            {
                                                                this.ai[0] = 2f;
                                                                this.ai[1] = (float)num669;
                                                                this.netUpdate = true;
                                                            }
                                                        }
                                                        if (this.ai[0] == 0f && num667 < 0)
                                                        {
                                                            float num680 = 500f;
                                                            if (this.type == ProjectileID.CrimsonHeart)
                                                            {
                                                                num680 = 200f;
                                                            }
                                                            if (Main.player[this.owner].rocketDelay2 > 0)
                                                            {
                                                                this.ai[0] = 1f;
                                                                this.netUpdate = true;
                                                            }
                                                            Vector2 vector68 = player2.Center - base.Center;
                                                            if (vector68.Length() > 2000f)
                                                            {
                                                                this.position = player2.Center - new Vector2((float)this.width, (float)this.height) / 2f;
                                                            }
                                                            else if (vector68.Length() > num680 || Math.Abs(vector68.Y) > 300f)
                                                            {
                                                                this.ai[0] = 1f;
                                                                this.netUpdate = true;
                                                                if (this.velocity.Y > 0f && vector68.Y < 0f)
                                                                {
                                                                    this.velocity.Y = 0f;
                                                                }
                                                                if (this.velocity.Y < 0f && vector68.Y > 0f)
                                                                {
                                                                    this.velocity.Y = 0f;
                                                                }
                                                            }
                                                        }
                                                        if (this.ai[0] == 0f)
                                                        {
                                                            this.tileCollide = true;
                                                            float num681 = 0.5f;
                                                            float num682 = 4f;
                                                            float num683 = 4f;
                                                            float num684 = 0.1f;
                                                            if (num683 < Math.Abs(player2.velocity.X) + Math.Abs(player2.velocity.Y))
                                                            {
                                                                num683 = Math.Abs(player2.velocity.X) + Math.Abs(player2.velocity.Y);
                                                                num681 = 0.7f;
                                                            }
                                                            int num685 = 0;
                                                            bool flag29 = false;
                                                            float num686 = vector65.X - base.Center.X;
                                                            if (Math.Abs(num686) > 5f)
                                                            {
                                                                if (num686 < 0f)
                                                                {
                                                                    num685 = -1;
                                                                    if (this.velocity.X > -num682)
                                                                    {
                                                                        this.velocity.X = this.velocity.X - num681;
                                                                    }
                                                                    else
                                                                    {
                                                                        this.velocity.X = this.velocity.X - num684;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    num685 = 1;
                                                                    if (this.velocity.X < num682)
                                                                    {
                                                                        this.velocity.X = this.velocity.X + num681;
                                                                    }
                                                                    else
                                                                    {
                                                                        this.velocity.X = this.velocity.X + num684;
                                                                    }
                                                                }
                                                                flag29 = true;
                                                            }
                                                            else
                                                            {
                                                                this.velocity.X = this.velocity.X * 0.9f;
                                                                if (Math.Abs(this.velocity.X) < num681 * 2f)
                                                                {
                                                                    this.velocity.X = 0f;
                                                                }
                                                            }
                                                            if (num685 != 0)
                                                            {
                                                                int num687 = (int)(this.position.X + (float)(this.width / 2)) / 16;
                                                                int num688 = (int)this.position.Y / 16;
                                                                num687 += num685;
                                                                num687 += (int)this.velocity.X;
                                                                for (int num689 = num688; num689 < num688 + this.height / 16 + 1; num689++)
                                                                {
                                                                    if (WorldGen.SolidTile(num687, num689))
                                                                    {
                                                                        flag29 = true;
                                                                    }
                                                                }
                                                            }
                                                            if (this.type == ProjectileID.CrimsonHeart && this.velocity.X != 0f)
                                                            {
                                                                flag29 = true;
                                                            }
                                                            Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, 1, false, 0);
                                                            if (this.velocity.Y == 0f && flag29)
                                                            {
                                                                int num690 = 0;
                                                                while (num690 < 3)
                                                                {
                                                                    int num691 = (int)(this.position.X + (float)(this.width / 2)) / 16;
                                                                    if (num690 == 0)
                                                                    {
                                                                        num691 = (int)this.position.X / 16;
                                                                    }
                                                                    if (num690 == 2)
                                                                    {
                                                                        num691 = (int)(this.position.X + (float)this.width) / 16;
                                                                    }
                                                                    int num692 = (int)(this.position.Y + (float)this.height) / 16 + 1;
                                                                    if (WorldGen.SolidTile(num691, num692) || Main.tile[num691, num692].halfBrick())
                                                                    {
                                                                        goto Block_1931;
                                                                    }
                                                                    if (Main.tile[num691, num692].slope() > 0)
                                                                    {
                                                                        goto Block_1931;
                                                                    }
                                                                IL_1C28D:
                                                                    num690++;
                                                                    continue;
                                                                Block_1931:
                                                                    try
                                                                    {
                                                                        num691 = (int)(this.position.X + (float)(this.width / 2)) / 16;
                                                                        num692 = (int)(this.position.Y + (float)(this.height / 2)) / 16;
                                                                        num691 += num685;
                                                                        num691 += (int)this.velocity.X;
                                                                        if (!WorldGen.SolidTile(num691, num692 - 1) && !WorldGen.SolidTile(num691, num692 - 2))
                                                                        {
                                                                            this.velocity.Y = -5.1f;
                                                                        }
                                                                        else if (!WorldGen.SolidTile(num691, num692 - 2))
                                                                        {
                                                                            this.velocity.Y = -7.1f;
                                                                        }
                                                                        else if (WorldGen.SolidTile(num691, num692 - 5))
                                                                        {
                                                                            this.velocity.Y = -11.1f;
                                                                        }
                                                                        else if (WorldGen.SolidTile(num691, num692 - 4))
                                                                        {
                                                                            this.velocity.Y = -10.1f;
                                                                        }
                                                                        else
                                                                        {
                                                                            this.velocity.Y = -9.1f;
                                                                        }
                                                                    }
                                                                    catch
                                                                    {
                                                                        this.velocity.Y = -9.1f;
                                                                    }
                                                                    goto IL_1C28D;
                                                                }
                                                            }
                                                            if (this.velocity.X > num683)
                                                            {
                                                                this.velocity.X = num683;
                                                            }
                                                            if (this.velocity.X < -num683)
                                                            {
                                                                this.velocity.X = -num683;
                                                            }
                                                            if (this.velocity.X < 0f)
                                                            {
                                                                this.direction = -1;
                                                            }
                                                            if (this.velocity.X > 0f)
                                                            {
                                                                this.direction = 1;
                                                            }
                                                            if (this.velocity.X > num681 && num685 == 1)
                                                            {
                                                                this.direction = 1;
                                                            }
                                                            if (this.velocity.X < -num681 && num685 == -1)
                                                            {
                                                                this.direction = -1;
                                                            }
                                                            this.spriteDirection = this.direction;
                                                            if (flag27)
                                                            {
                                                                this.rotation = 0f;
                                                                if (this.velocity.Y == 0f)
                                                                {
                                                                    if (this.velocity.X == 0f)
                                                                    {
                                                                        this.frame = 0;
                                                                        this.frameCounter = 0;
                                                                    }
                                                                    else if (Math.Abs(this.velocity.X) >= 0.5f)
                                                                    {
                                                                        this.frameCounter += (int)Math.Abs(this.velocity.X);
                                                                        this.frameCounter++;
                                                                        if (this.frameCounter > 10)
                                                                        {
                                                                            this.frame++;
                                                                            this.frameCounter = 0;
                                                                        }
                                                                        if (this.frame >= 4)
                                                                        {
                                                                            this.frame = 0;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        this.frame = 0;
                                                                        this.frameCounter = 0;
                                                                    }
                                                                }
                                                                else if (this.velocity.Y != 0f)
                                                                {
                                                                    this.frameCounter = 0;
                                                                    this.frame = 14;
                                                                }
                                                            }
                                                            this.velocity.Y = this.velocity.Y + 0.4f;
                                                            if (this.velocity.Y > 10f)
                                                            {
                                                                this.velocity.Y = 10f;
                                                            }
                                                        }
                                                        if (flag27)
                                                        {
                                                            this.localAI[0] += 1f;
                                                            if (this.velocity.X == 0f)
                                                            {
                                                                this.localAI[0] += 1f;
                                                            }
                                                            if (this.localAI[0] >= (float)Main.rand.Next(900, 1200))
                                                            {
                                                                return;
                                                            }
                                                        }
                                                    }
                                                    else if (this.aiStyle == 68)
                                                    {
                                                        this.rotation += 0.25f * (float)this.direction;
                                                        this.ai[0] += 1f;
                                                        if (this.ai[0] >= 3f)
                                                        {
                                                            this.alpha -= 40;
                                                            if (this.alpha < 0)
                                                            {
                                                                this.alpha = 0;
                                                            }
                                                        }
                                                        if (this.ai[0] >= 15f)
                                                        {
                                                            this.velocity.Y = this.velocity.Y + 0.2f;
                                                            if (this.velocity.Y > 16f)
                                                            {
                                                                this.velocity.Y = 16f;
                                                            }
                                                            this.velocity.X = this.velocity.X * 0.99f;
                                                        }
                                                        if (this.alpha == 0)
                                                        {
                                                        }
                                                        this.spriteDirection = this.direction;
                                                        if (this.owner == Main.myPlayer && this.timeLeft <= 3)
                                                        {
                                                            this.tileCollide = false;
                                                            this.alpha = 255;
                                                            this.position.X = this.position.X + (float)(this.width / 2);
                                                            this.position.Y = this.position.Y + (float)(this.height / 2);
                                                            this.width = 80;
                                                            this.height = 80;
                                                            this.position.X = this.position.X - (float)(this.width / 2);
                                                            this.position.Y = this.position.Y - (float)(this.height / 2);
                                                            this.knockBack = 8f;
                                                        }
                                                        if (this.wet && this.timeLeft > 3)
                                                        {
                                                            this.timeLeft = 3;
                                                            return;
                                                        }
                                                    }
                                                    else if (this.aiStyle == 69)
                                                    {
                                                        Vector2 vector70 = Main.player[this.owner].Center - base.Center;
                                                        this.rotation = vector70.ToRotation() - 1.57f;
                                                        if (Main.player[this.owner].dead)
                                                        {
                                                            this.Kill();
                                                            return;
                                                        }
                                                        Main.player[this.owner].itemAnimation = 10;
                                                        Main.player[this.owner].itemTime = 10;
                                                        if (vector70.X < 0f)
                                                        {
                                                            Main.player[this.owner].ChangeDir(1);
                                                            this.direction = 1;
                                                        }
                                                        else
                                                        {
                                                            Main.player[this.owner].ChangeDir(-1);
                                                            this.direction = -1;
                                                        }
                                                        Main.player[this.owner].itemRotation = (vector70 * -1f * (float)this.direction).ToRotation();
                                                        this.spriteDirection = ((vector70.X > 0f) ? -1 : 1);
                                                        if (this.ai[0] == 0f && vector70.Length() > 400f)
                                                        {
                                                            this.ai[0] = 1f;
                                                        }
                                                        if (this.ai[0] == 1f || this.ai[0] == 2f)
                                                        {
                                                            float num699 = vector70.Length();
                                                            if (num699 > 1500f)
                                                            {
                                                                this.Kill();
                                                                return;
                                                            }
                                                            if (num699 > 600f)
                                                            {
                                                                this.ai[0] = 2f;
                                                            }
                                                            this.tileCollide = false;
                                                            float num700 = 20f;
                                                            if (this.ai[0] == 2f)
                                                            {
                                                                num700 = 40f;
                                                            }
                                                            this.velocity = Vector2.Normalize(vector70) * num700;
                                                            if (vector70.Length() < num700)
                                                            {
                                                                this.Kill();
                                                                return;
                                                            }
                                                        }
                                                        this.ai[1] += 1f;
                                                        if (this.ai[1] > 5f)
                                                        {
                                                            this.alpha = 0;
                                                        }
                                                        if ((int)this.ai[1] % 4 == 0 && this.owner == Main.myPlayer)
                                                        {
                                                            Vector2 vector71 = vector70 * -1f;
                                                            vector71.Normalize();
                                                            vector71 *= (float)Main.rand.Next(45, 65) * 0.1f;
                                                            vector71 = vector71.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default(Vector2));
                                                            Projectile.NewProjectile(base.Center.X, base.Center.Y, vector71.X, vector71.Y, 405, this.damage, this.knockBack, this.owner, -10f, 0f);
                                                            return;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (this.aiStyle == 70)
                                                        {
                                                            if (this.ai[0] == 0f)
                                                            {
                                                                float num701 = 500f;
                                                                int num702 = -1;
                                                                for (int num703 = 0; num703 < 200; num703++)
                                                                {
                                                                    NPC nPC5 = Main.npc[num703];
                                                                    if (nPC5.CanBeChasedBy(this, false) && Collision.CanHit(this.position, this.width, this.height, nPC5.position, nPC5.width, nPC5.height))
                                                                    {
                                                                        float num704 = (nPC5.Center - base.Center).Length();
                                                                        if (num704 < num701)
                                                                        {
                                                                            num702 = num703;
                                                                            num701 = num704;
                                                                        }
                                                                    }
                                                                }
                                                                this.ai[0] = (float)(num702 + 1);
                                                                if (this.ai[0] == 0f)
                                                                {
                                                                    this.ai[0] = -15f;
                                                                }
                                                                if (this.ai[0] > 0f)
                                                                {
                                                                    float num705 = (float)Main.rand.Next(35, 75) / 30f;
                                                                    this.velocity = (this.velocity * 20f + Vector2.Normalize(Main.npc[(int)this.ai[0] - 1].Center - base.Center + new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101))) * num705) / 21f;
                                                                    this.netUpdate = true;
                                                                }
                                                            }
                                                            else if (this.ai[0] > 0f)
                                                            {
                                                                Vector2 vector72 = Vector2.Normalize(Main.npc[(int)this.ai[0] - 1].Center - base.Center);
                                                                this.velocity = (this.velocity * 40f + vector72 * 12f) / 41f;
                                                            }
                                                            else
                                                            {
                                                                this.ai[0] += 1f;
                                                                this.alpha -= 25;
                                                                if (this.alpha < 50)
                                                                {
                                                                    this.alpha = 50;
                                                                }
                                                                this.velocity *= 0.95f;
                                                            }
                                                            if (this.ai[1] == 0f)
                                                            {
                                                                this.ai[1] = (float)Main.rand.Next(80, 121) / 100f;
                                                                this.netUpdate = true;
                                                            }
                                                            this.scale = this.ai[1];
                                                            return;
                                                        }
                                                        if (this.aiStyle == 71)
                                                        {
                                                            this.localAI[1] += 1f;
                                                            if (this.localAI[1] > 10f && Main.rand.Next(3) == 0)
                                                            {
                                                                this.alpha -= 5;
                                                                if (this.alpha < 50)
                                                                {
                                                                    this.alpha = 50;
                                                                }
                                                                this.rotation += this.velocity.X * 0.1f;
                                                                this.frame = (int)(this.localAI[1] / 3f) % 3;
                                                            }
                                                            int num709 = -1;
                                                            Vector2 vector75 = base.Center;
                                                            float num710 = 500f;
                                                            if (this.localAI[0] > 0f)
                                                            {
                                                                this.localAI[0] -= 1f;
                                                            }
                                                            if (this.ai[0] == 0f && this.localAI[0] == 0f)
                                                            {
                                                                for (int num711 = 0; num711 < 200; num711++)
                                                                {
                                                                    NPC nPC6 = Main.npc[num711];
                                                                    if (nPC6.CanBeChasedBy(this, false) && (this.ai[0] == 0f || this.ai[0] == (float)(num711 + 1)))
                                                                    {
                                                                        Vector2 center4 = nPC6.Center;
                                                                        float num712 = Vector2.Distance(center4, vector75);
                                                                        if (num712 < num710 && Collision.CanHit(this.position, this.width, this.height, nPC6.position, nPC6.width, nPC6.height))
                                                                        {
                                                                            num710 = num712;
                                                                            vector75 = center4;
                                                                            num709 = num711;
                                                                        }
                                                                    }
                                                                }
                                                                if (num709 >= 0)
                                                                {
                                                                    this.ai[0] = (float)(num709 + 1);
                                                                    this.netUpdate = true;
                                                                }
                                                            }
                                                            if (this.localAI[0] == 0f && this.ai[0] == 0f)
                                                            {
                                                                this.localAI[0] = 30f;
                                                            }
                                                            bool flag30 = false;
                                                            if (this.ai[0] != 0f)
                                                            {
                                                                int num713 = (int)(this.ai[0] - 1f);
                                                                if (Main.npc[num713].active && !Main.npc[num713].dontTakeDamage && Main.npc[num713].immune[this.owner] == 0)
                                                                {
                                                                    float num714 = Main.npc[num713].position.X + (float)(Main.npc[num713].width / 2);
                                                                    float num715 = Main.npc[num713].position.Y + (float)(Main.npc[num713].height / 2);
                                                                    float num716 = Math.Abs(this.position.X + (float)(this.width / 2) - num714) + Math.Abs(this.position.Y + (float)(this.height / 2) - num715);
                                                                    if (num716 < 1000f)
                                                                    {
                                                                        flag30 = true;
                                                                        vector75 = Main.npc[num713].Center;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    this.ai[0] = 0f;
                                                                    flag30 = false;
                                                                    this.netUpdate = true;
                                                                }
                                                            }
                                                            if (flag30)
                                                            {
                                                                Vector2 v = vector75 - base.Center;
                                                                float num717 = this.velocity.ToRotation();
                                                                float num718 = v.ToRotation();
                                                                double num719 = (double)(num718 - num717);
                                                                if (num719 > 3.1415926535897931)
                                                                {
                                                                    num719 -= 6.2831853071795862;
                                                                }
                                                                if (num719 < -3.1415926535897931)
                                                                {
                                                                    num719 += 6.2831853071795862;
                                                                }
                                                                this.velocity = this.velocity.RotatedBy(num719 * 0.10000000149011612, default(Vector2));
                                                            }
                                                            float num720 = this.velocity.Length();
                                                            this.velocity.Normalize();
                                                            this.velocity *= num720 + 0.0025f;
                                                            return;
                                                        }
                                                        if (this.aiStyle == 72)
                                                        {
                                                            this.localAI[0] += 1f;
                                                            if (this.localAI[0] > 5f)
                                                            {
                                                                this.alpha -= 25;
                                                                if (this.alpha < 50)
                                                                {
                                                                    this.alpha = 50;
                                                                }
                                                            }
                                                            this.velocity *= 0.96f;
                                                            if (this.ai[1] == 0f)
                                                            {
                                                                this.ai[1] = (float)Main.rand.Next(60, 121) / 100f;
                                                                this.netUpdate = true;
                                                            }
                                                            this.scale = this.ai[1];
                                                            this.position = base.Center;
                                                            int num721 = 14;
                                                            int num722 = 14;
                                                            this.width = (int)((float)num721 * this.ai[1]);
                                                            this.height = (int)((float)num722 * this.ai[1]);
                                                            this.position -= new Vector2((float)(this.width / 2), (float)(this.height / 2));
                                                            return;
                                                        }
                                                        if (this.aiStyle == 73)
                                                        {
                                                            int num723 = (int)this.ai[0];
                                                            int num724 = (int)this.ai[1];
                                                            Tile tile = Main.tile[num723, num724];
                                                            if (tile == null || !tile.active() || tile.type != TileID.FireworkFountain)
                                                            {
                                                                this.Kill();
                                                                return;
                                                            }
                                                            float num725 = 2f;
                                                            float num726 = (float)this.timeLeft / 60f;
                                                            if (num726 < 1f)
                                                            {
                                                                num725 *= num726;
                                                            }
                                                            if (this.type == ProjectileID.FireworkFountainRainbow)
                                                            {
                                                                return;
                                                            }
                                                        }
                                                        else if (this.aiStyle == 74)
                                                        {
                                                            if (this.extraUpdates == 1)
                                                            {
                                                                this.localAI[0] *= this.localAI[1];
                                                                this.localAI[1] -= 0.001f;
                                                                if ((double)this.localAI[0] < 0.01)
                                                                {
                                                                    this.Kill();
                                                                    return;
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (this.aiStyle == 75)
                                                            {
                                                                this.AI_075();
                                                                return;
                                                            }
                                                            if (this.aiStyle == 76)
                                                            {
                                                                Player player3 = Main.player[this.owner];
                                                                player3.heldProj = this.whoAmI;
                                                                if (this.type == ProjectileID.ScutlixLaserCrosshair)
                                                                {
                                                                    if (player3.mount.Type != 9)
                                                                    {
                                                                        this.Kill();
                                                                        return;
                                                                    }
                                                                }
                                                                else if (this.type == ProjectileID.DrillMountCrosshair && player3.mount.Type != 8)
                                                                {
                                                                    this.Kill();
                                                                    return;
                                                                }
                                                                if (Main.myPlayer != this.owner)
                                                                {
                                                                    this.position.X = player3.position.X + this.ai[0];
                                                                    this.position.Y = player3.position.Y + this.ai[1];
                                                                    if (this.type == ProjectileID.ScutlixLaserCrosshair)
                                                                    {
                                                                        if (!player3.mount.AbilityCharging)
                                                                        {
                                                                            player3.mount.StartAbilityCharge(player3);
                                                                        }
                                                                    }
                                                                    else if (this.type == ProjectileID.DrillMountCrosshair && !player3.mount.AbilityActive)
                                                                    {
                                                                        player3.mount.UseAbility(player3, this.position, false);
                                                                    }
                                                                    player3.mount.AimAbility(player3, this.position);
                                                                    return;
                                                                }
                                                                this.position.X = Main.screenPosition.X + (float)Main.mouseX;
                                                                this.position.Y = Main.screenPosition.Y + (float)Main.mouseY;
                                                                if (this.ai[0] != this.position.X - player3.position.X || this.ai[1] != this.position.Y - player3.position.Y)
                                                                {
                                                                    this.netUpdate = true;
                                                                }
                                                                this.ai[0] = this.position.X - player3.position.X;
                                                                this.ai[1] = this.position.Y - player3.position.Y;
                                                                player3.mount.AimAbility(player3, this.position);
                                                                if (!player3.channel)
                                                                {
                                                                    player3.mount.UseAbility(player3, this.position, false);
                                                                    this.Kill();
                                                                    return;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if (this.aiStyle == 77)
                                                                {
                                                                    if (this.ai[1] == 1f)
                                                                    {
                                                                        this.friendly = false;
                                                                        if (this.alpha < 255)
                                                                        {
                                                                            this.alpha += 51;
                                                                        }
                                                                        if (this.alpha >= 255)
                                                                        {
                                                                            this.alpha = 255;
                                                                            this.Kill();
                                                                            return;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        if (this.alpha > 0)
                                                                        {
                                                                            this.alpha -= 50;
                                                                        }
                                                                        if (this.alpha < 0)
                                                                        {
                                                                            this.alpha = 0;
                                                                        }
                                                                    }
                                                                    float num739 = 30f;
                                                                    float num740 = num739 * 4f;
                                                                    this.ai[0] += 1f;
                                                                    if (this.ai[0] > num740)
                                                                    {
                                                                        this.ai[0] = 0f;
                                                                    }
                                                                    Vector2 vector81 = -Vector2.UnitY.RotatedBy((double)(6.28318548f * this.ai[0] / num739), default(Vector2));
                                                                    float val = 0.75f + vector81.Y * 0.25f;
                                                                    float val2 = 0.8f - vector81.Y * 0.2f;
                                                                    float num741 = Math.Max(val, val2);
                                                                    this.position += new Vector2((float)this.width, (float)this.height) / 2f;
                                                                    this.width = (this.height = (int)(80f * num741));
                                                                    this.position -= new Vector2((float)this.width, (float)this.height) / 2f;
                                                                    this.frameCounter++;
                                                                    if (this.frameCounter >= 3)
                                                                    {
                                                                        this.frameCounter = 0;
                                                                        this.frame++;
                                                                        if (this.frame >= 4)
                                                                        {
                                                                            this.frame = 0;
                                                                        }
                                                                    }
                                                                    return;
                                                                }
                                                                if (this.aiStyle == 78)
                                                                {
                                                                    if (this.alpha > 0)
                                                                    {
                                                                        this.alpha -= 30;
                                                                    }
                                                                    if (this.alpha < 0)
                                                                    {
                                                                        this.alpha = 0;
                                                                    }
                                                                    Vector2 v2 = this.ai[0].ToRotationVector2();
                                                                    float num747 = this.velocity.ToRotation();
                                                                    float num748 = v2.ToRotation();
                                                                    double num749 = (double)(num748 - num747);
                                                                    if (num749 > 3.1415926535897931)
                                                                    {
                                                                        num749 -= 6.2831853071795862;
                                                                    }
                                                                    if (num749 < -3.1415926535897931)
                                                                    {
                                                                        num749 += 6.2831853071795862;
                                                                    }
                                                                    this.velocity = this.velocity.RotatedBy(num749 * 0.05000000074505806, default(Vector2));
                                                                    this.velocity *= 0.96f;
                                                                    this.rotation = this.velocity.ToRotation() - 1.57079637f;
                                                                    if (Main.myPlayer == this.owner && this.timeLeft > 60)
                                                                    {
                                                                        this.timeLeft = 60;
                                                                        return;
                                                                    }
                                                                }
                                                                else if (this.aiStyle == 79)
                                                                {
                                                                    bool flag31 = true;
                                                                    int num750 = (int)this.ai[0] - 1;
                                                                    if (this.type == ProjectileID.SaucerDeathray && (this.ai[0] == 0f || ((!Main.npc[num750].active || Main.npc[num750].type != NPCID.MartianSaucer) && (!Main.npc[num750].active || Main.npc[num750].type != NPCID.MartianSaucerCore || Main.npc[num750].ai[3] % 120f < 60f || Main.npc[num750].ai[0] != 2f))))
                                                                    {
                                                                        flag31 = false;
                                                                    }
                                                                    if (!flag31)
                                                                    {
                                                                        this.Kill();
                                                                        return;
                                                                    }
                                                                    NPC nPC7 = Main.npc[num750];
                                                                    float num751 = nPC7.Center.Y + 46f;
                                                                    int num752 = (int)nPC7.Center.X / 16;
                                                                    int num753 = (int)num751 / 16;
                                                                    int num754 = 0;
                                                                    bool flag32 = Main.tile[num752, num753].nactive() && Main.tileSolid[(int)Main.tile[num752, num753].type] && !Main.tileSolidTop[(int)Main.tile[num752, num753].type];
                                                                    if (flag32)
                                                                    {
                                                                        num754 = 1;
                                                                    }
                                                                    else
                                                                    {
                                                                        while (num754 < 150 && num753 + num754 < Main.maxTilesY)
                                                                        {
                                                                            int num755 = num753 + num754;
                                                                            bool flag33 = Main.tile[num752, num755].nactive() && Main.tileSolid[(int)Main.tile[num752, num755].type] && !Main.tileSolidTop[(int)Main.tile[num752, num755].type];
                                                                            if (flag33)
                                                                            {
                                                                                num754--;
                                                                                break;
                                                                            }
                                                                            num754++;
                                                                        }
                                                                    }
                                                                    this.position.X = nPC7.Center.X - (float)(this.width / 2);
                                                                    this.position.Y = num751;
                                                                    this.height = (num754 + 1) * 16;
                                                                    int num756 = (int)this.position.Y + this.height;
                                                                    if (Main.tile[num752, num756 / 16].nactive() && Main.tileSolid[(int)Main.tile[num752, num756 / 16].type] && !Main.tileSolidTop[(int)Main.tile[num752, num756 / 16].type])
                                                                    {
                                                                        int num757 = num756 % 16;
                                                                        this.height -= num757 - 2;
                                                                    }
                                                                    if (this.type == ProjectileID.SaucerDeathray && ++this.frameCounter >= 5)
                                                                    {
                                                                        this.frameCounter = 0;
                                                                        if (++this.frame >= 4)
                                                                        {
                                                                            this.frame = 0;
                                                                            return;
                                                                        }
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    if (this.aiStyle == 80)
                                                                    {
                                                                        if (this.ai[0] == 0f && this.ai[1] > 0f)
                                                                        {
                                                                            this.ai[1] -= 1f;
                                                                        }
                                                                        else if (this.ai[0] == 0f && this.ai[1] == 0f)
                                                                        {
                                                                            this.ai[0] = 1f;
                                                                            this.ai[1] = (float)Player.FindClosest(this.position, this.width, this.height);
                                                                            this.netUpdate = true;
                                                                            float num761 = this.velocity.Length();
                                                                            this.velocity = Vector2.Normalize(this.velocity) * (num761 + 4f);
                                                                        }
                                                                        else if (this.ai[0] == 1f)
                                                                        {
                                                                            this.tileCollide = true;
                                                                            this.localAI[1] += 1f;
                                                                            float num764 = 180f;
                                                                            float num765 = 0f;
                                                                            float num766 = 30f;
                                                                            if (this.localAI[1] == num764)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                            if (this.localAI[1] >= num765 && this.localAI[1] < num765 + num766)
                                                                            {
                                                                                Vector2 v3 = Main.player[(int)this.ai[1]].Center - base.Center;
                                                                                float num767 = this.velocity.ToRotation();
                                                                                float num768 = v3.ToRotation();
                                                                                double num769 = (double)(num768 - num767);
                                                                                if (num769 > 3.1415926535897931)
                                                                                {
                                                                                    num769 -= 6.2831853071795862;
                                                                                }
                                                                                if (num769 < -3.1415926535897931)
                                                                                {
                                                                                    num769 += 6.2831853071795862;
                                                                                }
                                                                                this.velocity = this.velocity.RotatedBy(num769 * 0.20000000298023224, default(Vector2));
                                                                            }
                                                                        }
                                                                        this.rotation = this.velocity.ToRotation() + 1.57079637f;
                                                                        if (++this.frameCounter >= 3)
                                                                        {
                                                                            this.frameCounter = 0;
                                                                            if (++this.frame >= 3)
                                                                            {
                                                                                this.frame = 0;
                                                                            }
                                                                        }
                                                                        for (int num774 = 0; num774 < 255; num774++)
                                                                        {
                                                                            Player player4 = Main.player[num774];
                                                                            if (player4.active && !player4.dead && Vector2.Distance(player4.Center, base.Center) <= 42f)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                        }
                                                                        return;
                                                                    }
                                                                    if (this.aiStyle == 81)
                                                                    {
                                                                        int num775 = this.penetrate;
                                                                        if (this.ai[0] == 0f)
                                                                        {
                                                                            this.tileCollide = true;
                                                                            this.localAI[0] += 1f;
                                                                            float num780 = 0.01f;
                                                                            int num781 = 5;
                                                                            int num782 = num781 * 15;
                                                                            int num783 = 0;
                                                                            if (this.localAI[0] > 7f)
                                                                            {
                                                                                if (this.localAI[1] == 0f)
                                                                                {
                                                                                    this.scale -= num780;
                                                                                    this.alpha += num781;
                                                                                    if (this.alpha > num782)
                                                                                    {
                                                                                        this.alpha = num782;
                                                                                        this.localAI[1] = 1f;
                                                                                    }
                                                                                }
                                                                                else if (this.localAI[1] == 1f)
                                                                                {
                                                                                    this.scale += num780;
                                                                                    this.alpha -= num781;
                                                                                    if (this.alpha <= num783)
                                                                                    {
                                                                                        this.alpha = num783;
                                                                                        this.localAI[1] = 0f;
                                                                                    }
                                                                                }
                                                                            }
                                                                            this.rotation = this.velocity.ToRotation() + 0.7853982f;
                                                                        }
                                                                        else if (this.ai[0] >= (float)1 && this.ai[0] < (float)(1 + num775))
                                                                        {
                                                                            this.tileCollide = false;
                                                                            this.alpha += 15;
                                                                            this.velocity *= 0.98f;
                                                                            this.localAI[0] = 0f;
                                                                            if (this.alpha >= 255)
                                                                            {
                                                                                if (this.ai[0] == 1f)
                                                                                {
                                                                                    this.Kill();
                                                                                    return;
                                                                                }
                                                                                int num784 = -1;
                                                                                Vector2 vector86 = base.Center;
                                                                                float num785 = 250f;
                                                                                for (int num786 = 0; num786 < 200; num786++)
                                                                                {
                                                                                    NPC nPC8 = Main.npc[num786];
                                                                                    if (nPC8.CanBeChasedBy(this, false))
                                                                                    {
                                                                                        Vector2 center6 = nPC8.Center;
                                                                                        float num787 = Vector2.Distance(center6, base.Center);
                                                                                        if (num787 < num785)
                                                                                        {
                                                                                            num785 = num787;
                                                                                            vector86 = center6;
                                                                                            num784 = num786;
                                                                                        }
                                                                                    }
                                                                                }
                                                                                if (num784 >= 0)
                                                                                {
                                                                                    this.netUpdate = true;
                                                                                    this.ai[0] += (float)num775;
                                                                                    this.position = vector86 + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * 100f - new Vector2((float)this.width, (float)this.height) / 2f;
                                                                                    this.velocity = Vector2.Normalize(vector86 - base.Center) * 15f;
                                                                                    this.rotation = this.velocity.ToRotation() + 0.7853982f;
                                                                                }
                                                                                else
                                                                                {
                                                                                    this.Kill();
                                                                                }
                                                                            }
                                                                        }
                                                                        else if (this.ai[0] >= (float)(1 + num775) && this.ai[0] < (float)(1 + num775 * 2))
                                                                        {
                                                                            this.scale = 0.9f;
                                                                            this.tileCollide = false;
                                                                            this.rotation = this.velocity.ToRotation() + 0.7853982f;
                                                                            this.ai[1] += 1f;
                                                                            if (this.ai[1] >= 15f)
                                                                            {
                                                                                this.alpha += 51;
                                                                                this.velocity *= 0.8f;
                                                                                if (this.alpha >= 255)
                                                                                {
                                                                                    this.Kill();
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                this.alpha -= 125;
                                                                                if (this.alpha < 0)
                                                                                {
                                                                                    this.alpha = 0;
                                                                                }
                                                                                this.velocity *= 0.98f;
                                                                            }
                                                                            this.localAI[0] += 1f;
                                                                        }
                                                                        return;
                                                                    }
                                                                    if (this.aiStyle == 82)
                                                                    {
                                                                        this.alpha -= 40;
                                                                        if (this.alpha < 0)
                                                                        {
                                                                            this.alpha = 0;
                                                                        }
                                                                        if (this.ai[0] == 0f)
                                                                        {
                                                                            this.localAI[0] += 1f;
                                                                            if (this.localAI[0] >= 45f)
                                                                            {
                                                                                this.localAI[0] = 0f;
                                                                                this.ai[0] = 1f;
                                                                                this.ai[1] = -this.ai[1];
                                                                                this.netUpdate = true;
                                                                            }
                                                                            this.velocity.X = this.velocity.RotatedBy((double)this.ai[1], default(Vector2)).X;
                                                                            this.velocity.X = MathHelper.Clamp(this.velocity.X, -6f, 6f);
                                                                            this.velocity.Y = this.velocity.Y - 0.08f;
                                                                            if (this.velocity.Y > 0f)
                                                                            {
                                                                                this.velocity.Y = this.velocity.Y - 0.2f;
                                                                            }
                                                                            if (this.velocity.Y < -7f)
                                                                            {
                                                                                this.velocity.Y = -7f;
                                                                            }
                                                                        }
                                                                        else if (this.ai[0] == 1f)
                                                                        {
                                                                            this.localAI[0] += 1f;
                                                                            if (this.localAI[0] >= 90f)
                                                                            {
                                                                                this.localAI[0] = 0f;
                                                                                this.ai[0] = 2f;
                                                                                this.ai[1] = (float)Player.FindClosest(this.position, this.width, this.height);
                                                                                this.netUpdate = true;
                                                                            }
                                                                            this.velocity.X = this.velocity.RotatedBy((double)this.ai[1], default(Vector2)).X;
                                                                            this.velocity.X = MathHelper.Clamp(this.velocity.X, -6f, 6f);
                                                                            this.velocity.Y = this.velocity.Y - 0.08f;
                                                                            if (this.velocity.Y > 0f)
                                                                            {
                                                                                this.velocity.Y = this.velocity.Y - 0.2f;
                                                                            }
                                                                            if (this.velocity.Y < -7f)
                                                                            {
                                                                                this.velocity.Y = -7f;
                                                                            }
                                                                        }
                                                                        else if (this.ai[0] == 2f)
                                                                        {
                                                                            Vector2 vector89 = Main.player[(int)this.ai[1]].Center - base.Center;
                                                                            if (vector89.Length() < 30f)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                            vector89.Normalize();
                                                                            vector89 *= 14f;
                                                                            vector89 = Vector2.Lerp(this.velocity, vector89, 0.6f);
                                                                            if (vector89.Y < 6f)
                                                                            {
                                                                                vector89.Y = 6f;
                                                                            }
                                                                            float num797 = 0.4f;
                                                                            if (this.velocity.X < vector89.X)
                                                                            {
                                                                                this.velocity.X = this.velocity.X + num797;
                                                                                if (this.velocity.X < 0f && vector89.X > 0f)
                                                                                {
                                                                                    this.velocity.X = this.velocity.X + num797;
                                                                                }
                                                                            }
                                                                            else if (this.velocity.X > vector89.X)
                                                                            {
                                                                                this.velocity.X = this.velocity.X - num797;
                                                                                if (this.velocity.X > 0f && vector89.X < 0f)
                                                                                {
                                                                                    this.velocity.X = this.velocity.X - num797;
                                                                                }
                                                                            }
                                                                            if (this.velocity.Y < vector89.Y)
                                                                            {
                                                                                this.velocity.Y = this.velocity.Y + num797;
                                                                                if (this.velocity.Y < 0f && vector89.Y > 0f)
                                                                                {
                                                                                    this.velocity.Y = this.velocity.Y + num797;
                                                                                }
                                                                            }
                                                                            else if (this.velocity.Y > vector89.Y)
                                                                            {
                                                                                this.velocity.Y = this.velocity.Y - num797;
                                                                                if (this.velocity.Y > 0f && vector89.Y < 0f)
                                                                                {
                                                                                    this.velocity.Y = this.velocity.Y - num797;
                                                                                }
                                                                            }
                                                                        }
                                                                        this.rotation = this.velocity.ToRotation() + 1.57079637f;
                                                                        return;
                                                                    }
                                                                    if (this.aiStyle == 83)
                                                                    {
                                                                        if (this.alpha > 200)
                                                                        {
                                                                            this.alpha = 200;
                                                                        }
                                                                        this.alpha -= 5;
                                                                        if (this.alpha < 0)
                                                                        {
                                                                            this.alpha = 0;
                                                                        }
                                                                        float num799 = (float)this.alpha / 255f;
                                                                        this.scale = 1f - num799;
                                                                        if (this.ai[0] >= 0f)
                                                                        {
                                                                            this.ai[0] += 1f;
                                                                        }
                                                                        if (this.ai[0] == -1f)
                                                                        {
                                                                            this.frame = 1;
                                                                            this.extraUpdates = 1;
                                                                        }
                                                                        else if (this.ai[0] < 30f)
                                                                        {
                                                                            this.position = Main.npc[(int)this.ai[1]].Center - new Vector2((float)this.width, (float)this.height) / 2f - this.velocity;
                                                                        }
                                                                        else
                                                                        {
                                                                            this.velocity *= 0.96f;
                                                                            if (++this.frameCounter >= 6)
                                                                            {
                                                                                this.frameCounter = 0;
                                                                                if (++this.frame >= 2)
                                                                                {
                                                                                    this.frame = 0;
                                                                                }
                                                                            }
                                                                        }
                                                                        if (this.alpha < 40)
                                                                        {
                                                                            for (int num800 = 0; num800 < 2; num800++)
                                                                            {
                                                                                float num801 = (float)Main.rand.NextDouble() * 1f - 0.5f;
                                                                                if (num801 < -0.5f)
                                                                                {
                                                                                    num801 = -0.5f;
                                                                                }
                                                                                if (num801 > 0.5f)
                                                                                {
                                                                                    num801 = 0.5f;
                                                                                }
                                                                            }
                                                                            return;
                                                                        }
                                                                    }
                                                                    else if (this.aiStyle == 84)
                                                                    {
                                                                        Vector2? vector91 = null;
                                                                        if (this.velocity.HasNaNs() || this.velocity == Vector2.Zero)
                                                                        {
                                                                            this.velocity = -Vector2.UnitY;
                                                                        }
                                                                        if (this.type == ProjectileID.PhantasmalDeathray && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 396)
                                                                        {
                                                                            Vector2 vector92 = new Vector2(27f, 59f);
                                                                            Vector2 vector93 = Utils.Vector2FromElipse(Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2(), vector92 * Main.npc[(int)this.ai[1]].localAI[1]);
                                                                            this.position = Main.npc[(int)this.ai[1]].Center + vector93 - new Vector2((float)this.width, (float)this.height) / 2f;
                                                                        }
                                                                        else if (this.type == ProjectileID.PhantasmalDeathray && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 400)
                                                                        {
                                                                            Vector2 vector94 = new Vector2(30f, 30f);
                                                                            Vector2 vector95 = Utils.Vector2FromElipse(Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2(), vector94 * Main.npc[(int)this.ai[1]].localAI[1]);
                                                                            this.position = Main.npc[(int)this.ai[1]].Center + vector95 - new Vector2((float)this.width, (float)this.height) / 2f;
                                                                        }
                                                                        else if (this.type == ProjectileID.StardustSoldierLaser && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 411)
                                                                        {
                                                                            Vector2 vector96 = new Vector2((float)(Main.npc[(int)this.ai[1]].direction * 6), -4f);
                                                                            this.position = Main.npc[(int)this.ai[1]].Center + vector96 - base.Size / 2f + new Vector2(0f, -Main.npc[(int)this.ai[1]].gfxOffY);
                                                                        }
                                                                        else if (this.type == ProjectileID.ChargedBlasterLaser && Main.projectile[(int)this.ai[1]].active && Main.projectile[(int)this.ai[1]].type == 460)
                                                                        {
                                                                            Vector2 vector97 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
                                                                            this.position = Main.projectile[(int)this.ai[1]].Center + vector97 * 16f - new Vector2((float)this.width, (float)this.height) / 2f + new Vector2(0f, -Main.projectile[(int)this.ai[1]].gfxOffY);
                                                                            this.velocity = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
                                                                        }
                                                                        else if (this.type == ProjectileID.MoonlordTurretLaser && Main.projectile[(int)this.ai[1]].active && Main.projectile[(int)this.ai[1]].type == 641)
                                                                        {
                                                                            base.Center = Main.projectile[(int)this.ai[1]].Center;
                                                                            this.velocity = Vector2.Normalize(Main.projectile[(int)this.ai[1]].ai[1].ToRotationVector2());
                                                                        }
                                                                        else
                                                                        {
                                                                            if (this.type != ProjectileID.LastPrismLaser || !Main.projectile[(int)this.ai[1]].active || Main.projectile[(int)this.ai[1]].type != 633)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                            float num803 = (float)((int)this.ai[0]) - 2.5f;
                                                                            Vector2 vector98 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
                                                                            Projectile projectile = Main.projectile[(int)this.ai[1]];
                                                                            float num804 = num803 * 0.5235988f;
                                                                            Vector2 vector99 = Vector2.Zero;
                                                                            float num805;
                                                                            float num806;
                                                                            float num807;
                                                                            float num808;
                                                                            if (projectile.ai[0] < 180f)
                                                                            {
                                                                                num805 = 1f - projectile.ai[0] / 180f;
                                                                                num806 = 20f - projectile.ai[0] / 180f * 14f;
                                                                                if (projectile.ai[0] < 120f)
                                                                                {
                                                                                    num807 = 20f - 4f * (projectile.ai[0] / 120f);
                                                                                    this.Opacity = projectile.ai[0] / 120f * 0.4f;
                                                                                }
                                                                                else
                                                                                {
                                                                                    num807 = 16f - 10f * ((projectile.ai[0] - 120f) / 60f);
                                                                                    this.Opacity = 0.4f + (projectile.ai[0] - 120f) / 60f * 0.6f;
                                                                                }
                                                                                num808 = -22f + projectile.ai[0] / 180f * 20f;
                                                                            }
                                                                            else
                                                                            {
                                                                                num805 = 0f;
                                                                                num807 = 1.75f;
                                                                                num806 = 6f;
                                                                                this.Opacity = 1f;
                                                                                num808 = -2f;
                                                                            }
                                                                            float num809 = (projectile.ai[0] + num803 * num807) / (num807 * 6f) * 6.28318548f;
                                                                            num804 = Vector2.UnitY.RotatedBy((double)num809, default(Vector2)).Y * 0.5235988f * num805;
                                                                            vector99 = (Vector2.UnitY.RotatedBy((double)num809, default(Vector2)) * new Vector2(4f, num806)).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2));
                                                                            this.position = projectile.Center + vector98 * 16f - base.Size / 2f + new Vector2(0f, -Main.projectile[(int)this.ai[1]].gfxOffY);
                                                                            this.position += projectile.velocity.ToRotation().ToRotationVector2() * num808;
                                                                            this.position += vector99;
                                                                            this.velocity = Vector2.Normalize(projectile.velocity).RotatedBy((double)num804, default(Vector2));
                                                                            this.scale = 1.4f * (1f - num805);
                                                                            this.damage = projectile.damage;
                                                                            if (projectile.ai[0] >= 180f)
                                                                            {
                                                                                this.damage *= 3;
                                                                                vector91 = new Vector2?(projectile.Center);
                                                                            }
                                                                            if (!Collision.CanHitLine(Main.player[this.owner].Center, 0, 0, projectile.Center, 0, 0))
                                                                            {
                                                                                vector91 = new Vector2?(Main.player[this.owner].Center);
                                                                            }
                                                                            this.friendly = (projectile.ai[0] > 30f);
                                                                        }
                                                                        if (this.velocity.HasNaNs() || this.velocity == Vector2.Zero)
                                                                        {
                                                                            this.velocity = -Vector2.UnitY;
                                                                        }
                                                                        if (this.type == ProjectileID.ChargedBlasterLaser)
                                                                        {
                                                                            this.ai[0] += 1f;
                                                                            if (this.ai[0] >= 300f)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                            this.scale = (float)Math.Sin((double)(this.ai[0] * 3.14159274f / 300f)) * 10f;
                                                                            if (this.scale > 1f)
                                                                            {
                                                                                this.scale = 1f;
                                                                            }
                                                                        }
                                                                        if (this.type == ProjectileID.PhantasmalDeathray)
                                                                        {
                                                                            float num810 = 1f;
                                                                            if (Main.npc[(int)this.ai[1]].type == 400)
                                                                            {
                                                                                num810 = 0.4f;
                                                                            }
                                                                            this.localAI[0] += 1f;
                                                                            if (this.localAI[0] >= 180f)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                            this.scale = (float)Math.Sin((double)(this.localAI[0] * 3.14159274f / 180f)) * 10f * num810;
                                                                            if (this.scale > num810)
                                                                            {
                                                                                this.scale = num810;
                                                                            }
                                                                        }
                                                                        if (this.type == ProjectileID.MoonlordTurretLaser)
                                                                        {
                                                                            float num811 = 1f;
                                                                            this.localAI[0] += 1f;
                                                                            if (this.localAI[0] >= 50f)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                            this.scale = (float)Math.Sin((double)(this.localAI[0] * 3.14159274f / 50f)) * 10f * num811;
                                                                            if (this.scale > num811)
                                                                            {
                                                                                this.scale = num811;
                                                                            }
                                                                        }
                                                                        if (this.type == ProjectileID.StardustSoldierLaser)
                                                                        {
                                                                            float num812 = 0.8f;
                                                                            this.localAI[0] += 1f;
                                                                            if (this.localAI[0] >= 60f)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                            this.scale = (float)Math.Sin((double)(this.localAI[0] * 3.14159274f / 60f)) * 10f * num812;
                                                                            if (this.scale > num812)
                                                                            {
                                                                                this.scale = num812;
                                                                            }
                                                                        }
                                                                        float num813 = this.velocity.ToRotation();
                                                                        if (this.type == ProjectileID.PhantasmalDeathray)
                                                                        {
                                                                            num813 += this.ai[0];
                                                                        }
                                                                        this.rotation = num813 - 1.57079637f;
                                                                        this.velocity = num813.ToRotationVector2();
                                                                        float num814 = 0f;
                                                                        float num815 = 0f;
                                                                        Vector2 vector100 = base.Center;
                                                                        if (vector91.HasValue)
                                                                        {
                                                                            vector100 = vector91.Value;
                                                                        }
                                                                        if (this.type == ProjectileID.PhantasmalDeathray)
                                                                        {
                                                                            num814 = 3f;
                                                                            num815 = (float)this.width;
                                                                        }
                                                                        else if (this.type == ProjectileID.ChargedBlasterLaser)
                                                                        {
                                                                            num814 = 2f;
                                                                            num815 = 0f;
                                                                        }
                                                                        else if (this.type == ProjectileID.MoonlordTurretLaser)
                                                                        {
                                                                            num814 = 2f;
                                                                            num815 = 0f;
                                                                        }
                                                                        else if (this.type == ProjectileID.LastPrismLaser)
                                                                        {
                                                                            num814 = 2f;
                                                                            num815 = 0f;
                                                                        }
                                                                        else if (this.type == ProjectileID.StardustSoldierLaser)
                                                                        {
                                                                            num814 = 2f;
                                                                            num815 = 0f;
                                                                        }
                                                                        float[] array3 = new float[(int)num814];
                                                                        int num816 = 0;
                                                                        while ((float)num816 < num814)
                                                                        {
                                                                            float num817 = (float)num816 / (num814 - 1f);
                                                                            Vector2 vector101 = vector100 + this.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * (num817 - 0.5f) * num815 * this.scale;
                                                                            int num818 = (int)vector101.X / 16;
                                                                            int num819 = (int)vector101.Y / 16;
                                                                            Vector2 vector102 = vector101 + this.velocity * 16f * 150f;
                                                                            int num820 = (int)vector102.X / 16;
                                                                            int num821 = (int)vector102.Y / 16;
                                                                            Tuple<int, int> tuple;
                                                                            float num822;
                                                                            if (!Collision.TupleHitLine(num818, num819, num820, num821, 0, 0, new List<Tuple<int, int>>(), out tuple))
                                                                            {
                                                                                num822 = new Vector2((float)Math.Abs(num818 - tuple.Item1), (float)Math.Abs(num819 - tuple.Item2)).Length() * 16f;
                                                                            }
                                                                            else if (tuple.Item1 == num820 && tuple.Item2 == num821)
                                                                            {
                                                                                num822 = 2400f;
                                                                            }
                                                                            else
                                                                            {
                                                                                num822 = new Vector2((float)Math.Abs(num818 - tuple.Item1), (float)Math.Abs(num819 - tuple.Item2)).Length() * 16f;
                                                                            }
                                                                            array3[num816] = num822;
                                                                            num816++;
                                                                        }
                                                                        float num823 = 0f;
                                                                        for (int num824 = 0; num824 < array3.Length; num824++)
                                                                        {
                                                                            num823 += array3[num824];
                                                                        }
                                                                        num823 /= num814;
                                                                        float num825 = 0.5f;
                                                                        if (this.type == ProjectileID.LastPrismLaser)
                                                                        {
                                                                            num825 = 0.75f;
                                                                        }
                                                                        this.localAI[1] = MathHelper.Lerp(this.localAI[1], num823, num825);
                                                                        if (this.type == ProjectileID.PhantasmalDeathray)
                                                                        {
                                                                            DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f);
                                                                        }
                                                                        else if (this.type == ProjectileID.MoonlordTurretLaser)
                                                                        {
                                                                            DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f);
                                                                        }
                                                                        if (this.type == ProjectileID.ChargedBlasterLaser)
                                                                        {
                                                                            DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f);
                                                                        }
                                                                        if (this.type == ProjectileID.StardustSoldierLaser)
                                                                        {
                                                                            DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f);
                                                                        }
                                                                        if (this.type == ProjectileID.LastPrismLaser && Math.Abs(this.localAI[1] - num823) < 100f && this.scale > 0.15f)
                                                                        {
                                                                            float prismHue = this.GetPrismHue(this.ai[0]);
                                                                            Color color = Main.HslToRgb(prismHue, 1f, 0.5f);
                                                                            color.A = 0;
                                                                            Vector2 vector115 = base.Center + this.velocity * (this.localAI[1] - 14.5f * this.scale);
                                                                            float x = Main.RgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X;
                                                                            DelegateMethods.v3_1 = color.ToVector3() * 0.3f;
                                                                            return;
                                                                        }
                                                                    }
                                                                    else if (this.aiStyle == 85)
                                                                    {
                                                                        Vector2 vector118 = new Vector2(0f, 216f);
                                                                        this.alpha -= 15;
                                                                        if (this.alpha < 0)
                                                                        {
                                                                            this.alpha = 0;
                                                                        }
                                                                        int num851 = (int)Math.Abs(this.ai[0]) - 1;
                                                                        int num852 = (int)this.ai[1];
                                                                        if (!Main.npc[num851].active || Main.npc[num851].type != NPCID.MoonLordHead)
                                                                        {
                                                                            this.Kill();
                                                                            return;
                                                                        }
                                                                        this.localAI[0] += 1f;
                                                                        if (this.localAI[0] >= 330f && this.ai[0] > 0f && Main.netMode != 1)
                                                                        {
                                                                            this.ai[0] *= -1f;
                                                                            this.netUpdate = true;
                                                                        }
                                                                        if (Main.netMode != 1 && this.ai[0] > 0f && (!Main.player[(int)this.ai[1]].active || Main.player[(int)this.ai[1]].dead))
                                                                        {
                                                                            this.ai[0] *= -1f;
                                                                            this.netUpdate = true;
                                                                        }
                                                                        this.rotation = (Main.npc[(int)Math.Abs(this.ai[0]) - 1].Center - Main.player[(int)this.ai[1]].Center + vector118).ToRotation() + 1.57079637f;
                                                                        if (this.ai[0] > 0f)
                                                                        {
                                                                            Vector2 vector119 = Main.player[(int)this.ai[1]].Center - base.Center;
                                                                            if (vector119.X != 0f || vector119.Y != 0f)
                                                                            {
                                                                                this.velocity = Vector2.Normalize(vector119) * Math.Min(16f, vector119.Length());
                                                                            }
                                                                            else
                                                                            {
                                                                                this.velocity = Vector2.Zero;
                                                                            }
                                                                            if (vector119.Length() < 20f && this.localAI[1] == 0f)
                                                                            {
                                                                                this.localAI[1] = 1f;
                                                                                Main.player[num852].AddBuff(BuffID.MoonLeech, 600, true);
                                                                                return;
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            if (this.localAI[1] == 1f)
                                                                            {
                                                                                int num853 = Main.player[num852].HasBuff(BuffID.MoonLeech);
                                                                                if (num853 != -1)
                                                                                {
                                                                                    Main.player[num852].DelBuff(num853);
                                                                                }
                                                                            }
                                                                            Vector2 vector120 = Main.npc[(int)Math.Abs(this.ai[0]) - 1].Center - base.Center + vector118;
                                                                            if (vector120.X != 0f || vector120.Y != 0f)
                                                                            {
                                                                                this.velocity = Vector2.Normalize(vector120) * Math.Min(16f, vector120.Length());
                                                                            }
                                                                            else
                                                                            {
                                                                                this.velocity = Vector2.Zero;
                                                                            }
                                                                            if (vector120.Length() < 20f)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                        }
                                                                    }
                                                                    else if (this.aiStyle == 86)
                                                                    {
                                                                        if (this.localAI[1] == 0f)
                                                                        {
                                                                            this.localAI[1] = 1f;
                                                                        }
                                                                        this.ai[0] += 1f;
                                                                        if (this.ai[1] == 1f)
                                                                        {
                                                                            if (this.ai[0] >= 130f)
                                                                            {
                                                                                this.alpha += 10;
                                                                            }
                                                                            else
                                                                            {
                                                                                this.alpha -= 10;
                                                                            }
                                                                            if (this.alpha < 0)
                                                                            {
                                                                                this.alpha = 0;
                                                                            }
                                                                            if (this.alpha > 255)
                                                                            {
                                                                                this.alpha = 255;
                                                                            }
                                                                            if (this.ai[0] >= 150f)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                            if (this.ai[0] % 30f == 0f && Main.netMode != 1)
                                                                            {
                                                                                Vector2 vector121 = this.rotation.ToRotationVector2();
                                                                                Projectile.NewProjectile(base.Center.X, base.Center.Y, vector121.X, vector121.Y, 464, this.damage, this.knockBack, this.owner, 0f, 0f);
                                                                            }
                                                                            this.rotation += 0.104719758f;
                                                                            return;
                                                                        }
                                                                        else
                                                                        {
                                                                            this.position -= this.velocity;
                                                                            if (this.ai[0] >= 40f)
                                                                            {
                                                                                this.alpha += 3;
                                                                            }
                                                                            else
                                                                            {
                                                                                this.alpha -= 40;
                                                                            }
                                                                            if (this.alpha < 0)
                                                                            {
                                                                                this.alpha = 0;
                                                                            }
                                                                            if (this.alpha > 255)
                                                                            {
                                                                                this.alpha = 255;
                                                                            }
                                                                            if (this.ai[0] >= 45f)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                            Vector2 vector122 = new Vector2(0f, -720f).RotatedBy((double)this.velocity.ToRotation(), default(Vector2));
                                                                            float num854 = this.ai[0] % 45f / 45f;
                                                                            Vector2 spinningpoint = vector122 * num854;
                                                                            return;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        if (this.aiStyle == 87)
                                                                        {
                                                                            this.position.Y = this.ai[0];
                                                                            this.height = (int)this.ai[1];
                                                                            if (base.Center.X > Main.player[this.owner].Center.X)
                                                                            {
                                                                                this.direction = 1;
                                                                            }
                                                                            else
                                                                            {
                                                                                this.direction = -1;
                                                                            }
                                                                            this.velocity.X = (float)this.direction * 1E-06f;
                                                                            if (this.owner == Main.myPlayer)
                                                                            {
                                                                                for (int num858 = 0; num858 < 1000; num858++)
                                                                                {
                                                                                    if (Main.projectile[num858].active && num858 != this.whoAmI && Main.projectile[num858].type == this.type && Main.projectile[num858].owner == this.owner && Main.projectile[num858].timeLeft > this.timeLeft)
                                                                                    {
                                                                                        this.Kill();
                                                                                        return;
                                                                                    }
                                                                                }
                                                                            }
                                                                            return;
                                                                        }
                                                                        if (this.aiStyle == 88)
                                                                        {
                                                                            if (this.type == ProjectileID.CultistBossLightningOrb)
                                                                            {
                                                                                if (this.localAI[1] == 0f)
                                                                                {
                                                                                    this.localAI[1] = 1f;
                                                                                }
                                                                                if (this.ai[0] < 180f)
                                                                                {
                                                                                    this.alpha -= 5;
                                                                                    if (this.alpha < 0)
                                                                                    {
                                                                                        this.alpha = 0;
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    this.alpha += 5;
                                                                                    if (this.alpha > 255)
                                                                                    {
                                                                                        this.alpha = 255;
                                                                                        this.Kill();
                                                                                        return;
                                                                                    }
                                                                                }
                                                                                this.ai[0] += 1f;
                                                                                if (this.ai[0] % 30f == 0f && this.ai[0] < 180f && Main.netMode != 1)
                                                                                {
                                                                                    int[] array4 = new int[5];
                                                                                    Vector2[] array5 = new Vector2[5];
                                                                                    int num862 = 0;
                                                                                    float num863 = 2000f;
                                                                                    for (int num864 = 0; num864 < 255; num864++)
                                                                                    {
                                                                                        if (Main.player[num864].active && !Main.player[num864].dead)
                                                                                        {
                                                                                            Vector2 center9 = Main.player[num864].Center;
                                                                                            float num865 = Vector2.Distance(center9, base.Center);
                                                                                            if (num865 < num863 && Collision.CanHit(base.Center, 1, 1, center9, 1, 1))
                                                                                            {
                                                                                                array4[num862] = num864;
                                                                                                array5[num862] = center9;
                                                                                                if (++num862 >= array5.Length)
                                                                                                {
                                                                                                    break;
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                    for (int num866 = 0; num866 < num862; num866++)
                                                                                    {
                                                                                        Vector2 vector124 = array5[num866] - base.Center;
                                                                                        float ai = (float)Main.rand.Next(100);
                                                                                        Vector2 vector125 = Vector2.Normalize(vector124.RotatedByRandom(0.78539818525314331)) * 7f;
                                                                                        Projectile.NewProjectile(base.Center.X, base.Center.Y, vector125.X, vector125.Y, 466, this.damage, 0f, Main.myPlayer, vector124.ToRotation(), ai);
                                                                                    }
                                                                                }
                                                                                if (++this.frameCounter >= 4)
                                                                                {
                                                                                    this.frameCounter = 0;
                                                                                    if (++this.frame >= Main.projFrames[this.type])
                                                                                    {
                                                                                        this.frame = 0;
                                                                                    }
                                                                                }
                                                                                if (this.alpha < 150 && this.ai[0] < 180f)
                                                                                {
                                                                                    for (int num867 = 0; num867 < 1; num867++)
                                                                                    {
                                                                                        float num868 = (float)Main.rand.NextDouble() * 1f - 0.5f;
                                                                                        if (num868 < -0.5f)
                                                                                        {
                                                                                            num868 = -0.5f;
                                                                                        }
                                                                                        if (num868 > 0.5f)
                                                                                        {
                                                                                            num868 = 0.5f;
                                                                                        }
                                                                                    }
                                                                                    for (int num870 = 0; num870 < 1; num870++)
                                                                                    {
                                                                                        float num871 = (float)Main.rand.NextDouble() * 1f - 0.5f;
                                                                                        if (num871 < -0.5f)
                                                                                        {
                                                                                            num871 = -0.5f;
                                                                                        }
                                                                                        if (num871 > 0.5f)
                                                                                        {
                                                                                            num871 = 0.5f;
                                                                                        }
                                                                                    }
                                                                                    return;
                                                                                }
                                                                            }
                                                                            else if (this.type == ProjectileID.CultistBossLightningOrbArc)
                                                                            {
                                                                                this.frameCounter++;
                                                                                if (this.velocity == Vector2.Zero)
                                                                                {
                                                                                    if (this.frameCounter >= this.extraUpdates * 2)
                                                                                    {
                                                                                        this.frameCounter = 0;
                                                                                        bool flag34 = true;
                                                                                        for (int num873 = 1; num873 < this.oldPos.Length; num873++)
                                                                                        {
                                                                                            if (this.oldPos[num873] != this.oldPos[0])
                                                                                            {
                                                                                                flag34 = false;
                                                                                            }
                                                                                        }
                                                                                        if (flag34)
                                                                                        {
                                                                                            this.Kill();
                                                                                            return;
                                                                                        }
                                                                                    }
                                                                                    if (Main.rand.Next(this.extraUpdates) == 0)
                                                                                    {
                                                                                        if (Main.rand.Next(5) == 0)
                                                                                        {
                                                                                            return;
                                                                                        }
                                                                                    }
                                                                                }
                                                                                else if (this.frameCounter >= this.extraUpdates * 2)
                                                                                {
                                                                                    this.frameCounter = 0;
                                                                                    float num879 = this.velocity.Length();
                                                                                    Random random = new Random((int)this.ai[1]);
                                                                                    int num880 = 0;
                                                                                    Vector2 spinningpoint2 = -Vector2.UnitY;
                                                                                    Vector2 vector130;
                                                                                    do
                                                                                    {
                                                                                        int num881 = random.Next();
                                                                                        this.ai[1] = (float)num881;
                                                                                        num881 %= 100;
                                                                                        float f = (float)num881 / 100f * 6.28318548f;
                                                                                        vector130 = f.ToRotationVector2();
                                                                                        if (vector130.Y > 0f)
                                                                                        {
                                                                                            vector130.Y *= -1f;
                                                                                        }
                                                                                        bool flag35 = false;
                                                                                        if (vector130.Y > -0.02f)
                                                                                        {
                                                                                            flag35 = true;
                                                                                        }
                                                                                        if (vector130.X * (float)(this.extraUpdates + 1) * 2f * num879 + this.localAI[0] > 40f)
                                                                                        {
                                                                                            flag35 = true;
                                                                                        }
                                                                                        if (vector130.X * (float)(this.extraUpdates + 1) * 2f * num879 + this.localAI[0] < -40f)
                                                                                        {
                                                                                            flag35 = true;
                                                                                        }
                                                                                        if (!flag35)
                                                                                        {
                                                                                            goto IL_2363F;
                                                                                        }
                                                                                    }
                                                                                    while (num880++ < 100);
                                                                                    this.velocity = Vector2.Zero;
                                                                                    this.localAI[1] = 1f;
                                                                                    goto IL_23647;
                                                                                IL_2363F:
                                                                                    spinningpoint2 = vector130;
                                                                                IL_23647:
                                                                                    if (this.velocity != Vector2.Zero)
                                                                                    {
                                                                                        this.localAI[0] += spinningpoint2.X * (float)(this.extraUpdates + 1) * 2f * num879;
                                                                                        this.velocity = spinningpoint2.RotatedBy((double)(this.ai[0] + 1.57079637f), default(Vector2)) * num879;
                                                                                        this.rotation = this.velocity.ToRotation() + 1.57079637f;
                                                                                        return;
                                                                                    }
                                                                                }
                                                                            }
                                                                            else if (this.type == ProjectileID.VortexLightning)
                                                                            {
                                                                                if (this.localAI[1] == 0f && this.ai[0] >= 900f)
                                                                                {
                                                                                    this.ai[0] -= 1000f;
                                                                                    this.localAI[1] = -1f;
                                                                                }
                                                                                this.frameCounter++;
                                                                                if (this.velocity == Vector2.Zero)
                                                                                {
                                                                                    if (this.frameCounter >= this.extraUpdates * 2)
                                                                                    {
                                                                                        this.frameCounter = 0;
                                                                                        bool flag36 = true;
                                                                                        for (int num882 = 1; num882 < this.oldPos.Length; num882++)
                                                                                        {
                                                                                            if (this.oldPos[num882] != this.oldPos[0])
                                                                                            {
                                                                                                flag36 = false;
                                                                                            }
                                                                                        }
                                                                                        if (flag36)
                                                                                        {
                                                                                            this.Kill();
                                                                                            return;
                                                                                        }
                                                                                    }
                                                                                    if (Main.rand.Next(this.extraUpdates) == 0 && (this.velocity != Vector2.Zero || Main.rand.Next((this.localAI[1] == 2f) ? 2 : 6) == 0))
                                                                                    {
                                                                                        if (Main.rand.Next(5) == 0)
                                                                                        {
                                                                                            return;
                                                                                        }
                                                                                    }
                                                                                }
                                                                                else if (this.frameCounter >= this.extraUpdates * 2)
                                                                                {
                                                                                    this.frameCounter = 0;
                                                                                    float num888 = this.velocity.Length();
                                                                                    Random random2 = new Random((int)this.ai[1]);
                                                                                    int num889 = 0;
                                                                                    Vector2 spinningpoint3 = -Vector2.UnitY;
                                                                                    Vector2 vector133;
                                                                                    do
                                                                                    {
                                                                                        int num890 = random2.Next();
                                                                                        this.ai[1] = (float)num890;
                                                                                        num890 %= 100;
                                                                                        float f2 = (float)num890 / 100f * 6.28318548f;
                                                                                        vector133 = f2.ToRotationVector2();
                                                                                        if (vector133.Y > 0f)
                                                                                        {
                                                                                            vector133.Y *= -1f;
                                                                                        }
                                                                                        bool flag37 = false;
                                                                                        if (vector133.Y > -0.02f)
                                                                                        {
                                                                                            flag37 = true;
                                                                                        }
                                                                                        if (vector133.X * (float)(this.extraUpdates + 1) * 2f * num888 + this.localAI[0] > 40f)
                                                                                        {
                                                                                            flag37 = true;
                                                                                        }
                                                                                        if (vector133.X * (float)(this.extraUpdates + 1) * 2f * num888 + this.localAI[0] < -40f)
                                                                                        {
                                                                                            flag37 = true;
                                                                                        }
                                                                                        if (!flag37)
                                                                                        {
                                                                                            goto IL_23BA3;
                                                                                        }
                                                                                    }
                                                                                    while (num889++ < 100);
                                                                                    this.velocity = Vector2.Zero;
                                                                                    if (this.localAI[1] < 1f)
                                                                                    {
                                                                                        this.localAI[1] += 2f;
                                                                                        goto IL_23BAB;
                                                                                    }
                                                                                    goto IL_23BAB;
                                                                                IL_23BA3:
                                                                                    spinningpoint3 = vector133;
                                                                                IL_23BAB:
                                                                                    if (this.velocity != Vector2.Zero)
                                                                                    {
                                                                                        this.localAI[0] += spinningpoint3.X * (float)(this.extraUpdates + 1) * 2f * num888;
                                                                                        this.velocity = spinningpoint3.RotatedBy((double)(this.ai[0] + 1.57079637f), default(Vector2)) * num888;
                                                                                        this.rotation = this.velocity.ToRotation() + 1.57079637f;
                                                                                        if (Main.rand.Next(4) == 0 && Main.netMode != 1 && this.localAI[1] == 0f)
                                                                                        {
                                                                                            float num891 = (float)Main.rand.Next(-3, 4) * 1.04719758f / 3f;
                                                                                            Vector2 vector134 = this.ai[0].ToRotationVector2().RotatedBy((double)num891, default(Vector2)) * this.velocity.Length();
                                                                                            if (!Collision.CanHitLine(base.Center, 0, 0, base.Center + vector134 * 50f, 0, 0))
                                                                                            {
                                                                                                Projectile.NewProjectile(base.Center.X - vector134.X, base.Center.Y - vector134.Y, vector134.X, vector134.Y, this.type, this.damage, this.knockBack, this.owner, vector134.ToRotation() + 1000f, this.ai[1]);
                                                                                                return;
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                        else if (this.aiStyle == 89)
                                                                        {
                                                                            if (this.ai[1] == -1f)
                                                                            {
                                                                                this.alpha += 12;
                                                                            }
                                                                            else if (this.ai[0] < 300f)
                                                                            {
                                                                                this.alpha -= 5;
                                                                            }
                                                                            else
                                                                            {
                                                                                this.alpha += 12;
                                                                            }
                                                                            if (this.alpha < 0)
                                                                            {
                                                                                this.alpha = 0;
                                                                            }
                                                                            if (this.alpha > 255)
                                                                            {
                                                                                this.alpha = 255;
                                                                            }
                                                                            this.scale = 1f - (float)this.alpha / 255f;
                                                                            this.scale *= 0.6f;
                                                                            this.rotation += 0.0149599658f;
                                                                            if (this.localAI[1] == 0f)
                                                                            {
                                                                                this.localAI[1] = 1f;
                                                                            }
                                                                            this.ai[0] += 1f;
                                                                            if (this.ai[0] >= 60f)
                                                                            {
                                                                            }
                                                                            if (this.ai[0] == 300f && this.ai[1] != -1f && Main.netMode != 1)
                                                                            {
                                                                                if (!NPC.AnyNPCs(NPCID.CultistDragonHead))
                                                                                {
                                                                                    this.ai[1] = (float)NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 454, 0, 0f, 0f, 0f, 0f, 255);
                                                                                }
                                                                                else
                                                                                {
                                                                                    this.ai[1] = (float)NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 521, 0, 0f, 0f, 0f, 0f, 255);
                                                                                }
                                                                            }
                                                                            else if (this.ai[0] == 320f)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                            bool flag38 = false;
                                                                            if (this.ai[1] == -1f)
                                                                            {
                                                                                if (this.alpha == 255)
                                                                                {
                                                                                    flag38 = true;
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                flag38 = (this.ai[1] < 0f || !Main.npc[(int)this.ai[1]].active);
                                                                                if ((flag38 || Main.npc[(int)this.ai[1]].type != 439) && (flag38 || Main.npc[(int)this.ai[1]].type != 454) && (flag38 || Main.npc[(int)this.ai[1]].type != 521))
                                                                                {
                                                                                    flag38 = true;
                                                                                }
                                                                            }
                                                                            if (flag38)
                                                                            {
                                                                                this.Kill();
                                                                                return;
                                                                            }
                                                                        }
                                                                        else if (this.aiStyle == 90)
                                                                        {
                                                                            if (Main.player[this.owner].dead)
                                                                            {
                                                                                this.Kill();
                                                                            }
                                                                            if (Main.myPlayer == this.owner && Main.player[this.owner].magicLantern)
                                                                            {
                                                                                this.timeLeft = 2;
                                                                            }
                                                                            if (this.tileCollide)
                                                                            {
                                                                                if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.owner].Center, 1, 1))
                                                                                {
                                                                                    this.tileCollide = false;
                                                                                }
                                                                                else if (!Collision.SolidCollision(this.position, this.width, this.height) && Collision.CanHitLine(this.position, this.width, this.height, Main.player[this.owner].Center, 1, 1))
                                                                                {
                                                                                    this.tileCollide = true;
                                                                                }
                                                                            }
                                                                            this.direction = Main.player[this.owner].direction;
                                                                            this.spriteDirection = this.direction;
                                                                            this.localAI[0] += 1f;
                                                                            if (this.localAI[0] >= 10f)
                                                                            {
                                                                                this.localAI[0] = 0f;
                                                                            }
                                                                            Vector2 vector138 = Main.player[this.owner].Center - base.Center;
                                                                            vector138.X += (float)(40 * this.direction);
                                                                            vector138.Y -= 40f;
                                                                            float num905 = vector138.Length();
                                                                            if (num905 > 1000f)
                                                                            {
                                                                                base.Center = Main.player[this.owner].Center;
                                                                            }
                                                                            float num906 = 3f;
                                                                            float num907 = 4f;
                                                                            if (num905 > 200f)
                                                                            {
                                                                                num907 += (num905 - 200f) * 0.1f;
                                                                                this.tileCollide = false;
                                                                            }
                                                                            if (num905 < num907)
                                                                            {
                                                                                this.velocity *= 0.25f;
                                                                                num907 = num905;
                                                                            }
                                                                            if (vector138.X != 0f || vector138.Y != 0f)
                                                                            {
                                                                                vector138.Normalize();
                                                                                vector138 *= num907;
                                                                            }
                                                                            this.velocity = (this.velocity * (num906 - 1f) + vector138) / num906;
                                                                            if (this.velocity.Length() > 6f)
                                                                            {
                                                                                float num908 = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                                                                                if ((double)Math.Abs(this.rotation - num908) >= 3.14)
                                                                                {
                                                                                    if (num908 < this.rotation)
                                                                                    {
                                                                                        this.rotation -= 6.28f;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        this.rotation += 6.28f;
                                                                                    }
                                                                                }
                                                                                this.rotation = (this.rotation * 4f + num908) / 5f;
                                                                                this.frameCounter++;
                                                                                if (this.frameCounter > 4)
                                                                                {
                                                                                    this.frameCounter = 0;
                                                                                    this.frame++;
                                                                                    if (this.frame > 7)
                                                                                    {
                                                                                        this.frame = 4;
                                                                                    }
                                                                                }
                                                                                if (this.frame < 4)
                                                                                {
                                                                                    this.frame = 7;
                                                                                    return;
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                if ((double)this.rotation > 3.14)
                                                                                {
                                                                                    this.rotation -= 6.28f;
                                                                                }
                                                                                if ((double)this.rotation > -0.01 && (double)this.rotation < 0.01)
                                                                                {
                                                                                    this.rotation = 0f;
                                                                                }
                                                                                else
                                                                                {
                                                                                    this.rotation *= 0.9f;
                                                                                }
                                                                                this.frameCounter++;
                                                                                if (this.frameCounter > 6)
                                                                                {
                                                                                    this.frameCounter = 0;
                                                                                    this.frame++;
                                                                                    if (this.frame > 3)
                                                                                    {
                                                                                        this.frame = 0;
                                                                                        return;
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                        else if (this.aiStyle == 91)
                                                                        {
                                                                            Vector2 center10 = base.Center;
                                                                            this.scale = 1f - this.localAI[0];
                                                                            this.width = (int)(20f * this.scale);
                                                                            this.height = this.width;
                                                                            this.position.X = center10.X - (float)(this.width / 2);
                                                                            this.position.Y = center10.Y - (float)(this.height / 2);
                                                                            if ((double)this.localAI[0] < 0.1)
                                                                            {
                                                                                this.localAI[0] += 0.01f;
                                                                            }
                                                                            else
                                                                            {
                                                                                this.localAI[0] += 0.025f;
                                                                            }
                                                                            if (this.localAI[0] >= 0.95f)
                                                                            {
                                                                                this.Kill();
                                                                            }
                                                                            this.velocity.X = this.velocity.X + this.ai[0] * 1.5f;
                                                                            this.velocity.Y = this.velocity.Y + this.ai[1] * 1.5f;
                                                                            if (this.velocity.Length() > 16f)
                                                                            {
                                                                                this.velocity.Normalize();
                                                                                this.velocity *= 16f;
                                                                            }
                                                                            this.ai[0] *= 1.05f;
                                                                            this.ai[1] *= 1.05f;
                                                                            if (this.scale < 1f)
                                                                            {
                                                                                return;
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            if (this.aiStyle == 92)
                                                                            {
                                                                                this.tileCollide = false;
                                                                                this.ai[1] += 1f;
                                                                                if (this.ai[1] > 60f)
                                                                                {
                                                                                    this.ai[0] += 10f;
                                                                                }
                                                                                if (this.ai[0] > 255f)
                                                                                {
                                                                                    this.Kill();
                                                                                    this.ai[0] = 255f;
                                                                                }
                                                                                this.alpha = (int)(100.0 + (double)this.ai[0] * 0.7);
                                                                                this.rotation += this.velocity.X * 0.1f;
                                                                                this.rotation += (float)this.direction * 0.003f;
                                                                                this.velocity *= 0.96f;
                                                                                Rectangle rectangle12 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
                                                                                for (int num911 = 0; num911 < 1000; num911++)
                                                                                {
                                                                                    if (num911 != this.whoAmI && Main.projectile[num911].active && Main.projectile[num911].type >= ProjectileID.ToxicCloud && Main.projectile[num911].type <= ProjectileID.ToxicCloud3)
                                                                                    {
                                                                                        Rectangle rectangle13 = new Rectangle((int)Main.projectile[num911].position.X, (int)Main.projectile[num911].position.Y, Main.projectile[num911].width, Main.projectile[num911].height);
                                                                                        if (rectangle12.Intersects(rectangle13))
                                                                                        {
                                                                                            Vector2 vector139 = Main.projectile[num911].Center - base.Center;
                                                                                            if (vector139.X == 0f && vector139.Y == 0f)
                                                                                            {
                                                                                                if (num911 < this.whoAmI)
                                                                                                {
                                                                                                    vector139.X = -1f;
                                                                                                    vector139.Y = 1f;
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    vector139.X = 1f;
                                                                                                    vector139.Y = -1f;
                                                                                                }
                                                                                            }
                                                                                            vector139.Normalize();
                                                                                            vector139 *= 0.005f;
                                                                                            this.velocity -= vector139;
                                                                                            Main.projectile[num911].velocity += vector139;
                                                                                        }
                                                                                    }
                                                                                }
                                                                                return;
                                                                            }
                                                                            if (this.aiStyle == 93)
                                                                            {
                                                                                if (this.alpha > 0)
                                                                                {
                                                                                    this.alpha -= 25;
                                                                                    if (this.alpha <= 0)
                                                                                    {
                                                                                        this.alpha = 0;
                                                                                    }
                                                                                }
                                                                                if (this.velocity.Y > 18f)
                                                                                {
                                                                                    this.velocity.Y = 18f;
                                                                                }
                                                                                if (this.ai[0] == 0f)
                                                                                {
                                                                                    this.ai[1] += 1f;
                                                                                    if (this.ai[1] > 20f)
                                                                                    {
                                                                                        this.velocity.Y = this.velocity.Y + 0.1f;
                                                                                        this.velocity.X = this.velocity.X * 0.992f;
                                                                                    }
                                                                                    this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
                                                                                    return;
                                                                                }
                                                                                this.tileCollide = false;
                                                                                if (this.ai[0] == 1f)
                                                                                {
                                                                                    this.tileCollide = false;
                                                                                    this.velocity *= 0.6f;
                                                                                }
                                                                                else
                                                                                {
                                                                                    this.tileCollide = false;
                                                                                    int num912 = (int)(-(int)this.ai[0]);
                                                                                    num912--;
                                                                                    this.position = Main.npc[num912].Center - this.velocity;
                                                                                    this.position.X = this.position.X - (float)(this.width / 2);
                                                                                    this.position.Y = this.position.Y - (float)(this.height / 2);
                                                                                    if (!Main.npc[num912].active || Main.npc[num912].life < 0)
                                                                                    {
                                                                                        this.tileCollide = true;
                                                                                        this.ai[0] = 0f;
                                                                                        this.ai[1] = 20f;
                                                                                        this.velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
                                                                                        this.velocity.Normalize();
                                                                                        this.velocity *= 6f;
                                                                                        this.netUpdate = true;
                                                                                    }
                                                                                    else if (this.velocity.Length() > (float)((Main.npc[num912].width + Main.npc[num912].height) / 3))
                                                                                    {
                                                                                        this.velocity *= 0.99f;
                                                                                    }
                                                                                }
                                                                                if (this.ai[0] != 0f)
                                                                                {
                                                                                    this.ai[1] += 1f;
                                                                                    if (this.ai[1] > 90f)
                                                                                    {
                                                                                        this.Kill();
                                                                                        return;
                                                                                    }
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                if (this.aiStyle == 94)
                                                                                {
                                                                                    if (++this.frameCounter >= 4)
                                                                                    {
                                                                                        this.frameCounter = 0;
                                                                                        if (++this.frame >= Main.projFrames[this.type])
                                                                                        {
                                                                                            this.frame = 0;
                                                                                        }
                                                                                    }
                                                                                    this.ai[0] += 1f;
                                                                                    if (this.ai[0] <= 40f)
                                                                                    {
                                                                                        this.alpha -= 5;
                                                                                        if (this.alpha < 0)
                                                                                        {
                                                                                            this.alpha = 0;
                                                                                        }
                                                                                        this.velocity *= 0.85f;
                                                                                        if (this.ai[0] == 40f)
                                                                                        {
                                                                                            this.netUpdate = true;
                                                                                            switch (Main.rand.Next(3))
                                                                                            {
                                                                                                case 0:
                                                                                                    this.ai[1] = 10f;
                                                                                                    break;
                                                                                                case 1:
                                                                                                    this.ai[1] = 15f;
                                                                                                    break;
                                                                                                case 2:
                                                                                                    this.ai[1] = 30f;
                                                                                                    break;
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                    else if (this.ai[0] <= 60f)
                                                                                    {
                                                                                        this.velocity = Vector2.Zero;
                                                                                        if (this.ai[0] == 60f)
                                                                                        {
                                                                                            this.netUpdate = true;
                                                                                        }
                                                                                    }
                                                                                    else if (this.ai[0] <= 210f)
                                                                                    {
                                                                                        if (Main.netMode != 1 && (this.localAI[0] += 1f) >= this.ai[1])
                                                                                        {
                                                                                            this.localAI[0] = 0f;
                                                                                            int num913 = Item.NewItem((int)base.Center.X, (int)base.Center.Y, 0, 0, 73, 1, false, 0, false);
                                                                                            Main.item[num913].velocity = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * new Vector2(3f, 2f) * (Main.rand.NextFloat() * 0.5f + 0.5f) - Vector2.UnitY * 1f;
                                                                                        }
                                                                                        if (this.ai[0] == 210f)
                                                                                        {
                                                                                            this.netUpdate = true;
                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        this.scale -= 0.0333333351f;
                                                                                        this.alpha += 15;
                                                                                        if (this.ai[0] == 239f)
                                                                                        {
                                                                                            this.netUpdate = true;
                                                                                        }
                                                                                        if (this.ai[0] == 240f)
                                                                                        {
                                                                                            this.Kill();
                                                                                        }
                                                                                    }
                                                                                    return;
                                                                                }
                                                                                if (this.aiStyle == 95)
                                                                                {
                                                                                    if (this.localAI[0] > 2f)
                                                                                    {
                                                                                        this.alpha -= 20;
                                                                                        if (this.alpha < 100)
                                                                                        {
                                                                                            this.alpha = 100;
                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        this.localAI[0] += 1f;
                                                                                    }
                                                                                    if (this.ai[0] > 30f)
                                                                                    {
                                                                                        if (this.velocity.Y > -8f)
                                                                                        {
                                                                                            this.velocity.Y = this.velocity.Y - 0.05f;
                                                                                        }
                                                                                        this.velocity.X = this.velocity.X * 0.98f;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        this.ai[0] += 1f;
                                                                                    }
                                                                                    this.rotation = this.velocity.X * 0.1f;
                                                                                    if (this.wet)
                                                                                    {
                                                                                        if (this.velocity.Y > 0f)
                                                                                        {
                                                                                            this.velocity.Y = this.velocity.Y * 0.98f;
                                                                                        }
                                                                                        if (this.velocity.Y > -8f)
                                                                                        {
                                                                                            this.velocity.Y = this.velocity.Y - 0.2f;
                                                                                        }
                                                                                        this.velocity.X = this.velocity.X * 0.94f;
                                                                                        return;
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    if (this.aiStyle == 96)
                                                                                    {
                                                                                        this.ai[0] += 0.6f;
                                                                                        if (this.ai[0] > 500f)
                                                                                        {
                                                                                            this.Kill();
                                                                                        }
                                                                                        this.velocity.Y = this.velocity.Y + 0.008f;
                                                                                        return;
                                                                                    }
                                                                                    if (this.aiStyle == 97)
                                                                                    {
                                                                                        this.frameCounter++;
                                                                                        float num921 = 4f;
                                                                                        if ((float)this.frameCounter < num921 * 1f)
                                                                                        {
                                                                                            this.frame = 0;
                                                                                        }
                                                                                        else if ((float)this.frameCounter < num921 * 2f)
                                                                                        {
                                                                                            this.frame = 1;
                                                                                        }
                                                                                        else if ((float)this.frameCounter < num921 * 3f)
                                                                                        {
                                                                                            this.frame = 2;
                                                                                        }
                                                                                        else if ((float)this.frameCounter < num921 * 4f)
                                                                                        {
                                                                                            this.frame = 3;
                                                                                        }
                                                                                        else if ((float)this.frameCounter < num921 * 5f)
                                                                                        {
                                                                                            this.frame = 4;
                                                                                        }
                                                                                        else if ((float)this.frameCounter < num921 * 6f)
                                                                                        {
                                                                                            this.frame = 3;
                                                                                        }
                                                                                        else if ((float)this.frameCounter < num921 * 7f)
                                                                                        {
                                                                                            this.frame = 2;
                                                                                        }
                                                                                        else if ((float)this.frameCounter < num921 * 8f)
                                                                                        {
                                                                                            this.frame = 1;
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            this.frameCounter = 0;
                                                                                            this.frame = 0;
                                                                                        }
                                                                                        if (this.owner == Main.myPlayer)
                                                                                        {
                                                                                            for (int num922 = 0; num922 < 1000; num922++)
                                                                                            {
                                                                                                if (num922 != this.whoAmI && Main.projectile[num922].active && Main.projectile[num922].owner == this.owner && Main.projectile[num922].type == this.type)
                                                                                                {
                                                                                                    if (this.timeLeft >= Main.projectile[num922].timeLeft)
                                                                                                    {
                                                                                                        Main.projectile[num922].Kill();
                                                                                                    }
                                                                                                    else
                                                                                                    {
                                                                                                        this.Kill();
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                        if (this.ai[0] == 0f)
                                                                                        {
                                                                                            if ((double)this.velocity.Length() < 0.1)
                                                                                            {
                                                                                                this.velocity.X = 0f;
                                                                                                this.velocity.Y = 0f;
                                                                                                this.ai[0] = 1f;
                                                                                                this.ai[1] = 45f;
                                                                                                return;
                                                                                            }
                                                                                            this.velocity *= 0.94f;
                                                                                            if (this.velocity.X < 0f)
                                                                                            {
                                                                                                this.direction = -1;
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                this.direction = 1;
                                                                                            }
                                                                                            this.spriteDirection = this.direction;
                                                                                            return;
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            if (Main.player[this.owner].Center.X < base.Center.X)
                                                                                            {
                                                                                                this.direction = -1;
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                this.direction = 1;
                                                                                            }
                                                                                            this.spriteDirection = this.direction;
                                                                                            this.ai[1] += 1f;
                                                                                            float num923 = 0.005f;
                                                                                            if (this.ai[1] > 0f)
                                                                                            {
                                                                                                this.velocity.Y = this.velocity.Y - num923;
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                this.velocity.Y = this.velocity.Y + num923;
                                                                                            }
                                                                                            if (this.ai[1] >= 90f)
                                                                                            {
                                                                                                this.ai[1] *= -1f;
                                                                                                return;
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                    else if (this.aiStyle == 98)
                                                                                    {
                                                                                        Vector2 vector142 = new Vector2(this.ai[0], this.ai[1]);
                                                                                        Vector2 vector143 = vector142 - base.Center;
                                                                                        if (vector143.Length() < this.velocity.Length())
                                                                                        {
                                                                                            this.Kill();
                                                                                            return;
                                                                                        }
                                                                                        vector143.Normalize();
                                                                                        vector143 *= 15f;
                                                                                        this.velocity = Vector2.Lerp(this.velocity, vector143, 0.1f);
                                                                                        return;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        if (this.aiStyle == 99 && this.type >= ProjectileID.BlackCounterweight && this.type <= ProjectileID.YellowCounterweight)
                                                                                        {
                                                                                            this.AI_099_1();
                                                                                            return;
                                                                                        }
                                                                                        if (this.aiStyle == 99)
                                                                                        {
                                                                                            this.AI_099_2();
                                                                                            return;
                                                                                        }
                                                                                        if (this.aiStyle == 100)
                                                                                        {
                                                                                            Player player5 = Main.player[this.owner];
                                                                                            Vector2 zero2 = Vector2.Zero;
                                                                                            if (this.type == ProjectileID.MedusaHead)
                                                                                            {
                                                                                                zero2.X = (float)player5.direction * 6f;
                                                                                                zero2.Y = player5.gravDir * -14f;
                                                                                                this.ai[0] += 1f;
                                                                                                int num926 = 0;
                                                                                                if (this.ai[0] >= 60f)
                                                                                                {
                                                                                                    num926++;
                                                                                                }
                                                                                                if (this.ai[0] >= 180f)
                                                                                                {
                                                                                                    num926++;
                                                                                                }
                                                                                                if (this.ai[0] >= 240f)
                                                                                                {
                                                                                                    this.Kill();
                                                                                                    return;
                                                                                                }
                                                                                                bool flag40 = false;
                                                                                                if (this.ai[0] == 60f || this.ai[0] == 180f)
                                                                                                {
                                                                                                    flag40 = true;
                                                                                                }
                                                                                                bool flag41 = this.ai[0] >= 180f;
                                                                                                if (flag41)
                                                                                                {
                                                                                                    if (this.frame < 8)
                                                                                                    {
                                                                                                        this.frame = 8;
                                                                                                    }
                                                                                                    if (this.frame >= 12)
                                                                                                    {
                                                                                                        this.frame = 8;
                                                                                                    }
                                                                                                    this.frameCounter++;
                                                                                                    if (++this.frameCounter >= 5)
                                                                                                    {
                                                                                                        this.frameCounter = 0;
                                                                                                        if (++this.frame >= 12)
                                                                                                        {
                                                                                                            this.frame = 8;
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                                else if (++this.frameCounter >= 5)
                                                                                                {
                                                                                                    this.frameCounter = 0;
                                                                                                    if (++this.frame >= 8)
                                                                                                    {
                                                                                                        this.frame = 0;
                                                                                                    }
                                                                                                }
                                                                                                Vector2 center11 = player5.Center;
                                                                                                Vector2 vector144 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - center11;
                                                                                                if (player5.gravDir == -1f)
                                                                                                {
                                                                                                    vector144.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - center11.Y;
                                                                                                }
                                                                                                Vector2 velocity2 = new Vector2((float)Math.Sign((vector144.X == 0f) ? ((float)player5.direction) : vector144.X), 0f);
                                                                                                if (velocity2.X != this.velocity.X || velocity2.Y != this.velocity.Y)
                                                                                                {
                                                                                                    this.netUpdate = true;
                                                                                                }
                                                                                                this.velocity = velocity2;
                                                                                                if (this.soundDelay <= 0 && !flag41)
                                                                                                {
                                                                                                    this.soundDelay = 10;
                                                                                                    this.soundDelay *= 2;
                                                                                                }
                                                                                                if (Main.myPlayer == this.owner)
                                                                                                {
                                                                                                    bool flag42 = !flag40 || player5.CheckMana(player5.inventory[player5.selectedItem].mana, true, false);
                                                                                                    bool flag43 = player5.channel && flag42;
                                                                                                    if ((!flag41 && !flag43) || this.ai[0] == 180f)
                                                                                                    {
                                                                                                        Vector2 vector149 = player5.Center + new Vector2((float)(player5.direction * 4), player5.gravDir * 2f);
                                                                                                        int num932 = this.damage * (1 + num926);
                                                                                                        vector149 = base.Center;
                                                                                                        int num933 = 0;
                                                                                                        float num934 = 0f;
                                                                                                        for (int num935 = 0; num935 < 200; num935++)
                                                                                                        {
                                                                                                            NPC nPC9 = Main.npc[num935];
                                                                                                            if (nPC9.active && base.Distance(nPC9.Center) < 500f && nPC9.CanBeChasedBy(this, false) && Collision.CanHitLine(nPC9.position, nPC9.width, nPC9.height, vector149, 0, 0))
                                                                                                            {
                                                                                                                Vector2 v4 = nPC9.Center - vector149;
                                                                                                                num934 += v4.ToRotation();
                                                                                                                num933++;
                                                                                                                int num936 = Projectile.NewProjectile(vector149.X, vector149.Y, v4.X, v4.Y, 536, 0, 0f, this.owner, (float)this.whoAmI, 0f);
                                                                                                                Main.projectile[num936].Center = nPC9.Center;
                                                                                                                Main.projectile[num936].damage = num932;
                                                                                                                Main.projectile[num936].Damage();
                                                                                                                Main.projectile[num936].damage = 0;
                                                                                                                Main.projectile[num936].Center = vector149;
                                                                                                                this.ai[0] = 180f;
                                                                                                            }
                                                                                                        }
                                                                                                        if (num933 != 0)
                                                                                                        {
                                                                                                            num934 /= (float)num933;
                                                                                                        }
                                                                                                        else
                                                                                                        {
                                                                                                            num934 = ((player5.direction == 1) ? 0f : 3.14159274f);
                                                                                                        }
                                                                                                        for (int num937 = 0; num937 < 6; num937++)
                                                                                                        {
                                                                                                            Vector2 vector150 = Vector2.Zero;
                                                                                                            if (Main.rand.Next(4) != 0)
                                                                                                            {
                                                                                                                vector150 = Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)num934, default(Vector2)) * new Vector2(200f, 50f) * (Main.rand.NextFloat() * 0.7f + 0.3f);
                                                                                                            }
                                                                                                            else
                                                                                                            {
                                                                                                                vector150 = Vector2.UnitX.RotatedByRandom(6.2831854820251465) * new Vector2(200f, 50f) * (Main.rand.NextFloat() * 0.7f + 0.3f);
                                                                                                            }
                                                                                                            Projectile.NewProjectile(vector149.X, vector149.Y, vector150.X, vector150.Y, 536, 0, 0f, this.owner, (float)this.whoAmI, 0f);
                                                                                                        }
                                                                                                        this.ai[0] = 180f;
                                                                                                        this.netUpdate = true;
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                            this.rotation = ((player5.gravDir == 1f) ? 0f : 3.14159274f);
                                                                                            this.spriteDirection = this.direction;
                                                                                            this.timeLeft = 2;
                                                                                            Vector2 vector151 = Main.OffsetsPlayerOnhand[player5.bodyFrame.Y / 56] * 2f;
                                                                                            if (player5.direction != 1)
                                                                                            {
                                                                                                vector151.X = (float)player5.bodyFrame.Width - vector151.X;
                                                                                            }
                                                                                            vector151 -= (player5.bodyFrame.Size() - new Vector2((float)player5.width, 42f)) / 2f;
                                                                                            base.Center = (player5.position + vector151 + zero2 - this.velocity).Floor();
                                                                                            player5.ChangeDir(this.direction);
                                                                                            player5.heldProj = this.whoAmI;
                                                                                            player5.itemTime = 2;
                                                                                            player5.itemAnimation = 2;
                                                                                            return;
                                                                                        }
                                                                                        if (this.aiStyle == 101)
                                                                                        {
                                                                                            float num938 = 20f;
                                                                                            this.localAI[0] += 1f;
                                                                                            this.alpha = (int)MathHelper.Lerp(0f, 255f, this.localAI[0] / num938);
                                                                                            int num939 = (int)this.ai[0];
                                                                                            int num940 = -1;
                                                                                            int num941 = -1;
                                                                                            int num655 = this.type;
                                                                                            if (num655 != 536)
                                                                                            {
                                                                                                if (num655 == 591)
                                                                                                {
                                                                                                    num941 = 1;
                                                                                                }
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                num940 = 535;
                                                                                                num941 = 0;
                                                                                            }
                                                                                            if (num941 == 1)
                                                                                            {
                                                                                                if (this.localAI[0] >= num938 || num939 < 0 || num939 > 255 || !Main.player[num939].active || Main.player[num939].dead)
                                                                                                {
                                                                                                    this.Kill();
                                                                                                    return;
                                                                                                }
                                                                                                if (this.type == ProjectileID.MinecartMechLaser)
                                                                                                {
                                                                                                    base.Center = Mount.GetMinecartMechPoint(Main.player[num939], 20, -19) - this.velocity;
                                                                                                    this.rotation = this.velocity.ToRotation() + 1.57079637f;
                                                                                                    if (Math.Sign(this.velocity.X) != Math.Sign(Main.player[num939].velocity.X) && Main.player[num939].velocity.X != 0f)
                                                                                                    {
                                                                                                        this.Kill();
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    base.Center = Main.player[num939].Center - this.velocity;
                                                                                                }
                                                                                            }
                                                                                            else if (num941 == 0)
                                                                                            {
                                                                                                if (this.localAI[0] >= num938 || num939 < 0 || num939 > 1000 || !Main.projectile[num939].active || Main.projectile[num939].type != num940)
                                                                                                {
                                                                                                    this.Kill();
                                                                                                    return;
                                                                                                }
                                                                                                base.Center = Main.projectile[num939].Center - this.velocity;
                                                                                            }
                                                                                            this.rotation = this.velocity.ToRotation() + 1.57079637f;
                                                                                            return;
                                                                                        }
                                                                                        if (this.aiStyle == 102)
                                                                                        {
                                                                                            int num942 = 0;
                                                                                            float num943 = 0f;
                                                                                            float num944 = 0f;
                                                                                            float num945 = 0f;
                                                                                            int num946 = -1;
                                                                                            int num947 = 0;
                                                                                            float num948 = 0f;
                                                                                            bool flag44 = true;
                                                                                            bool flag45 = false;
                                                                                            bool flag46 = false;
                                                                                            int num655 = this.type;
                                                                                            if (num655 != 539)
                                                                                            {
                                                                                                switch (num655)
                                                                                                {
                                                                                                    case 573:
                                                                                                        num942 = 424;
                                                                                                        num943 = 90f;
                                                                                                        num948 = 20f;
                                                                                                        flag44 = false;
                                                                                                        flag45 = true;
                                                                                                        break;
                                                                                                    case 574:
                                                                                                        num942 = 420;
                                                                                                        num943 = 180f;
                                                                                                        num944 = 0.15f;
                                                                                                        num945 = 0.075f;
                                                                                                        num948 = 8f;
                                                                                                        flag44 = false;
                                                                                                        num946 = 576;
                                                                                                        num947 = 65;
                                                                                                        if (Main.expertMode)
                                                                                                        {
                                                                                                            num947 = 50;
                                                                                                        }
                                                                                                        flag46 = true;
                                                                                                        break;
                                                                                                }
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                num942 = 407;
                                                                                                num943 = 210f;
                                                                                                num944 = 0.15f;
                                                                                                num945 = 0.075f;
                                                                                                num948 = 16f;
                                                                                            }
                                                                                            if (flag46)
                                                                                            {
                                                                                                int num949 = (int)this.ai[1];
                                                                                                if (!Main.npc[num949].active || Main.npc[num949].type != num942)
                                                                                                {
                                                                                                    this.Kill();
                                                                                                    return;
                                                                                                }
                                                                                                this.timeLeft = 2;
                                                                                            }
                                                                                            this.ai[0] += 1f;
                                                                                            if (this.ai[0] < num943)
                                                                                            {
                                                                                                bool flag47 = true;
                                                                                                int num950 = (int)this.ai[1];
                                                                                                if (Main.npc[num950].active && Main.npc[num950].type == num942)
                                                                                                {
                                                                                                    if (!flag45 && Main.npc[num950].oldPos[1] != Vector2.Zero)
                                                                                                    {
                                                                                                        this.position += Main.npc[num950].position - Main.npc[num950].oldPos[1];
                                                                                                    }
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    this.ai[0] = num943;
                                                                                                    flag47 = false;
                                                                                                }
                                                                                                if (flag47 && !flag45)
                                                                                                {
                                                                                                    this.velocity += new Vector2((float)Math.Sign(Main.npc[num950].Center.X - base.Center.X), (float)Math.Sign(Main.npc[num950].Center.Y - base.Center.Y)) * new Vector2(num944, num945);
                                                                                                    if (this.velocity.Length() > 6f)
                                                                                                    {
                                                                                                        this.velocity *= 6f / this.velocity.Length();
                                                                                                    }
                                                                                                }
                                                                                                if (this.type == ProjectileID.StardustJellyfishSmall)
                                                                                                {
                                                                                                    if (++this.frameCounter >= 4)
                                                                                                    {
                                                                                                        this.frameCounter = 0;
                                                                                                        if (++this.frame >= Main.projFrames[this.type])
                                                                                                        {
                                                                                                            this.frame = 0;
                                                                                                        }
                                                                                                    }
                                                                                                    this.rotation = this.velocity.X * 0.1f;
                                                                                                }
                                                                                                if (this.type == ProjectileID.NebulaBolt)
                                                                                                {
                                                                                                    this.alpha = 255;
                                                                                                }
                                                                                                if (this.type == ProjectileID.NebulaEye)
                                                                                                {
                                                                                                    if (flag47)
                                                                                                    {
                                                                                                        int target = Main.npc[num950].target;
                                                                                                        float num954 = this.velocity.ToRotation();
                                                                                                        if (Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0))
                                                                                                        {
                                                                                                            num954 = base.DirectionTo(Main.player[target].Center).ToRotation();
                                                                                                        }
                                                                                                        this.rotation = this.rotation.AngleLerp(num954 + 1.57079637f, 0.2f);
                                                                                                    }
                                                                                                    this.frame = 1;
                                                                                                }
                                                                                            }
                                                                                            if (this.ai[0] == num943)
                                                                                            {
                                                                                                bool flag48 = true;
                                                                                                int num955 = -1;
                                                                                                if (!flag44)
                                                                                                {
                                                                                                    int num956 = (int)this.ai[1];
                                                                                                    if (Main.npc[num956].active && Main.npc[num956].type == num942)
                                                                                                    {
                                                                                                        num955 = Main.npc[num956].target;
                                                                                                    }
                                                                                                    else
                                                                                                    {
                                                                                                        flag48 = false;
                                                                                                    }
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    flag48 = false;
                                                                                                }
                                                                                                if (!flag48)
                                                                                                {
                                                                                                    num955 = (int)Player.FindClosest(this.position, this.width, this.height);
                                                                                                }
                                                                                                Vector2 vector152 = Main.player[num955].Center - base.Center;
                                                                                                vector152.X += (float)Main.rand.Next(-50, 51);
                                                                                                vector152.Y += (float)Main.rand.Next(-50, 51);
                                                                                                vector152.X *= (float)Main.rand.Next(80, 121) * 0.01f;
                                                                                                vector152.Y *= (float)Main.rand.Next(80, 121) * 0.01f;
                                                                                                Vector2 vector153 = Vector2.Normalize(vector152);
                                                                                                if (vector153.HasNaNs())
                                                                                                {
                                                                                                    vector153 = Vector2.UnitY;
                                                                                                }
                                                                                                if (num946 == -1)
                                                                                                {
                                                                                                    this.velocity = vector153 * num948;
                                                                                                    this.netUpdate = true;
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    if (Main.netMode != 1 && Collision.CanHitLine(base.Center, 0, 0, Main.player[num955].Center, 0, 0))
                                                                                                    {
                                                                                                        Projectile.NewProjectile(base.Center.X, base.Center.Y, vector153.X * num948, vector153.Y * num948, num946, num947, 1f, Main.myPlayer, 0f, 0f);
                                                                                                    }
                                                                                                    this.ai[0] = 0f;
                                                                                                }
                                                                                            }
                                                                                            if (this.ai[0] >= num943)
                                                                                            {
                                                                                                this.rotation = this.rotation.AngleLerp(this.velocity.ToRotation() + 1.57079637f, 0.4f);
                                                                                                if (this.type == ProjectileID.StardustJellyfishSmall)
                                                                                                {
                                                                                                    if (++this.frameCounter >= 2)
                                                                                                    {
                                                                                                        this.frameCounter = 0;
                                                                                                        if (++this.frame >= Main.projFrames[this.type])
                                                                                                        {
                                                                                                            this.frame = 0;
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                                if (this.type == ProjectileID.NebulaBolt)
                                                                                                {
                                                                                                    this.alpha = 0;
                                                                                                    return;
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                        else if (this.aiStyle == 103)
                                                                                        {
                                                                                            this.scale = this.ai[1];
                                                                                            this.ai[0] += 1f;
                                                                                            if (this.ai[0] >= 30f)
                                                                                            {
                                                                                                this.alpha += 25;
                                                                                                if (this.alpha >= 250)
                                                                                                {
                                                                                                    this.Kill();
                                                                                                    return;
                                                                                                }
                                                                                            }
                                                                                            else if (this.ai[0] >= 0f)
                                                                                            {
                                                                                                this.alpha -= 25;
                                                                                                if (this.alpha < 0)
                                                                                                {
                                                                                                    this.alpha = 0;
                                                                                                    if (this.localAI[1] == 0f && Main.netMode != 1 && this.localAI[0] != 0f)
                                                                                                    {
                                                                                                        this.localAI[1] = 1f;
                                                                                                        NPC.NewNPC((int)base.Center.X, (int)base.Bottom.Y, (int)this.localAI[0], 0, 0f, 0f, 0f, 0f, 255);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            if (this.aiStyle == 104)
                                                                                            {
                                                                                                if (this.ai[0] == 1f)
                                                                                                {
                                                                                                    this.scale *= 0.995f;
                                                                                                    this.alpha += 3;
                                                                                                    if (this.alpha >= 250)
                                                                                                    {
                                                                                                        this.Kill();
                                                                                                    }
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    this.scale *= 1.01f;
                                                                                                    this.alpha -= 7;
                                                                                                    if (this.alpha < 0)
                                                                                                    {
                                                                                                        this.alpha = 0;
                                                                                                        this.ai[0] = 1f;
                                                                                                    }
                                                                                                }
                                                                                                this.frameCounter++;
                                                                                                if (this.frameCounter > 6)
                                                                                                {
                                                                                                    this.frameCounter = 0;
                                                                                                    this.frame++;
                                                                                                    if (this.frame > 3)
                                                                                                    {
                                                                                                        this.frame = 0;
                                                                                                    }
                                                                                                }
                                                                                                this.velocity.Y = this.velocity.Y - 0.03f;
                                                                                                this.velocity.X = this.velocity.X * 0.97f;
                                                                                                return;
                                                                                            }
                                                                                            if (this.aiStyle == 105)
                                                                                            {
                                                                                                this.localAI[0] += 1f;
                                                                                                if (this.localAI[0] >= 90f)
                                                                                                {
                                                                                                    this.localAI[0] *= -1f;
                                                                                                }
                                                                                                if (this.localAI[0] >= 0f)
                                                                                                {
                                                                                                    this.scale += 0.003f;
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    this.scale -= 0.003f;
                                                                                                }
                                                                                                this.rotation += 0.0025f * this.scale;
                                                                                                float num961 = 1f;
                                                                                                float num962 = 1f;
                                                                                                if (this.identity % 6 == 0)
                                                                                                {
                                                                                                    num962 *= -1f;
                                                                                                }
                                                                                                if (this.identity % 6 == 1)
                                                                                                {
                                                                                                    num961 *= -1f;
                                                                                                }
                                                                                                if (this.identity % 6 == 2)
                                                                                                {
                                                                                                    num962 *= -1f;
                                                                                                    num961 *= -1f;
                                                                                                }
                                                                                                if (this.identity % 6 == 3)
                                                                                                {
                                                                                                    num962 = 0f;
                                                                                                }
                                                                                                if (this.identity % 6 == 4)
                                                                                                {
                                                                                                    num961 = 0f;
                                                                                                }
                                                                                                this.localAI[1] += 1f;
                                                                                                if (this.localAI[1] > 60f)
                                                                                                {
                                                                                                    this.localAI[1] = -180f;
                                                                                                }
                                                                                                if (this.localAI[1] >= -60f)
                                                                                                {
                                                                                                    this.velocity.X = this.velocity.X + 0.002f * num962;
                                                                                                    this.velocity.Y = this.velocity.Y + 0.002f * num961;
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    this.velocity.X = this.velocity.X - 0.002f * num962;
                                                                                                    this.velocity.Y = this.velocity.Y - 0.002f * num961;
                                                                                                }
                                                                                                this.ai[0] += 1f;
                                                                                                if (this.ai[0] > 5400f)
                                                                                                {
                                                                                                    this.damage = 0;
                                                                                                    this.ai[1] = 1f;
                                                                                                    if (this.alpha < 255)
                                                                                                    {
                                                                                                        this.alpha += 5;
                                                                                                        if (this.alpha > 255)
                                                                                                        {
                                                                                                            this.alpha = 255;
                                                                                                        }
                                                                                                    }
                                                                                                    else if (this.owner == Main.myPlayer)
                                                                                                    {
                                                                                                        this.Kill();
                                                                                                    }
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    float num963 = (base.Center - Main.player[this.owner].Center).Length() / 100f;
                                                                                                    if (num963 > 4f)
                                                                                                    {
                                                                                                        num963 *= 1.1f;
                                                                                                    }
                                                                                                    if (num963 > 5f)
                                                                                                    {
                                                                                                        num963 *= 1.2f;
                                                                                                    }
                                                                                                    if (num963 > 6f)
                                                                                                    {
                                                                                                        num963 *= 1.3f;
                                                                                                    }
                                                                                                    if (num963 > 7f)
                                                                                                    {
                                                                                                        num963 *= 1.4f;
                                                                                                    }
                                                                                                    if (num963 > 8f)
                                                                                                    {
                                                                                                        num963 *= 1.5f;
                                                                                                    }
                                                                                                    if (num963 > 9f)
                                                                                                    {
                                                                                                        num963 *= 1.6f;
                                                                                                    }
                                                                                                    if (num963 > 10f)
                                                                                                    {
                                                                                                        num963 *= 1.7f;
                                                                                                    }
                                                                                                    if (!Main.player[this.owner].sporeSac)
                                                                                                    {
                                                                                                        num963 += 100f;
                                                                                                    }
                                                                                                    this.ai[0] += num963;
                                                                                                    if (this.alpha > 50)
                                                                                                    {
                                                                                                        this.alpha -= 10;
                                                                                                        if (this.alpha < 50)
                                                                                                        {
                                                                                                            this.alpha = 50;
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                                bool flag49 = false;
                                                                                                Vector2 center12 = new Vector2(0f, 0f);
                                                                                                float num964 = 280f;
                                                                                                for (int num965 = 0; num965 < 200; num965++)
                                                                                                {
                                                                                                    if (Main.npc[num965].CanBeChasedBy(this, false))
                                                                                                    {
                                                                                                        float num966 = Main.npc[num965].position.X + (float)(Main.npc[num965].width / 2);
                                                                                                        float num967 = Main.npc[num965].position.Y + (float)(Main.npc[num965].height / 2);
                                                                                                        float num968 = Math.Abs(this.position.X + (float)(this.width / 2) - num966) + Math.Abs(this.position.Y + (float)(this.height / 2) - num967);
                                                                                                        if (num968 < num964)
                                                                                                        {
                                                                                                            num964 = num968;
                                                                                                            center12 = Main.npc[num965].Center;
                                                                                                            flag49 = true;
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                                if (flag49)
                                                                                                {
                                                                                                    Vector2 vector154 = center12 - base.Center;
                                                                                                    vector154.Normalize();
                                                                                                    vector154 *= 0.75f;
                                                                                                    this.velocity = (this.velocity * 10f + vector154) / 11f;
                                                                                                    return;
                                                                                                }
                                                                                                if ((double)this.velocity.Length() > 0.2)
                                                                                                {
                                                                                                    this.velocity *= 0.98f;
                                                                                                    return;
                                                                                                }
                                                                                            }
                                                                                            else if (this.aiStyle == 106)
                                                                                            {
                                                                                                this.rotation += this.velocity.X * 0.02f;
                                                                                                if (this.velocity.X < 0f)
                                                                                                {
                                                                                                    this.rotation -= Math.Abs(this.velocity.Y) * 0.02f;
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    this.rotation += Math.Abs(this.velocity.Y) * 0.02f;
                                                                                                }
                                                                                                this.velocity *= 0.98f;
                                                                                                this.ai[0] += 1f;
                                                                                                if (this.ai[0] >= 60f)
                                                                                                {
                                                                                                    if (this.alpha < 255)
                                                                                                    {
                                                                                                        this.alpha += 5;
                                                                                                        if (this.alpha > 255)
                                                                                                        {
                                                                                                            this.alpha = 255;
                                                                                                            return;
                                                                                                        }
                                                                                                    }
                                                                                                    else if (this.owner == Main.myPlayer)
                                                                                                    {
                                                                                                        this.Kill();
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                else if (this.alpha > 80)
                                                                                                {
                                                                                                    this.alpha -= 30;
                                                                                                    if (this.alpha < 80)
                                                                                                    {
                                                                                                        this.alpha = 80;
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                            else if (this.aiStyle == 107)
                                                                                            {
                                                                                                float num969 = 10f;
                                                                                                float num970 = 5f;
                                                                                                float num971 = 40f;
                                                                                                if (this.type == ProjectileID.NebulaSphere)
                                                                                                {
                                                                                                    if (this.timeLeft > 30 && this.alpha > 0)
                                                                                                    {
                                                                                                        this.alpha -= 25;
                                                                                                    }
                                                                                                    if (this.timeLeft > 30 && this.alpha < 128 && Collision.SolidCollision(this.position, this.width, this.height))
                                                                                                    {
                                                                                                        this.alpha = 128;
                                                                                                    }
                                                                                                    if (this.alpha < 0)
                                                                                                    {
                                                                                                        this.alpha = 0;
                                                                                                    }
                                                                                                    if (++this.frameCounter > 4)
                                                                                                    {
                                                                                                        this.frameCounter = 0;
                                                                                                        if (++this.frame >= 4)
                                                                                                        {
                                                                                                            this.frame = 0;
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                                else if (this.type == ProjectileID.DesertDjinnCurse)
                                                                                                {
                                                                                                    num969 = 10f;
                                                                                                    num970 = 7.5f;
                                                                                                    if (this.timeLeft > 30 && this.alpha > 0)
                                                                                                    {
                                                                                                        this.alpha -= 25;
                                                                                                    }
                                                                                                    if (this.timeLeft > 30 && this.alpha < 128 && Collision.SolidCollision(this.position, this.width, this.height))
                                                                                                    {
                                                                                                        this.alpha = 128;
                                                                                                    }
                                                                                                    if (this.alpha < 0)
                                                                                                    {
                                                                                                        this.alpha = 0;
                                                                                                    }
                                                                                                    if (++this.frameCounter > 4)
                                                                                                    {
                                                                                                        this.frameCounter = 0;
                                                                                                        if (++this.frame >= 4)
                                                                                                        {
                                                                                                            this.frame = 0;
                                                                                                        }
                                                                                                    }
                                                                                                    this.ai[1] += 1f;
                                                                                                    float arg_282A8_0 = this.ai[1] / 180f;
                                                                                                    for (float num973 = 0f; num973 < 3f; num973 += 1f)
                                                                                                    {
                                                                                                        if (Main.rand.Next(3) != 0)
                                                                                                        {
                                                                                                            return;
                                                                                                        }
                                                                                                    }
                                                                                                    if (this.timeLeft < 4)
                                                                                                    {
                                                                                                        int num974 = 40;
                                                                                                        if (Main.expertMode)
                                                                                                        {
                                                                                                            num974 = 30;
                                                                                                        }
                                                                                                        this.position = base.Center;
                                                                                                        this.width = (this.height = 60);
                                                                                                        base.Center = this.position;
                                                                                                        this.damage = num974;
                                                                                                    }
                                                                                                }
                                                                                                int num976 = (int)this.ai[0];
                                                                                                if (num976 >= 0 && Main.player[num976].active && !Main.player[num976].dead)
                                                                                                {
                                                                                                    if (base.Distance(Main.player[num976].Center) > num971)
                                                                                                    {
                                                                                                        Vector2 vector155 = base.DirectionTo(Main.player[num976].Center);
                                                                                                        if (vector155.HasNaNs())
                                                                                                        {
                                                                                                            vector155 = Vector2.UnitY;
                                                                                                        }
                                                                                                        this.velocity = (this.velocity * (num969 - 1f) + vector155 * num970) / num969;
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    if (this.timeLeft > 30)
                                                                                                    {
                                                                                                        this.timeLeft = 30;
                                                                                                    }
                                                                                                    if (this.ai[0] != -1f)
                                                                                                    {
                                                                                                        this.ai[0] = -1f;
                                                                                                        this.netUpdate = true;
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                            else if (this.aiStyle == 108)
                                                                                            {
                                                                                                if (this.type == ProjectileID.VortexVortexLightning && this.localAI[0] == 0f)
                                                                                                {
                                                                                                    this.localAI[0] = 1f;
                                                                                                    int num977 = (int)Player.FindClosest(base.Center, 0, 0);
                                                                                                    Vector2 vector156 = Main.player[num977].Center - base.Center;
                                                                                                    if (vector156 == Vector2.Zero)
                                                                                                    {
                                                                                                        vector156 = Vector2.UnitY;
                                                                                                    }
                                                                                                    this.ai[1] = vector156.ToRotation();
                                                                                                    this.netUpdate = true;
                                                                                                }
                                                                                                this.ai[0] += 1f;
                                                                                                if (this.ai[0] <= 90f)
                                                                                                {
                                                                                                    if (this.type == ProjectileID.VortexVortexPortal)
                                                                                                    {
                                                                                                    }
                                                                                                    if (this.type == ProjectileID.VortexVortexLightning && Main.rand.Next(2) == 0)
                                                                                                    {
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                else if (this.ai[0] <= 90f)
                                                                                                {
                                                                                                    this.scale = (this.ai[0] - 50f) / 40f;
                                                                                                    this.alpha = 255 - (int)(255f * this.scale);
                                                                                                    this.rotation -= 0.157079637f;
                                                                                                    if (this.type == ProjectileID.VortexVortexLightning)
                                                                                                    {
                                                                                                        if (this.ai[0] == 90f && Main.netMode != 1)
                                                                                                        {
                                                                                                            Vector2 vector168 = this.ai[1].ToRotationVector2() * 8f;
                                                                                                            float ai2 = (float)Main.rand.Next(80);
                                                                                                            Projectile.NewProjectile(base.Center.X - vector168.X, base.Center.Y - vector168.Y, vector168.X, vector168.Y, 580, 15, 1f, Main.myPlayer, this.ai[1], ai2);
                                                                                                            return;
                                                                                                        }
                                                                                                    }
                                                                                                    else if (this.type == ProjectileID.VortexVortexPortal && this.ai[0] == 90f && Main.netMode != 1)
                                                                                                    {
                                                                                                        for (int num980 = 0; num980 < 2; num980++)
                                                                                                        {
                                                                                                            int num981 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 427, this.whoAmI, 0f, 0f, 0f, 0f, 255);
                                                                                                            Main.npc[num981].velocity = -Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (float)Main.rand.Next(4, 9) - Vector2.UnitY * 2f;
                                                                                                            Main.npc[num981].netUpdate = true;
                                                                                                        }
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    if (this.ai[0] > 120f)
                                                                                                    {
                                                                                                        this.scale = 1f - (this.ai[0] - 120f) / 60f;
                                                                                                        this.alpha = 255 - (int)(255f * this.scale);
                                                                                                        this.rotation -= 0.104719758f;
                                                                                                        if (this.alpha >= 255)
                                                                                                        {
                                                                                                            this.Kill();
                                                                                                        }
                                                                                                        return;
                                                                                                    }
                                                                                                    this.scale = 1f;
                                                                                                    this.alpha = 0;
                                                                                                    this.rotation -= 0.05235988f;
                                                                                                    return;
                                                                                                }
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                if (this.aiStyle == 109)
                                                                                                {
                                                                                                    if (this.localAI[1] == 0f)
                                                                                                    {
                                                                                                        this.localAI[1] = this.velocity.Length();
                                                                                                    }
                                                                                                    if (this.ai[0] == 0f)
                                                                                                    {
                                                                                                        this.localAI[0] += 1f;
                                                                                                        if (this.localAI[0] > 30f)
                                                                                                        {
                                                                                                            this.ai[0] = 1f;
                                                                                                            this.localAI[0] = 0f;
                                                                                                            return;
                                                                                                        }
                                                                                                    }
                                                                                                    else if (this.ai[0] == 1f)
                                                                                                    {
                                                                                                        Vector2 vector173 = Vector2.Zero;
                                                                                                        if (this.type != ProjectileID.MechanicWrench || !Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].type != 124)
                                                                                                        {
                                                                                                            this.Kill();
                                                                                                            return;
                                                                                                        }
                                                                                                        vector173 = Main.npc[(int)this.ai[1]].Center;
                                                                                                        this.tileCollide = false;
                                                                                                        float num984 = this.localAI[1];
                                                                                                        Vector2 vector174 = vector173 - base.Center;
                                                                                                        if (vector174.Length() < num984)
                                                                                                        {
                                                                                                            this.Kill();
                                                                                                            return;
                                                                                                        }
                                                                                                        vector174.Normalize();
                                                                                                        vector174 *= num984;
                                                                                                        this.velocity = Vector2.Lerp(this.velocity, vector174, 0.04f);
                                                                                                    }
                                                                                                    this.rotation += 0.314159274f;
                                                                                                    return;
                                                                                                }
                                                                                                if (this.aiStyle == 110)
                                                                                                {
                                                                                                    if (this.localAI[1] == 0f)
                                                                                                    {
                                                                                                        this.localAI[1] = this.velocity.Length();
                                                                                                    }
                                                                                                    Vector2 vector175 = Vector2.Zero;
                                                                                                    if (!Main.npc[(int)this.ai[0]].active || !Main.npc[(int)this.ai[0]].townNPC)
                                                                                                    {
                                                                                                        this.Kill();
                                                                                                        return;
                                                                                                    }
                                                                                                    vector175 = Main.npc[(int)this.ai[0]].Center;
                                                                                                    float num985 = this.localAI[1];
                                                                                                    Vector2 vector176 = vector175 - base.Center;
                                                                                                    if (vector176.Length() < num985 || base.Hitbox.Intersects(Main.npc[(int)this.ai[0]].Hitbox))
                                                                                                    {
                                                                                                        this.Kill();
                                                                                                        int num986 = Main.npc[(int)this.ai[0]].lifeMax - Main.npc[(int)this.ai[0]].life;
                                                                                                        if (num986 > 20)
                                                                                                        {
                                                                                                            num986 = 20;
                                                                                                        }
                                                                                                        if (num986 > 0)
                                                                                                        {
                                                                                                            Main.npc[(int)this.ai[0]].life += num986;
                                                                                                            Main.npc[(int)this.ai[0]].HealEffect(num986, true);
                                                                                                        }
                                                                                                        return;
                                                                                                    }
                                                                                                    vector176.Normalize();
                                                                                                    vector176 *= num985;
                                                                                                    if (vector176.Y < this.velocity.Y)
                                                                                                    {
                                                                                                        vector176.Y = this.velocity.Y;
                                                                                                    }
                                                                                                    vector176.Y += 1f;
                                                                                                    this.velocity = Vector2.Lerp(this.velocity, vector176, 0.04f);
                                                                                                    this.rotation += this.velocity.X * 0.05f;
                                                                                                    return;
                                                                                                }
                                                                                                else if (this.aiStyle == 111)
                                                                                                {
                                                                                                    if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].type != 20 || Main.npc[(int)this.ai[1]].ai[0] != 14f)
                                                                                                    {
                                                                                                        this.Kill();
                                                                                                        return;
                                                                                                    }
                                                                                                    this.ai[0] += 1f;
                                                                                                    this.rotation += 0.0104719754f;
                                                                                                    this.scale = this.ai[0] / 100f;
                                                                                                    if (this.scale > 1f)
                                                                                                    {
                                                                                                        this.scale = 1f;
                                                                                                    }
                                                                                                    this.alpha = (int)(255f * (1f - this.scale));
                                                                                                    float num987 = 300f;
                                                                                                    if (this.ai[0] >= 100f)
                                                                                                    {
                                                                                                        num987 = MathHelper.Lerp(300f, 600f, (this.ai[0] - 100f) / 200f);
                                                                                                    }
                                                                                                    if (num987 > 600f)
                                                                                                    {
                                                                                                        num987 = 600f;
                                                                                                    }
                                                                                                    if (this.ai[0] >= 500f)
                                                                                                    {
                                                                                                        this.alpha = (int)MathHelper.Lerp(0f, 255f, (this.ai[0] - 500f) / 100f);
                                                                                                        num987 = MathHelper.Lerp(600f, 1200f, (this.ai[0] - 500f) / 100f);
                                                                                                        this.rotation += 0.0104719754f;
                                                                                                    }
                                                                                                    if (this.ai[0] >= 30f && Main.netMode != 2)
                                                                                                    {
                                                                                                        Player player6 = Main.player[Main.myPlayer];
                                                                                                        if (player6.active && !player6.dead && base.Distance(player6.Center) <= num987 && player6.HasBuff(BuffID.DryadsWard) == -1)
                                                                                                        {
                                                                                                            player6.AddBuff(BuffID.DryadsWard, 120, true);
                                                                                                        }
                                                                                                    }
                                                                                                    if (this.ai[0] >= 30f && this.ai[0] % 10f == 0f && Main.netMode != 1)
                                                                                                    {
                                                                                                        for (int num993 = 0; num993 < 200; num993++)
                                                                                                        {
                                                                                                            NPC nPC10 = Main.npc[num993];
                                                                                                            if (nPC10.type != 488 && nPC10.active && base.Distance(nPC10.Center) <= num987)
                                                                                                            {
                                                                                                                if (nPC10.townNPC && (nPC10.HasBuff(BuffID.DryadsWard) == -1 || nPC10.buffTime[nPC10.HasBuff(BuffID.DryadsWard)] <= 20))
                                                                                                                {
                                                                                                                    nPC10.AddBuff(BuffID.DryadsWard, 120, false);
                                                                                                                }
                                                                                                                else if (!nPC10.friendly && nPC10.lifeMax > 5 && !nPC10.dontTakeDamage && (nPC10.HasBuff(BuffID.DryadsWardDebuff) == -1 || nPC10.buffTime[nPC10.HasBuff(BuffID.DryadsWardDebuff)] <= 20) && (nPC10.dryadBane || Collision.CanHit(base.Center, 1, 1, nPC10.position, nPC10.width, nPC10.height)))
                                                                                                                {
                                                                                                                    nPC10.AddBuff(BuffID.DryadsWardDebuff, 120, false);
                                                                                                                }
                                                                                                            }
                                                                                                        }
                                                                                                    }
                                                                                                    if (this.ai[0] >= 570f)
                                                                                                    {
                                                                                                        this.Kill();
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                else if (this.aiStyle == 112)
                                                                                                {
                                                                                                    if (this.type == ProjectileID.TruffleSpore)
                                                                                                    {
                                                                                                        if (++this.frameCounter >= 4)
                                                                                                        {
                                                                                                            this.frameCounter = 0;
                                                                                                            if (++this.frame >= 3)
                                                                                                            {
                                                                                                                this.frame = 0;
                                                                                                            }
                                                                                                        }
                                                                                                        if (this.alpha > 0)
                                                                                                        {
                                                                                                            this.alpha -= 15;
                                                                                                        }
                                                                                                        if (this.alpha < 0)
                                                                                                        {
                                                                                                            this.alpha = 0;
                                                                                                        }
                                                                                                        this.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * this.ai[0] / 180f)) * 0.15f);
                                                                                                        this.ai[0] += 1f;
                                                                                                        if (this.ai[0] >= 180f)
                                                                                                        {
                                                                                                            this.ai[0] = 0f;
                                                                                                        }
                                                                                                    }
                                                                                                    if (this.type == ProjectileID.RainbowCrystalExplosion)
                                                                                                    {
                                                                                                        Color newColor2 = Main.HslToRgb(this.ai[0], 1f, 0.5f);
                                                                                                        int num999 = (int)this.ai[1];
                                                                                                        if (num999 < 0 || num999 >= 1000 || (!Main.projectile[num999].active && Main.projectile[num999].type != ProjectileID.RainbowCrystal))
                                                                                                        {
                                                                                                            this.ai[1] = -1f;
                                                                                                        }
                                                                                                        else
                                                                                                        {
                                                                                                            DelegateMethods.v3_1 = newColor2.ToVector3() * 0.5f;
                                                                                                        }
                                                                                                        if (this.localAI[0] == 0f)
                                                                                                        {
                                                                                                            this.localAI[0] = Main.rand.NextFloat() * 0.8f + 0.8f;
                                                                                                            this.direction = ((Main.rand.Next(2) > 0) ? 1 : -1);
                                                                                                        }
                                                                                                        this.rotation = this.localAI[1] / 40f * 6.28318548f * (float)this.direction;
                                                                                                        if (this.alpha > 0)
                                                                                                        {
                                                                                                            this.alpha -= 8;
                                                                                                        }
                                                                                                        if (this.alpha < 0)
                                                                                                        {
                                                                                                            this.alpha = 0;
                                                                                                        }
                                                                                                        if (Main.rand.Next(10) == 0)
                                                                                                        {
                                                                                                            float num1002 = 1f + Main.rand.NextFloat() * 2f;
                                                                                                            float fadeIn = 1f + Main.rand.NextFloat();
                                                                                                            float num1003 = 1f + Main.rand.NextFloat();
                                                                                                            Vector2 vector181 = Utils.RandomVector2(Main.rand, -1f, 1f);
                                                                                                            if (vector181 != Vector2.Zero)
                                                                                                            {
                                                                                                                vector181.Normalize();
                                                                                                            }
                                                                                                            vector181 *= 20f + Main.rand.NextFloat() * 100f;
                                                                                                            Vector2 vector182 = base.Center + vector181;
                                                                                                            Point point3 = vector182.ToTileCoordinates();
                                                                                                            bool flag50 = true;
                                                                                                            if (!WorldGen.InWorld(point3.X, point3.Y, 0))
                                                                                                            {
                                                                                                                flag50 = false;
                                                                                                            }
                                                                                                            if (flag50 && WorldGen.SolidTile(point3.X, point3.Y))
                                                                                                            {
                                                                                                                flag50 = false;
                                                                                                            }
                                                                                                        }
                                                                                                        this.scale = this.Opacity / 2f * this.localAI[0];
                                                                                                        this.velocity = Vector2.Zero;
                                                                                                        this.localAI[1] += 1f;
                                                                                                        if (this.localAI[1] >= 60f)
                                                                                                        {
                                                                                                            this.Kill();
                                                                                                            return;
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                                else if (this.aiStyle == 113)
                                                                                                {
                                                                                                    int num1004 = 25;
                                                                                                    if (this.type == ProjectileID.StardustCellMinionShot)
                                                                                                    {
                                                                                                        num1004 = 63;
                                                                                                    }
                                                                                                    if (this.alpha > 0)
                                                                                                    {
                                                                                                        this.alpha -= num1004;
                                                                                                    }
                                                                                                    if (this.alpha < 0)
                                                                                                    {
                                                                                                        this.alpha = 0;
                                                                                                    }
                                                                                                    if (this.ai[0] == 0f)
                                                                                                    {
                                                                                                        bool flag51 = this.type == ProjectileID.StardustCellMinionShot;
                                                                                                        if (flag51)
                                                                                                        {
                                                                                                            int num1005 = (int)this.ai[1];
                                                                                                            if (!Main.npc[num1005].active)
                                                                                                            {
                                                                                                                this.Kill();
                                                                                                                return;
                                                                                                            }
                                                                                                            this.velocity.ToRotation();
                                                                                                            Vector2 vector183 = Main.npc[num1005].Center - base.Center;
                                                                                                            if (vector183 != Vector2.Zero)
                                                                                                            {
                                                                                                                vector183.Normalize();
                                                                                                                vector183 *= 14f;
                                                                                                            }
                                                                                                            float num1006 = 5f;
                                                                                                            this.velocity = (this.velocity * (num1006 - 1f) + vector183) / num1006;
                                                                                                        }
                                                                                                        else
                                                                                                        {
                                                                                                            this.ai[1] += 1f;
                                                                                                            if (this.ai[1] >= 45f)
                                                                                                            {
                                                                                                                float num1007 = 0.98f;
                                                                                                                float num1008 = 0.35f;
                                                                                                                if (this.type == ProjectileID.Daybreak)
                                                                                                                {
                                                                                                                    num1007 = 0.995f;
                                                                                                                    num1008 = 0.15f;
                                                                                                                }
                                                                                                                this.ai[1] = 45f;
                                                                                                                this.velocity.X = this.velocity.X * num1007;
                                                                                                                this.velocity.Y = this.velocity.Y + num1008;
                                                                                                            }
                                                                                                            this.rotation = this.velocity.ToRotation() + 1.57079637f;
                                                                                                        }
                                                                                                    }
                                                                                                    if (this.ai[0] == 1f)
                                                                                                    {
                                                                                                        this.ignoreWater = true;
                                                                                                        this.tileCollide = false;
                                                                                                        int num1009 = 15;
                                                                                                        if (this.type == ProjectileID.Daybreak)
                                                                                                        {
                                                                                                            num1009 = 5 * this.MaxUpdates;
                                                                                                        }
                                                                                                        bool flag52 = false;
                                                                                                        bool flag53 = false;
                                                                                                        this.localAI[0] += 1f;
                                                                                                        if (this.localAI[0] % 30f == 0f)
                                                                                                        {
                                                                                                            flag53 = true;
                                                                                                        }
                                                                                                        int num1010 = (int)this.ai[1];
                                                                                                        if (this.localAI[0] >= (float)(60 * num1009))
                                                                                                        {
                                                                                                            flag52 = true;
                                                                                                        }
                                                                                                        else if (num1010 < 0 || num1010 >= 200)
                                                                                                        {
                                                                                                            flag52 = true;
                                                                                                        }
                                                                                                        else if (Main.npc[num1010].active && !Main.npc[num1010].dontTakeDamage)
                                                                                                        {
                                                                                                            base.Center = Main.npc[num1010].Center - this.velocity * 2f;
                                                                                                            this.gfxOffY = Main.npc[num1010].gfxOffY;
                                                                                                            if (flag53)
                                                                                                            {
                                                                                                                Main.npc[num1010].HitEffect(0, 1.0);
                                                                                                            }
                                                                                                        }
                                                                                                        else
                                                                                                        {
                                                                                                            flag52 = true;
                                                                                                        }
                                                                                                        if (flag52)
                                                                                                        {
                                                                                                            this.Kill();
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                                else if (this.aiStyle == 114)
                                                                                                {
                                                                                                    if (Main.netMode == 2 && this.localAI[0] == 0f)
                                                                                                    {
                                                                                                        PortalHelper.SyncPortalSections(base.Center, 1);
                                                                                                        this.localAI[0] = 1f;
                                                                                                    }
                                                                                                    this.timeLeft = 3;
                                                                                                    bool flag54 = false;
                                                                                                    if (!Main.player[this.owner].active || Main.player[this.owner].dead || base.Distance(Main.player[this.owner].Center) > 12800f)
                                                                                                    {
                                                                                                        flag54 = true;
                                                                                                    }
                                                                                                    if (!flag54 && !WorldGen.InWorld((int)base.Center.X / 16, (int)base.Center.Y / 16))
                                                                                                    {
                                                                                                        flag54 = true;
                                                                                                    }
                                                                                                    if (!flag54 && !PortalHelper.SupportedTilesAreFine(base.Center, this.ai[0]))
                                                                                                    {
                                                                                                        flag54 = true;
                                                                                                    }
                                                                                                    if (flag54)
                                                                                                    {
                                                                                                        this.Kill();
                                                                                                        return;
                                                                                                    }
                                                                                                    Color portalColor = PortalHelper.GetPortalColor(this.owner, (int)this.ai[1]);
                                                                                                    this.alpha -= 25;
                                                                                                    if (this.alpha < 0)
                                                                                                    {
                                                                                                        this.alpha = 0;
                                                                                                    }
                                                                                                    if (++this.frameCounter >= 6)
                                                                                                    {
                                                                                                        this.frameCounter = 0;
                                                                                                        if (++this.frame >= Main.projFrames[this.type])
                                                                                                        {
                                                                                                            this.frame = 0;
                                                                                                        }
                                                                                                    }
                                                                                                    this.rotation = this.ai[0] - 1.57079637f;
                                                                                                    return;
                                                                                                }
                                                                                                else if (this.aiStyle == 115)
                                                                                                {
                                                                                                    this.velocity *= 0.985f;
                                                                                                    this.rotation += this.velocity.X * 0.2f;
                                                                                                    if (this.velocity.X > 0f)
                                                                                                    {
                                                                                                        this.rotation += 0.08f;
                                                                                                    }
                                                                                                    else
                                                                                                    {
                                                                                                        this.rotation -= 0.08f;
                                                                                                    }
                                                                                                    this.ai[1] += 1f;
                                                                                                    if (this.ai[1] > 30f)
                                                                                                    {
                                                                                                        this.alpha += 10;
                                                                                                        if (this.alpha >= 255)
                                                                                                        {
                                                                                                            this.alpha = 255;
                                                                                                            this.Kill();
                                                                                                            return;
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    if (this.aiStyle == 116)
                                                                                                    {
                                                                                                        if (this.localAI[0] == 0f)
                                                                                                        {
                                                                                                            this.rotation = this.ai[1];
                                                                                                            this.localAI[0] = 1f;
                                                                                                        }
                                                                                                        Player player7 = Main.player[this.owner];
                                                                                                        if (player7.setSolar)
                                                                                                        {
                                                                                                            this.timeLeft = 2;
                                                                                                        }
                                                                                                        float num1011 = (float)player7.miscCounter / 300f * 12.566371f + this.ai[1];
                                                                                                        num1011 = MathHelper.WrapAngle(num1011);
                                                                                                        this.rotation = this.rotation.AngleLerp(num1011, 0.05f);
                                                                                                        this.alpha -= 15;
                                                                                                        if (this.alpha < 0)
                                                                                                        {
                                                                                                            this.alpha = 0;
                                                                                                        }
                                                                                                        this.velocity = this.rotation.ToRotationVector2() * 100f - player7.velocity;
                                                                                                        base.Center = player7.Center - this.velocity;
                                                                                                        return;
                                                                                                    }
                                                                                                    if (this.aiStyle == 117)
                                                                                                    {
                                                                                                        this.ai[1] += 0.01f;
                                                                                                        this.scale = this.ai[1];
                                                                                                        this.ai[0] += 1f;
                                                                                                        if (this.ai[0] >= (float)(3 * Main.projFrames[this.type]))
                                                                                                        {
                                                                                                            this.Kill();
                                                                                                            return;
                                                                                                        }
                                                                                                        if (++this.frameCounter >= 3)
                                                                                                        {
                                                                                                            this.frameCounter = 0;
                                                                                                            if (++this.frame >= Main.projFrames[this.type])
                                                                                                            {
                                                                                                                this.hide = true;
                                                                                                            }
                                                                                                        }
                                                                                                        this.alpha -= 63;
                                                                                                        if (this.alpha < 0)
                                                                                                        {
                                                                                                            this.alpha = 0;
                                                                                                        }
                                                                                                        bool flag55 = this.type == ProjectileID.SolarWhipSwordExplosion;
                                                                                                        bool flag56 = this.type == ProjectileID.StardustGuardianExplosion;
                                                                                                        if (this.ai[0] == 1f)
                                                                                                        {
                                                                                                            this.position = base.Center;
                                                                                                            this.width = (this.height = (int)(52f * this.scale));
                                                                                                            base.Center = this.position;
                                                                                                            this.Damage();
                                                                                                            if (flag55)
                                                                                                            {
                                                                                                                if (flag56)
                                                                                                                {
                                                                                                                    return;
                                                                                                                }
                                                                                                            }
                                                                                                        }
                                                                                                    }
                                                                                                        else if (this.aiStyle == 118)
                                                                                                        {
                                                                                                            this.ai[0] += 1f;
                                                                                                            int num1035 = 0;
                                                                                                            if (this.velocity.Length() <= 4f)
                                                                                                            {
                                                                                                                num1035 = 1;
                                                                                                            }
                                                                                                            this.alpha -= 15;
                                                                                                            if (this.alpha < 0)
                                                                                                            {
                                                                                                                this.alpha = 0;
                                                                                                            }
                                                                                                            if (num1035 == 0)
                                                                                                            {
                                                                                                                this.rotation -= 0.104719758f;
                                                                                                                if (this.ai[0] >= 30f)
                                                                                                                {
                                                                                                                    this.velocity *= 0.98f;
                                                                                                                    this.scale += 0.00744680827f;
                                                                                                                    if (this.scale > 1.3f)
                                                                                                                    {
                                                                                                                        this.scale = 1.3f;
                                                                                                                    }
                                                                                                                    this.rotation -= 0.0174532924f;
                                                                                                                }
                                                                                                                if (this.velocity.Length() < 4.1f)
                                                                                                                {
                                                                                                                    this.velocity.Normalize();
                                                                                                                    this.velocity *= 4f;
                                                                                                                    this.ai[0] = 0f;
                                                                                                                }
                                                                                                            }
                                                                                                            else if (num1035 == 1)
                                                                                                            {
                                                                                                                this.rotation -= 0.104719758f;
                                                                                                                if (this.ai[0] % 30f == 0f && this.ai[0] < 241f && Main.myPlayer == this.owner)
                                                                                                                {
                                                                                                                    Vector2 vector189 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 12f;
                                                                                                                    Projectile.NewProjectile(base.Center.X, base.Center.Y, vector189.X, vector189.Y, 618, this.damage / 2, 0f, this.owner, 0f, (float)this.whoAmI);
                                                                                                                }
                                                                                                                Vector2 vector190 = base.Center;
                                                                                                                float num1037 = 800f;
                                                                                                                bool flag57 = false;
                                                                                                                int num1038 = 0;
                                                                                                                if (this.ai[1] == 0f)
                                                                                                                {
                                                                                                                    for (int num1039 = 0; num1039 < 200; num1039++)
                                                                                                                    {
                                                                                                                        if (Main.npc[num1039].CanBeChasedBy(this, false))
                                                                                                                        {
                                                                                                                            Vector2 center13 = Main.npc[num1039].Center;
                                                                                                                            if (base.Distance(center13) < num1037 && Collision.CanHit(new Vector2(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2)), 1, 1, Main.npc[num1039].position, Main.npc[num1039].width, Main.npc[num1039].height))
                                                                                                                            {
                                                                                                                                num1037 = base.Distance(center13);
                                                                                                                                vector190 = center13;
                                                                                                                                flag57 = true;
                                                                                                                                num1038 = num1039;
                                                                                                                            }
                                                                                                                        }
                                                                                                                    }
                                                                                                                    if (flag57)
                                                                                                                    {
                                                                                                                        if (this.ai[1] != (float)(num1038 + 1))
                                                                                                                        {
                                                                                                                            this.netUpdate = true;
                                                                                                                        }
                                                                                                                        this.ai[1] = (float)(num1038 + 1);
                                                                                                                    }
                                                                                                                    flag57 = false;
                                                                                                                }
                                                                                                                if (this.ai[1] != 0f)
                                                                                                                {
                                                                                                                    int num1040 = (int)(this.ai[1] - 1f);
                                                                                                                    if (Main.npc[num1040].active && Main.npc[num1040].CanBeChasedBy(this, true) && base.Distance(Main.npc[num1040].Center) < 1000f)
                                                                                                                    {
                                                                                                                        flag57 = true;
                                                                                                                        vector190 = Main.npc[num1040].Center;
                                                                                                                    }
                                                                                                                }
                                                                                                                if (!this.friendly)
                                                                                                                {
                                                                                                                    flag57 = false;
                                                                                                                }
                                                                                                                if (flag57)
                                                                                                                {
                                                                                                                    float num1041 = 4f;
                                                                                                                    Vector2 vector191 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
                                                                                                                    float num1042 = vector190.X - vector191.X;
                                                                                                                    float num1043 = vector190.Y - vector191.Y;
                                                                                                                    float num1044 = (float)Math.Sqrt((double)(num1042 * num1042 + num1043 * num1043));
                                                                                                                    num1044 = num1041 / num1044;
                                                                                                                    num1042 *= num1044;
                                                                                                                    num1043 *= num1044;
                                                                                                                    int num1045 = 8;
                                                                                                                    this.velocity.X = (this.velocity.X * (float)(num1045 - 1) + num1042) / (float)num1045;
                                                                                                                    this.velocity.Y = (this.velocity.Y * (float)(num1045 - 1) + num1043) / (float)num1045;
                                                                                                                }
                                                                                                            }
                                                                                                            if (this.ai[0] >= 600f)
                                                                                                            {
                                                                                                                this.Kill();
                                                                                                                return;
                                                                                                            }
                                                                                                        }
                                                                                                        else if (this.aiStyle == 119)
                                                                                                        {
                                                                                                            int num1046 = 0;
                                                                                                            float num1047 = 0f;
                                                                                                            float num1048 = 0f;
                                                                                                            float num1049 = 0f;
                                                                                                            bool flag58 = false;
                                                                                                            bool flag59 = false;
                                                                                                            int num655 = this.type;
                                                                                                            if (num655 == 618)
                                                                                                            {
                                                                                                                num1046 = 617;
                                                                                                                num1047 = 420f;
                                                                                                                num1048 = 0.15f;
                                                                                                                num1049 = 0.15f;
                                                                                                            }
                                                                                                            if (flag59)
                                                                                                            {
                                                                                                                int num1050 = (int)this.ai[1];
                                                                                                                if (!Main.projectile[num1050].active || Main.projectile[num1050].type != num1046)
                                                                                                                {
                                                                                                                    this.Kill();
                                                                                                                    return;
                                                                                                                }
                                                                                                                this.timeLeft = 2;
                                                                                                            }
                                                                                                            this.ai[0] += 1f;
                                                                                                            if (this.ai[0] < num1047)
                                                                                                            {
                                                                                                                bool flag60 = true;
                                                                                                                int num1051 = (int)this.ai[1];
                                                                                                                if (Main.projectile[num1051].active && Main.projectile[num1051].type == num1046)
                                                                                                                {
                                                                                                                    if (!flag58 && Main.projectile[num1051].oldPos[1] != Vector2.Zero)
                                                                                                                    {
                                                                                                                        this.position += Main.projectile[num1051].position - Main.projectile[num1051].oldPos[1];
                                                                                                                    }
                                                                                                                    if (base.Center.HasNaNs())
                                                                                                                    {
                                                                                                                        this.Kill();
                                                                                                                        return;
                                                                                                                    }
                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    this.ai[0] = num1047;
                                                                                                                    flag60 = false;
                                                                                                                    this.Kill();
                                                                                                                }
                                                                                                                if (flag60 && !flag58)
                                                                                                                {
                                                                                                                    this.velocity += new Vector2((float)Math.Sign(Main.projectile[num1051].Center.X - base.Center.X), (float)Math.Sign(Main.projectile[num1051].Center.Y - base.Center.Y)) * new Vector2(num1048, num1049);
                                                                                                                    if (this.velocity.Length() > 6f)
                                                                                                                    {
                                                                                                                        this.velocity *= 6f / this.velocity.Length();
                                                                                                                    }
                                                                                                                }
                                                                                                                if (this.type == ProjectileID.NebulaArcanumSubshot)
                                                                                                                {
                                                                                                                    this.alpha = 255;
                                                                                                                    return;
                                                                                                                }
                                                                                                                this.Kill();
                                                                                                                return;
                                                                                                            }
                                                                                                        }
                                                                                                        else if (this.aiStyle == 120)
                                                                                                        {
                                                                                                            Player player8 = Main.player[this.owner];
                                                                                                            if (!player8.active)
                                                                                                            {
                                                                                                                this.active = false;
                                                                                                                return;
                                                                                                            }
                                                                                                            bool flag61 = this.type == ProjectileID.StardustGuardian;
                                                                                                            Vector2 vector192 = player8.Center;
                                                                                                            float num1053 = 100f;
                                                                                                            float num1054 = 300f;
                                                                                                            float num1055 = 100f;
                                                                                                            float num1056 = 100f;
                                                                                                            if (flag61)
                                                                                                            {
                                                                                                                if (player8.dead)
                                                                                                                {
                                                                                                                    player8.stardustGuardian = false;
                                                                                                                }
                                                                                                                if (player8.stardustGuardian)
                                                                                                                {
                                                                                                                    this.timeLeft = 2;
                                                                                                                }
                                                                                                                num1053 = 150f;
                                                                                                                num1054 = 250f;
                                                                                                                num1055 = 200f;
                                                                                                                vector192.X -= (float)((5 + player8.width / 2) * player8.direction);
                                                                                                                vector192.Y -= 25f;
                                                                                                                if (this.ai[0] != 3f && this.alpha == 255)
                                                                                                                {
                                                                                                                    this.alpha = 0;
                                                                                                                }
                                                                                                                if (this.localAI[0] > 0f)
                                                                                                                {
                                                                                                                    this.localAI[0] -= 1f;
                                                                                                                }
                                                                                                            }
                                                                                                            if (this.ai[0] != 0f)
                                                                                                            {
                                                                                                                Main.player[this.owner].tankPet = this.whoAmI;
                                                                                                                Main.player[this.owner].tankPetReset = false;
                                                                                                            }
                                                                                                            if (this.ai[0] == 0f)
                                                                                                            {
                                                                                                                if (player8.HasMinionTarget)
                                                                                                                {
                                                                                                                    this.ai[0] = 3f;
                                                                                                                    this.netUpdate = true;
                                                                                                                }
                                                                                                                base.Center = Vector2.Lerp(base.Center, vector192, 0.2f);
                                                                                                                this.velocity *= 0.8f;
                                                                                                                this.direction = (this.spriteDirection = player8.direction);
                                                                                                                if (flag61 && ++this.frameCounter >= 9)
                                                                                                                {
                                                                                                                    this.frameCounter = 0;
                                                                                                                    if (++this.frame >= Main.projFrames[this.type] - 4)
                                                                                                                    {
                                                                                                                        this.frame = 0;
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                            else if (this.ai[0] == 1f)
                                                                                                            {
                                                                                                                if (player8.HasMinionTarget)
                                                                                                                {
                                                                                                                    vector192 = player8.MinionTargetPoint;
                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    this.ai[0] = 0f;
                                                                                                                    this.netUpdate = true;
                                                                                                                }
                                                                                                                int num1059 = -1;
                                                                                                                bool flag62 = true;
                                                                                                                if (flag61 && Math.Abs(base.Center.X - vector192.X) > num1053 + 20f)
                                                                                                                {
                                                                                                                    flag62 = false;
                                                                                                                }
                                                                                                                if (flag62)
                                                                                                                {
                                                                                                                    for (int num1060 = 0; num1060 < 200; num1060++)
                                                                                                                    {
                                                                                                                        NPC nPC11 = Main.npc[num1060];
                                                                                                                        if (nPC11.CanBeChasedBy(this, false))
                                                                                                                        {
                                                                                                                            float num1061 = base.Distance(nPC11.Center);
                                                                                                                            if (num1061 < num1054)
                                                                                                                            {
                                                                                                                                num1059 = num1060;
                                                                                                                            }
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                                if (num1059 != -1)
                                                                                                                {
                                                                                                                    NPC nPC12 = Main.npc[num1059];
                                                                                                                    this.direction = (this.spriteDirection = (nPC12.Center.X > base.Center.X).ToDirectionInt());
                                                                                                                    float num1062 = Math.Abs(vector192.X - base.Center.X);
                                                                                                                    float num1063 = Math.Abs(nPC12.Center.X - base.Center.X);
                                                                                                                    float num1064 = Math.Abs(vector192.Y - base.Center.Y);
                                                                                                                    float num1065 = Math.Abs(nPC12.Center.Y - base.Bottom.Y);
                                                                                                                    float num1066 = (float)(nPC12.Center.Y > base.Bottom.Y).ToDirectionInt();
                                                                                                                    if ((num1062 < num1053 || (vector192.X - base.Center.X) * (float)this.direction < 0f) && num1063 > 20f && num1063 < num1053 - num1062 + 100f)
                                                                                                                    {
                                                                                                                        this.velocity.X = this.velocity.X + 0.1f * (float)this.direction;
                                                                                                                    }
                                                                                                                    else
                                                                                                                    {
                                                                                                                        this.velocity.X = this.velocity.X * 0.7f;
                                                                                                                    }
                                                                                                                    if ((num1064 < num1056 || (vector192.Y - base.Bottom.Y) * num1066 < 0f) && num1065 > 10f && num1065 < num1056 - num1064 + 10f)
                                                                                                                    {
                                                                                                                        this.velocity.Y = this.velocity.Y + 0.1f * num1066;
                                                                                                                    }
                                                                                                                    else
                                                                                                                    {
                                                                                                                        this.velocity.Y = this.velocity.Y * 0.7f;
                                                                                                                    }
                                                                                                                    if (this.localAI[0] == 0f && this.owner == Main.myPlayer && num1063 < num1055)
                                                                                                                    {
                                                                                                                        this.ai[1] = 0f;
                                                                                                                        this.ai[0] = 2f;
                                                                                                                        this.netUpdate = true;
                                                                                                                        this.localAI[0] = 90f;
                                                                                                                    }
                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    if (Math.Abs(vector192.X - base.Center.X) > num1053 + 40f)
                                                                                                                    {
                                                                                                                        this.ai[0] = 3f;
                                                                                                                        this.netUpdate = true;
                                                                                                                    }
                                                                                                                    else if (Math.Abs(vector192.X - base.Center.X) > 20f)
                                                                                                                    {
                                                                                                                        this.direction = (this.spriteDirection = (vector192.X > base.Center.X).ToDirectionInt());
                                                                                                                        this.velocity.X = this.velocity.X + 0.06f * (float)this.direction;
                                                                                                                    }
                                                                                                                    else
                                                                                                                    {
                                                                                                                        this.velocity.X = this.velocity.X * 0.8f;
                                                                                                                        this.direction = (this.spriteDirection = (player8.Center.X < base.Center.X).ToDirectionInt());
                                                                                                                    }
                                                                                                                    if (Math.Abs(vector192.Y - base.Center.Y) > num1056)
                                                                                                                    {
                                                                                                                        this.ai[0] = 3f;
                                                                                                                        this.netUpdate = true;
                                                                                                                    }
                                                                                                                    else if (Math.Abs(vector192.Y - base.Center.Y) > 10f)
                                                                                                                    {
                                                                                                                        this.velocity.Y = this.velocity.Y + 0.06f * (float)Math.Sign(vector192.Y - base.Center.Y);
                                                                                                                    }
                                                                                                                    else
                                                                                                                    {
                                                                                                                        this.velocity.Y = this.velocity.Y * 0.8f;
                                                                                                                    }
                                                                                                                }
                                                                                                                if (flag61 && ++this.frameCounter >= 9)
                                                                                                                {
                                                                                                                    this.frameCounter = 0;
                                                                                                                    if (++this.frame >= Main.projFrames[this.type] - 4)
                                                                                                                    {
                                                                                                                        this.frame = 0;
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                            else if (this.ai[0] == 2f)
                                                                                                            {
                                                                                                                this.velocity.X = this.velocity.X * 0.9f;
                                                                                                                this.ai[1] += 1f;
                                                                                                                float num1067 = 0f;
                                                                                                                if (flag61)
                                                                                                                {
                                                                                                                    num1067 = 20f;
                                                                                                                    if (this.ai[1] == 10f && this.owner == Main.myPlayer)
                                                                                                                    {
                                                                                                                        int num1068 = (int)(20f * Main.player[this.owner].minionDamage);
                                                                                                                        Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 624, num1068, 6f, this.owner, 0f, 5f);
                                                                                                                    }
                                                                                                                }
                                                                                                                if (this.ai[1] >= num1067)
                                                                                                                {
                                                                                                                    this.ai[1] = 0f;
                                                                                                                    this.ai[0] = 1f;
                                                                                                                    this.netUpdate = true;
                                                                                                                }
                                                                                                                if (flag61)
                                                                                                                {
                                                                                                                    if (this.frame < Main.projFrames[this.type] - 4)
                                                                                                                    {
                                                                                                                        this.frame = Main.projFrames[this.type] - 1;
                                                                                                                        this.frameCounter = 0;
                                                                                                                    }
                                                                                                                    if (++this.frameCounter >= 5)
                                                                                                                    {
                                                                                                                        this.frameCounter = 0;
                                                                                                                        if (--this.frame < Main.projFrames[this.type] - 5)
                                                                                                                        {
                                                                                                                            this.frame = Main.projFrames[this.type] - 1;
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                            if (this.ai[0] == 3f)
                                                                                                            {
                                                                                                                if (player8.HasMinionTarget)
                                                                                                                {
                                                                                                                    vector192 = player8.MinionTargetPoint;
                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    this.ai[0] = 0f;
                                                                                                                    this.netUpdate = true;
                                                                                                                }
                                                                                                                if (this.alpha == 0)
                                                                                                                {
                                                                                                                    this.alpha = 255;
                                                                                                                }
                                                                                                                this.velocity *= 0.7f;
                                                                                                                base.Center = Vector2.Lerp(base.Center, vector192, 0.2f);
                                                                                                                if (base.Distance(vector192) < 10f)
                                                                                                                {
                                                                                                                    this.ai[0] = 1f;
                                                                                                                    this.netUpdate = true;
                                                                                                                    return;
                                                                                                                }
                                                                                                            }
                                                                                                        }
                                                                                                        else if (this.aiStyle == 121)
                                                                                                        {
                                                                                                            Player player9 = Main.player[this.owner];
                                                                                                            if ((int)Main.time % 120 == 0)
                                                                                                            {
                                                                                                                this.netUpdate = true;
                                                                                                            }
                                                                                                            if (!player9.active)
                                                                                                            {
                                                                                                                this.active = false;
                                                                                                                return;
                                                                                                            }
                                                                                                            bool flag63 = this.type == ProjectileID.StardustDragon1;
                                                                                                            bool flag64 = this.type == ProjectileID.StardustDragon1 || this.type == ProjectileID.StardustDragon2 || this.type == ProjectileID.StardustDragon3 || this.type == ProjectileID.StardustDragon4;
                                                                                                            int num1051 = 10;
                                                                                                            if (flag64)
                                                                                                            {
                                                                                                                if (player9.dead)
                                                                                                                {
                                                                                                                    player9.stardustDragon = false;
                                                                                                                }
                                                                                                                if (player9.stardustDragon)
                                                                                                                {
                                                                                                                    this.timeLeft = 2;
                                                                                                                }
                                                                                                                num1051 = 30;
                                                                                                            }
                                                                                                            if (flag63)
                                                                                                            {
                                                                                                                Vector2 center14 = player9.Center;
                                                                                                                float num1077 = 700f;
                                                                                                                float num1078 = 1000f;
                                                                                                                int num1079 = -1;
                                                                                                                if (base.Distance(center14) > 2000f)
                                                                                                                {
                                                                                                                    base.Center = center14;
                                                                                                                    this.netUpdate = true;
                                                                                                                }
                                                                                                                bool flag65 = true;
                                                                                                                if (flag65)
                                                                                                                {
                                                                                                                    for (int num1080 = 0; num1080 < 200; num1080++)
                                                                                                                    {
                                                                                                                        NPC nPC13 = Main.npc[num1080];
                                                                                                                        if (nPC13.CanBeChasedBy(this, false) && player9.Distance(nPC13.Center) < num1078)
                                                                                                                        {
                                                                                                                            float num1081 = base.Distance(nPC13.Center);
                                                                                                                            if (num1081 < num1077)
                                                                                                                            {
                                                                                                                                num1079 = num1080;
                                                                                                                                bool arg_2D71A_0 = nPC13.boss;
                                                                                                                            }
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                                if (num1079 != -1)
                                                                                                                {
                                                                                                                    NPC nPC14 = Main.npc[num1079];
                                                                                                                    Vector2 vector193 = nPC14.Center - base.Center;
                                                                                                                    (vector193.X > 0f).ToDirectionInt();
                                                                                                                    (vector193.Y > 0f).ToDirectionInt();
                                                                                                                    float num1082 = 0.4f;
                                                                                                                    if (vector193.Length() < 600f)
                                                                                                                    {
                                                                                                                        num1082 = 0.6f;
                                                                                                                    }
                                                                                                                    if (vector193.Length() < 300f)
                                                                                                                    {
                                                                                                                        num1082 = 0.8f;
                                                                                                                    }
                                                                                                                    if (vector193.Length() > nPC14.Size.Length() * 0.75f)
                                                                                                                    {
                                                                                                                        this.velocity += Vector2.Normalize(vector193) * num1082 * 1.5f;
                                                                                                                        if (Vector2.Dot(this.velocity, vector193) < 0.25f)
                                                                                                                        {
                                                                                                                            this.velocity *= 0.8f;
                                                                                                                        }
                                                                                                                    }
                                                                                                                    float num1083 = 30f;
                                                                                                                    if (this.velocity.Length() > num1083)
                                                                                                                    {
                                                                                                                        this.velocity = Vector2.Normalize(this.velocity) * num1083;
                                                                                                                    }
                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    float num1084 = 0.2f;
                                                                                                                    Vector2 vector194 = center14 - base.Center;
                                                                                                                    if (vector194.Length() < 200f)
                                                                                                                    {
                                                                                                                        num1084 = 0.12f;
                                                                                                                    }
                                                                                                                    if (vector194.Length() < 140f)
                                                                                                                    {
                                                                                                                        num1084 = 0.06f;
                                                                                                                    }
                                                                                                                    if (vector194.Length() > 100f)
                                                                                                                    {
                                                                                                                        if (Math.Abs(center14.X - base.Center.X) > 20f)
                                                                                                                        {
                                                                                                                            this.velocity.X = this.velocity.X + num1084 * (float)Math.Sign(center14.X - base.Center.X);
                                                                                                                        }
                                                                                                                        if (Math.Abs(center14.Y - base.Center.Y) > 10f)
                                                                                                                        {
                                                                                                                            this.velocity.Y = this.velocity.Y + num1084 * (float)Math.Sign(center14.Y - base.Center.Y);
                                                                                                                        }
                                                                                                                    }
                                                                                                                    else if (this.velocity.Length() > 2f)
                                                                                                                    {
                                                                                                                        this.velocity *= 0.96f;
                                                                                                                    }
                                                                                                                    if (Math.Abs(this.velocity.Y) < 1f)
                                                                                                                    {
                                                                                                                        this.velocity.Y = this.velocity.Y - 0.1f;
                                                                                                                    }
                                                                                                                    float num1085 = 15f;
                                                                                                                    if (this.velocity.Length() > num1085)
                                                                                                                    {
                                                                                                                        this.velocity = Vector2.Normalize(this.velocity) * num1085;
                                                                                                                    }
                                                                                                                }
                                                                                                                this.rotation = this.velocity.ToRotation() + (float)(Math.PI / 2f);
                                                                                                                int direction = this.direction;
                                                                                                                this.direction = (this.spriteDirection = ((this.velocity.X > 0f) ? 1 : -1));
                                                                                                                if (direction != this.direction)
                                                                                                                {
                                                                                                                    this.netUpdate = true;
                                                                                                                }
                                                                                                                this.position = base.Center;
                                                                                                                this.scale = 1f + this.localAI[0] * 0.01f;
                                                                                                                this.width = (this.height = (int)((float)num1051 * this.scale));
                                                                                                                base.Center = this.position;
                                                                                                                if (this.alpha > 0)
                                                                                                                {
                                                                                                                    this.alpha -= 42;
                                                                                                                    if (this.alpha < 0)
                                                                                                                    {
                                                                                                                        this.alpha = 0;
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                            else
                                                                                                            {
                                                                                                                bool flag66 = false;
                                                                                                                Vector2 vector195 = Vector2.Zero;
                                                                                                                Vector2 arg_2DBC1_0 = Vector2.Zero;
                                                                                                                float num1088 = 0f;
                                                                                                                float num1089 = 0f;
                                                                                                                float num1090 = 1f;
                                                                                                                if (this.ai[1] == 1f)
                                                                                                                {
                                                                                                                    this.ai[1] = 0f;
                                                                                                                    this.netUpdate = true;
                                                                                                                }
                                                                                                                int byUUID = Projectile.GetByUUID(this.owner, (int)this.ai[0]);
                                                                                                                if (flag64 && byUUID >= 0 && Main.projectile[byUUID].active && (Main.projectile[byUUID].type == ProjectileID.StardustDragon1 || Main.projectile[byUUID].type == ProjectileID.StardustDragon2 || Main.projectile[byUUID].type == ProjectileID.StardustDragon3))
                                                                                                                {
                                                                                                                    flag66 = true;
                                                                                                                    vector195 = Main.projectile[byUUID].Center;
                                                                                                                    Vector2 arg_2DE6A_0 = Main.projectile[byUUID].velocity;
                                                                                                                    num1088 = Main.projectile[byUUID].rotation;
                                                                                                                    float num1065 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f);
                                                                                                                    num1089 = num1065;
                                                                                                                    num1090 = 16f;
                                                                                                                    int arg_2DEC0_0 = Main.projectile[byUUID].alpha;
                                                                                                                    Main.projectile[byUUID].localAI[0] = this.localAI[0] + 1f;
                                                                                                                    if (Main.projectile[byUUID].type != ProjectileID.StardustDragon1)
                                                                                                                    {
                                                                                                                        Main.projectile[byUUID].localAI[1] = (float)this.whoAmI;
                                                                                                                    }
                                                                                                                    if (this.owner == Main.myPlayer && Main.projectile[byUUID].type == ProjectileID.StardustDragon1 && this.type == ProjectileID.StardustDragon4)
                                                                                                                    {
                                                                                                                        Main.projectile[byUUID].Kill();
                                                                                                                        this.Kill();
                                                                                                                        return;
                                                                                                                    }
                                                                                                                }
                                                                                                                if (!flag66)
                                                                                                                {
                                                                                                                    return;
                                                                                                                }
                                                                                                                this.alpha -= 42;
                                                                                                                if (this.alpha < 0)
                                                                                                                {
                                                                                                                    this.alpha = 0;
                                                                                                                }
                                                                                                                this.velocity = Vector2.Zero;
                                                                                                                Vector2 vector134 = vector195 - base.Center;
                                                                                                                if (num1088 != this.rotation)
                                                                                                                {
                                                                                                                    float num1068 = MathHelper.WrapAngle(num1088 - this.rotation);
                                                                                                                    vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2));
                                                                                                                }
                                                                                                                this.rotation = vector134.ToRotation() + 1.57079637f;
                                                                                                                this.position = base.Center;
                                                                                                                this.scale = num1090;
                                                                                                                this.width = (this.height = (int)((float)num1051 * this.scale));
                                                                                                                base.Center = this.position;
                                                                                                                if (vector134 != Vector2.Zero)
                                                                                                                {
                                                                                                                    base.Center = vector195 - Vector2.Normalize(vector134) * num1090 * num1090;
                                                                                                                }
                                                                                                                this.spriteDirection = ((vector134.X > 0f) ? 1 : -1);
                                                                                                                return;
                                                                                                            }
                                                                                                        }
                                                                                                        else if (this.aiStyle == 122)
                                                                                                        {
                                                                                                            int num1096 = (int)this.ai[0];
                                                                                                            bool flag67 = false;
                                                                                                            if (num1096 == -1 || !Main.npc[num1096].active)
                                                                                                            {
                                                                                                                flag67 = true;
                                                                                                            }
                                                                                                            if (flag67)
                                                                                                            {
                                                                                                                if (this.type == ProjectileID.TowerDamageBolt)
                                                                                                                {
                                                                                                                    this.Kill();
                                                                                                                    return;
                                                                                                                }
                                                                                                                if (this.type == ProjectileID.PhantasmArrow && this.ai[0] != -1f)
                                                                                                                {
                                                                                                                    this.ai[0] = -1f;
                                                                                                                    this.netUpdate = true;
                                                                                                                }
                                                                                                            }
                                                                                                            if (!flag67 && base.Hitbox.Intersects(Main.npc[num1096].Hitbox))
                                                                                                            {
                                                                                                                this.Kill();
                                                                                                                if (this.type == ProjectileID.PhantasmArrow)
                                                                                                                {
                                                                                                                    this.localAI[1] = 1f;
                                                                                                                    this.Damage();
                                                                                                                }
                                                                                                                return;
                                                                                                            }
                                                                                                            if (this.type == ProjectileID.TowerDamageBolt)
                                                                                                            {
                                                                                                                Vector2 vector197 = Main.npc[num1096].Center - base.Center;
                                                                                                                this.velocity = Vector2.Normalize(vector197) * 5f;
                                                                                                            }
                                                                                                            if (this.type == ProjectileID.PhantasmArrow)
                                                                                                            {
                                                                                                                if (this.ai[1] > 0f)
                                                                                                                {
                                                                                                                    this.ai[1] -= 1f;
                                                                                                                    this.velocity = Vector2.Zero;
                                                                                                                    return;
                                                                                                                }
                                                                                                                if (flag67)
                                                                                                                {
                                                                                                                    if (this.velocity == Vector2.Zero)
                                                                                                                    {
                                                                                                                        this.Kill();
                                                                                                                    }
                                                                                                                    this.tileCollide = true;
                                                                                                                    this.alpha += 10;
                                                                                                                    if (this.alpha > 255)
                                                                                                                    {
                                                                                                                        this.Kill();
                                                                                                                    }
                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    Vector2 vector198 = Main.npc[num1096].Center - base.Center;
                                                                                                                    this.velocity = Vector2.Normalize(vector198) * 12f;
                                                                                                                    this.alpha -= 15;
                                                                                                                    if (this.alpha < 0)
                                                                                                                    {
                                                                                                                        this.alpha = 0;
                                                                                                                    }
                                                                                                                }
                                                                                                                this.rotation = this.velocity.ToRotation() - 1.57079637f;
                                                                                                                return;
                                                                                                            }
                                                                                                        }
                                                                                                        else if (this.aiStyle == 123)
                                                                                                        {
                                                                                                            bool flag68 = this.type == ProjectileID.MoonlordTurret;
                                                                                                            bool flag69 = this.type == ProjectileID.RainbowCrystal;
                                                                                                            float num1097 = 1000f;
                                                                                                            this.velocity = Vector2.Zero;
                                                                                                            if (flag68)
                                                                                                            {
                                                                                                                this.alpha -= 5;
                                                                                                                if (this.alpha < 0)
                                                                                                                {
                                                                                                                    this.alpha = 0;
                                                                                                                }
                                                                                                                if (this.direction == 0)
                                                                                                                {
                                                                                                                    this.direction = Main.player[this.owner].direction;
                                                                                                                }
                                                                                                                this.rotation -= (float)this.direction * 6.28318548f / 120f;
                                                                                                                this.scale = this.Opacity;
                                                                                                            }
                                                                                                            if (flag69)
                                                                                                            {
                                                                                                                this.alpha -= 5;
                                                                                                                if (this.alpha < 0)
                                                                                                                {
                                                                                                                    this.alpha = 0;
                                                                                                                }
                                                                                                                if (this.direction == 0)
                                                                                                                {
                                                                                                                    this.direction = Main.player[this.owner].direction;
                                                                                                                }
                                                                                                                if (++this.frameCounter >= 3)
                                                                                                                {
                                                                                                                    this.frameCounter = 0;
                                                                                                                    if (++this.frame >= Main.projFrames[this.type])
                                                                                                                    {
                                                                                                                        this.frame = 0;
                                                                                                                    }
                                                                                                                }
                                                                                                                this.localAI[0] += 1f;
                                                                                                                if (this.localAI[0] >= 60f)
                                                                                                                {
                                                                                                                    this.localAI[0] = 0f;
                                                                                                                }
                                                                                                            }
                                                                                                            if (this.ai[0] < 0f)
                                                                                                            {
                                                                                                                this.ai[0] += 1f;
                                                                                                                if (flag68)
                                                                                                                {
                                                                                                                    this.ai[1] -= (float)this.direction * 0.3926991f / 50f;
                                                                                                                }
                                                                                                            }
                                                                                                            if (this.ai[0] == 0f)
                                                                                                            {
                                                                                                                int num1099 = -1;
                                                                                                                float num1100 = num1097;
                                                                                                                for (int num1101 = 0; num1101 < 200; num1101++)
                                                                                                                {
                                                                                                                    NPC nPC15 = Main.npc[num1101];
                                                                                                                    if (nPC15.CanBeChasedBy(this, false))
                                                                                                                    {
                                                                                                                        float num1102 = base.Distance(nPC15.Center);
                                                                                                                        if (num1102 < num1100 && Collision.CanHitLine(base.Center, 0, 0, nPC15.Center, 0, 0))
                                                                                                                        {
                                                                                                                            num1100 = num1102;
                                                                                                                            num1099 = num1101;
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                                if (num1099 != -1)
                                                                                                                {
                                                                                                                    this.ai[0] = 1f;
                                                                                                                    this.ai[1] = (float)num1099;
                                                                                                                    this.netUpdate = true;
                                                                                                                    return;
                                                                                                                }
                                                                                                            }
                                                                                                            if (this.ai[0] > 0f)
                                                                                                            {
                                                                                                                int num1103 = (int)this.ai[1];
                                                                                                                if (!Main.npc[num1103].CanBeChasedBy(this, false))
                                                                                                                {
                                                                                                                    this.ai[0] = 0f;
                                                                                                                    this.ai[1] = 0f;
                                                                                                                    this.netUpdate = true;
                                                                                                                    return;
                                                                                                                }
                                                                                                                this.ai[0] += 1f;
                                                                                                                float num1104 = 30f;
                                                                                                                if (flag69)
                                                                                                                {
                                                                                                                    num1104 = 5f;
                                                                                                                }
                                                                                                                if (this.ai[0] >= num1104)
                                                                                                                {
                                                                                                                    Vector2 vector201 = base.DirectionTo(Main.npc[num1103].Center);
                                                                                                                    if (vector201.HasNaNs())
                                                                                                                    {
                                                                                                                        vector201 = Vector2.UnitY;
                                                                                                                    }
                                                                                                                    float num1105 = vector201.ToRotation();
                                                                                                                    int num1106 = (vector201.X > 0f) ? 1 : -1;
                                                                                                                    if (flag68)
                                                                                                                    {
                                                                                                                        this.direction = num1106;
                                                                                                                        this.ai[0] = -60f;
                                                                                                                        this.ai[1] = num1105 + (float)num1106 * 3.14159274f / 16f;
                                                                                                                        this.netUpdate = true;
                                                                                                                        if (this.owner == Main.myPlayer)
                                                                                                                        {
                                                                                                                            Projectile.NewProjectile(base.Center.X, base.Center.Y, vector201.X, vector201.Y, 642, this.damage, this.knockBack, this.owner, 0f, (float)this.whoAmI);
                                                                                                                        }
                                                                                                                    }
                                                                                                                    if (flag69)
                                                                                                                    {
                                                                                                                        this.direction = num1106;
                                                                                                                        this.ai[0] = -20f;
                                                                                                                        this.netUpdate = true;
                                                                                                                        if (this.owner == Main.myPlayer)
                                                                                                                        {
                                                                                                                            Vector2 vector202 = Main.npc[num1103].position + Main.npc[num1103].Size * Utils.RandomVector2(Main.rand, 0f, 1f) - base.Center;
                                                                                                                            for (int num1107 = 0; num1107 < 3; num1107++)
                                                                                                                            {
                                                                                                                                Vector2 vector203 = base.Center + vector202;
                                                                                                                                if (num1107 > 0)
                                                                                                                                {
                                                                                                                                    vector203 = base.Center + vector202.RotatedByRandom(0.78539818525314331) * (Main.rand.NextFloat() * 0.5f + 0.75f);
                                                                                                                                }
                                                                                                                                float x2 = Main.RgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X;
                                                                                                                                Projectile.NewProjectile(vector203.X, vector203.Y, 0f, 0f, 644, this.damage, this.knockBack, this.owner, x2, (float)this.whoAmI);
                                                                                                                            }
                                                                                                                            return;
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                        }
                                                                                                        else if (this.aiStyle == 124)
                                                                                                        {
                                                                                                            Player player10 = Main.player[this.owner];
                                                                                                            if (player10.dead)
                                                                                                            {
                                                                                                                this.Kill();
                                                                                                                return;
                                                                                                            }
                                                                                                            if (Main.myPlayer == this.owner && player10.suspiciouslookingTentacle)
                                                                                                            {
                                                                                                                this.timeLeft = 2;
                                                                                                            }
                                                                                                            this.direction = (this.spriteDirection = player10.direction);
                                                                                                            Vector3 v3_ = new Vector3(0.5f, 0.9f, 1f) * 1.5f;
                                                                                                            DelegateMethods.v3_1 = v3_;
                                                                                                            Vector2 vector204 = new Vector2((float)(player10.direction * 30), -20f);
                                                                                                            Vector2 vector205 = player10.MountedCenter + vector204;
                                                                                                            float num1108 = Vector2.Distance(base.Center, vector205);
                                                                                                            if (num1108 > 1000f)
                                                                                                            {
                                                                                                                base.Center = player10.Center + vector204;
                                                                                                            }
                                                                                                            Vector2 vector206 = vector205 - base.Center;
                                                                                                            float num1109 = 4f;
                                                                                                            if (num1108 < num1109)
                                                                                                            {
                                                                                                                this.velocity *= 0.25f;
                                                                                                            }
                                                                                                            if (vector206 != Vector2.Zero)
                                                                                                            {
                                                                                                                if (vector206.Length() < num1109)
                                                                                                                {
                                                                                                                    this.velocity = vector206;
                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    this.velocity = vector206 * 0.1f;
                                                                                                                }
                                                                                                            }
                                                                                                            if (this.velocity.Length() > 6f)
                                                                                                            {
                                                                                                                float num1110 = this.velocity.ToRotation() + 1.57079637f;
                                                                                                                if (Math.Abs(this.rotation - num1110) >= 3.14159274f)
                                                                                                                {
                                                                                                                    if (num1110 < this.rotation)
                                                                                                                    {
                                                                                                                        this.rotation -= 6.28318548f;
                                                                                                                    }
                                                                                                                    else
                                                                                                                    {
                                                                                                                        this.rotation += 6.28318548f;
                                                                                                                    }
                                                                                                                }
                                                                                                                float num1111 = 12f;
                                                                                                                this.rotation = (this.rotation * (num1111 - 1f) + num1110) / num1111;
                                                                                                                if (++this.frameCounter >= 4)
                                                                                                                {
                                                                                                                    this.frameCounter = 0;
                                                                                                                    if (++this.frame >= Main.projFrames[this.type])
                                                                                                                    {
                                                                                                                        this.frame = 0;
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                            else
                                                                                                            {
                                                                                                                if (this.rotation > 3.14159274f)
                                                                                                                {
                                                                                                                    this.rotation -= 6.28318548f;
                                                                                                                }
                                                                                                                if (this.rotation > -0.005f && this.rotation < 0.005f)
                                                                                                                {
                                                                                                                    this.rotation = 0f;
                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    this.rotation *= 0.96f;
                                                                                                                }
                                                                                                                if (++this.frameCounter >= 6)
                                                                                                                {
                                                                                                                    this.frameCounter = 0;
                                                                                                                    if (++this.frame >= Main.projFrames[this.type])
                                                                                                                    {
                                                                                                                        this.frame = 0;
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                            if (this.ai[0] > 0f && (this.ai[0] += 1f) >= 60f)
                                                                                                            {
                                                                                                                this.ai[0] = 0f;
                                                                                                                this.ai[1] = 0f;
                                                                                                            }
                                                                                                            if (Main.rand.Next(15) == 0)
                                                                                                            {
                                                                                                                float num1112 = -1f;
                                                                                                                int num1113 = 17;
                                                                                                                if ((base.Center - player10.Center).Length() < (float)Main.screenWidth)
                                                                                                                {
                                                                                                                    int num1114 = (int)base.Center.X / 16;
                                                                                                                    int num1115 = (int)base.Center.Y / 16;
                                                                                                                    num1114 = (int)MathHelper.Clamp((float)num1114, (float)(num1113 + 1), (float)(Main.maxTilesX - num1113 - 1));
                                                                                                                    num1115 = (int)MathHelper.Clamp((float)num1115, (float)(num1113 + 1), (float)(Main.maxTilesY - num1113 - 1));
                                                                                                                    for (int num1116 = num1114 - num1113; num1116 <= num1114 + num1113; num1116++)
                                                                                                                    {
                                                                                                                        for (int num1117 = num1115 - num1113; num1117 <= num1115 + num1113; num1117++)
                                                                                                                        {
                                                                                                                            int num1118 = Main.rand.Next(8);
                                                                                                                            if (num1118 < 4)
                                                                                                                            {
                                                                                                                                Vector2 vector207 = new Vector2((float)(num1114 - num1116), (float)(num1115 - num1117));
                                                                                                                                if (vector207.Length() < (float)num1113 && Main.tile[num1116, num1117] != null && Main.tile[num1116, num1117].active())
                                                                                                                                {
                                                                                                                                    bool flag70 = false;
                                                                                                                                    if (Main.tile[num1116, num1117].type == TileID.SmallPiles && Main.tile[num1116, num1117].frameY == 18)
                                                                                                                                    {
                                                                                                                                        if (Main.tile[num1116, num1117].frameX >= 576 && Main.tile[num1116, num1117].frameX <= 882)
                                                                                                                                        {
                                                                                                                                            flag70 = true;
                                                                                                                                        }
                                                                                                                                    }
                                                                                                                                    else if (Main.tile[num1116, num1117].type == TileID.LargePiles && Main.tile[num1116, num1117].frameX >= 864 && Main.tile[num1116, num1117].frameX <= 1170)
                                                                                                                                    {
                                                                                                                                        flag70 = true;
                                                                                                                                    }
                                                                                                                                    if (flag70 || Main.tileSpelunker[(int)Main.tile[num1116, num1117].type] || (Main.tileAlch[(int)Main.tile[num1116, num1117].type] && Main.tile[num1116, num1117].type != TileID.ImmatureHerbs))
                                                                                                                                    {
                                                                                                                                        float num1119 = base.Distance(new Vector2((float)(num1116 * 16 + 8), (float)(num1117 * 16 + 8)));
                                                                                                                                        if (num1119 < num1112 || num1112 == -1f)
                                                                                                                                        {
                                                                                                                                            num1112 = num1119;
                                                                                                                                            this.ai[0] = 1f;
                                                                                                                                            this.ai[1] = base.AngleTo(new Vector2((float)(num1116 * 16 + 8), (float)(num1117 * 16 + 8)));
                                                                                                                                        }
                                                                                                                                    }
                                                                                                                                }
                                                                                                                            }
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                            float f3 = this.localAI[0] % 6.28318548f - 3.14159274f;
                                                                                                            float num1121 = (float)Math.IEEERemainder((double)this.localAI[1], 1.0);
                                                                                                            if (num1121 < 0f)
                                                                                                            {
                                                                                                                num1121 += 1f;
                                                                                                            }
                                                                                                            float num1122 = (float)Math.Floor((double)this.localAI[1]);
                                                                                                            float num1123 = 0.999f;
                                                                                                            int num1124 = 0;
                                                                                                            float num1125 = 0.1f;
                                                                                                            bool flag71 = player10.velocity.Length() > 3f;
                                                                                                            int num1126 = -1;
                                                                                                            int num1127 = -1;
                                                                                                            float num1128 = 300f;
                                                                                                            float num1129 = 500f;
                                                                                                            for (int num1130 = 0; num1130 < 200; num1130++)
                                                                                                            {
                                                                                                                NPC nPC16 = Main.npc[num1130];
                                                                                                                if (nPC16.active && nPC16.chaseable && !nPC16.dontTakeDamage && !nPC16.immortal)
                                                                                                                {
                                                                                                                    float num1131 = base.Distance(nPC16.Center);
                                                                                                                    if (nPC16.friendly || nPC16.lifeMax <= 5)
                                                                                                                    {
                                                                                                                        if (num1131 < num1128 && !flag71)
                                                                                                                        {
                                                                                                                            num1128 = num1131;
                                                                                                                            num1127 = num1130;
                                                                                                                        }
                                                                                                                    }
                                                                                                                    else if (num1131 < num1129)
                                                                                                                    {
                                                                                                                        num1129 = num1131;
                                                                                                                        num1126 = num1130;
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                            float num1132;
                                                                                                            if (flag71)
                                                                                                            {
                                                                                                                num1132 = base.AngleTo(base.Center + player10.velocity);
                                                                                                                num1124 = 1;
                                                                                                                num1121 = MathHelper.Clamp(num1121 + 0.05f, 0f, num1123);
                                                                                                                num1122 += (float)Math.Sign(-10f - num1122);
                                                                                                            }
                                                                                                            else if (num1126 != -1)
                                                                                                            {
                                                                                                                num1132 = base.AngleTo(Main.npc[num1126].Center);
                                                                                                                num1124 = 2;
                                                                                                                num1121 = MathHelper.Clamp(num1121 + 0.05f, 0f, num1123);
                                                                                                                num1122 += (float)Math.Sign(-12f - num1122);
                                                                                                            }
                                                                                                            else if (num1127 != -1)
                                                                                                            {
                                                                                                                num1132 = base.AngleTo(Main.npc[num1127].Center);
                                                                                                                num1124 = 3;
                                                                                                                num1121 = MathHelper.Clamp(num1121 + 0.05f, 0f, num1123);
                                                                                                                num1122 += (float)Math.Sign(6f - num1122);
                                                                                                            }
                                                                                                            else if (this.ai[0] > 0f)
                                                                                                            {
                                                                                                                num1132 = this.ai[1];
                                                                                                                num1121 = MathHelper.Clamp(num1121 + (float)Math.Sign(0.75f - num1121) * 0.05f, 0f, num1123);
                                                                                                                num1124 = 4;
                                                                                                                num1122 += (float)Math.Sign(10f - num1122);
                                                                                                            }
                                                                                                            else
                                                                                                            {
                                                                                                                num1132 = ((player10.direction == 1) ? 0f : 3.14160275f);
                                                                                                                num1121 = MathHelper.Clamp(num1121 + (float)Math.Sign(0.75f - num1121) * 0.05f, 0f, num1123);
                                                                                                                num1122 += (float)Math.Sign(0f - num1122);
                                                                                                                num1125 = 0.12f;
                                                                                                            }
                                                                                                            Vector2 vector208 = num1132.ToRotationVector2();
                                                                                                            num1132 = Vector2.Lerp(f3.ToRotationVector2(), vector208, num1125).ToRotation();
                                                                                                            this.localAI[0] = num1132 + (float)num1124 * 6.28318548f + 3.14159274f;
                                                                                                            this.localAI[1] = num1122 + num1121;
                                                                                                        }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#31
0
		public void PutItemInInventory(int type, int selItem = -1)
		{
			for (int i = 0; i < 58; i++)
			{
				Item item = this.inventory[i];
				if (item.stack > 0 && item.type == type && item.stack < item.maxStack)
				{
					item.stack++;
					return;
				}
			}
			if (selItem >= 0 && (this.inventory[selItem].type == 0 || this.inventory[selItem].stack <= 0))
			{
				this.inventory[selItem].SetDefaults(type, false);
				return;
			}
			Item item2 = new Item();
			item2.SetDefaults(type, false);
			Item item3 = this.GetItem(this.whoAmi, item2, false);
			if (item3.stack > 0)
			{
				int number = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type, 1, false, 0, true);
				if (Main.netMode == 1)
				{
					NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0);
					return;
				}
			}
			else
			{
				item2.position.X = this.center().X - (float)(item2.width / 2);
				item2.position.Y = this.center().Y - (float)(item2.height / 2);
				item2.active = true;
			}
		}
示例#32
0
        protected override void Initialize()
        {
            NPC.clrNames();
            NPC.setNames();
            bgAlpha[0] = 1f;
            bgAlpha2[0] = 1f;
            for (int i = 0; i < 0x6f; i++)
            {
                projFrames[i] = 1;
            }
            projFrames[0x48] = 4;
            projFrames[0x56] = 4;
            projFrames[0x57] = 4;
            projFrames[0x66] = 2;
            debuff[20] = true;
            debuff[0x15] = true;
            debuff[0x16] = true;
            debuff[0x17] = true;
            debuff[0x18] = true;
            debuff[0x19] = true;
            debuff[0x1c] = true;
            debuff[30] = true;
            debuff[0x1f] = true;
            debuff[0x20] = true;
            debuff[0x21] = true;
            debuff[0x22] = true;
            debuff[0x23] = true;
            debuff[0x24] = true;
            debuff[0x25] = true;
            debuff[0x26] = true;
            debuff[0x27] = true;
            buffName[1] = "Obsidian Skin";
            buffTip[1] = "Immune to lava";
            buffName[2] = "Regeneration";
            buffTip[2] = "Provides life regeneration";
            buffName[3] = "Swiftness";
            buffTip[3] = "25% increased movement speed";
            buffName[4] = "Gills";
            buffTip[4] = "Breathe water instead of air";
            buffName[5] = "Ironskin";
            buffTip[5] = "Increase defense by 8";
            buffName[6] = "Mana Regeneration";
            buffTip[6] = "Increased mana regeneration";
            buffName[7] = "Magic Power";
            buffTip[7] = "20% increased magic damage";
            buffName[8] = "Featherfall";
            buffTip[8] = "Press UP or DOWN to control speed of descent";
            buffName[9] = "Spelunker";
            buffTip[9] = "Shows the location of treasure and ore";
            buffName[10] = "Invisibility";
            buffTip[10] = "Grants invisibility";
            buffName[11] = "Shine";
            buffTip[11] = "Emitting light";
            buffName[12] = "Night Owl";
            buffTip[12] = "Increased night vision";
            buffName[13] = "Battle";
            buffTip[13] = "Increased enemy spawn rate";
            buffName[14] = "Thorns";
            buffTip[14] = "Attackers also take damage";
            buffName[15] = "Water Walking";
            buffTip[15] = "Press DOWN to enter water";
            buffName[0x10] = "Archery";
            buffTip[0x10] = "20% increased arrow damage and speed";
            buffName[0x11] = "Hunter";
            buffTip[0x11] = "Shows the location of enemies";
            buffName[0x12] = "Gravitation";
            buffTip[0x12] = "Press UP or DOWN to reverse gravity";
            buffName[0x13] = "Orb of Light";
            buffTip[0x13] = "A magical orb that provides light";
            buffName[20] = "Poisoned";
            buffTip[20] = "Slowly losing life";
            buffName[0x15] = "Potion Sickness";
            buffTip[0x15] = "Cannot consume anymore healing items";
            buffName[0x16] = "Darkness";
            buffTip[0x16] = "Decreased light vision";
            buffName[0x17] = "Cursed";
            buffTip[0x17] = "Cannot use any items";
            buffName[0x18] = "On Fire!";
            buffTip[0x18] = "Slowly losing life";
            buffName[0x19] = "Tipsy";
            buffTip[0x19] = "Increased melee abilities, lowered defense";
            buffName[0x1a] = "Well Fed";
            buffTip[0x1a] = "Minor improvements to all stats";
            buffName[0x1b] = "Fairy";
            buffTip[0x1b] = "A fairy is following you";
            buffName[0x1c] = "Werewolf";
            buffTip[0x1c] = "Physical abilities are increased";
            buffName[0x1d] = "Clairvoyance";
            buffTip[0x1d] = "Magic powers are increased";
            buffName[30] = "Bleeding";
            buffTip[30] = "Cannot regenerate life";
            buffName[0x1f] = "Confused";
            buffTip[0x1f] = "Movement is reversed";
            buffName[0x20] = "Slow";
            buffTip[0x20] = "Movement speed is reduced";
            buffName[0x21] = "Weak";
            buffTip[0x21] = "Physical abilities are decreased";
            buffName[0x22] = "Merfolk";
            buffTip[0x22] = "Can breathe and move easily underwater";
            buffName[0x23] = "Silenced";
            buffTip[0x23] = "Cannot use items that require mana";
            buffName[0x24] = "Broken Armor";
            buffTip[0x24] = "Defense is cut in half";
            buffName[0x25] = "Horrified";
            buffTip[0x25] = "You have seen something nasty, there is no escape.";
            buffName[0x26] = "The Tongue";
            buffTip[0x26] = "You are being sucked into the mouth";
            buffName[0x27] = "Cursed Inferno";
            buffTip[0x27] = "Losing life";
            for (int j = 0; j < 10; j++)
            {
                recentWorld[j] = "";
                recentIP[j] = "";
                recentPort[j] = 0;
            }
            if (rand == null)
            {
                rand = new Random((int)DateTime.Now.Ticks);
            }
            if (WorldGen.genRand == null)
            {
                WorldGen.genRand = new Random((int)DateTime.Now.Ticks);
            }
            switch (rand.Next(15))
            {
                case 0:
                    base.Window.Title = "Terraria: Dig Peon, Dig!";
                    break;

                case 1:
                    base.Window.Title = "Terraria: Epic Dirt";
                    break;

                case 2:
                    base.Window.Title = "Terraria: Hey Guys!";
                    break;

                case 3:
                    base.Window.Title = "Terraria: Sand is Overpowered";
                    break;

                case 4:
                    base.Window.Title = "Terraria Part 3: The Return of the Guide";
                    break;

                case 5:
                    base.Window.Title = "Terraria: A Bunnies Tale";
                    break;

                case 6:
                    base.Window.Title = "Terraria: Dr. Bones and The Temple of Blood Moon";
                    break;

                case 7:
                    base.Window.Title = "Terraria: Slimeassic Park";
                    break;

                case 8:
                    base.Window.Title = "Terraria: The Grass is Greener on This Side";
                    break;

                case 9:
                    base.Window.Title = "Terraria: Small Blocks, Not for Children Under the Age of 5";
                    break;

                case 10:
                    base.Window.Title = "Terraria: Digger T' Blocks";
                    break;

                case 11:
                    base.Window.Title = "Terraria: There is No Cow Layer";
                    break;

                case 12:
                    base.Window.Title = "Terraria: Suspicous Looking Eyeballs";
                    break;

                case 13:
                    base.Window.Title = "Terraria: Purple Grass!";
                    break;

                case 14:
                    base.Window.Title = "Terraria: Noone Dug Behind!";
                    break;

                default:
                    base.Window.Title = "Terraria: Shut Up and Dig Gaiden!";
                    break;
            }
            lo = rand.Next(6);
            //ADDED TILEOPTIONS for flags:  (tiki = 0x56)
            tileHammer[150] = true;
            tileLighted[150] = true;
            tileLavaDeath[150] = true;
            tileFrameImportant[150] = true;
            tileNoAttach[150] = true;
            tileName[150] = "Red Flag";     //CHANGED: ADDED

            tileHammer[151] = true;
            //tileLighted[151] = true;
            tileLavaDeath[151] = true;
            //tileFrameImportant[151] = true;
            tileNoAttach[151] = true;
            tileName[151] = "Blue Flag";     //CHANGED: ADDED

            //ORIG
            tileShine2[6] = true;
            tileShine2[7] = true;
            tileShine2[8] = true;
            tileShine2[9] = true;
            tileShine2[12] = true;
            tileShine2[0x15] = true;
            tileShine2[0x16] = true;
            tileShine2[0x19] = true;
            tileShine2[0x2d] = true;
            tileShine2[0x2e] = true;
            tileShine2[0x2f] = true;
            tileShine2[0x3f] = true;
            tileShine2[0x40] = true;
            tileShine2[0x41] = true;
            tileShine2[0x42] = true;
            tileShine2[0x43] = true;
            tileShine2[0x44] = true;
            tileShine2[0x6b] = true;
            tileShine2[0x6c] = true;
            tileShine2[0x6f] = true;
            tileShine2[0x79] = true;
            tileShine2[0x7a] = true;
            tileShine2[0x75] = true;
            tileShine[0x81] = 300;
            tileHammer[0x8d] = true;
            tileHammer[4] = true;
            tileHammer[10] = true;
            tileHammer[11] = true;
            tileHammer[12] = true;
            tileHammer[13] = true;
            tileHammer[14] = true;
            tileHammer[15] = true;
            tileHammer[0x10] = true;
            tileHammer[0x11] = true;
            tileHammer[0x12] = true;
            tileHammer[0x13] = true;
            tileHammer[0x15] = true;
            tileHammer[0x1a] = true;
            tileHammer[0x1c] = true;
            tileHammer[0x1d] = true;
            tileHammer[0x1f] = true;
            tileHammer[0x21] = true;
            tileHammer[0x22] = true;
            tileHammer[0x23] = true;
            tileHammer[0x24] = true;
            tileHammer[0x2a] = true;
            tileHammer[0x30] = true;
            tileHammer[0x31] = true;
            tileHammer[50] = true;
            tileHammer[0x36] = true;
            tileHammer[0x37] = true;
            tileHammer[0x4d] = true;
            tileHammer[0x4e] = true;
            tileHammer[0x4f] = true;
            tileHammer[0x51] = true;
            tileHammer[0x55] = true;
            tileHammer[0x56] = true;
            tileHammer[0x57] = true;
            tileHammer[0x58] = true;
            tileHammer[0x59] = true;
            tileHammer[90] = true;
            tileHammer[0x5b] = true;
            tileHammer[0x5c] = true;
            tileHammer[0x5d] = true;
            tileHammer[0x5e] = true;
            tileHammer[0x5f] = true;
            tileHammer[0x60] = true;
            tileHammer[0x61] = true;
            tileHammer[0x62] = true;
            tileHammer[0x63] = true;
            tileHammer[100] = true;
            tileHammer[0x65] = true;
            tileHammer[0x66] = true;
            tileHammer[0x67] = true;
            tileHammer[0x68] = true;
            tileHammer[0x69] = true;
            tileHammer[0x6a] = true;
            tileHammer[0x72] = true;
            tileHammer[0x7d] = true;
            tileHammer[0x7e] = true;
            tileHammer[0x80] = true;
            tileHammer[0x81] = true;
            tileHammer[0x84] = true;
            tileHammer[0x85] = true;
            tileHammer[0x86] = true;
            tileHammer[0x87] = true;
            tileHammer[0x88] = true;
            tileFrameImportant[0x8b] = true;
            tileHammer[0x8b] = true;
            tileLighted[0x95] = true;
            tileFrameImportant[0x95] = true;
            tileHammer[0x95] = true;
            tileFrameImportant[0x8e] = true;
            tileHammer[0x8e] = true;
            tileFrameImportant[0x8f] = true;
            tileHammer[0x8f] = true;
            tileFrameImportant[0x90] = true;
            tileHammer[0x90] = true;
            tileStone[0x83] = true;
            tileFrameImportant[0x88] = true;
            tileFrameImportant[0x89] = true;
            tileFrameImportant[0x8a] = true;
            tileBlockLight[0x89] = true;
            tileSolid[0x89] = true;
            tileBlockLight[0x91] = true;
            tileSolid[0x91] = true;
            tileMergeDirt[0x91] = true;
            tileBlockLight[0x92] = true;
            tileSolid[0x92] = true;
            tileMergeDirt[0x92] = true;
            tileBlockLight[0x93] = true;
            tileSolid[0x93] = true;
            tileMergeDirt[0x93] = true;
            tileBlockLight[0x94] = true;
            tileSolid[0x94] = true;
            tileMergeDirt[0x94] = true;
            tileBlockLight[0x8a] = true;
            tileSolid[0x8a] = true;
            tileBlockLight[140] = true;
            tileSolid[140] = true;
            tileAxe[5] = true;
            tileAxe[30] = true;
            tileAxe[0x48] = true;
            tileAxe[80] = true;
            tileAxe[0x7c] = true;
            tileShine[0x16] = 0x47e;
            tileShine[6] = 0x47e;
            tileShine[7] = 0x44c;
            tileShine[8] = 0x3e8;
            tileShine[9] = 0x41a;
            tileShine[12] = 0x3e8;
            tileShine[0x15] = 0x4b0;
            tileShine[0x3f] = 900;
            tileShine[0x40] = 900;
            tileShine[0x41] = 900;
            tileShine[0x42] = 900;
            tileShine[0x43] = 900;
            tileShine[0x44] = 900;
            tileShine[0x2d] = 0x76c;
            tileShine[0x2e] = 0x7d0;
            tileShine[0x2f] = 0x834;
            tileShine[0x7a] = 0x708;
            tileShine[0x79] = 0x73a;
            tileShine[0x7d] = 600;
            tileShine[0x6d] = 0x2328;
            tileShine[110] = 0x2328;
            tileShine[0x74] = 0x2328;
            tileShine[0x75] = 0x2328;
            tileShine[0x76] = 0x1f40;
            tileShine[0x6b] = 950;
            tileShine[0x6c] = 900;
            tileShine[0x6f] = 850;
            tileLighted[4] = true;
            tileLighted[0x11] = true;
            tileLighted[0x85] = true;
            tileLighted[0x1f] = true;
            tileLighted[0x21] = true;
            tileLighted[0x22] = true;
            tileLighted[0x23] = true;
            tileLighted[0x24] = true;
            tileLighted[0x25] = true;
            tileLighted[0x2a] = true;
            tileLighted[0x31] = true;
            tileLighted[0x3a] = true;
            tileLighted[0x3d] = true;
            tileLighted[70] = true;
            tileLighted[0x47] = true;
            tileLighted[0x48] = true;
            tileLighted[0x4c] = true;
            tileLighted[0x4d] = true;
            tileLighted[0x13] = true;
            tileLighted[0x16] = true;
            tileLighted[0x1a] = true;
            tileLighted[0x53] = true;
            tileLighted[0x54] = true;
            tileLighted[0x5c] = true;
            tileLighted[0x5d] = true;
            tileLighted[0x5f] = true;
            tileLighted[0x62] = true;
            tileLighted[100] = true;
            tileLighted[0x6d] = true;
            tileLighted[0x7d] = true;
            tileLighted[0x7e] = true;
            tileLighted[0x81] = true;
            tileLighted[140] = true;
            tileMergeDirt[1] = true;
            tileMergeDirt[6] = true;
            tileMergeDirt[7] = true;
            tileMergeDirt[8] = true;
            tileMergeDirt[9] = true;
            tileMergeDirt[0x16] = true;
            tileMergeDirt[0x19] = true;
            tileMergeDirt[30] = true;
            tileMergeDirt[0x25] = true;
            tileMergeDirt[0x26] = true;
            tileMergeDirt[40] = true;
            tileMergeDirt[0x35] = true;
            tileMergeDirt[0x38] = true;
            tileMergeDirt[0x6b] = true;
            tileMergeDirt[0x6c] = true;
            tileMergeDirt[0x6f] = true;
            tileMergeDirt[0x70] = true;
            tileMergeDirt[0x74] = true;
            tileMergeDirt[0x75] = true;
            tileMergeDirt[0x7b] = true;
            tileMergeDirt[140] = true;
            tileMergeDirt[0x27] = true;
            tileMergeDirt[0x7a] = true;
            tileMergeDirt[0x79] = true;
            tileMergeDirt[120] = true;
            tileMergeDirt[0x77] = true;
            tileMergeDirt[0x76] = true;
            tileMergeDirt[0x2f] = true;
            tileMergeDirt[0x2e] = true;
            tileMergeDirt[0x2d] = true;
            tileMergeDirt[0x2c] = true;
            tileMergeDirt[0x2b] = true;
            tileMergeDirt[0x29] = true;
            tileFrameImportant[3] = true;
            tileFrameImportant[4] = true;
            tileFrameImportant[5] = true;
            tileFrameImportant[10] = true;
            tileFrameImportant[11] = true;
            tileFrameImportant[12] = true;
            tileFrameImportant[13] = true;
            tileFrameImportant[14] = true;
            tileFrameImportant[15] = true;
            tileFrameImportant[0x10] = true;
            tileFrameImportant[0x11] = true;
            tileFrameImportant[0x12] = true;
            tileFrameImportant[20] = true;
            tileFrameImportant[0x15] = true;
            tileFrameImportant[0x18] = true;
            tileFrameImportant[0x1a] = true;
            tileFrameImportant[0x1b] = true;
            tileFrameImportant[0x1c] = true;
            tileFrameImportant[0x1d] = true;
            tileFrameImportant[0x1f] = true;
            tileFrameImportant[0x21] = true;
            tileFrameImportant[0x22] = true;
            tileFrameImportant[0x23] = true;
            tileFrameImportant[0x24] = true;
            tileFrameImportant[0x2a] = true;
            tileFrameImportant[50] = true;
            tileFrameImportant[0x37] = true;
            tileFrameImportant[0x3d] = true;
            tileFrameImportant[0x47] = true;
            tileFrameImportant[0x48] = true;
            tileFrameImportant[0x49] = true;
            tileFrameImportant[0x4a] = true;
            tileFrameImportant[0x4d] = true;
            tileFrameImportant[0x4e] = true;
            tileFrameImportant[0x4f] = true;
            tileFrameImportant[0x51] = true;
            tileFrameImportant[0x52] = true;
            tileFrameImportant[0x53] = true;
            tileFrameImportant[0x54] = true;
            tileFrameImportant[0x55] = true;
            tileFrameImportant[0x56] = true;
            tileFrameImportant[0x57] = true;
            tileFrameImportant[0x58] = true;
            tileFrameImportant[0x59] = true;
            tileFrameImportant[90] = true;
            tileFrameImportant[0x5b] = true;
            tileFrameImportant[0x5c] = true;
            tileFrameImportant[0x5d] = true;
            tileFrameImportant[0x5e] = true;
            tileFrameImportant[0x5f] = true;
            tileFrameImportant[0x60] = true;
            tileFrameImportant[0x61] = true;
            tileFrameImportant[0x62] = true;
            tileFrameImportant[0x63] = true;
            tileFrameImportant[0x65] = true;
            tileFrameImportant[0x66] = true;
            tileFrameImportant[0x67] = true;
            tileFrameImportant[0x68] = true;
            tileFrameImportant[0x69] = true;
            tileFrameImportant[100] = true;
            tileFrameImportant[0x6a] = true;
            tileFrameImportant[110] = true;
            tileFrameImportant[0x71] = true;
            tileFrameImportant[0x72] = true;
            tileFrameImportant[0x7d] = true;
            tileFrameImportant[0x7e] = true;
            tileFrameImportant[0x80] = true;
            tileFrameImportant[0x81] = true;
            tileFrameImportant[0x84] = true;
            tileFrameImportant[0x85] = true;
            tileFrameImportant[0x86] = true;
            tileFrameImportant[0x87] = true;
            tileFrameImportant[0x8d] = true;
            tileCut[3] = true;
            tileCut[0x18] = true;
            tileCut[0x1c] = true;
            tileCut[0x20] = true;
            tileCut[0x33] = true;
            tileCut[0x34] = true;
            tileCut[0x3d] = true;
            tileCut[0x3e] = true;
            tileCut[0x45] = true;
            tileCut[0x47] = true;
            tileCut[0x49] = true;
            tileCut[0x4a] = true;
            tileCut[0x52] = true;
            tileCut[0x53] = true;
            tileCut[0x54] = true;
            tileCut[110] = true;
            tileCut[0x71] = true;
            tileCut[0x73] = true;
            tileAlch[0x52] = true;
            tileAlch[0x53] = true;
            tileAlch[0x54] = true;
            tileLavaDeath[0x68] = true;
            tileLavaDeath[110] = true;
            tileLavaDeath[0x71] = true;
            tileLavaDeath[0x73] = true;
            tileSolid[0x7f] = true;
            tileSolid[130] = true;
            tileBlockLight[130] = true;
            tileBlockLight[0x83] = true;
            tileSolid[0x6b] = true;
            tileBlockLight[0x6b] = true;
            tileSolid[0x6c] = true;
            tileBlockLight[0x6c] = true;
            tileSolid[0x6f] = true;
            tileBlockLight[0x6f] = true;
            tileSolid[0x6d] = true;
            tileBlockLight[0x6d] = true;
            tileSolid[110] = false;
            tileNoAttach[110] = true;
            tileNoFail[110] = true;
            tileSolid[0x70] = true;
            tileBlockLight[0x70] = true;
            tileSolid[0x74] = true;
            tileBlockLight[0x74] = true;
            tileSolid[0x75] = true;
            tileBlockLight[0x75] = true;
            tileSolid[0x7b] = true;
            tileBlockLight[0x7b] = true;
            tileSolid[0x76] = true;
            tileBlockLight[0x76] = true;
            tileSolid[0x77] = true;
            tileBlockLight[0x77] = true;
            tileSolid[120] = true;
            tileBlockLight[120] = true;
            tileSolid[0x79] = true;
            tileBlockLight[0x79] = true;
            tileSolid[0x7a] = true;
            tileBlockLight[0x7a] = true;
            tileBlockLight[0x73] = true;
            tileSolid[0] = true;
            tileBlockLight[0] = true;
            tileSolid[1] = true;
            tileBlockLight[1] = true;
            tileSolid[2] = true;
            tileBlockLight[2] = true;
            tileSolid[3] = false;
            tileNoAttach[3] = true;
            tileNoFail[3] = true;
            tileSolid[4] = false;
            tileNoAttach[4] = true;
            tileNoFail[4] = true;
            tileNoFail[0x18] = true;
            tileSolid[5] = false;
            tileSolid[6] = true;
            tileBlockLight[6] = true;
            tileSolid[7] = true;
            tileBlockLight[7] = true;
            tileSolid[8] = true;
            tileBlockLight[8] = true;
            tileSolid[9] = true;
            tileBlockLight[9] = true;
            tileBlockLight[10] = true;
            tileSolid[10] = true;
            tileNoAttach[10] = true;
            tileBlockLight[10] = true;
            tileSolid[11] = false;
            tileSolidTop[0x13] = true;
            tileSolid[0x13] = true;
            tileSolid[0x16] = true;
            tileSolid[0x17] = true;
            tileSolid[0x19] = true;
            tileSolid[30] = true;
            tileNoFail[0x20] = true;
            tileBlockLight[0x20] = true;
            tileSolid[0x25] = true;
            tileBlockLight[0x25] = true;
            tileSolid[0x26] = true;
            tileBlockLight[0x26] = true;
            tileSolid[0x27] = true;
            tileBlockLight[0x27] = true;
            tileSolid[40] = true;
            tileBlockLight[40] = true;
            tileSolid[0x29] = true;
            tileBlockLight[0x29] = true;
            tileSolid[0x2b] = true;
            tileBlockLight[0x2b] = true;
            tileSolid[0x2c] = true;
            tileBlockLight[0x2c] = true;
            tileSolid[0x2d] = true;
            tileBlockLight[0x2d] = true;
            tileSolid[0x2e] = true;
            tileBlockLight[0x2e] = true;
            tileSolid[0x2f] = true;
            tileBlockLight[0x2f] = true;
            tileSolid[0x30] = true;
            tileBlockLight[0x30] = true;
            tileSolid[0x35] = true;
            tileBlockLight[0x35] = true;
            tileSolid[0x36] = true;
            tileBlockLight[0x34] = true;
            tileSolid[0x38] = true;
            tileBlockLight[0x38] = true;
            tileSolid[0x39] = true;
            tileBlockLight[0x39] = true;
            tileSolid[0x3a] = true;
            tileBlockLight[0x3a] = true;
            tileSolid[0x3b] = true;
            tileBlockLight[0x3b] = true;
            tileSolid[60] = true;
            tileBlockLight[60] = true;
            tileSolid[0x3f] = true;
            tileBlockLight[0x3f] = true;
            tileStone[0x3f] = true;
            tileStone[130] = true;
            tileSolid[0x40] = true;
            tileBlockLight[0x40] = true;
            tileStone[0x40] = true;
            tileSolid[0x41] = true;
            tileBlockLight[0x41] = true;
            tileStone[0x41] = true;
            tileSolid[0x42] = true;
            tileBlockLight[0x42] = true;
            tileStone[0x42] = true;
            tileSolid[0x43] = true;
            tileBlockLight[0x43] = true;
            tileStone[0x43] = true;
            tileSolid[0x44] = true;
            tileBlockLight[0x44] = true;
            tileStone[0x44] = true;
            tileSolid[0x4b] = true;
            tileBlockLight[0x4b] = true;
            tileSolid[0x4c] = true;
            tileBlockLight[0x4c] = true;
            tileSolid[70] = true;
            tileBlockLight[70] = true;
            tileNoFail[50] = true;
            tileNoAttach[50] = true;
            tileDungeon[0x29] = true;
            tileDungeon[0x2b] = true;
            tileDungeon[0x2c] = true;
            tileBlockLight[30] = true;
            tileBlockLight[0x19] = true;
            tileBlockLight[0x17] = true;
            tileBlockLight[0x16] = true;
            tileBlockLight[0x3e] = true;
            tileSolidTop[0x12] = true;
            tileSolidTop[14] = true;
            tileSolidTop[0x10] = true;
            tileSolidTop[0x72] = true;
            tileNoAttach[20] = true;
            tileNoAttach[0x13] = true;
            tileNoAttach[13] = true;
            tileNoAttach[14] = true;
            tileNoAttach[15] = true;
            tileNoAttach[0x10] = true;
            tileNoAttach[0x11] = true;
            tileNoAttach[0x12] = true;
            tileNoAttach[0x13] = true;
            tileNoAttach[0x15] = true;
            tileNoAttach[0x1b] = true;
            tileNoAttach[0x72] = true;
            tileTable[14] = true;
            tileTable[0x12] = true;
            tileTable[0x13] = true;
            tileTable[0x72] = true;
            tileNoAttach[0x56] = true;
            tileNoAttach[0x57] = true;
            tileNoAttach[0x58] = true;
            tileNoAttach[0x59] = true;
            tileNoAttach[90] = true;
            tileLavaDeath[0x56] = true;
            tileLavaDeath[0x57] = true;
            tileLavaDeath[0x58] = true;
            tileLavaDeath[0x59] = true;
            tileLavaDeath[0x7d] = true;
            tileLavaDeath[0x7e] = true;
            tileLavaDeath[0x65] = true;
            tileTable[0x65] = true;
            tileNoAttach[0x65] = true;
            tileLavaDeath[0x66] = true;
            tileNoAttach[0x66] = true;
            tileNoAttach[0x5e] = true;
            tileNoAttach[0x5f] = true;
            tileNoAttach[0x60] = true;
            tileNoAttach[0x61] = true;
            tileNoAttach[0x62] = true;
            tileNoAttach[0x63] = true;
            tileLavaDeath[0x5e] = true;
            tileLavaDeath[0x5f] = true;
            tileLavaDeath[0x60] = true;
            tileLavaDeath[0x61] = true;
            tileLavaDeath[0x62] = true;
            tileLavaDeath[0x63] = true;
            tileLavaDeath[100] = true;
            tileLavaDeath[0x67] = true;
            tileTable[0x57] = true;
            tileTable[0x58] = true;
            tileSolidTop[0x57] = true;
            tileSolidTop[0x58] = true;
            tileSolidTop[0x65] = true;
            tileNoAttach[0x5b] = true;
            tileLavaDeath[0x5b] = true;
            tileNoAttach[0x5c] = true;
            tileLavaDeath[0x5c] = true;
            tileNoAttach[0x5d] = true;
            tileLavaDeath[0x5d] = true;
            tileWaterDeath[4] = true;
            tileWaterDeath[0x33] = true;
            tileWaterDeath[0x5d] = true;
            tileWaterDeath[0x62] = true;
            tileLavaDeath[3] = true;
            tileLavaDeath[5] = true;
            tileLavaDeath[10] = true;
            tileLavaDeath[11] = true;
            tileLavaDeath[12] = true;
            tileLavaDeath[13] = true;
            tileLavaDeath[14] = true;
            tileLavaDeath[15] = true;
            tileLavaDeath[0x10] = true;
            tileLavaDeath[0x11] = true;
            tileLavaDeath[0x12] = true;
            tileLavaDeath[0x13] = true;
            tileLavaDeath[20] = true;
            tileLavaDeath[0x1b] = true;
            tileLavaDeath[0x1c] = true;
            tileLavaDeath[0x1d] = true;
            tileLavaDeath[0x20] = true;
            tileLavaDeath[0x21] = true;
            tileLavaDeath[0x22] = true;
            tileLavaDeath[0x23] = true;
            tileLavaDeath[0x24] = true;
            tileLavaDeath[0x2a] = true;
            tileLavaDeath[0x31] = true;
            tileLavaDeath[50] = true;
            tileLavaDeath[0x34] = true;
            tileLavaDeath[0x37] = true;
            tileLavaDeath[0x3d] = true;
            tileLavaDeath[0x3e] = true;
            tileLavaDeath[0x45] = true;
            tileLavaDeath[0x47] = true;
            tileLavaDeath[0x48] = true;
            tileLavaDeath[0x49] = true;
            tileLavaDeath[0x4a] = true;
            tileLavaDeath[0x4f] = true;
            tileLavaDeath[80] = true;
            tileLavaDeath[0x51] = true;
            tileLavaDeath[0x6a] = true;
            wallHouse[1] = true;
            wallHouse[4] = true;
            wallHouse[5] = true;
            wallHouse[6] = true;
            wallHouse[10] = true;
            wallHouse[11] = true;
            wallHouse[12] = true;
            wallHouse[0x10] = true;
            wallHouse[0x11] = true;
            wallHouse[0x12] = true;
            wallHouse[0x13] = true;
            wallHouse[20] = true;
            wallHouse[0x15] = true;
            wallHouse[0x16] = true;
            wallHouse[0x17] = true;
            wallHouse[0x18] = true;
            wallHouse[0x19] = true;
            wallHouse[0x1a] = true;
            wallHouse[0x1b] = true;
            wallHouse[0x1d] = true;
            wallHouse[30] = true;
            wallHouse[0x1f] = true;
            for (int k = 0; k < 0x20; k++)
            {
                switch (k)
                {
                    case 20:
                        wallBlend[k] = 14;
                        break;

                    case 0x13:
                        wallBlend[k] = 9;
                        break;

                    case 0x12:
                        wallBlend[k] = 8;
                        break;

                    case 0x11:
                        wallBlend[k] = 7;
                        break;

                    case 0x10:
                        wallBlend[k] = 2;
                        break;

                    default:
                        wallBlend[k] = k;
                        break;
                }
            }
            tileNoFail[0x20] = true;
            tileNoFail[0x3d] = true;
            tileNoFail[0x45] = true;
            tileNoFail[0x49] = true;
            tileNoFail[0x4a] = true;
            tileNoFail[0x52] = true;
            tileNoFail[0x53] = true;
            tileNoFail[0x54] = true;
            tileNoFail[110] = true;
            tileNoFail[0x71] = true;
            for (int m = 0; m < maxTileSets; m++)    //CHANGED: orig 150
            {
                tileName[m] = "";
                if (tileSolid[m])
                {
                    tileNoSunLight[m] = true;
                }
            }
            tileNoSunLight[0x13] = false;
            tileNoSunLight[11] = true;
            tileName[13] = "Bottle";
            tileName[14] = "Table";
            tileName[15] = "Chair";
            tileName[0x10] = "Anvil";
            tileName[0x11] = "Furnace";
            tileName[0x12] = "Workbench";
            tileName[0x1a] = "Demon Altar";
            tileName[0x4d] = "Hellforge";
            tileName[0x56] = "Loom";
            tileName[0x5e] = "Keg";
            tileName[0x60] = "Cooking Pot";
            tileName[0x65] = "Bookcase";
            tileName[0x6a] = "Sawmill";
            tileName[0x72] = "Tinkerer's Workshop";
            tileName[0x85] = "Adamantite Forge";
            tileName[0x86] = "Mythril Anvil";

            for (int n = 0; n < maxMenuItems; n++)
            {
                this.menuItemScale[n] = 0.8f;
            }
            for (int num7 = 0; num7 < 0x7d1; num7++)
            {
                dust[num7] = new Dust();
            }
            for (int num8 = 0; num8 < 0xc9; num8++)
            {
                Main.item[num8] = new Item();
            }
            for (int num9 = 0; num9 < 0xc9; num9++)
            {
                npc[num9] = new NPC();
                npc[num9].whoAmI = num9;
            }
            for (int num10 = 0; num10 < 0x100; num10++)
            {
                player[num10] = new Player();
            }
            for (int num11 = 0; num11 < 0x3e9; num11++)
            {
                projectile[num11] = new Projectile();
            }
            for (int num12 = 0; num12 < 0xc9; num12++)
            {
                gore[num12] = new Gore();
            }
            for (int num13 = 0; num13 < 100; num13++)
            {
                cloud[num13] = new Cloud();
            }
            for (int num14 = 0; num14 < 100; num14++)
            {
                combatText[num14] = new CombatText();
            }
            for (int num15 = 0; num15 < 20; num15++)
            {
                itemText[num15] = new ItemText();
            }
            for (int num16 = 0; num16 < maxItemTypes; num16++) //CHANGED, orig 0x25b
            {
                Item item = new Item();
                item.SetDefaults(num16, false);
                itemName[num16] = item.name;
                if (item.headSlot > 0)
                {
                    Item.headType[item.headSlot] = item.type;
                }
                if (item.bodySlot > 0)
                {
                    Item.bodyType[item.bodySlot] = item.type;
                }
                if (item.legSlot > 0)
                {
                    Item.legType[item.legSlot] = item.type;
                }
            }
            for (int num17 = 0; num17 < Recipe.maxRecipes; num17++)
            {
                recipe[num17] = new Recipe();
                availableRecipeY[num17] = 0x41 * num17;
            }
            Recipe.SetupRecipes();
            for (int num18 = 0; num18 < numChatLines; num18++)
            {
                chatLine[num18] = new ChatLine();
            }
            for (int num19 = 0; num19 < Liquid.resLiquid; num19++)
            {
                liquid[num19] = new Liquid();
            }
            for (int num20 = 0; num20 < 0x2710; num20++)
            {
                liquidBuffer[num20] = new LiquidBuffer();
            }
            this.shop[0] = new Chest();
            this.shop[1] = new Chest();
            this.shop[1].SetupShop(1);
            this.shop[2] = new Chest();
            this.shop[2].SetupShop(2);
            this.shop[3] = new Chest();
            this.shop[3].SetupShop(3);
            this.shop[4] = new Chest();
            this.shop[4].SetupShop(4);
            this.shop[5] = new Chest();
            this.shop[5].SetupShop(5);
            this.shop[6] = new Chest();
            this.shop[6].SetupShop(6);
            this.shop[7] = new Chest();
            this.shop[7].SetupShop(7);
            this.shop[8] = new Chest();
            this.shop[8].SetupShop(8);
            this.shop[9] = new Chest();
            this.shop[9].SetupShop(9);
            teamColor[0] = Color.White;
            teamColor[1] = new Color(230, 40, 20);
            teamColor[2] = new Color(20, 200, 30);
            teamColor[3] = new Color(0x4b, 90, 0xff);
            teamColor[4] = new Color(200, 180, 0);
            if (menuMode == 1)
            {
                LoadPlayers();
            }
            Netplay.Init();
            /*if (skipMenu) // CHANGED: wasnt working so made new skipmenu (line 17280)
            {
                WorldGen.clearWorld();
                gameMenu = false;
                LoadPlayers();
                player[myPlayer] = (Player)loadPlayer[0].Clone();
                PlayerPath = loadPlayerPath[0];
                LoadWorlds();
                WorldGen.generateWorld(-1);
                WorldGen.EveryTileFrame();
                player[myPlayer].Spawn();
            }
            else
            {*/
                IntPtr systemMenu = GetSystemMenu(base.Window.Handle, false);
                int menuItemCount = GetMenuItemCount(systemMenu);
                RemoveMenu(systemMenu, menuItemCount - 1, 0x400);
            //}
            if (!dedServ)
            {
                this.graphics.PreferredBackBufferWidth = screenWidth;
                this.graphics.PreferredBackBufferHeight = screenHeight;
                this.graphics.ApplyChanges();
                base.Initialize();
                base.Window.AllowUserResizing = true;
                this.OpenSettings();
                this.OpenRecent();
                Star.SpawnStars();
                foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
                {
                    if (((mode.Width < minScreenW) || (mode.Height < minScreenH)) || ((mode.Width > maxScreenW) || (mode.Height > maxScreenH)))
                    {
                        continue;
                    }
                    bool flag = true;
                    for (int num22 = 0; num22 < this.numDisplayModes; num22++)
                    {
                        if ((mode.Width == this.displayWidth[num22]) && (mode.Height == this.displayHeight[num22]))
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        this.displayHeight[this.numDisplayModes] = mode.Height;
                        this.displayWidth[this.numDisplayModes] = mode.Width;
                        this.numDisplayModes++;
                    }
                }
                if (autoJoin)
                {
                    LoadPlayers();
                    menuMode = 1;
                    menuMultiplayer = true;
                }
                fpsTimer.Start();
                updateTimer.Start();
            }
            if(Mods.ModMain.skipMenu)
            {
                Mods.ModMain.skipMenus();   //CHANGED: Try to skip menus
            }
        }
示例#33
0
		public void GetAnglerReward()
		{
			Item item = new Item();
			item.type = 0;
			float num = 1f;
			if (this.anglerQuestsFinished <= 50)
			{
				num -= (float)this.anglerQuestsFinished * 0.01f;
			}
			else if (this.anglerQuestsFinished <= 100)
			{
				num = 0.5f - (float)(this.anglerQuestsFinished - 50) * 0.005f;
			}
			else if (this.anglerQuestsFinished <= 150)
			{
				num = 0.25f - (float)(this.anglerQuestsFinished - 100) * 0.002f;
			}
			if (this.anglerQuestsFinished == 10)
			{
				item.SetDefaults(2428, false);
			}
			else if (this.anglerQuestsFinished == 20)
			{
				item.SetDefaults(2367, false);
			}
			else if (this.anglerQuestsFinished == 30)
			{
				item.SetDefaults(2368, false);
			}
			else if (this.anglerQuestsFinished == 40)
			{
				item.SetDefaults(2369, false);
			}
			else if (this.anglerQuestsFinished == 50)
			{
				item.SetDefaults(2294, false);
			}
			else if (this.anglerQuestsFinished > 75 && Main.rand.Next((int)(250f * num)) == 0)
			{
				item.SetDefaults(2294, false);
			}
			else if (Main.hardMode && this.anglerQuestsFinished > 25 && Main.rand.Next((int)(150f * num)) == 0)
			{
				item.SetDefaults(2422, false);
			}
			else if (Main.hardMode && this.anglerQuestsFinished > 10 && Main.rand.Next((int)(100f * num)) == 0)
			{
				item.SetDefaults(2494, false);
			}
			else if (Main.rand.Next((int)(75f * num)) == 0)
			{
				item.SetDefaults(2360, false);
			}
			else if (Main.rand.Next((int)(50f * num)) == 0)
			{
				item.SetDefaults(2373, false);
			}
			else if (Main.rand.Next((int)(50f * num)) == 0)
			{
				item.SetDefaults(2374, false);
			}
			else if (Main.rand.Next((int)(50f * num)) == 0)
			{
				item.SetDefaults(2375, false);
			}
			else if (Main.rand.Next((int)(50f * num)) == 0)
			{
				item.SetDefaults(2417, false);
			}
			else if (Main.rand.Next((int)(50f * num)) == 0)
			{
				item.SetDefaults(2498, false);
			}
			else
			{
				int num2 = Main.rand.Next(27);
				if (num2 == 0)
				{
					item.SetDefaults(2442, false);
				}
				else if (num2 == 1)
				{
					item.SetDefaults(2443, false);
				}
				else if (num2 == 2)
				{
					item.SetDefaults(2444, false);
				}
				else if (num2 == 3)
				{
					item.SetDefaults(2445, false);
				}
				else if (num2 == 4)
				{
					item.SetDefaults(2497, false);
				}
				else if (num2 == 5)
				{
					item.SetDefaults(2495, false);
				}
				else if (num2 == 6)
				{
					item.SetDefaults(2446, false);
				}
				else if (num2 == 7)
				{
					item.SetDefaults(2447, false);
				}
				else if (num2 == 8)
				{
					item.SetDefaults(2448, false);
				}
				else if (num2 == 9)
				{
					item.SetDefaults(2449, false);
				}
				else if (num2 == 10)
				{
					item.SetDefaults(2490, false);
				}
				else if (num2 == 11)
				{
					item.SetDefaults(2435, false);
					item.stack = Main.rand.Next(50, 151);
				}
				else if (num2 == 12)
				{
					item.SetDefaults(2496, false);
				}
				else if (num2 == 13 || num2 == 14)
				{
					item.SetDefaults(2354, false);
					item.stack = Main.rand.Next(2, 6);
				}
				else if (num2 == 15 || num2 == 16)
				{
					item.SetDefaults(2355, false);
					item.stack = Main.rand.Next(2, 6);
				}
				else if (num2 == 17 || num2 == 18)
				{
					item.SetDefaults(2356, false);
					item.stack = Main.rand.Next(2, 6);
				}
				else
				{
					int num3 = (this.anglerQuestsFinished + 50) / 2;
					num3 = (int)((float)(num3 * Main.rand.Next(50, 201)) * 0.01f);
					if (num3 > 100)
					{
						num3 /= 100;
						if (num3 > 10)
						{
							num3 = 10;
						}
						if (num3 < 1)
						{
							num3 = 1;
						}
						item.SetDefaults(73, false);
						item.stack = num3;
					}
					else
					{
						if (num3 > 99)
						{
							num3 = 99;
						}
						if (num3 < 1)
						{
							num3 = 1;
						}
						item.SetDefaults(72, false);
						item.stack = num3;
					}
				}
			}
			item.position = this.center();
			Item item2 = this.GetItem(this.whoAmi, item, true);
			if (item2.stack > 0)
			{
				int number = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, item2.type, item2.stack, false, 0, true);
				if (Main.netMode == 1)
				{
					NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0);
				}
			}
			if (item.type == 2417)
			{
				Item item3 = new Item();
				Item item4 = new Item();
				item3.SetDefaults(2418, false);
				item3.position = this.center();
				item2 = this.GetItem(this.whoAmi, item3, true);
				if (item2.stack > 0)
				{
					int number2 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, item2.type, item2.stack, false, 0, true);
					if (Main.netMode == 1)
					{
						NetMessage.SendData(21, -1, -1, "", number2, 1f, 0f, 0f, 0);
					}
				}
				item4.SetDefaults(2419, false);
				item4.position = this.center();
				item2 = this.GetItem(this.whoAmi, item4, true);
				if (item2.stack > 0)
				{
					int number3 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, item2.type, item2.stack, false, 0, true);
					if (Main.netMode == 1)
					{
						NetMessage.SendData(21, -1, -1, "", number3, 1f, 0f, 0f, 0);
					}
				}
			}
			else if (item.type == 2498)
			{
				Item item5 = new Item();
				Item item6 = new Item();
				item5.SetDefaults(2499, false);
				item5.position = this.center();
				item2 = this.GetItem(this.whoAmi, item5, true);
				if (item2.stack > 0)
				{
					int number4 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, item2.type, item2.stack, false, 0, true);
					if (Main.netMode == 1)
					{
						NetMessage.SendData(21, -1, -1, "", number4, 1f, 0f, 0f, 0);
					}
				}
				item6.SetDefaults(2500, false);
				item6.position = this.center();
				item2 = this.GetItem(this.whoAmi, item6, true);
				if (item2.stack > 0)
				{
					int number5 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, item2.type, item2.stack, false, 0, true);
					if (Main.netMode == 1)
					{
						NetMessage.SendData(21, -1, -1, "", number5, 1f, 0f, 0f, 0);
					}
				}
			}
			if (Main.rand.Next((int)(100f * num)) <= 50)
			{
				Item item7 = new Item();
				if (Main.rand.Next((int)(15f * num)) == 0)
				{
					item7.SetDefaults(2676, false);
				}
				else if (Main.rand.Next((int)(5f * num)) == 0)
				{
					item7.SetDefaults(2675, false);
				}
				else
				{
					item7.SetDefaults(2674, false);
				}
				if (Main.rand.Next(25) <= this.anglerQuestsFinished)
				{
					item7.stack++;
				}
				if (Main.rand.Next(50) <= this.anglerQuestsFinished)
				{
					item7.stack++;
				}
				if (Main.rand.Next(100) <= this.anglerQuestsFinished)
				{
					item7.stack++;
				}
				if (Main.rand.Next(150) <= this.anglerQuestsFinished)
				{
					item7.stack++;
				}
				if (Main.rand.Next(200) <= this.anglerQuestsFinished)
				{
					item7.stack++;
				}
				if (Main.rand.Next(250) <= this.anglerQuestsFinished)
				{
					item7.stack++;
				}
				item7.position = this.center();
				item2 = this.GetItem(this.whoAmi, item7, true);
				if (item2.stack > 0)
				{
					int number6 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, item2.type, item2.stack, false, 0, true);
					if (Main.netMode == 1)
					{
						NetMessage.SendData(21, -1, -1, "", number6, 1f, 0f, 0f, 0);
					}
				}
			}
		}
示例#34
0
        protected void MouseText(string cursorText, int rare = 0, byte diff = 0)
        {
            if ((this.mouseNPC <= -1) && (cursorText != null))
            {
                float num3;
                Vector2 vector4;
                int num = mouseX + 10;
                int num2 = mouseY + 10;
                Color color = new Color((int)mouseTextColor, (int)mouseTextColor, (int)mouseTextColor, (int)mouseTextColor);
                if (toolTip.type > 0)
                {
                    if (player[myPlayer].kbGlove)
                    {
                        toolTip.knockBack *= 1.7f;
                    }
                    rare = toolTip.rare;
                    int num4 = 20;
                    int index = 1;
                    string[] strArray = new string[num4];
                    bool[] flagArray = new bool[num4];
                    bool[] flagArray2 = new bool[num4];
                    for (int i = 0; i < num4; i++)
                    {
                        flagArray[i] = false;
                        flagArray2[i] = false;
                    }
                    strArray[0] = toolTip.AffixName();
                    if (toolTip.stack > 1)
                    {
                        strArray[0] = string.Concat(strArray[0], " (", toolTip.stack, ")");
                    }
                    if (toolTip.social)
                    {
                        strArray[index] = "Equipped in social slot";
                        index++;
                        strArray[index] = "No stats will be gained";
                        index++;
                    }
                    else
                    {
                        if (toolTip.damage > 0)
                        {
                            string[] strArray6;
                            IntPtr ptr4;
                            string[] strArray8;
                            IntPtr ptr6;
                            int damage = toolTip.damage;
                            if (toolTip.melee)
                            {
                                string[] strArray3;
                                IntPtr ptr;
                                strArray[index] = ((int)(player[myPlayer].meleeDamage * damage)).ToString();
                                (strArray3 = strArray)[(int)(ptr = (IntPtr)index)] = strArray3[(int)ptr] + " melee";
                            }
                            else if (toolTip.ranged)
                            {
                                string[] strArray4;
                                IntPtr ptr2;
                                strArray[index] = ((int)(player[myPlayer].rangedDamage * damage)).ToString();
                                (strArray4 = strArray)[(int)(ptr2 = (IntPtr)index)] = strArray4[(int)ptr2] + " ranged";
                            }
                            else if (toolTip.magic)
                            {
                                string[] strArray5;
                                IntPtr ptr3;
                                strArray[index] = ((int)(player[myPlayer].magicDamage * damage)).ToString();
                                (strArray5 = strArray)[(int)(ptr3 = (IntPtr)index)] = strArray5[(int)ptr3] + " magic";
                            }
                            else
                            {
                                strArray[index] = damage.ToString();
                            }
                            (strArray6 = strArray)[(int)(ptr4 = (IntPtr)index)] = strArray6[(int)ptr4] + " damage";
                            index++;
                            if (toolTip.melee)
                            {
                                int num8 = (player[myPlayer].meleeCrit - player[myPlayer].inventory[player[myPlayer].selectedItem].crit) + toolTip.crit;
                                strArray[index] = num8 + "% critical strike chance";
                                index++;
                            }
                            else if (toolTip.ranged)
                            {
                                int num9 = (player[myPlayer].rangedCrit - player[myPlayer].inventory[player[myPlayer].selectedItem].crit) + toolTip.crit;
                                strArray[index] = num9 + "% critical strike chance";
                                index++;
                            }
                            else if (toolTip.magic)
                            {
                                int num10 = (player[myPlayer].magicCrit - player[myPlayer].inventory[player[myPlayer].selectedItem].crit) + toolTip.crit;
                                strArray[index] = num10 + "% critical strike chance";
                                index++;
                            }
                            if (toolTip.useStyle > 0)
                            {
                                string[] strArray7;
                                IntPtr ptr5;
                                if (toolTip.useAnimation <= 8)
                                {
                                    strArray[index] = "Insanely fast";
                                }
                                else if (toolTip.useAnimation <= 20)
                                {
                                    strArray[index] = "Very fast";
                                }
                                else if (toolTip.useAnimation <= 0x19)
                                {
                                    strArray[index] = "Fast";
                                }
                                else if (toolTip.useAnimation <= 30)
                                {
                                    strArray[index] = "Average";
                                }
                                else if (toolTip.useAnimation <= 0x23)
                                {
                                    strArray[index] = "Slow";
                                }
                                else if (toolTip.useAnimation <= 0x2d)
                                {
                                    strArray[index] = "Very slow";
                                }
                                else if (toolTip.useAnimation <= 0x37)
                                {
                                    strArray[index] = "Extremely slow";
                                }
                                else
                                {
                                    strArray[index] = "Snail";
                                }
                                (strArray7 = strArray)[(int)(ptr5 = (IntPtr)index)] = strArray7[(int)ptr5] + " speed";
                                index++;
                            }
                            if (toolTip.knockBack == 0f)
                            {
                                strArray[index] = "No";
                            }
                            else if (toolTip.knockBack <= 1.5)
                            {
                                strArray[index] = "Extremely weak";
                            }
                            else if (toolTip.knockBack <= 3f)
                            {
                                strArray[index] = "Very weak";
                            }
                            else if (toolTip.knockBack <= 4f)
                            {
                                strArray[index] = "Weak";
                            }
                            else if (toolTip.knockBack <= 6f)
                            {
                                strArray[index] = "Average";
                            }
                            else if (toolTip.knockBack <= 7f)
                            {
                                strArray[index] = "Strong";
                            }
                            else if (toolTip.knockBack <= 9f)
                            {
                                strArray[index] = "Very strong";
                            }
                            else if (toolTip.knockBack <= 11f)
                            {
                                strArray[index] = "Extremely strong";
                            }
                            else
                            {
                                strArray[index] = "Insane";
                            }
                            (strArray8 = strArray)[(int)(ptr6 = (IntPtr)index)] = strArray8[(int)ptr6] + " knockback";
                            index++;
                        }
                        if (((toolTip.headSlot > 0) || (toolTip.bodySlot > 0)) || ((toolTip.legSlot > 0) || toolTip.accessory))
                        {
                            strArray[index] = "Equipable";
                            index++;
                        }
                        if (toolTip.vanity)
                        {
                            strArray[index] = "Vanity Item";
                            index++;
                        }
                        if (toolTip.defense > 0)
                        {
                            strArray[index] = toolTip.defense + " defense";
                            index++;
                        }
                        if (toolTip.pick > 0)
                        {
                            strArray[index] = toolTip.pick + "% pickaxe power";
                            index++;
                        }
                        if (toolTip.axe > 0)
                        {
                            strArray[index] = (toolTip.axe * 5) + "% axe power";
                            index++;
                        }
                        if (toolTip.hammer > 0)
                        {
                            strArray[index] = toolTip.hammer + "% hammer power";
                            index++;
                        }
                        if (toolTip.healLife > 0)
                        {
                            strArray[index] = "Restores " + toolTip.healLife + " life";
                            index++;
                        }
                        if (toolTip.healMana > 0)
                        {
                            strArray[index] = "Restores " + toolTip.healMana + " mana";
                            index++;
                        }
                        if ((toolTip.mana > 0) && ((toolTip.type != 0x7f) || !player[myPlayer].spaceGun))
                        {
                            strArray[index] = "Uses " + ((int)(toolTip.mana * player[myPlayer].manaCost)) + " mana";
                            index++;
                        }
                        if ((toolTip.createWall > 0) || (toolTip.createTile > -1))
                        {
                            if (toolTip.type != 0xd5)
                            {
                                strArray[index] = "Can be placed";
                                index++;
                            }
                        }
                        else if (toolTip.ammo > 0)
                        {
                            strArray[index] = "Ammo";
                            index++;
                        }
                        else if (toolTip.consumable)
                        {
                            strArray[index] = "Consumable";
                            index++;
                        }
                        if (toolTip.material)
                        {
                            strArray[index] = "Material";
                            index++;
                        }
                        if (toolTip.toolTip != null)
                        {
                            strArray[index] = toolTip.toolTip;
                            index++;
                        }
                        if (toolTip.toolTip2 != null)
                        {
                            strArray[index] = toolTip.toolTip2;
                            index++;
                        }
                        if (toolTip.buffTime > 0)
                        {
                            string str = "0 s";
                            if ((toolTip.buffTime / 60) >= 60)
                            {
                                str = Math.Round((double)(((double)(toolTip.buffTime / 60)) / 60.0)) + " minute duration";
                            }
                            else
                            {
                                str = Math.Round((double)(((double)toolTip.buffTime) / 60.0)) + " second duration";
                            }
                            strArray[index] = str;
                            index++;
                        }
                        if (toolTip.prefix > 0)
                        {
                            if ((cpItem == null) || (cpItem.name != toolTip.name))
                            {
                                cpItem = new Item();
                                cpItem.SetDefaults(toolTip.name);
                            }
                            if (cpItem.damage != toolTip.damage)
                            {
                                double a = toolTip.damage - cpItem.damage;
                                a = (a / ((double)cpItem.damage)) * 100.0;
                                a = Math.Round(a);
                                if (a > 0.0)
                                {
                                    strArray[index] = "+" + a + "% damage";
                                }
                                else
                                {
                                    strArray[index] = a + "% damage";
                                }
                                if (a < 0.0)
                                {
                                    flagArray2[index] = true;
                                }
                                flagArray[index] = true;
                                index++;
                            }
                            if (cpItem.useAnimation != toolTip.useAnimation)
                            {
                                double num12 = toolTip.useAnimation - cpItem.useAnimation;
                                num12 = (num12 / ((double)cpItem.useAnimation)) * 100.0;
                                num12 = Math.Round(num12) * -1.0;
                                if (num12 > 0.0)
                                {
                                    strArray[index] = "+" + num12 + "% speed";
                                }
                                else
                                {
                                    strArray[index] = num12 + "% speed";
                                }
                                if (num12 < 0.0)
                                {
                                    flagArray2[index] = true;
                                }
                                flagArray[index] = true;
                                index++;
                            }
                            if (cpItem.crit != toolTip.crit)
                            {
                                double num13 = toolTip.crit - cpItem.crit;
                                if (num13 > 0.0)
                                {
                                    strArray[index] = "+" + num13 + "% critical strike chance";
                                }
                                else
                                {
                                    strArray[index] = num13 + "% critical strike chance";
                                }
                                if (num13 < 0.0)
                                {
                                    flagArray2[index] = true;
                                }
                                flagArray[index] = true;
                                index++;
                            }
                            if (cpItem.mana != toolTip.mana)
                            {
                                double num14 = toolTip.mana - cpItem.mana;
                                num14 = (num14 / ((double)cpItem.mana)) * 100.0;
                                num14 = Math.Round(num14);
                                if (num14 > 0.0)
                                {
                                    strArray[index] = "+" + num14 + "% mana cost";
                                }
                                else
                                {
                                    strArray[index] = num14 + "% mana cost";
                                }
                                if (num14 > 0.0)
                                {
                                    flagArray2[index] = true;
                                }
                                flagArray[index] = true;
                                index++;
                            }
                            if (cpItem.scale != toolTip.scale)
                            {
                                double num15 = toolTip.scale - cpItem.scale;
                                num15 = (num15 / ((double)cpItem.scale)) * 100.0;
                                num15 = Math.Round(num15);
                                if (num15 > 0.0)
                                {
                                    strArray[index] = "+" + num15 + "% size";
                                }
                                else
                                {
                                    strArray[index] = num15 + "% size";
                                }
                                if (num15 < 0.0)
                                {
                                    flagArray2[index] = true;
                                }
                                flagArray[index] = true;
                                index++;
                            }
                            if (cpItem.shootSpeed != toolTip.shootSpeed)
                            {
                                double num16 = toolTip.shootSpeed - cpItem.shootSpeed;
                                num16 = (num16 / ((double)cpItem.shootSpeed)) * 100.0;
                                num16 = Math.Round(num16);
                                if (num16 > 0.0)
                                {
                                    strArray[index] = "+" + num16 + "% velocity";
                                }
                                else
                                {
                                    strArray[index] = num16 + "% velocity";
                                }
                                if (num16 < 0.0)
                                {
                                    flagArray2[index] = true;
                                }
                                flagArray[index] = true;
                                index++;
                            }
                            if (cpItem.knockBack != toolTip.knockBack)
                            {
                                double num17 = toolTip.knockBack - cpItem.knockBack;
                                num17 = (num17 / ((double)cpItem.knockBack)) * 100.0;
                                num17 = Math.Round(num17);
                                if (num17 > 0.0)
                                {
                                    strArray[index] = "+" + num17 + "% knockback";
                                }
                                else
                                {
                                    strArray[index] = num17 + "% knockback";
                                }
                                if (num17 < 0.0)
                                {
                                    flagArray2[index] = true;
                                }
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x3e)
                            {
                                strArray[index] = "+1 defense";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x3f)
                            {
                                strArray[index] = "+2 defense";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x40)
                            {
                                strArray[index] = "+3 defense";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x41)
                            {
                                strArray[index] = "+4 defense";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x42)
                            {
                                strArray[index] = "+20 mana";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x43)
                            {
                                strArray[index] = "+1% critical strike chance";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x44)
                            {
                                strArray[index] = "+2% critical strike chance";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x45)
                            {
                                strArray[index] = "+1% damage";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 70)
                            {
                                strArray[index] = "+2% damage";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x47)
                            {
                                strArray[index] = "+3% damage";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x48)
                            {
                                strArray[index] = "+4% damage";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x49)
                            {
                                strArray[index] = "+1% movement speed";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x4a)
                            {
                                strArray[index] = "+2% movement speed";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x4b)
                            {
                                strArray[index] = "+3% movement speed";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x4c)
                            {
                                strArray[index] = "+4% movement speed";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x4d)
                            {
                                strArray[index] = "+1% melee speed";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x4e)
                            {
                                strArray[index] = "+2% melee speed";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 0x4f)
                            {
                                strArray[index] = "+3% melee speed";
                                flagArray[index] = true;
                                index++;
                            }
                            if (toolTip.prefix == 80)
                            {
                                strArray[index] = "+4% melee speed";
                                flagArray[index] = true;
                                index++;
                            }
                        }
                        if (toolTip.wornArmor && (player[myPlayer].setBonus != ""))
                        {
                            strArray[index] = "Set bonus: " + player[myPlayer].setBonus;
                            index++;
                        }
                    }
                    if (npcShop > 0)
                    {
                        if (toolTip.value > 0)
                        {
                            string str2 = "";
                            int num18 = 0;
                            int num19 = 0;
                            int num20 = 0;
                            int num21 = 0;
                            int num22 = toolTip.value * toolTip.stack;
                            if (!toolTip.buy)
                            {
                                num22 = (toolTip.value / 5) * toolTip.stack;
                            }
                            if (num22 < 1)
                            {
                                num22 = 1;
                            }
                            if (num22 >= 0xf4240)
                            {
                                num18 = num22 / 0xf4240;
                                num22 -= num18 * 0xf4240;
                            }
                            if (num22 >= 0x2710)
                            {
                                num19 = num22 / 0x2710;
                                num22 -= num19 * 0x2710;
                            }
                            if (num22 >= 100)
                            {
                                num20 = num22 / 100;
                                num22 -= num20 * 100;
                            }
                            if (num22 >= 1)
                            {
                                num21 = num22;
                            }
                            if (num18 > 0)
                            {
                                str2 = str2 + num18 + " platinum ";
                            }
                            if (num19 > 0)
                            {
                                str2 = str2 + num19 + " gold ";
                            }
                            if (num20 > 0)
                            {
                                str2 = str2 + num20 + " silver ";
                            }
                            if (num21 > 0)
                            {
                                str2 = str2 + num21 + " copper ";
                            }
                            if (!toolTip.buy)
                            {
                                strArray[index] = "Sell price: " + str2;
                            }
                            else
                            {
                                strArray[index] = "Buy price: " + str2;
                            }
                            index++;
                            num3 = ((float)mouseTextColor) / 255f;
                            if (num18 > 0)
                            {
                                color = new Color((int)((byte)(220f * num3)), (int)((byte)(220f * num3)), (int)((byte)(198f * num3)), (int)mouseTextColor);
                            }
                            else if (num19 > 0)
                            {
                                color = new Color((int)((byte)(224f * num3)), (int)((byte)(201f * num3)), (int)((byte)(92f * num3)), (int)mouseTextColor);
                            }
                            else if (num20 > 0)
                            {
                                color = new Color((int)((byte)(181f * num3)), (int)((byte)(192f * num3)), (int)((byte)(193f * num3)), (int)mouseTextColor);
                            }
                            else if (num21 > 0)
                            {
                                color = new Color((int)((byte)(246f * num3)), (int)((byte)(138f * num3)), (int)((byte)(96f * num3)), (int)mouseTextColor);
                            }
                        }
                        else
                        {
                            num3 = ((float)mouseTextColor) / 255f;
                            strArray[index] = "No value";
                            index++;
                            color = new Color((int)((byte)(120f * num3)), (int)((byte)(120f * num3)), (int)((byte)(120f * num3)), (int)mouseTextColor);
                        }
                    }
                    Vector2 vector = new Vector2();
                    int num23 = 0;
                    for (int j = 0; j < index; j++)
                    {
                        Vector2 vector2 = fontMouseText.MeasureString(strArray[j]);
                        if (vector2.X > vector.X)
                        {
                            vector.X = vector2.X;
                        }
                        vector.Y += vector2.Y + num23;
                    }
                    if (((num + vector.X) + 4f) > screenWidth)
                    {
                        num = (int)((screenWidth - vector.X) - 4f);
                    }
                    if (((num2 + vector.Y) + 4f) > screenHeight)
                    {
                        num2 = (int)((screenHeight - vector.Y) - 4f);
                    }
                    int num25 = 0;
                    num3 = ((float)mouseTextColor) / 255f;
                    for (int k = 0; k < index; k++)
                    {
                        for (int m = 0; m < 5; m++)
                        {
                            int num28 = num;
                            int num29 = num2 + num25;
                            Color black = Color.Black;
                            switch (m)
                            {
                                case 0:
                                    num28 -= 2;
                                    break;

                                case 1:
                                    num28 += 2;
                                    break;

                                case 2:
                                    num29 -= 2;
                                    break;

                                case 3:
                                    num29 += 2;
                                    break;

                                default:
                                    black = new Color((int)mouseTextColor, (int)mouseTextColor, (int)mouseTextColor, (int)mouseTextColor);
                                    if (k == 0)
                                    {
                                        if (rare == -1)
                                        {
                                            black = new Color((int)((byte)(130f * num3)), (int)((byte)(130f * num3)), (int)((byte)(130f * num3)), (int)mouseTextColor);
                                        }
                                        if (rare == 1)
                                        {
                                            black = new Color((int)((byte)(150f * num3)), (int)((byte)(150f * num3)), (int)((byte)(255f * num3)), (int)mouseTextColor);
                                        }
                                        if (rare == 2)
                                        {
                                            black = new Color((int)((byte)(150f * num3)), (int)((byte)(255f * num3)), (int)((byte)(150f * num3)), (int)mouseTextColor);
                                        }
                                        if (rare == 3)
                                        {
                                            black = new Color((int)((byte)(255f * num3)), (int)((byte)(200f * num3)), (int)((byte)(150f * num3)), (int)mouseTextColor);
                                        }
                                        if (rare == 4)
                                        {
                                            black = new Color((int)((byte)(255f * num3)), (int)((byte)(150f * num3)), (int)((byte)(150f * num3)), (int)mouseTextColor);
                                        }
                                        if (rare == 5)
                                        {
                                            black = new Color((int)((byte)(255f * num3)), (int)((byte)(150f * num3)), (int)((byte)(255f * num3)), (int)mouseTextColor);
                                        }
                                        if (rare == 6)
                                        {
                                            black = new Color((int)((byte)(210f * num3)), (int)((byte)(160f * num3)), (int)((byte)(255f * num3)), (int)mouseTextColor);
                                        }
                                        if (diff == 1)
                                        {
                                            black = new Color((int)((byte)(mcColor.R * num3)), (int)((byte)(mcColor.G * num3)), (int)((byte)(mcColor.B * num3)), (int)mouseTextColor);
                                        }
                                        if (diff == 2)
                                        {
                                            black = new Color((int)((byte)(hcColor.R * num3)), (int)((byte)(hcColor.G * num3)), (int)((byte)(hcColor.B * num3)), (int)mouseTextColor);
                                        }
                                    }
                                    else if (flagArray[k])
                                    {
                                        if (flagArray2[k])
                                        {
                                            black = new Color((int)((byte)(190f * num3)), (int)((byte)(120f * num3)), (int)((byte)(120f * num3)), (int)mouseTextColor);
                                        }
                                        else
                                        {
                                            black = new Color((int)((byte)(120f * num3)), (int)((byte)(190f * num3)), (int)((byte)(120f * num3)), (int)mouseTextColor);
                                        }
                                    }
                                    else if (k == (index - 1))
                                    {
                                        black = color;
                                    }
                                    break;
                            }
                            vector4 = new Vector2();
                            this.spriteBatch.DrawString(fontMouseText, strArray[k], new Vector2((float)num28, (float)num29), black, 0f, vector4, (float)1f, SpriteEffects.None, 0f);
                        }
                        num25 += ((int)fontMouseText.MeasureString(strArray[k]).Y) + num23;
                    }
                }
                else
                {
                    if ((buffString != "") && (buffString != null))
                    {
                        for (int n = 0; n < 5; n++)
                        {
                            int num31 = num;
                            int num32 = num2 + ((int)fontMouseText.MeasureString(buffString).Y);
                            Color color3 = Color.Black;
                            switch (n)
                            {
                                case 0:
                                    num31 -= 2;
                                    break;

                                case 1:
                                    num31 += 2;
                                    break;

                                case 2:
                                    num32 -= 2;
                                    break;

                                case 3:
                                    num32 += 2;
                                    break;

                                default:
                                    color3 = new Color((int)mouseTextColor, (int)mouseTextColor, (int)mouseTextColor, (int)mouseTextColor);
                                    break;
                            }
                            Vector2 origin = new Vector2();
                            this.spriteBatch.DrawString(fontMouseText, buffString, new Vector2((float)num31, (float)num32), color3, 0f, origin, (float)1f, SpriteEffects.None, 0f);
                        }
                    }
                    Vector2 vector3 = fontMouseText.MeasureString(cursorText);
                    if (((num + vector3.X) + 4f) > screenWidth)
                    {
                        num = (int)((screenWidth - vector3.X) - 4f);
                    }
                    if (((num2 + vector3.Y) + 4f) > screenHeight)
                    {
                        num2 = (int)((screenHeight - vector3.Y) - 4f);
                    }
                    vector4 = new Vector2();
                    this.spriteBatch.DrawString(fontMouseText, cursorText, new Vector2((float)num, (float)(num2 - 2)), Color.Black, 0f, vector4, (float)1f, SpriteEffects.None, 0f);
                    vector4 = new Vector2();
                    this.spriteBatch.DrawString(fontMouseText, cursorText, new Vector2((float)num, (float)(num2 + 2)), Color.Black, 0f, vector4, (float)1f, SpriteEffects.None, 0f);
                    vector4 = new Vector2();
                    this.spriteBatch.DrawString(fontMouseText, cursorText, new Vector2((float)(num - 2), (float)num2), Color.Black, 0f, vector4, (float)1f, SpriteEffects.None, 0f);
                    vector4 = new Vector2();
                    this.spriteBatch.DrawString(fontMouseText, cursorText, new Vector2((float)(num + 2), (float)num2), Color.Black, 0f, vector4, (float)1f, SpriteEffects.None, 0f);
                    num3 = ((float)mouseTextColor) / 255f;
                    Color color4 = new Color((int)mouseTextColor, (int)mouseTextColor, (int)mouseTextColor, (int)mouseTextColor);
                    if (rare == -1)
                    {
                        color4 = new Color((int)((byte)(130f * num3)), (int)((byte)(130f * num3)), (int)((byte)(130f * num3)), (int)mouseTextColor);
                    }
                    if (rare == 6)
                    {
                        color4 = new Color((int)((byte)(210f * num3)), (int)((byte)(160f * num3)), (int)((byte)(255f * num3)), (int)mouseTextColor);
                    }
                    if (rare == 1)
                    {
                        color4 = new Color((int)((byte)(150f * num3)), (int)((byte)(150f * num3)), (int)((byte)(255f * num3)), (int)mouseTextColor);
                    }
                    if (rare == 2)
                    {
                        color4 = new Color((int)((byte)(150f * num3)), (int)((byte)(255f * num3)), (int)((byte)(150f * num3)), (int)mouseTextColor);
                    }
                    if (rare == 3)
                    {
                        color4 = new Color((int)((byte)(255f * num3)), (int)((byte)(200f * num3)), (int)((byte)(150f * num3)), (int)mouseTextColor);
                    }
                    if (rare == 4)
                    {
                        color4 = new Color((int)((byte)(255f * num3)), (int)((byte)(150f * num3)), (int)((byte)(150f * num3)), (int)mouseTextColor);
                    }
                    if (rare == 5)
                    {
                        color4 = new Color((int)((byte)(255f * num3)), (int)((byte)(150f * num3)), (int)((byte)(255f * num3)), (int)mouseTextColor);
                    }
                    if (diff == 1)
                    {
                        color4 = new Color((int)((byte)(mcColor.R * num3)), (int)((byte)(mcColor.G * num3)), (int)((byte)(mcColor.B * num3)), (int)mouseTextColor);
                    }
                    if (diff == 2)
                    {
                        color4 = new Color((int)((byte)(hcColor.R * num3)), (int)((byte)(hcColor.G * num3)), (int)((byte)(hcColor.B * num3)), (int)mouseTextColor);
                    }
                    this.spriteBatch.DrawString(fontMouseText, cursorText, new Vector2((float)num, (float)num2), color4, 0f, new Vector2(), (float)1f, SpriteEffects.None, 0f);
                }
            }
        }
示例#35
0
 public void SetRefillItems(string raw)
 {
     string[] array = raw.Split(',');
     for (int i = 0; i < array.Length && i < 20; i++)
     {
         var item = new Item();
         item.SetDefaults(array[i]);
         RefillItems[i] = item;
     }
     //if (set)
     //    setChestItems(RefillItems);
 }
示例#36
0
        private void checkItemDrops(GetDataEventArgs args)
        {
            if (args.MsgID == PacketTypes.ItemDrop)
            {
                if (args.Handled)
                    return;

                using (var data = new MemoryStream(args.Msg.readBuffer, args.Index, args.Length))
                {
                    Int16 id = data.ReadInt16();
                    float posx = data.ReadSingle();
                    float posy = data.ReadSingle();
                    float velx = data.ReadSingle();
                    float vely = data.ReadSingle();
                    int stack = data.ReadByte();
                    int prefix = data.ReadByte();
                    Int16 type = data.ReadInt16();

                    Item item = new Item();
                    item.SetDefaults(type);

                    if (id == 0)
                        return;

                    if (toBeCollected.ContainsKey(item.name))
                    {
                        toBeCollected[item.name] -= stack;

                        if (toBeCollected[item.name] < 0)
                        {
                            if (Math.Abs(toBeCollected[item.name]) > 1)
                                player.TSPlayer.SendInfoMessage(string.Format("Returning {0} {1}s", Math.Abs(toBeCollected[item.name]), item.name));
                            else
                                player.TSPlayer.SendInfoMessage(string.Format("Returning {0} {1}", Math.Abs(toBeCollected[item.name]), item.name));
                            args.Handled = true;
                            player.TSPlayer.GiveItem(item.type, item.name, item.width, item.width, Math.Abs(toBeCollected[item.name]));
                            toBeCollected.Remove(item.name);
                        }
                        else if (toBeCollected[item.name] > 0)
                        {
                             if (Math.Abs(toBeCollected[item.name]) > 1)
                                player.TSPlayer.SendInfoMessage(string.Format("Drop another {0} {1}s, to continue", Math.Abs(toBeCollected[item.name]), item.name));
                            else
                                player.TSPlayer.SendInfoMessage(string.Format("Drop {0} {1}, to continue", Math.Abs(toBeCollected[item.name]), item.name));
                            args.Handled = true;
                        }
                        else
                        {
                            if (stack > 1)
                                player.TSPlayer.SendInfoMessage(string.Format("You dropped {0} {1}s", stack, item.name));
                            else
                                player.TSPlayer.SendInfoMessage(string.Format("You dropped {0} {1}", stack, item.name));

                            toBeCollected.Remove(item.name);
                            args.Handled = true;
                        }
                    }
                    args.Handled = true;
                }
            }
        }
示例#37
0
 public static void CatchNPC(int i, int who = -1)
 {
     if (!Main.npc[i].active)
     {
         return;
     }
     if (Main.netMode == 1)
     {
         Main.npc[i].active = false;
         NetMessage.SendData((int)PacketTypes.CatchNPC, -1, -1, "", i, (float)who, 0f, 0f, 0, 0, 0);
         return;
     }
     if (Main.npc[i].catchItem > 0)
     {
         int arg_61_0 = Main.npc[i].type;
         Item item = new Item();
         item.SetDefaults((int)Main.npc[i].catchItem, false);
         Item.NewItem((int)Main.player[who].Center.X, (int)Main.player[who].Center.Y, 0, 0, (int)Main.npc[i].catchItem, 1, false, 0, true, false);
         Main.npc[i].active = false;
         NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", i, 0f, 0f, 0f, 0, 0, 0);
     }
 }
示例#38
0
        void Craft(CommandArgs args)
        {
            if (!args.Player.IsLoggedIn) {
            args.Player.SendErrorMessage("You must be logged in to use this command!");
            return;
              }

              Item item;
              var player = RPlayers[args.Player.Index];
              int page = 1;

              if (args.Parameters.Count == 0) {
            if (player.activeRecipe != null) {
              Utils.PrintCurrentRecipe(args.Player);
              return;
            }
            else {
              args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /craft <recipe/-quit/-list/-allcats/-cat/-confirm>");
              return;
            }
              }

              switch (args.Parameters[0].ToLowerInvariant()) {
            #region -list
            case "-list":
              if (!PaginationTools.TryParsePageNumber(args.Parameters, 1, args.Player, out page))
            return;

              List<string> allRec = CommandRecipes.config.Recipes.Where(r => !r.invisible).Select(r => r.name).ToList();

              PaginationTools.SendPage(args.Player, page, PaginationTools.BuildLinesFromTerms(allRec),
            new PaginationTools.Settings {
              HeaderFormat = "All Recipes ({0}/{1}):",
              FooterFormat = "Type /craft -list {0} for more.",
              NothingToDisplayString = "There are currently no recipes defined!"
            });
              return;
            #endregion

            #region -allcats
            case "-allcats":
              if (!PaginationTools.TryParsePageNumber(args.Parameters, 1, args.Player, out page))
            return;

              List<string> cats = config.Recipes.SelectMany(x => x.categories).Distinct().ToList();

              PaginationTools.SendPage(args.Player, page, PaginationTools.BuildLinesFromTerms(cats),
            new PaginationTools.Settings {
              HeaderFormat = "Recipe Categories ({0}/{1}):",
              FooterFormat = "Type /craft -allcats {0} for more.",
              NothingToDisplayString = "There are currently no categories defined!"
            });
              return;
            #endregion

            #region -cat
            case "-cat":
              if (!PaginationTools.TryParsePageNumber(args.Parameters, 2, args.Player, out page))
            return;

              if (args.Parameters.Count < 2) {
            args.Player.SendErrorMessage("Invalid category!");
            return;
              }

              args.Parameters.RemoveAt(0);
              string cat = string.Join(" ", args.Parameters);
              List<string> catrec = config.Recipes
            .Where(r => !r.invisible && r.categories.Contains(cat, StringComparer.InvariantCultureIgnoreCase))
            .Select(x => x.name).ToList();

              PaginationTools.SendPage(args.Player, page, PaginationTools.BuildLinesFromTerms(catrec),
            new PaginationTools.Settings {
              HeaderFormat = "Recipes in this category ({0}/{1}):",
              FooterFormat = string.Format("Type /craft -cat {0} {{{0}}} for more.", cat),
              NothingToDisplayString = "There are currently no recipes in this category defined!"
            });
              return;
            #endregion

            #region -quit
            case "-quit":
              //args.Player.SendInfoMessage("Returning dropped items...");
              //foreach (RecItem itm in player.droppedItems) {
              //  item = new Item();
              //  item.SetDefaults(itm.name);
              //  args.Player.GiveItem(item.type, itm.name, item.width, item.height, itm.stack, itm.prefix);
              //  player.TSPlayer.SendInfoMessage("Returned {0}.", Utils.FormatItem((Item)itm));
              //}
              player.activeRecipe = null;
              player.TSPlayer.SendInfoMessage("Successfully quit crafting.");
              return;
            #endregion

            #region -confirm
            case "-confirm":
              int ingcount = 0;
              Dictionary<int, bool> finishedGroup = new Dictionary<int, bool>();
              Dictionary<int, int> slots = new Dictionary<int, int>();
              int ingredientCount = player.activeRecipe.ingredients.Count;
              foreach (Ingredient ing in player.activeRecipe.ingredients) {
            if (!finishedGroup.ContainsKey(ing.group)) {
              finishedGroup.Add(ing.group, false);
            }
            else if (ing.group != 0)
              ingredientCount--;
              }
              foreach (Ingredient ing in player.activeRecipe.ingredients) {
            if (ing.group == 0 || !finishedGroup[ing.group]) {
              Dictionary<int, RecItem> ingSlots = new Dictionary<int, RecItem>();
              for (int i = 58; i >= 0; i--) {
                item = args.TPlayer.inventory[i];
                if (ing.name == item.name && (ing.prefix == -1 || ing.prefix == item.prefix)) {
                  ingSlots.Add(i, new RecItem(item.name, item.stack, item.prefix));
                }
              }
              if (ingSlots.Count == 0)
                continue;

              int totalStack = 0;
              foreach (var key in ingSlots.Keys)
                totalStack += ingSlots[key].stack;

              if (totalStack >= ing.stack) {
                foreach (var key in ingSlots.Keys)
                  slots.Add(key, (ingSlots[key].stack < ing.stack) ? args.TPlayer.inventory[key].stack : ing.stack);
                if (ing.group != 0)
                  finishedGroup[ing.group] = true;
                ingcount++;
              }
            }
              }

              if (ingcount < ingredientCount) {
            args.Player.SendErrorMessage("Insufficient ingredients!");
            return;
              }

              if (!args.Player.InventorySlotAvailable) {
            args.Player.SendErrorMessage("Insufficient inventory space!");
            return;
              }

              if (player.activeRecipe.SEconomyCost != 0 && SEconomyPlugin.Instance != null) {
            IBankAccount bankAccount = SEconomyPlugin.Instance.GetPlayerBankAccount(args.Player.Name);
            SEconomy seconomy = SEconomyPlugin.Instance;
            if (bankAccount.Balance < player.activeRecipe.SEconomyCost) {
              args.Player.SendErrorMessage("You don't have the necessary amount of {0} {1} to craft this recipe.", player.activeRecipe.SEconomyCost, seconomy.Configuration.MoneyConfiguration.MoneyNamePlural);
              return;
            }

            bankAccount.TransferTo(seconomy.WorldAccount, player.activeRecipe.SEconomyCost, BankAccountTransferOptions.AnnounceToSender, "Crafted " + player.activeRecipe.name, "/craft " + player.activeRecipe.name);
              }

              foreach (var slot in slots) {
            item = args.TPlayer.inventory[slot.Key];
            var ing = player.activeRecipe.ingredients.GetIngredient(item.name, item.prefix);
            if (ing.stack > 0) {
              int stack;
              if (ing.stack < slot.Value)
                stack = ing.stack;
              else
                stack = slot.Value;

              item.stack -= stack;
              ing.stack -= stack;
              if (!player.droppedItems.ContainsItem(item.name, item.prefix))
                player.droppedItems.Add(new RecItem(item.name, stack, item.prefix));
              else
                player.droppedItems.GetItem(item.name, item.prefix).stack += slot.Value;
              NetMessage.SendData((int)PacketTypes.PlayerSlot, -1, -1, "", args.Player.Index, slot.Key);
            }
              }
              List<Product> lDetPros = Utils.DetermineProducts(player.activeRecipe.products);
              foreach (Product pro in lDetPros) {
            Item product = new Item();
            product.SetDefaults(pro.name);
            product.Prefix(pro.prefix);
            pro.prefix = product.prefix;
            player.TSPlayer.GiveItem(product.type, product.name, product.width, product.height, pro.stack, product.prefix);
            player.TSPlayer.SendSuccessMessage("Received {0}.", Utils.FormatItem((Item)pro));
              }
              List<RecItem> prods = new List<RecItem>();
              lDetPros.ForEach(i => prods.Add(new RecItem(i.name, i.stack, i.prefix)));
              Log.Recipe(player.activeRecipe.name, player.droppedItems, prods, player.name);
              player.activeRecipe = null;
              player.droppedItems.Clear();
              player.TSPlayer.SendInfoMessage("Finished crafting.");
              return;
            #endregion

            #region default
            default:
              if (player.activeRecipe != null) {
            args.Player.SendErrorMessage("You must finish crafting or \"/craft -quit\" your current recipe!");
            return;
              }

              string recipe = string.Join(" ", args.Parameters);
              Recipe rec = config.Recipes.Where(r => r.name.ToLower() == recipe.ToLower()).FirstOrDefault();
              if (rec == null) {
            args.Player.SendErrorMessage("Invalid recipe!");
            return;
              }
              if (!rec.permissions.Contains("") && !args.Player.Group.CheckPermissions(rec.permissions)) {
            args.Player.SendErrorMessage("You do not have the required permission to craft the recipe: {0}!", rec.name);
            return;
              }
              if (!Utils.CheckIfInRegion(args.Player, rec.regions)) {
            args.Player.SendErrorMessage("You are not in a valid region to craft the recipe: {0}!", rec.name);
            return;
              }

              player.activeRecipe = rec.Clone();

              if (player.activeRecipe == null)
            return;

              Utils.PrintCurrentRecipe(args.Player);
              return;
              #endregion
              }
        }