terraria-source-code/NPC.cs
2021-10-27 18:03:19 -04:00

39709 lines
1.4 MiB

// Decompiled with JetBrains decompiler
// Type: Terraria.NPC
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Utilities;
using System;
using System.Collections.Generic;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.GameContent;
using Terraria.GameContent.Achievements;
using Terraria.GameContent.Events;
using Terraria.GameContent.UI;
using Terraria.ID;
using Terraria.Localization;
using Terraria.Utilities;
using Terraria.World.Generation;
namespace Terraria
{
public class NPC : Entity
{
private const int NPC_TARGETS_START = 300;
private float waterMovementSpeed = 0.5f;
private float lavaMovementSpeed = 0.5f;
private float honeyMovementSpeed = 0.25f;
public static readonly int[,,,] MoonLordAttacksArray = NPC.InitializeMoonLordAttacks();
public static readonly int[,] MoonLordAttacksArray2 = NPC.InitializeMoonLordAttacks2();
public static int MoonLordCountdown = 0;
public const int MaxMoonLordCountdown = 3600;
public int teleportStyle;
public float teleportTime;
public static int immuneTime = 20;
public static int maxAI = 4;
public int netSpam;
public static int goldCritterChance = 150;
public static int[] killCount = new int[580];
public static float waveKills = 0.0f;
public static int waveNumber = 0;
public const float nameOverIncrement = 0.025f;
public const float nameOverDistance = 400f;
public float nameOver;
public bool SpawnedFromStatue;
public bool dripping;
public bool drippingSlime;
public int altTexture;
public Vector2 visualOffset = Vector2.Zero;
public short catchItem;
public short releaseOwner = (short) byte.MaxValue;
public int rarity;
public static bool taxCollector = false;
public bool[] playerInteraction = new bool[256];
public int lastInteraction = (int) byte.MaxValue;
public float takenDamageMultiplier = 1f;
private static int spawnSpaceX = 3;
private static int spawnSpaceY = 3;
public float gfxOffY;
public float stepSpeed;
private static float gravity = 0.3f;
public bool teleporting;
private static int maxAttack = 20;
private static int[] attackNPC = new int[NPC.maxAttack];
public bool stairFall;
public static int fireFlyFriendly = 0;
public static int fireFlyChance = 0;
public static int fireFlyMultiple = 0;
public static int butterflyChance = 0;
private byte netStream;
private byte[] streamPlayer = new byte[(int) byte.MaxValue];
private byte npcNameLookup;
public Vector2[] oldPos = new Vector2[10];
public float[] oldRot = new float[10];
public bool setFrameSize;
public static int golemBoss = -1;
public static int plantBoss = -1;
public static int crimsonBoss = -1;
public int netSkip;
public bool netAlways;
public int realLife = -1;
private string _givenName = "";
public static int sWidth = 1920;
public static int sHeight = 1080;
private static int spawnRangeX = (int) ((double) (NPC.sWidth / 16) * 0.7);
private static int spawnRangeY = (int) ((double) (NPC.sHeight / 16) * 0.7);
public static int safeRangeX = (int) ((double) (NPC.sWidth / 16) * 0.52);
public static int safeRangeY = (int) ((double) (NPC.sHeight / 16) * 0.52);
private static int activeRangeX = (int) ((double) NPC.sWidth * 2.1);
private static int activeRangeY = (int) ((double) NPC.sHeight * 2.1);
private static int townRangeX = NPC.sWidth;
private static int townRangeY = NPC.sHeight;
public float npcSlots = 1f;
private static bool noSpawnCycle = false;
private static int activeTime = 750;
private static int defaultSpawnRate = 600;
private static int defaultMaxSpawns = 5;
public bool dontCountMe;
public const int maxBuffs = 5;
public int[] buffType = new int[5];
public int[] buffTime = new int[5];
public bool[] buffImmune = new bool[206];
public bool midas;
public bool ichor;
public bool onFire;
public bool onFire2;
public bool onFrostBurn;
public bool poisoned;
public bool venom;
public bool shadowFlame;
public bool soulDrain;
public int lifeRegen;
public int lifeRegenCount;
public int lifeRegenExpectedLossPerSecond = -1;
public bool confused;
public bool loveStruck;
public bool stinky;
public bool dryadWard;
public bool immortal;
public bool chaseable = true;
public bool canGhostHeal = true;
public bool javelined;
public bool celled;
public bool dryadBane;
public bool daybreak;
public bool dontTakeDamageFromHostiles;
public bool betsysCurse;
public bool oiled;
public static bool savedTaxCollector = false;
public static bool savedGoblin = false;
public static bool savedWizard = false;
public static bool savedMech = false;
public static bool savedAngler = false;
public static bool savedStylist = false;
public static bool savedBartender = false;
public static bool downedBoss1 = false;
public static bool downedBoss2 = false;
public static bool downedBoss3 = false;
public static bool downedQueenBee = false;
public static bool downedSlimeKing = false;
public static bool downedGoblins = false;
public static bool downedFrost = false;
public static bool downedPirates = false;
public static bool downedClown = false;
public static bool downedPlantBoss = false;
public static bool downedGolemBoss = false;
public static bool downedMartians = false;
public static bool downedFishron = false;
public static bool downedHalloweenTree = false;
public static bool downedHalloweenKing = false;
public static bool downedChristmasIceQueen = false;
public static bool downedChristmasTree = false;
public static bool downedChristmasSantank = false;
public static bool downedAncientCultist = false;
public static bool downedMoonlord = false;
public static bool downedTowerSolar = false;
public static bool downedTowerVortex = false;
public static bool downedTowerNebula = false;
public static bool downedTowerStardust = false;
public static int ShieldStrengthTowerSolar = 0;
public static int ShieldStrengthTowerVortex = 0;
public static int ShieldStrengthTowerNebula = 0;
public static int ShieldStrengthTowerStardust = 0;
public static int LunarShieldPowerNormal = 100;
public static int LunarShieldPowerExpert = 150;
public static bool TowerActiveSolar = false;
public static bool TowerActiveVortex = false;
public static bool TowerActiveNebula = false;
public static bool TowerActiveStardust = false;
public static bool LunarApocalypseIsUp = false;
public static bool downedMechBossAny = false;
public static bool downedMechBoss1 = false;
public static bool downedMechBoss2 = false;
public static bool downedMechBoss3 = false;
public static bool[] npcsFoundForCheckActive = new bool[580];
private static int spawnRate = NPC.defaultSpawnRate;
private static int maxSpawns = NPC.defaultMaxSpawns;
public int soundDelay;
public int[] immune = new int[256];
public int directionY = 1;
public int type;
public float[] ai = new float[NPC.maxAI];
public float[] localAI = new float[NPC.maxAI];
public int aiAction;
public int aiStyle;
public bool justHit;
public int timeLeft;
public int target = -1;
public int damage;
public int defense;
public int defDamage;
public int defDefense;
public bool coldDamage;
public bool trapImmune;
public LegacySoundStyle HitSound;
public LegacySoundStyle DeathSound;
public int life;
public int lifeMax;
public Microsoft.Xna.Framework.Rectangle targetRect;
public double frameCounter;
public Microsoft.Xna.Framework.Rectangle frame;
public Color color;
public int alpha;
public bool hide;
public float scale = 1f;
public float knockBackResist = 1f;
public int oldDirectionY;
public int oldTarget;
public float rotation;
public bool noGravity;
public bool noTileCollide;
public bool netUpdate;
public bool netUpdate2;
public bool collideX;
public bool collideY;
public bool boss;
public int spriteDirection = -1;
public bool behindTiles;
public bool lavaImmune;
public float value;
public float extraValue;
public bool dontTakeDamage;
public int netID;
public bool townNPC;
public static bool travelNPC = false;
public bool homeless;
public int homeTileX = -1;
public int homeTileY = -1;
public bool oldHomeless;
public int oldHomeTileX = -1;
public int oldHomeTileY = -1;
public bool friendly;
public bool closeDoor;
public int doorX;
public int doorY;
public int friendlyRegen;
public int breath;
public const int breathMax = 200;
public int breathCounter;
public bool reflectingProjectiles;
public int lastPortalColorIndex;
public static int[,] cavernMonsterType = new int[2, 3];
private static int ignorePlayerInteractions = 0;
public bool CanTalk => (this.townNPC || this.type == 453) && this.aiStyle == 7 && (double) this.velocity.Y == 0.0;
public bool HasValidTarget
{
get
{
if (this.HasPlayerTarget && Main.player[this.target].active && !Main.player[this.target].dead && !Main.player[this.target].ghost)
return true;
return this.SupportsNPCTargets && this.HasNPCTarget && Main.npc[this.TranslatedTargetIndex].active;
}
}
public bool HasPlayerTarget => this.target >= 0 && this.target < (int) byte.MaxValue;
public bool HasNPCTarget => this.target >= 300 && this.target < 500;
public bool SupportsNPCTargets => NPCID.Sets.UsesNewTargetting[this.type];
public int TranslatedTargetIndex => this.HasNPCTarget ? this.target - 300 : this.target;
public int WhoAmIToTargettingIndex => this.whoAmI + 300;
public NPCAimedTarget GetTargetData(bool ignorePlayerTankPets = true)
{
if (!this.HasValidTarget)
return new NPCAimedTarget();
return this.SupportsNPCTargets && this.HasNPCTarget ? new NPCAimedTarget(Main.npc[this.TranslatedTargetIndex]) : new NPCAimedTarget(Main.player[this.target], ignorePlayerTankPets);
}
public static int[,,,] InitializeMoonLordAttacks()
{
int[,,,] numArray;
if (NPC.MoonLordAttacksArray != null)
{
numArray = NPC.MoonLordAttacksArray;
for (int index1 = 0; index1 < numArray.GetLength(0); ++index1)
{
for (int index2 = 0; index2 < numArray.GetLength(1); ++index2)
{
for (int index3 = 0; index3 < numArray.GetLength(2); ++index3)
{
for (int index4 = 0; index4 < numArray.GetLength(3); ++index4)
numArray[index1, index2, index3, index4] = 0;
}
}
}
}
else
numArray = new int[3, 3, 2, 5];
numArray[0, 0, 0, 0] = 0;
numArray[0, 0, 1, 0] = 60;
numArray[0, 0, 0, 1] = 1;
numArray[0, 0, 1, 1] = 70;
numArray[0, 0, 0, 2] = 2;
numArray[0, 0, 1, 2] = 330;
numArray[0, 0, 0, 3] = 0;
numArray[0, 0, 1, 3] = 60;
numArray[0, 0, 0, 4] = 3;
numArray[0, 0, 1, 4] = 90;
numArray[0, 1, 0, 0] = 1;
numArray[0, 1, 1, 0] = 70;
numArray[0, 1, 0, 1] = 0;
numArray[0, 1, 1, 1] = 120;
numArray[0, 1, 0, 2] = 3;
numArray[0, 1, 1, 2] = 90;
numArray[0, 1, 0, 3] = 0;
numArray[0, 1, 1, 3] = 120;
numArray[0, 1, 0, 4] = 2;
numArray[0, 1, 1, 4] = 390;
numArray[0, 2, 0, 0] = 3;
numArray[0, 2, 1, 0] = 90;
numArray[0, 2, 0, 1] = 0;
numArray[0, 2, 1, 1] = 120;
numArray[0, 2, 0, 2] = 2;
numArray[0, 2, 1, 2] = 435;
numArray[0, 2, 0, 3] = 0;
numArray[0, 2, 1, 3] = 120;
numArray[0, 2, 0, 4] = 1;
numArray[0, 2, 1, 4] = 375;
numArray[1, 0, 0, 0] = 0;
numArray[1, 0, 1, 0] = 0;
numArray[1, 0, 0, 1] = 0;
numArray[1, 0, 1, 1] = 0;
numArray[1, 0, 0, 2] = 0;
numArray[1, 0, 1, 2] = 0;
numArray[1, 0, 0, 3] = 0;
numArray[1, 0, 1, 3] = 0;
numArray[1, 0, 0, 4] = 0;
numArray[1, 0, 1, 4] = 0;
numArray[1, 1, 0, 0] = 0;
numArray[1, 1, 1, 0] = 0;
numArray[1, 1, 0, 1] = 0;
numArray[1, 1, 1, 1] = 0;
numArray[1, 1, 0, 2] = 0;
numArray[1, 1, 1, 2] = 0;
numArray[1, 1, 0, 3] = 0;
numArray[1, 1, 1, 3] = 0;
numArray[1, 1, 0, 4] = 0;
numArray[1, 1, 1, 4] = 0;
numArray[1, 2, 0, 0] = 0;
numArray[1, 2, 1, 0] = 0;
numArray[1, 2, 0, 1] = 0;
numArray[1, 2, 1, 1] = 0;
numArray[1, 2, 0, 2] = 0;
numArray[1, 2, 1, 2] = 0;
numArray[1, 2, 0, 3] = 0;
numArray[1, 2, 1, 3] = 0;
numArray[1, 2, 0, 4] = 0;
numArray[1, 2, 1, 4] = 0;
numArray[2, 0, 0, 0] = 0;
numArray[2, 0, 1, 0] = 0;
numArray[2, 0, 0, 1] = 0;
numArray[2, 0, 1, 1] = 0;
numArray[2, 0, 0, 2] = 0;
numArray[2, 0, 1, 2] = 0;
numArray[2, 0, 0, 3] = 0;
numArray[2, 0, 1, 3] = 0;
numArray[2, 0, 0, 4] = 0;
numArray[2, 0, 1, 4] = 0;
numArray[2, 1, 0, 0] = 0;
numArray[2, 1, 1, 0] = 0;
numArray[2, 1, 0, 1] = 0;
numArray[2, 1, 1, 1] = 0;
numArray[2, 1, 0, 2] = 0;
numArray[2, 1, 1, 2] = 0;
numArray[2, 1, 0, 3] = 0;
numArray[2, 1, 1, 3] = 0;
numArray[2, 1, 0, 4] = 0;
numArray[2, 1, 1, 4] = 0;
numArray[2, 2, 0, 0] = 0;
numArray[2, 2, 1, 0] = 0;
numArray[2, 2, 0, 1] = 0;
numArray[2, 2, 1, 1] = 0;
numArray[2, 2, 0, 2] = 0;
numArray[2, 2, 1, 2] = 0;
numArray[2, 2, 0, 3] = 0;
numArray[2, 2, 1, 3] = 0;
numArray[2, 2, 0, 4] = 0;
numArray[2, 2, 1, 4] = 0;
NPC.InitializeMoonLordAttacks2();
return numArray;
}
public static int[,] InitializeMoonLordAttacks2()
{
int[,] numArray;
if (NPC.MoonLordAttacksArray2 != null)
{
numArray = NPC.MoonLordAttacksArray2;
for (int index1 = 0; index1 < numArray.GetLength(0); ++index1)
{
for (int index2 = 0; index2 < numArray.GetLength(1); ++index2)
numArray[index1, index2] = 0;
}
}
else
numArray = new int[2, 10];
numArray[0, 0] = 0;
numArray[1, 0] = 90;
numArray[0, 1] = 1;
numArray[1, 1] = 90;
numArray[0, 2] = 0;
numArray[1, 2] = 90;
numArray[0, 3] = 2;
numArray[1, 3] = 135;
numArray[0, 4] = 0;
numArray[1, 4] = 90;
numArray[0, 5] = 3;
numArray[1, 5] = 200;
numArray[0, 6] = 0;
numArray[1, 6] = 90;
numArray[0, 7] = 4;
numArray[1, 7] = 375;
numArray[0, 8] = 0;
numArray[1, 8] = 90;
numArray[0, 9] = 2;
numArray[1, 9] = 135;
return numArray;
}
public string TypeName => Lang.GetNPCNameValue(this.netID);
public string FullName => !this.HasGivenName ? this.TypeName : Language.GetTextValue("Game.NPCTitle", (object) this._givenName, (object) this.TypeName);
public bool HasGivenName => (uint) this._givenName.Length > 0U;
public string GivenOrTypeName => !this.HasGivenName ? this.TypeName : this._givenName;
public string GivenName
{
get => this._givenName;
set => this._givenName = value ?? "";
}
public static bool downedTowers => NPC.downedTowerSolar && NPC.downedTowerVortex && NPC.downedTowerNebula && NPC.downedTowerStardust;
public static int ShieldStrengthTowerMax => !Main.expertMode ? NPC.LunarShieldPowerNormal : NPC.LunarShieldPowerExpert;
public static bool TowersDefeated => NPC.TowerActiveSolar && NPC.TowerActiveVortex && NPC.TowerActiveNebula && NPC.TowerActiveStardust;
public static bool BusyWithAnyInvasionOfSorts() => Main.slimeRainTime != 0.0 || Main.bloodMoon || Main.eclipse || Main.snowMoon || Main.pumpkinMoon || Main.invasionType != 0 || DD2Event.Ongoing;
public float Opacity
{
get => (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
set => this.alpha = (int) MathHelper.Clamp((float) ((1.0 - (double) value) * (double) byte.MaxValue), 0.0f, (float) byte.MaxValue);
}
public static void ClearFoundActiveNPCs()
{
for (int index = 0; index < NPC.npcsFoundForCheckActive.Length; ++index)
NPC.npcsFoundForCheckActive[index] = false;
}
public static void UpdateFoundActiveNPCs()
{
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.active && npc.type >= 0 && npc.type < 580)
NPC.npcsFoundForCheckActive[npc.type] = true;
}
}
public static string getNewNPCName(int npcType)
{
switch (npcType)
{
case 17:
switch (WorldGen.genRand.Next(23))
{
case 0:
return "Alfred";
case 1:
return "Barney";
case 2:
return "Calvin";
case 3:
return "Edmund";
case 4:
return "Edwin";
case 5:
return "Eugene";
case 6:
return "Frank";
case 7:
return "Frederick";
case 8:
return "Gilbert";
case 9:
return "Gus";
case 10:
return "Wilbur";
case 11:
return "Seymour";
case 12:
return "Louis";
case 13:
return "Humphrey";
case 14:
return "Harold";
case 15:
return "Milton";
case 16:
return "Mortimer";
case 17:
return "Howard";
case 18:
return "Walter";
case 19:
return "Finn";
case 20:
return "Isaac";
case 21:
return "Joseph";
default:
return "Ralph";
}
case 18:
switch (WorldGen.genRand.Next(24))
{
case 0:
return "Molly";
case 1:
return "Amy";
case 2:
return "Claire";
case 3:
return "Emily";
case 4:
return "Katie";
case 5:
return "Madeline";
case 6:
return "Katelyn";
case 7:
return "Emma";
case 8:
return "Abigail";
case 9:
return "Carly";
case 10:
return "Jenna";
case 11:
return "Heather";
case 12:
return "Katherine";
case 13:
return "Caitlin";
case 14:
return "Kaitlin";
case 15:
return "Holly";
case 16:
return "Kaitlyn";
case 17:
return "Hannah";
case 18:
return "Kathryn";
case 19:
return "Lorraine";
case 20:
return "Helen";
case 21:
return "Kayla";
case 22:
return "Lisa";
default:
return "Allison";
}
case 19:
switch (WorldGen.genRand.Next(24))
{
case 0:
return "DeShawn";
case 1:
return "DeAndre";
case 2:
return "Marquis";
case 3:
return "Darnell";
case 4:
return "Terrell";
case 5:
return "Malik";
case 6:
return "Trevon";
case 7:
return "Tyrone";
case 8:
return "Willie";
case 9:
return "Dominique";
case 10:
return "Demetrius";
case 11:
return "Reginald";
case 12:
return "Jamal";
case 13:
return "Maurice";
case 14:
return "Jalen";
case 15:
return "Darius";
case 16:
return "Xavier";
case 17:
return "Terrance";
case 18:
return "Andre";
case 19:
return "Dante";
case 20:
return "Brimst";
case 21:
return "Bronson";
case 22:
return "Tony";
default:
return "Darryl";
}
case 20:
switch (WorldGen.genRand.Next(22))
{
case 0:
return "Alalia";
case 1:
return "Alalia";
case 2:
return "Alura";
case 3:
return "Ariella";
case 4:
return "Caelia";
case 5:
return "Calista";
case 6:
return "Chryseis";
case 7:
return "Emerenta";
case 8:
return "Elysia";
case 9:
return "Evvie";
case 10:
return "Faye";
case 11:
return "Felicitae";
case 12:
return "Lunette";
case 13:
return "Nata";
case 14:
return "Nissa";
case 15:
return "Tatiana";
case 16:
return "Rosalva";
case 17:
return "Shea";
case 18:
return "Tania";
case 19:
return "Isis";
case 20:
return "Celestia";
default:
return "Xylia";
}
case 22:
switch (WorldGen.genRand.Next(35))
{
case 0:
return "Joe";
case 1:
return "Connor";
case 2:
return "Tanner";
case 3:
return "Wyatt";
case 4:
return "Cody";
case 5:
return "Levi";
case 6:
return "Luke";
case 7:
return "Jack";
case 8:
return "Scott";
case 9:
return "Logan";
case 10:
return "Cole";
case 11:
return "Asher";
case 12:
return "Bradley";
case 13:
return "Jacob";
case 14:
return "Garrett";
case 15:
return "Dylan";
case 16:
return "Maxwell";
case 17:
return "Steve";
case 18:
return "Brett";
case 19:
return "Andrew";
case 20:
return "Harley";
case 21:
return "Kyle";
case 22:
return "Jake";
case 23:
return "Ryan";
case 24:
return "Jeffrey";
case 25:
return "Seth";
case 26:
return "Marty";
case 27:
return "Brandon";
case 28:
return "Zach";
case 29:
return "Jeff";
case 30:
return "Daniel";
case 31:
return "Trent";
case 32:
return "Kevin";
case 33:
return "Brian";
default:
return "Colin";
}
case 38:
switch (WorldGen.genRand.Next(22))
{
case 0:
return "Dolbere";
case 1:
return "Bazdin";
case 2:
return "Durim";
case 3:
return "Tordak";
case 4:
return "Garval";
case 5:
return "Morthal";
case 6:
return "Oten";
case 7:
return "Dolgen";
case 8:
return "Gimli";
case 9:
return "Gimut";
case 10:
return "Duerthen";
case 11:
return "Beldin";
case 12:
return "Jarut";
case 13:
return "Ovbere";
case 14:
return "Norkas";
case 15:
return "Dolgrim";
case 16:
return "Boften";
case 17:
return "Norsun";
case 18:
return "Dias";
case 19:
return "Fikod";
case 20:
return "Urist";
default:
return "Darur";
}
case 54:
switch (WorldGen.genRand.Next(26))
{
case 0:
return "Sebastian";
case 1:
return "Rupert";
case 2:
return "Clive";
case 3:
return "Nigel";
case 4:
return "Mervyn";
case 5:
return "Cedric";
case 6:
return "Pip";
case 7:
return "Cyril";
case 8:
return "Fitz";
case 9:
return "Lloyd";
case 10:
return "Arthur";
case 11:
return "Rodney";
case 12:
return "Graham";
case 13:
return "Edward";
case 14:
return "Alfred";
case 15:
return "Edmund";
case 16:
return "Henry";
case 17:
return "Herald";
case 18:
return "Roland";
case 19:
return "Lincoln";
case 20:
return "Lloyd";
case 21:
return "Edgar";
case 22:
return "Eustace";
case 23:
return "Benjamin";
case 24:
return "James";
default:
return "Rodrick";
}
case 107:
switch (WorldGen.genRand.Next(25))
{
case 0:
return "Grodax";
case 1:
return "Sarx";
case 2:
return "Xon";
case 3:
return "Mrunok";
case 4:
return "Nuxatk";
case 5:
return "Tgerd";
case 6:
return "Darz";
case 7:
return "Smador";
case 8:
return "Stazen";
case 9:
return "Mobart";
case 10:
return "Knogs";
case 11:
return "Tkanus";
case 12:
return "Negurk";
case 13:
return "Nort";
case 14:
return "Durnok";
case 15:
return "Trogem";
case 16:
return "Stezom";
case 17:
return "Gnudar";
case 18:
return "Ragz";
case 19:
return "Fahd";
case 20:
return "Xanos";
case 21:
return "Arback";
case 22:
return "Fjell";
case 23:
return "Dalek";
default:
return "Knub";
}
case 108:
switch (WorldGen.genRand.Next(22))
{
case 0:
return "Dalamar";
case 1:
return "Dulais";
case 2:
return "Elric";
case 3:
return "Arddun";
case 4:
return "Maelor";
case 5:
return "Leomund";
case 6:
return "Hirael";
case 7:
return "Gwentor";
case 8:
return "Greum";
case 9:
return "Gearroid";
case 10:
return "Fizban";
case 11:
return "Ningauble";
case 12:
return "Seonag";
case 13:
return "Sargon";
case 14:
return "Merlyn";
case 15:
return "Magius";
case 16:
return "Berwyn";
case 17:
return "Arwyn";
case 18:
return "Alasdair";
case 19:
return "Tagar";
case 20:
return "Abram";
default:
return "Xanadu";
}
case 124:
switch (WorldGen.genRand.Next(24))
{
case 0:
return "Shayna";
case 1:
return "Korrie";
case 2:
return "Ginger";
case 3:
return "Brooke";
case 4:
return "Jenny";
case 5:
return "Autumn";
case 6:
return "Nancy";
case 7:
return "Ella";
case 8:
return "Kayla";
case 9:
return "Selah";
case 10:
return "Sophia";
case 11:
return "Marshanna";
case 12:
return "Lauren";
case 13:
return "Trisha";
case 14:
return "Shirlena";
case 15:
return "Sheena";
case 16:
return "Ellen";
case 17:
return "Amy";
case 18:
return "Dawn";
case 19:
return "Susana";
case 20:
return "Meredith";
case 21:
return "Selene";
case 22:
return "Terra";
default:
return "Sally";
}
case 160:
switch (WorldGen.genRand.Next(12))
{
case 0:
return "Reishi";
case 1:
return "Maitake";
case 2:
return "Chanterelle";
case 3:
return "Porcini";
case 4:
return "Shimeji";
case 5:
return "Amanita";
case 6:
return "Muscaria";
case 7:
return "Agaric";
case 8:
return "Cremini";
case 9:
return "Morel";
case 10:
return "Enoki";
default:
return "Shiitake";
}
case 178:
switch (WorldGen.genRand.Next(20))
{
case 0:
return "Whitney";
case 1:
return "Verity";
case 2:
return "Ada";
case 3:
return "Cornelia";
case 4:
return "Lydia";
case 5:
return "Leila";
case 6:
return "Minerva";
case 7:
return "Emeline";
case 8:
return "Cynthia";
case 9:
return "Fidelia";
case 10:
return "Lilly";
case 11:
return "Phoebe";
case 12:
return "Zylphia";
case 13:
return "Zelda";
case 14:
return "Selina";
case 15:
return "Hope";
case 16:
return "Isabella";
case 17:
return "Judith";
case 18:
return "Savannah";
default:
return "Vivian";
}
case 207:
switch (WorldGen.genRand.Next(16))
{
case 0:
return "Abdosir";
case 1:
return "Akbar";
case 2:
return "Bodashtart";
case 3:
return "Danel";
case 4:
return "Hanno";
case 5:
return "Hiram";
case 6:
return "Kanmi";
case 7:
return "Philosir";
case 8:
return "Tabnit";
case 9:
return "Yutpan";
case 10:
return "Ahirom";
case 11:
return "Batnoam";
case 12:
return "Sikarbaal";
case 13:
return "Hannibal";
case 14:
return "Yehomilk";
default:
return "Ahinadab";
}
case 208:
switch (WorldGen.genRand.Next(17))
{
case 0:
return "Candy";
case 1:
return "Isis";
case 2:
return "Trixy";
case 3:
return "Destiny";
case 4:
return "Lexus";
case 5:
return "Bambi";
case 6:
return "Bailey";
case 7:
return "Glitter";
case 8:
return "Sparkle";
case 9:
return "Paris";
case 10:
return "Dazzle";
case 11:
return "Fantasy";
case 12:
return "Bunny";
case 13:
return "Sugar";
case 14:
return "Fantasia";
case 15:
return "Star";
default:
return "Cherry";
}
case 209:
switch (WorldGen.genRand.Next(23))
{
case 0:
return "Alpha";
case 1:
return "Beta";
case 2:
return "Delta";
case 3:
return "Omega";
case 4:
return "Gamma";
case 5:
return "Theta";
case 6:
return "Kappa";
case 7:
return "Omicron";
case 8:
return "Sigma";
case 9:
return "Upsilon";
case 10:
return "Phi";
case 11:
return "Zeta";
case 12:
return "Lambda";
case 13:
return "Nu";
case 14:
return "Ci";
case 15:
return "Rho";
case 16:
return "Phi";
case 17:
return "Fender";
case 18:
return "T-3E0";
case 19:
return "Niner-7";
case 20:
return "A.N.D.Y";
case 21:
return "Syn-X";
default:
return "Mu";
}
case 227:
switch (WorldGen.genRand.Next(18))
{
case 0:
return "Marco";
case 1:
return "Guido";
case 2:
return "Enzo";
case 3:
return "Martino";
case 4:
return "Mauro";
case 5:
return "Lorenzo";
case 6:
return "Ludo";
case 7:
return "Luciano";
case 8:
return "Carlo";
case 9:
return "Bruno";
case 10:
return "Mario";
case 11:
return "Leonardo";
case 12:
return "Raphael";
case 13:
return "Luigi";
case 14:
return "Luca";
case 15:
return "Darren";
case 16:
return "Esreadel";
default:
return "Stefano";
}
case 228:
switch (WorldGen.genRand.Next(10))
{
case 0:
return "Abibe";
case 1:
return "Jamundi";
case 2:
return "U'wa";
case 3:
return "Tairona";
case 4:
return "Xirigua";
case 5:
return "Zop'a";
case 6:
return "Opuni";
case 7:
return "Kogi-ghi";
case 8:
return "Konah";
default:
return "Gboto";
}
case 229:
switch (WorldGen.genRand.Next(11))
{
case 0:
return "David";
case 1:
return "Red Beard";
case 2:
return "Jack";
case 3:
return "Black Beard";
case 4:
return "Captain Morgan";
case 5:
return "Wet Beard";
case 6:
return "James T. Beard";
case 7:
return "Gunpowder Garry";
case 8:
return "Captain Stoney Dirt";
case 9:
return "Jake";
default:
return "Captain Bullywort";
}
case 353:
switch (WorldGen.genRand.Next(20))
{
case 0:
return "Bri";
case 1:
return "Brianne";
case 2:
return "Flora";
case 3:
return "Iris";
case 4:
return "Scarlett";
case 5:
return "Lola";
case 6:
return "Hazel";
case 7:
return "Stella";
case 8:
return "Pearl";
case 9:
return "Tallulah";
case 10:
return "Ruby";
case 11:
return "Esmeralda";
case 12:
return "Kylie";
case 13:
return "Kati";
case 14:
return "Biah";
case 15:
return "Meliyah";
case 16:
return "Petra";
case 17:
return "Rox";
case 18:
return "Roxanne";
default:
return "Annabel";
}
case 368:
switch (WorldGen.genRand.Next(13))
{
case 0:
return "Abraham";
case 1:
return "Bohemas";
case 2:
return "Eladon";
case 3:
return "Aphraim";
case 4:
return "Gallius";
case 5:
return "Llewellyn";
case 6:
return "Riley";
case 7:
return "Rawleigh";
case 8:
return "Shipton";
case 9:
return "Romeo";
case 10:
return "Aedan";
case 11:
return "Mercer";
default:
return "Willy";
}
case 369:
switch (WorldGen.genRand.Next(22))
{
case 0:
return "Bobby";
case 1:
return "Sammy";
case 2:
return "Jimmy";
case 3:
return "Danny";
case 4:
return "Timmy";
case 5:
return "Simon";
case 6:
return "Johnny";
case 7:
return "Billy";
case 8:
return "Matty";
case 9:
return "Bart";
case 10:
return "Phillip";
case 11:
return "Spencer";
case 12:
return "Nathan";
case 13:
return "Grayson";
case 14:
return "Bryce";
case 15:
return "Miles";
case 16:
return "Charles";
case 17:
return "Adam";
case 18:
return "Tyler";
case 19:
return "Jey";
case 20:
return "Ivan";
default:
return "Izzy";
}
case 441:
switch (WorldGen.genRand.Next(20))
{
case 0:
return "McKinly";
case 1:
return "Millard";
case 2:
return "Fillmore";
case 3:
return "Rutherford";
case 4:
return "Chester";
case 5:
return "Grover";
case 6:
return "Cleveland";
case 7:
return "Theodore";
case 8:
return "Herbert";
case 9:
return "Warren";
case 10:
return "Lyndon";
case 11:
return "Ronald";
case 12:
return "Harrison";
case 13:
return "Woodrow";
case 14:
return "Tweed";
case 15:
return "Blanton";
case 16:
return "Dwyer";
case 17:
return "Carroll";
default:
return "Agnew";
}
case 453:
switch (WorldGen.genRand.Next(10))
{
case 0:
return "Skellington";
case 1:
return "Bones McGee";
case 2:
return "Gloomy Mays";
case 3:
return "Jack Sellington";
case 4:
return "Billy Marrows";
case 5:
return "Tom";
case 6:
return "Rattles Magoo";
case 7:
return "Mandible Calavera";
case 8:
return "Mika";
default:
return "No-Eyed Wiley";
}
case 550:
return Language.RandomFromCategory("BartenderNames", WorldGen.genRand).Value;
default:
return "";
}
}
public NetworkText GetTypeNetName() => NetworkText.FromKey(Lang.GetNPCName(this.netID).Key);
public NetworkText GetFullNetName()
{
if (!this.HasGivenName)
return this.GetTypeNetName();
return NetworkText.FromKey("Game.NPCTitle", (object) this.GetGivenNetName(), (object) this.GetTypeNetName());
}
public NetworkText GetGivenOrTypeNetName() => !this.HasGivenName ? this.GetTypeNetName() : this.GetGivenNetName();
public NetworkText GetGivenNetName() => NetworkText.FromLiteral(this._givenName);
public static void setNPCName(string newName, int npcType, bool resetExtras = false)
{
bool flag = false;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == npcType)
{
if (flag)
{
Main.npc[index].GivenName = NPC.getNewNPCName(npcType);
}
else
{
Main.npc[index].GivenName = newName;
if (!resetExtras)
break;
flag = true;
}
}
}
}
public static string firstNPCName(int npcType)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == npcType)
return Main.npc[index].GivenOrTypeName;
}
return NPC.getNewNPCName(npcType);
}
public static string GetFirstNPCNameOrNull(int npcType)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == npcType)
return Main.npc[index].GivenOrTypeName;
}
return (string) null;
}
public static bool MechSpawn(float x, float y, int type)
{
int num1 = 0;
int num2 = 0;
int num3 = 0;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == type)
{
++num1;
Vector2 vector2 = new Vector2(x, y);
double num4 = (double) Main.npc[index].position.X - (double) vector2.X;
float num5 = Main.npc[index].position.Y - vector2.Y;
double num6 = Math.Sqrt(num4 * num4 + (double) num5 * (double) num5);
if (num6 < 200.0)
++num2;
if (num6 < 600.0)
++num3;
}
}
return num2 < 3 && num3 < 6 && num1 < 10;
}
public static int TypeToHeadIndex(int type)
{
switch (type)
{
case 17:
return 2;
case 18:
return 3;
case 19:
return 6;
case 20:
return 5;
case 22:
return 1;
case 38:
return 4;
case 54:
return 7;
case 107:
return 9;
case 108:
return 10;
case 124:
return 8;
case 142:
return 11;
case 160:
return 12;
case 178:
return 13;
case 207:
return 14;
case 208:
return 15;
case 209:
return 16;
case 227:
return 17;
case 228:
return 18;
case 229:
return 19;
case 353:
return 20;
case 368:
return 21;
case 369:
return 22;
case 441:
return 23;
case 550:
return 24;
default:
return -1;
}
}
public static int HeadIndexToType(int type)
{
switch (type)
{
case 1:
return 22;
case 2:
return 17;
case 3:
return 18;
case 4:
return 38;
case 5:
return 20;
case 6:
return 19;
case 7:
return 54;
case 8:
return 124;
case 9:
return 107;
case 10:
return 108;
case 11:
return 142;
case 12:
return 160;
case 13:
return 178;
case 14:
return 207;
case 15:
return 208;
case 16:
return 209;
case 17:
return 227;
case 18:
return 228;
case 19:
return 229;
case 20:
return 353;
case 21:
return 368;
case 22:
return 369;
case 23:
return 441;
case 24:
return 550;
default:
return -1;
}
}
public int GetBossHeadTextureIndex()
{
int num = NPCID.Sets.BossHeadTextures[this.type];
switch (this.type)
{
case 4:
if ((double) this.ai[0] >= 2.0)
{
num = 1;
break;
}
break;
case 125:
if ((double) this.ai[0] >= 3.0)
{
num = 20;
break;
}
break;
case 126:
if ((double) this.ai[0] >= 3.0)
{
num = 21;
break;
}
break;
case 262:
if (this.life <= this.lifeMax / 2)
{
num = 12;
break;
}
break;
case 439:
if ((double) this.ai[0] == 5.0 && this.alpha == (int) byte.MaxValue)
{
num = -1;
break;
}
break;
case 440:
if ((double) this.ai[0] != 5.0 || this.alpha == (int) byte.MaxValue)
{
num = -1;
break;
}
break;
}
return num;
}
public float GetBossHeadRotation()
{
float num = 0.0f;
switch (this.type)
{
case 35:
case (int) sbyte.MaxValue:
if ((double) this.ai[1] == 1.0 || (double) this.ai[1] == 2.0)
{
num = this.rotation;
break;
}
break;
case 68:
case 262:
num = this.rotation;
break;
case 345:
if ((double) this.ai[0] == 2.0)
{
num = this.rotation;
break;
}
break;
}
return num;
}
public SpriteEffects GetBossHeadSpriteEffects()
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (this.type == 491 && this.spriteDirection == 1)
spriteEffects = SpriteEffects.FlipHorizontally;
return spriteEffects;
}
public int BannerID() => this.netID >= -10 ? this.netID : this.type;
private void SetDefaultsFromNetId(int id)
{
bool flag = false;
int Type = NPCID.FromNetId(id);
this.SetDefaults(0);
switch (id)
{
case -65:
this.SetDefaults(Type, 1.21f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -64:
this.SetDefaults(Type, 0.87f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -63:
this.SetDefaults(Type, 1.16f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -62:
this.SetDefaults(Type, 0.78f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -61:
this.SetDefaults(Type, 1.1f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -60:
this.SetDefaults(Type, 0.92f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -59:
this.SetDefaults(Type, 1.15f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -58:
this.SetDefaults(Type, 0.8f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -57:
this.SetDefaults(Type, 1.25f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -56:
this.SetDefaults(Type, 0.85f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -55:
this.SetDefaults(Type, 1.1f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -54:
this.SetDefaults(Type, 0.9f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -53:
this.SetDefaults(Type, 1.15f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -52:
this.SetDefaults(Type, 0.85f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -51:
this.SetDefaults(Type, 1.13f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -50:
this.SetDefaults(Type, 0.87f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -49:
this.SetDefaults(Type, 1.07f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -48:
this.SetDefaults(Type, 0.93f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -47:
this.SetDefaults(Type, 1.1f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -46:
this.SetDefaults(Type, 0.9f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -45:
this.SetDefaults(Type, 1.05f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -44:
this.SetDefaults(Type, 0.87f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -43:
this.SetDefaults(Type, 1.15f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -42:
this.SetDefaults(Type, 1.1f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -41:
this.SetDefaults(Type, 0.85f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -40:
this.SetDefaults(Type, 0.9f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -39:
this.SetDefaults(Type, 1.1f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -38:
this.SetDefaults(Type, 1.15f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -37:
this.SetDefaults(Type, 1.08f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -36:
this.SetDefaults(Type, 0.92f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -35:
this.SetDefaults(Type, 1.13f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -34:
this.SetDefaults(Type, 0.87f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -33:
this.SetDefaults(Type, 1.11f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -32:
this.SetDefaults(Type, 0.89f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -31:
this.SetDefaults(Type, 1.13f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -30:
this.SetDefaults(Type, 0.93f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -29:
this.SetDefaults(Type, 1.15f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -28:
this.SetDefaults(Type, 0.85f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -27:
this.SetDefaults(Type, 1.1f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -26:
this.SetDefaults(Type, 0.9f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -25:
this.SetDefaults(Type, 1.15f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -24:
this.SetDefaults(Type, 0.85f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -23:
this.SetDefaults(Type, 1.15f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -22:
this.SetDefaults(Type, 0.85f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -21:
this.SetDefaults(Type, 1.2f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -20:
this.SetDefaults(Type, 1.1f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -19:
this.SetDefaults(Type, 0.9f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -18:
this.SetDefaults(Type, 0.8f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -17:
this.SetDefaults(Type, 1.2f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -16:
this.SetDefaults(Type, 0.85f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -15:
this.SetDefaults(Type, 1.15f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale * 1.1);
this.life = 400;
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots = 2f;
this.knockBackResist *= 2f - this.scale;
this.height = 44;
break;
case -14:
this.SetDefaults(Type, 1.15f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale * 1.1);
this.life = (int) ((double) this.life * (double) this.scale * 1.1);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots = 2f;
this.knockBackResist *= 2f - this.scale;
break;
case -13:
this.SetDefaults(Type, 0.9f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
break;
case -12:
this.SetDefaults(Type, 1.15f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -11:
this.SetDefaults(Type, 0.85f);
this.defense = (int) ((double) this.defense * (double) this.scale);
this.damage = (int) ((double) this.damage * (double) this.scale);
this.life = (int) ((double) this.life * (double) this.scale);
this.value = (float) (int) ((double) this.value * (double) this.scale);
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
break;
case -10:
this.SetDefaults(Type, 1.1f);
this.damage = 18;
this.defense = 6;
this.life = 60;
this.color = new Color(143, 215, 93, 100);
this.value = 500f;
flag = true;
break;
case -9:
this.SetDefaults(Type, 1.2f);
this.damage = 15;
this.defense = 7;
this.life = 45;
this.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, 0, 100);
this.value = 10f;
flag = true;
break;
case -8:
this.SetDefaults(Type, 1.025f);
this.damage = 12;
this.defense = 4;
this.life = 35;
this.color = new Color((int) byte.MaxValue, 30, 0, 100);
this.value = 8f;
flag = true;
break;
case -7:
this.SetDefaults(Type, 1.2f);
this.damage = 12;
this.defense = 6;
this.life = 40;
this.knockBackResist *= 0.9f;
this.color = new Color(200, 0, (int) byte.MaxValue, 150);
this.value = 10f;
flag = true;
break;
case -6:
this.SetDefaults(Type, 1.05f);
this.damage = 15;
this.defense = 4;
this.life = 45;
this.color = new Color(0, 0, 0, 50);
this.value = 20f;
flag = true;
break;
case -5:
this.SetDefaults(Type, 0.9f);
this.damage = 13;
this.defense = 4;
this.life = 30;
this.knockBackResist *= 0.95f;
this.alpha = 120;
this.color = new Color(0, 0, 0, 50);
this.value = 10f;
flag = true;
break;
case -4:
this.SetDefaults(Type, 0.6f);
this.damage = 5;
this.defense = 5;
this.life = 150;
this.knockBackResist *= 1.4f;
this.color = new Color(250, 30, 90, 90);
this.value = 10000f;
flag = true;
this.rarity = 1;
break;
case -3:
this.SetDefaults(Type, 0.9f);
this.damage = 6;
this.defense = 0;
this.life = 14;
this.knockBackResist *= 1.2f;
this.color = new Color(0, 220, 40, 100);
this.value = 3f;
flag = true;
break;
case -2:
this.SetDefaults(Type, 0.9f);
this.damage = 45;
this.defense = 20;
this.life = 90;
this.knockBackResist *= 1.2f;
this.value = 100f;
flag = true;
break;
case -1:
this.SetDefaults(Type, 0.6f);
this.damage = 45;
this.defense = 10;
this.life = 90;
this.knockBackResist *= 1.2f;
this.value = 100f;
flag = true;
break;
default:
return;
}
this.netID = id;
this.lifeMax = this.life;
this.defDamage = this.damage;
this.defDefense = this.defense;
if (!(Main.expertMode & flag))
return;
this.scaleStats();
}
public void SetDefaultsKeepPlayerInteraction(int Type)
{
bool[] flagArray = new bool[this.playerInteraction.Length];
for (int index = 0; index < this.playerInteraction.Length; ++index)
flagArray[index] = this.playerInteraction[index];
this.SetDefaults(Type);
for (int index = 0; index < this.playerInteraction.Length; ++index)
this.playerInteraction[index] = flagArray[index];
}
public void SetDefaults(int Type, float scaleOverride = -1f)
{
if (Type < 0)
{
this.SetDefaultsFromNetId(Type);
}
else
{
this.waterMovementSpeed = this.lavaMovementSpeed = 0.5f;
this.honeyMovementSpeed = 0.25f;
this.altTexture = 0;
this.nameOver = 0.0f;
this.takenDamageMultiplier = 1f;
this.extraValue = 0.0f;
for (int index = 0; index < this.playerInteraction.Length; ++index)
this.playerInteraction[index] = false;
this.rarity = 0;
this.dontCountMe = false;
this.releaseOwner = (short) byte.MaxValue;
this.catchItem = (short) 0;
this.npcNameLookup = (byte) 0;
this.netStream = (byte) 32;
bool flag = false;
this.netID = 0;
this.netAlways = false;
this.netSpam = 0;
this.SpawnedFromStatue = false;
int newSize = 10;
if (Type >= 0)
newSize = NPCID.Sets.TrailCacheLength[Type];
if (newSize != this.oldPos.Length)
{
Array.Resize<Vector2>(ref this.oldPos, newSize);
Array.Resize<float>(ref this.oldRot, newSize);
}
for (int index = 0; index < this.oldPos.Length; ++index)
{
this.oldRot[index] = 0.0f;
this.oldPos[index].X = 0.0f;
this.oldPos[index].Y = 0.0f;
}
for (int index = 0; index < 5; ++index)
{
this.buffTime[index] = 0;
this.buffType[index] = 0;
}
for (int index = 0; index < 206; ++index)
this.buffImmune[index] = false;
this.setFrameSize = false;
this.buffImmune[31] = true;
this.netSkip = -2;
this.realLife = -1;
this.lifeRegen = 0;
this.lifeRegenExpectedLossPerSecond = -1;
this.lifeRegenCount = 0;
this.poisoned = false;
this.soulDrain = false;
this.venom = false;
this.shadowFlame = false;
this.onFire = false;
this.midas = false;
this.ichor = false;
this.onFrostBurn = false;
this.confused = false;
this.loveStruck = false;
this.dontTakeDamageFromHostiles = false;
this.stinky = false;
this.dryadWard = false;
this.onFire2 = false;
this.justHit = false;
this.dontTakeDamage = false;
this.npcSlots = 1f;
this.lavaImmune = false;
this.lavaWet = false;
this.wetCount = (byte) 0;
this.wet = false;
this.townNPC = false;
this.homeless = false;
this.homeTileX = -1;
this.homeTileY = -1;
this.friendly = false;
this.behindTiles = false;
this.boss = false;
this.noTileCollide = false;
this.rotation = 0.0f;
this.active = true;
this.alpha = 0;
this.color = new Color();
this.collideX = false;
this.collideY = false;
this.direction = 0;
this.oldDirection = this.direction;
this.frameCounter = 0.0;
this.netUpdate = true;
this.netUpdate2 = false;
this.knockBackResist = 1f;
this.GivenName = "";
this.noGravity = false;
this.scale = 1f;
this.HitSound = (LegacySoundStyle) null;
this.DeathSound = (LegacySoundStyle) null;
this.spriteDirection = -1;
this.target = (int) byte.MaxValue;
this.oldTarget = this.target;
this.targetRect = new Microsoft.Xna.Framework.Rectangle();
this.timeLeft = NPC.activeTime;
this.type = Type;
this.value = 0.0f;
this.coldDamage = false;
this.trapImmune = false;
this.hide = false;
this.immortal = false;
this.chaseable = true;
this.breath = 200;
this.breathCounter = 0;
this.reflectingProjectiles = false;
this.canGhostHeal = true;
this.javelined = false;
this.daybreak = false;
this.celled = false;
this.dryadBane = false;
this.betsysCurse = false;
this.oiled = false;
for (int index = 0; index < NPC.maxAI; ++index)
this.ai[index] = 0.0f;
for (int index = 0; index < NPC.maxAI; ++index)
this.localAI[index] = 0.0f;
if (this.type == 1)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 7;
this.defense = 2;
this.lifeMax = 25;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 175;
this.color = new Color(0, 80, (int) byte.MaxValue, 100);
this.value = 25f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 2)
{
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 18;
this.defense = 2;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 75f;
this.buffImmune[31] = false;
}
else if (this.type == 3)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 14;
this.defense = 6;
this.lifeMax = 45;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 60f;
this.buffImmune[31] = false;
}
else if (this.type == 430)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 14;
this.defense = 6;
this.lifeMax = 45;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 60f;
this.buffImmune[31] = false;
}
else if (this.type == 431)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 16;
this.defense = 8;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.45f;
this.value = 80f;
this.buffImmune[31] = false;
}
else if (this.type == 432)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 16;
this.defense = 8;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.45f;
this.value = 65f;
this.buffImmune[31] = false;
}
else if (this.type == 433)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 13;
this.defense = 6;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.55f;
this.value = 55f;
this.buffImmune[31] = false;
}
else if (this.type == 434)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 13;
this.defense = 8;
this.lifeMax = 45;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.45f;
this.value = 80f;
this.buffImmune[31] = false;
}
else if (this.type == 435)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 16;
this.defense = 4;
this.lifeMax = 45;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.55f;
this.value = 70f;
this.buffImmune[31] = false;
}
else if (this.type == 436)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 12;
this.defense = 4;
this.lifeMax = 38;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.6f;
this.value = 65f;
this.buffImmune[31] = false;
}
else if (this.type == 4)
{
this.width = 100;
this.height = 110;
this.aiStyle = 4;
this.damage = 15;
this.defense = 12;
this.lifeMax = 2800;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.timeLeft = NPC.activeTime * 30;
this.boss = true;
this.value = 30000f;
this.npcSlots = 5f;
}
else if (this.type == 5)
{
this.width = 20;
this.height = 20;
this.aiStyle = 5;
this.damage = 12;
this.defense = 0;
this.lifeMax = 8;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
}
else if (this.type == 6)
{
this.npcSlots = 1f;
this.width = 30;
this.height = 30;
this.aiStyle = 5;
this.damage = 22;
this.defense = 8;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.knockBackResist = 0.5f;
this.value = 90f;
}
else if (this.type == 7)
{
this.npcSlots = 3.5f;
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.damage = 31;
this.defense = 2;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 140f;
this.netAlways = true;
}
else if (this.type == 8)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 16;
this.defense = 6;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 140f;
this.dontCountMe = true;
}
else if (this.type == 9)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 13;
this.defense = 10;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 140f;
this.dontCountMe = true;
}
else if (this.type == 10)
{
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 8;
this.defense = 0;
this.lifeMax = 30;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 40f;
}
else if (this.type == 11)
{
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 4;
this.defense = 4;
this.lifeMax = 30;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 40f;
this.dontCountMe = true;
}
else if (this.type == 12)
{
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 4;
this.defense = 6;
this.lifeMax = 30;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 40f;
this.dontCountMe = true;
}
else if (this.type == 13)
{
this.npcSlots = 5f;
this.width = 38;
this.height = 38;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 22;
this.defense = 2;
this.lifeMax = 65;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 300f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 14)
{
this.width = 38;
this.height = 38;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 13;
this.defense = 4;
this.lifeMax = 150;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 300f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.dontCountMe = true;
}
else if (this.type == 15)
{
this.width = 38;
this.height = 38;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 11;
this.defense = 8;
this.lifeMax = 220;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 300f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.dontCountMe = true;
}
else if (this.type == 16)
{
this.npcSlots = 2f;
this.width = 36;
this.height = 24;
this.aiStyle = 1;
this.damage = 20;
this.defense = 7;
this.lifeMax = 90;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 120;
this.color = new Color(0, 0, 0, 50);
this.value = 75f;
this.scale = 1.25f;
this.knockBackResist = 0.6f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 17)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 18)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 19)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 20)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 21)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 8;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 100f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 22)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 23)
{
this.width = 22;
this.height = 22;
this.aiStyle = 5;
this.damage = 40;
this.defense = 6;
this.lifeMax = 26;
this.HitSound = SoundID.NPCHit3;
this.DeathSound = SoundID.NPCDeath3;
this.noGravity = true;
this.noTileCollide = true;
this.value = 80f;
this.knockBackResist = 0.4f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 24)
{
this.npcSlots = 3f;
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 30;
this.defense = 16;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.lavaImmune = true;
this.value = 350f;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 25)
{
this.width = 16;
this.height = 16;
this.aiStyle = 9;
this.damage = 30;
this.defense = 0;
this.lifeMax = 1;
this.HitSound = SoundID.NPCHit3;
this.DeathSound = SoundID.NPCDeath3;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.alpha = 100;
}
else if (this.type == 31)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 26;
this.defense = 8;
this.lifeMax = 80;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.8f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 32)
{
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 20;
this.defense = 2;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.6f;
this.value = 140f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else if (this.type == 33)
{
this.width = 16;
this.height = 16;
this.aiStyle = 9;
this.damage = 20;
this.defense = 0;
this.lifeMax = 1;
this.HitSound = SoundID.NPCHit3;
this.DeathSound = SoundID.NPCDeath3;
this.noGravity = true;
this.noTileCollide = true;
this.alpha = (int) byte.MaxValue;
this.knockBackResist = 0.0f;
}
else if (this.type == 34)
{
this.width = 26;
this.height = 28;
this.aiStyle = 10;
this.damage = 35;
this.defense = 6;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.noGravity = true;
this.noTileCollide = true;
this.value = 150f;
this.knockBackResist = 0.2f;
this.npcSlots = 0.75f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 35)
{
this.width = 80;
this.height = 102;
this.aiStyle = 11;
this.damage = 32;
this.defense = 10;
this.lifeMax = 4400;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.noGravity = true;
this.noTileCollide = true;
this.value = 50000f;
this.knockBackResist = 0.0f;
this.boss = true;
this.npcSlots = 6f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[189] = this.buffImmune[169] = this.buffImmune[183] = true;
}
else if (this.type == 36)
{
this.width = 52;
this.height = 52;
this.aiStyle = 12;
this.damage = 20;
this.defense = 14;
this.lifeMax = 600;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 37)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 38)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 39)
{
this.npcSlots = 6f;
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 30;
this.defense = 10;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath5;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 1200f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 40)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 15;
this.defense = 12;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath5;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 1200f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.dontCountMe = true;
}
else if (this.type == 41)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 10;
this.defense = 18;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath5;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 1200f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.dontCountMe = true;
}
else if (this.type == 42)
{
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 26;
this.defense = 12;
this.lifeMax = 48;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.5f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else if (this.type == 43)
{
this.noGravity = true;
this.noTileCollide = true;
this.width = 30;
this.height = 30;
this.aiStyle = 13;
this.damage = 34;
this.defense = 10;
this.lifeMax = 110;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.0f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 350f;
this.buffImmune[20] = true;
}
else if (this.type == 44)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 22;
this.defense = 9;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 250f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 45)
{
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 20;
this.defense = 4;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.6f;
this.value = 5000f;
this.buffImmune[20] = true;
this.rarity = 4;
}
else if (this.type == 46 || this.type == 303 || this.type == 337 || this.type == 540)
{
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2019;
}
else if (this.type == 47)
{
this.width = 18;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 4;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 500f;
this.buffImmune[31] = false;
}
else if (this.type == 48)
{
this.width = 24;
this.height = 34;
this.aiStyle = 14;
this.damage = 25;
this.defense = 8;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.6f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 300f;
}
else if (this.type == 49)
{
this.npcSlots = 0.5f;
this.width = 22;
this.height = 18;
this.aiStyle = 14;
this.damage = 13;
this.defense = 2;
this.lifeMax = 16;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath4;
this.value = 90f;
this.buffImmune[31] = false;
}
else if (this.type == 50)
{
this.boss = true;
this.width = 98;
this.height = 92;
this.aiStyle = 15;
this.damage = 40;
this.defense = 10;
this.lifeMax = 2000;
this.knockBackResist = 0.0f;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 30;
this.value = 10000f;
this.scale = 1.25f;
this.buffImmune[20] = true;
this.timeLeft = NPC.activeTime * 30;
}
else if (this.type == 51)
{
this.npcSlots = 0.5f;
this.width = 22;
this.height = 18;
this.aiStyle = 14;
this.damage = 20;
this.defense = 4;
this.lifeMax = 34;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath4;
this.value = 80f;
this.buffImmune[31] = false;
}
else if (this.type == 52)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 1000f;
this.buffImmune[31] = false;
this.rarity = 2;
}
else if (this.type == 53)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 14;
this.defense = 8;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 1000f;
this.buffImmune[31] = false;
this.rarity = 2;
}
else if (this.type == 54)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 55)
{
this.noGravity = true;
this.width = 20;
this.height = 18;
this.aiStyle = 16;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.catchItem = (short) 261;
}
else if (this.type == 56)
{
this.noTileCollide = true;
this.noGravity = true;
this.width = 30;
this.height = 30;
this.aiStyle = 13;
this.damage = 25;
this.defense = 10;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.0f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 90f;
this.buffImmune[20] = true;
}
else if (this.type == 57)
{
this.noGravity = true;
this.width = 18;
this.height = 20;
this.aiStyle = 16;
this.damage = 30;
this.defense = 6;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 500f;
}
else if (this.type == 58)
{
this.npcSlots = 0.5f;
this.noGravity = true;
this.width = 18;
this.height = 20;
this.aiStyle = 16;
this.damage = 25;
this.defense = 2;
this.lifeMax = 30;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 50f;
}
else if (this.type == 59)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 15;
this.defense = 10;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.scale = 1.1f;
this.alpha = 50;
this.lavaImmune = true;
this.value = 120f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else if (this.type == 60)
{
this.npcSlots = 0.5f;
this.width = 22;
this.height = 18;
this.aiStyle = 14;
this.damage = 35;
this.defense = 8;
this.lifeMax = 46;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath4;
this.value = 120f;
this.scale = 1.1f;
this.lavaImmune = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else if (this.type == 61)
{
this.width = 36;
this.height = 36;
this.aiStyle = 17;
this.damage = 15;
this.defense = 4;
this.lifeMax = 40;
this.knockBackResist = 0.8f;
this.HitSound = SoundID.NPCHit28;
this.DeathSound = SoundID.NPCDeath31;
this.value = 60f;
}
else if (this.type == 62)
{
this.npcSlots = 2f;
this.width = 28;
this.height = 48;
this.aiStyle = 14;
this.damage = 32;
this.defense = 8;
this.lifeMax = 120;
this.HitSound = SoundID.NPCHit21;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath24;
this.value = 300f;
this.lavaImmune = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 63)
{
this.noGravity = true;
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 25;
this.defense = 4;
this.lifeMax = 34;
this.HitSound = SoundID.NPCHit25;
this.DeathSound = SoundID.NPCDeath28;
this.value = 100f;
this.alpha = 20;
}
else if (this.type == 64)
{
this.noGravity = true;
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 30;
this.defense = 6;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit25;
this.DeathSound = SoundID.NPCDeath28;
this.value = 100f;
this.alpha = 20;
}
else if (this.type == 65)
{
this.noGravity = true;
this.width = 100;
this.height = 24;
this.aiStyle = 16;
this.damage = 40;
this.defense = 2;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 400f;
this.knockBackResist = 0.7f;
}
else if (this.type == 66)
{
this.npcSlots = 2f;
this.width = 28;
this.height = 48;
this.aiStyle = 14;
this.damage = 32;
this.defense = 8;
this.lifeMax = 140;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 1000f;
this.lavaImmune = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 67)
{
this.width = 28;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 60f;
}
else if (this.type == 68)
{
this.width = 80;
this.height = 102;
this.aiStyle = 11;
this.damage = 1000;
this.defense = 9999;
this.lifeMax = 9999;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[189] = this.buffImmune[169] = this.buffImmune[183] = true;
}
else if (this.type == 69)
{
this.width = 24;
this.height = 24;
this.aiStyle = 19;
this.damage = 10;
this.defense = 6;
this.lifeMax = 45;
this.HitSound = SoundID.NPCHit31;
this.DeathSound = SoundID.NPCDeath34;
this.knockBackResist = 0.0f;
this.value = 60f;
this.behindTiles = true;
}
else if (this.type == 70)
{
this.npcSlots = 0.3f;
this.width = 34;
this.height = 34;
this.aiStyle = 20;
this.damage = 32;
this.defense = 100;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.dontTakeDamage = true;
this.scale = 1.5f;
}
else if (this.type == 71)
{
this.npcSlots = 2f;
this.width = 36;
this.height = 24;
this.aiStyle = 1;
this.damage = 30;
this.defense = 7;
this.lifeMax = 150;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 60;
this.value = 150f;
this.scale = 1.25f;
this.knockBackResist = 0.6f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.rarity = 1;
}
else if (this.type == 72)
{
this.npcSlots = 0.3f;
this.width = 34;
this.height = 34;
this.aiStyle = 21;
this.damage = 24;
this.defense = 100;
this.lifeMax = 100;
this.alpha = 100;
this.behindTiles = true;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.dontTakeDamage = true;
this.scale = 1.2f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 73)
{
this.scale = 0.95f;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 6;
this.lifeMax = 80;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.7f;
this.value = 200f;
this.buffImmune[31] = false;
this.rarity = 1;
}
else if (this.type == 74 || this.type == 297 || this.type == 298)
{
this.width = 14;
this.height = 14;
this.aiStyle = 24;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath1;
if (this.type == 74)
this.catchItem = (short) 2015;
if (this.type == 297)
this.catchItem = (short) 2016;
if (this.type == 298)
this.catchItem = (short) 2017;
this.npcSlots = 0.4f;
}
else if (this.type == 75)
{
this.noGravity = true;
this.width = 20;
this.height = 20;
this.aiStyle = 22;
this.damage = 55;
this.defense = 20;
this.lifeMax = 150;
this.HitSound = SoundID.NPCHit5;
this.knockBackResist = 0.6f;
this.DeathSound = SoundID.NPCDeath7;
this.value = 350f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else if (this.type == 77)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 40;
this.defense = 28;
this.lifeMax = 260;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 78)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 50;
this.defense = 16;
this.lifeMax = 130;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.6f;
this.value = 600f;
this.buffImmune[31] = false;
}
else if (this.type == 79)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 18;
this.lifeMax = 180;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.5f;
this.value = 700f;
this.buffImmune[31] = false;
}
else if (this.type == 80)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 55;
this.defense = 18;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.55f;
this.value = 700f;
this.buffImmune[31] = false;
}
else if (this.type == 81)
{
this.width = 40;
this.height = 30;
this.aiStyle = 1;
this.damage = 55;
this.defense = 20;
this.lifeMax = 170;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 55;
this.value = 400f;
this.scale = 1.1f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 82)
{
this.noGravity = true;
this.noTileCollide = true;
this.width = 24;
this.height = 44;
this.aiStyle = 22;
this.damage = 65;
this.defense = 16;
this.lifeMax = 160;
this.HitSound = SoundID.NPCHit54;
this.DeathSound = SoundID.NPCDeath52;
this.alpha = 100;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.7f;
}
else if (this.type == 83)
{
this.width = 40;
this.height = 40;
this.aiStyle = 23;
this.damage = 80;
this.defense = 18;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath6;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.4f;
}
else if (this.type == 84)
{
this.width = 40;
this.height = 40;
this.aiStyle = 23;
this.damage = 80;
this.defense = 18;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath6;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.4f;
}
else if (this.type == 85)
{
this.width = 24;
this.height = 24;
this.aiStyle = 25;
this.damage = 80;
this.defense = 30;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath6;
this.value = 100000f;
this.knockBackResist = 0.3f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.rarity = 4;
}
else if (this.type == 86)
{
this.width = 46;
this.height = 42;
this.aiStyle = 26;
this.damage = 65;
this.defense = 30;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit12;
this.DeathSound = SoundID.NPCDeath18;
this.knockBackResist = 0.3f;
this.value = 1000f;
this.buffImmune[31] = false;
}
else if (this.type == 87)
{
this.noTileCollide = true;
this.npcSlots = 5f;
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 80;
this.defense = 10;
this.lifeMax = 4000;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath8;
this.noGravity = true;
this.knockBackResist = 0.0f;
this.value = 10000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 88)
{
this.noTileCollide = true;
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath8;
this.noGravity = true;
this.knockBackResist = 0.0f;
this.value = 10000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.dontCountMe = true;
}
else if (this.type == 89)
{
this.noTileCollide = true;
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath8;
this.noGravity = true;
this.knockBackResist = 0.0f;
this.value = 2000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.dontCountMe = true;
}
else if (this.type == 90)
{
this.noTileCollide = true;
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath8;
this.noGravity = true;
this.knockBackResist = 0.0f;
this.value = 10000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.dontCountMe = true;
}
else if (this.type == 91)
{
this.noTileCollide = true;
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath8;
this.noGravity = true;
this.knockBackResist = 0.0f;
this.value = 10000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.dontCountMe = true;
}
else if (this.type == 92)
{
this.noTileCollide = true;
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath8;
this.noGravity = true;
this.knockBackResist = 0.0f;
this.value = 10000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.dontCountMe = true;
}
else if (this.type == 93)
{
this.npcSlots = 0.5f;
this.width = 26;
this.height = 20;
this.aiStyle = 14;
this.damage = 45;
this.defense = 16;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.75f;
this.DeathSound = SoundID.NPCDeath4;
this.value = 400f;
this.buffImmune[31] = false;
}
else if (this.type == 94)
{
this.npcSlots = 1f;
this.width = 44;
this.height = 44;
this.aiStyle = 5;
this.damage = 60;
this.defense = 32;
this.lifeMax = 230;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.knockBackResist = 0.55f;
this.value = 500f;
}
else if (this.type == 95)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 45;
this.defense = 10;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.scale = 0.9f;
this.value = 300f;
}
else if (this.type == 96)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 28;
this.defense = 20;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.scale = 0.9f;
this.value = 300f;
this.dontCountMe = true;
}
else if (this.type == 97)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 26;
this.defense = 30;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.scale = 0.9f;
this.value = 300f;
this.dontCountMe = true;
}
else if (this.type == 98)
{
this.npcSlots = 3.5f;
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 70;
this.defense = 36;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 700f;
}
else if (this.type == 99)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 55;
this.defense = 40;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 700f;
this.dontCountMe = true;
}
else if (this.type == 100)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 44;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 700f;
this.dontCountMe = true;
}
else if (this.type == 101)
{
this.noGravity = true;
this.noTileCollide = true;
this.behindTiles = true;
this.width = 30;
this.height = 30;
this.aiStyle = 13;
this.damage = 70;
this.defense = 30;
this.lifeMax = 320;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.2f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 600f;
}
else if (this.type == 102)
{
this.npcSlots = 0.5f;
this.noGravity = true;
this.width = 18;
this.height = 20;
this.aiStyle = 16;
this.damage = 80;
this.defense = 22;
this.lifeMax = 90;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 500f;
}
else if (this.type == 103)
{
this.noGravity = true;
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 80;
this.defense = 30;
this.lifeMax = 120;
this.HitSound = SoundID.NPCHit25;
this.DeathSound = SoundID.NPCDeath28;
this.value = 800f;
this.alpha = 20;
}
else if (this.type == 104)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 38;
this.lifeMax = 350;
this.HitSound = SoundID.NPCHit6;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[31] = false;
}
else if (this.type == 105)
{
this.friendly = true;
this.width = 18;
this.height = 34;
this.aiStyle = 0;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.rarity = 1;
}
else if (this.type == 106)
{
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 0;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.rarity = 1;
}
else if (this.type == 107)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 108)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 109)
{
this.width = 34;
this.height = 78;
this.aiStyle = 3;
this.damage = 50;
this.defense = 20;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 8000f;
}
else if (this.type == 110)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 45;
this.defense = 14;
this.lifeMax = 210;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.55f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 112)
{
this.width = 16;
this.height = 16;
this.aiStyle = 9;
this.damage = 65;
this.defense = 0;
this.lifeMax = 1;
this.HitSound = (LegacySoundStyle) null;
this.DeathSound = SoundID.NPCDeath9;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.scale = 0.9f;
this.alpha = 80;
}
else if (this.type == 113)
{
this.npcSlots = 10f;
this.width = 100;
this.height = 100;
this.aiStyle = 27;
this.damage = 50;
this.defense = 12;
this.lifeMax = 8000;
this.HitSound = SoundID.NPCHit8;
this.DeathSound = SoundID.NPCDeath10;
this.noGravity = true;
this.noTileCollide = true;
this.behindTiles = true;
this.knockBackResist = 0.0f;
this.scale = 1.2f;
this.boss = true;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.value = 80000f;
}
else if (this.type == 114)
{
this.width = 100;
this.height = 100;
this.aiStyle = 28;
this.damage = 50;
this.defense = 0;
this.lifeMax = 8000;
this.HitSound = SoundID.NPCHit8;
this.DeathSound = SoundID.NPCDeath10;
this.noGravity = true;
this.noTileCollide = true;
this.behindTiles = true;
this.knockBackResist = 0.0f;
this.scale = 1.2f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.value = 80000f;
}
else if (this.type == 115)
{
this.width = 30;
this.height = 30;
this.aiStyle = 29;
this.damage = 30;
this.defense = 10;
this.lifeMax = 240;
this.HitSound = SoundID.NPCHit9;
this.DeathSound = SoundID.NPCDeath11;
this.noGravity = true;
this.behindTiles = true;
this.noTileCollide = true;
this.knockBackResist = 1.1f;
}
else if (this.type == 116)
{
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 30;
this.defense = 6;
this.lifeMax = 80;
this.HitSound = SoundID.NPCHit9;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath12;
}
else if (this.type == 117)
{
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 26;
this.defense = 2;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit9;
this.DeathSound = SoundID.NPCDeath12;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
}
else if (this.type == 118)
{
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 22;
this.defense = 6;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit9;
this.DeathSound = SoundID.NPCDeath12;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
}
else if (this.type == 119)
{
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 18;
this.defense = 10;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit9;
this.DeathSound = SoundID.NPCDeath12;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
}
else if (this.type == 120)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 40;
this.defense = 30;
this.lifeMax = 370;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.4f;
this.value = 600f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else if (this.type == 121)
{
this.width = 40;
this.height = 30;
this.aiStyle = 14;
this.damage = 45;
this.defense = 20;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.alpha = 55;
this.knockBackResist = 0.8f;
this.scale = 1.1f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 122)
{
this.noGravity = true;
this.width = 20;
this.height = 20;
this.aiStyle = 22;
this.damage = 60;
this.defense = 22;
this.lifeMax = 220;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 600f;
this.buffImmune[20] = true;
}
else if (this.type == 123)
{
this.friendly = true;
this.width = 18;
this.height = 34;
this.aiStyle = 0;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.scale = 0.9f;
this.rarity = 1;
}
else if (this.type == 124)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 125)
{
this.width = 100;
this.height = 110;
this.aiStyle = 30;
this.defense = 10;
this.damage = 45;
this.lifeMax = 20000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath14;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.timeLeft = NPC.activeTime * 30;
this.boss = true;
this.value = 120000f;
this.npcSlots = 5f;
}
else if (this.type == 126)
{
this.width = 100;
this.height = 110;
this.aiStyle = 31;
this.defense = 10;
this.damage = 50;
this.lifeMax = 23000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath14;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.timeLeft = NPC.activeTime * 30;
this.boss = true;
this.value = 120000f;
this.npcSlots = 5f;
}
else if (this.type == (int) sbyte.MaxValue)
{
this.width = 80;
this.height = 102;
this.aiStyle = 32;
this.damage = 47;
this.defense = 24;
this.lifeMax = 28000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.noGravity = true;
this.noTileCollide = true;
this.value = 120000f;
this.knockBackResist = 0.0f;
this.boss = true;
this.npcSlots = 6f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[189] = this.buffImmune[169] = this.buffImmune[183] = true;
this.boss = true;
}
else if (this.type == 128)
{
this.width = 52;
this.height = 52;
this.aiStyle = 35;
this.damage = 30;
this.defense = 23;
this.lifeMax = 7000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.netAlways = true;
}
else if (this.type == 129)
{
this.width = 52;
this.height = 52;
this.aiStyle = 33;
this.damage = 56;
this.defense = 38;
this.lifeMax = 9000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.netAlways = true;
}
else if (this.type == 130)
{
this.width = 52;
this.height = 52;
this.aiStyle = 34;
this.damage = 52;
this.defense = 34;
this.lifeMax = 9000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.netAlways = true;
}
else if (this.type == 131)
{
this.width = 52;
this.height = 52;
this.aiStyle = 36;
this.damage = 29;
this.defense = 20;
this.lifeMax = 6000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.netAlways = true;
}
else if (this.type == 132)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 15;
this.defense = 5;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 65f;
this.buffImmune[31] = false;
}
else if (this.type == 133)
{
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 40;
this.defense = 20;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 500f;
this.buffImmune[31] = false;
}
else if (this.type == 134)
{
this.npcSlots = 5f;
this.width = 38;
this.height = 38;
this.aiStyle = 37;
this.defense = 0;
this.damage = 70;
this.lifeMax = 80000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 120000f;
this.scale = 1.25f;
this.boss = true;
this.netAlways = true;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
flag = true;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 135)
{
this.npcSlots = 5f;
this.width = 38;
this.height = 38;
this.aiStyle = 37;
this.damage = 55;
this.defense = 30;
this.lifeMax = 80000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.netAlways = true;
this.scale = 1.25f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
flag = true;
this.dontCountMe = true;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 136)
{
this.npcSlots = 5f;
this.width = 38;
this.height = 38;
this.aiStyle = 37;
this.damage = 40;
this.defense = 35;
this.lifeMax = 80000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.scale = 1.25f;
this.netAlways = true;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
flag = true;
this.dontCountMe = true;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 139)
{
this.npcSlots = 1f;
this.width = 30;
this.height = 30;
this.aiStyle = 5;
this.damage = 50;
this.defense = 20;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.noGravity = true;
this.knockBackResist = 0.8f;
this.noTileCollide = true;
flag = true;
}
else if (this.type == 137)
{
this.width = 26;
this.height = 20;
this.aiStyle = 14;
this.damage = 75;
this.defense = 30;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.75f;
this.DeathSound = SoundID.NPCDeath6;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else if (this.type == 138)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 70;
this.defense = 30;
this.lifeMax = 180;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.alpha = 100;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.85f;
this.scale = 1.05f;
this.buffImmune[31] = false;
}
else if (this.type == 140)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 55;
this.defense = 28;
this.lifeMax = 260;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.4f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.buffImmune[24] = true;
}
else if (this.type == 141)
{
this.width = 34;
this.height = 28;
this.aiStyle = 1;
this.damage = 50;
this.defense = 18;
this.lifeMax = 150;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 55;
this.value = 400f;
this.scale = 1.1f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.knockBackResist = 0.8f;
}
else if (this.type == 142)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 143)
{
this.width = 26;
this.height = 40;
this.aiStyle = 38;
this.damage = 50;
this.defense = 20;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit11;
this.DeathSound = SoundID.NPCDeath15;
this.knockBackResist = 0.6f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 144)
{
this.width = 26;
this.height = 40;
this.aiStyle = 38;
this.damage = 65;
this.defense = 26;
this.lifeMax = 240;
this.HitSound = SoundID.NPCHit11;
this.DeathSound = SoundID.NPCDeath15;
this.knockBackResist = 0.6f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.coldDamage = true;
}
else if (this.type == 145)
{
this.width = 26;
this.height = 40;
this.aiStyle = 38;
this.damage = 55;
this.defense = 22;
this.lifeMax = 220;
this.HitSound = SoundID.NPCHit11;
this.DeathSound = SoundID.NPCDeath15;
this.knockBackResist = 0.6f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.coldDamage = true;
}
else if (this.type == 147)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 8;
this.defense = 4;
this.lifeMax = 30;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 50;
this.value = 50f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.coldDamage = true;
}
else if (this.type == 148)
{
this.width = 16;
this.height = 34;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2205;
}
else if (this.type == 149)
{
this.width = 16;
this.height = 34;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2205;
}
else if (this.type == 150)
{
this.npcSlots = 0.5f;
this.width = 22;
this.height = 22;
this.aiStyle = 14;
this.damage = 18;
this.defense = 6;
this.lifeMax = 30;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath4;
this.value = 250f;
this.buffImmune[31] = false;
}
else if (this.type == 151)
{
this.npcSlots = 0.5f;
this.width = 22;
this.height = 22;
this.aiStyle = 14;
this.damage = 50;
this.defense = 16;
this.lifeMax = 160;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.6f;
this.DeathSound = SoundID.NPCDeath4;
this.value = 400f;
this.scale = 1.15f;
this.lavaImmune = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else if (this.type == 152)
{
this.npcSlots = 0.5f;
this.width = 38;
this.height = 34;
this.aiStyle = 14;
this.damage = 80;
this.defense = 24;
this.lifeMax = 220;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.65f;
this.DeathSound = SoundID.NPCDeath4;
this.value = 400f;
this.buffImmune[31] = false;
}
else if (this.type == 153)
{
this.npcSlots = 2f;
this.width = 46;
this.height = 32;
this.aiStyle = 39;
this.damage = 80;
this.defense = 30;
this.lifeMax = 470;
this.HitSound = SoundID.NPCHit24;
this.knockBackResist = 0.3f;
this.DeathSound = SoundID.NPCDeath27;
this.value = 500f;
this.noGravity = false;
this.buffImmune[31] = false;
}
else if (this.type == 154)
{
this.npcSlots = 1.5f;
this.width = 46;
this.height = 32;
this.aiStyle = 39;
this.damage = 55;
this.defense = 28;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit24;
this.knockBackResist = 0.3f;
this.DeathSound = SoundID.NPCDeath27;
this.value = 450f;
this.noGravity = false;
this.buffImmune[31] = false;
}
else if (this.type == 155)
{
this.width = 46;
this.height = 30;
this.aiStyle = 26;
this.damage = 65;
this.defense = 30;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.3f;
this.value = 1000f;
this.buffImmune[31] = false;
}
else if (this.type == 156)
{
this.npcSlots = 2f;
this.width = 28;
this.height = 48;
this.aiStyle = 14;
this.damage = 50;
this.defense = 40;
this.lifeMax = 600;
this.HitSound = SoundID.NPCHit21;
this.knockBackResist = 0.5f;
this.DeathSound = SoundID.NPCDeath24;
this.value = 1200f;
this.lavaImmune = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 157)
{
this.npcSlots = 0.5f;
this.noGravity = true;
this.width = 74;
this.height = 20;
this.aiStyle = 16;
this.damage = 75;
this.defense = 30;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 500f;
}
else if (this.type == 160)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 161)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 16;
this.defense = 8;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.45f;
this.value = 80f;
this.buffImmune[31] = false;
}
else if (this.type == 163)
{
this.width = 50;
this.height = 20;
this.aiStyle = 3;
this.damage = 90;
this.defense = 40;
this.lifeMax = 350;
this.HitSound = SoundID.NPCHit29;
this.DeathSound = SoundID.NPCDeath31;
this.knockBackResist = 0.25f;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.npcSlots = 0.5f;
this.timeLeft = NPC.activeTime * 2;
}
else if (this.type == 238)
{
this.noGravity = true;
this.width = 36;
this.height = 36;
this.aiStyle = 40;
this.damage = 100;
this.defense = 40;
this.lifeMax = 350;
this.HitSound = SoundID.NPCHit29;
this.DeathSound = SoundID.NPCDeath31;
this.knockBackResist = 0.25f;
this.value = 500f;
this.timeLeft = NPC.activeTime * 2;
this.npcSlots = 0.5f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 164)
{
this.width = 50;
this.height = 20;
this.aiStyle = 3;
this.damage = 30;
this.defense = 10;
this.lifeMax = 80;
this.HitSound = SoundID.NPCHit29;
this.DeathSound = SoundID.NPCDeath31;
this.knockBackResist = 0.25f;
this.value = 100f;
this.timeLeft = NPC.activeTime * 2;
this.npcSlots = 0.5f;
this.buffImmune[20] = true;
}
else if (this.type == 165)
{
this.noGravity = true;
this.width = 36;
this.height = 36;
this.aiStyle = 40;
this.damage = 30;
this.defense = 10;
this.lifeMax = 80;
this.HitSound = SoundID.NPCHit29;
this.DeathSound = SoundID.NPCDeath31;
this.knockBackResist = 0.25f;
this.value = 100f;
this.timeLeft = NPC.activeTime * 2;
this.npcSlots = 0.5f;
this.buffImmune[20] = true;
}
else if (this.type == 167)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 24;
this.defense = 10;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 200f;
this.buffImmune[31] = false;
this.buffImmune[20] = true;
}
else if (this.type == 168)
{
this.width = 16;
this.height = 34;
this.aiStyle = 3;
this.damage = 20;
this.defense = 4;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 500f;
this.buffImmune[31] = false;
}
else if (this.type == 169)
{
this.noGravity = true;
this.width = 18;
this.height = 40;
this.aiStyle = 22;
this.damage = 55;
this.defense = 20;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit5;
this.knockBackResist = 0.6f;
this.DeathSound = SoundID.NPCDeath7;
this.value = 1500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
this.buffImmune[44] = true;
this.coldDamage = true;
}
else if (this.type == 170)
{
this.width = 44;
this.height = 36;
this.aiStyle = 2;
this.damage = 70;
this.defense = 16;
this.lifeMax = 210;
this.HitSound = SoundID.NPCHit27;
this.DeathSound = SoundID.NPCDeath30;
this.knockBackResist = 0.5f;
this.value = 2000f;
this.buffImmune[31] = false;
}
else if (this.type == 171)
{
this.width = 44;
this.height = 36;
this.aiStyle = 2;
this.damage = 70;
this.defense = 16;
this.lifeMax = 210;
this.HitSound = SoundID.NPCHit27;
this.DeathSound = SoundID.NPCDeath30;
this.knockBackResist = 0.5f;
this.value = 2000f;
this.buffImmune[31] = false;
}
else if (this.type == 172)
{
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 200;
this.defense = 30;
this.lifeMax = 600;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.3f;
this.value = 5000f;
this.buffImmune[20] = true;
this.rarity = 2;
}
else if (this.type == 173)
{
this.npcSlots = 1f;
this.width = 30;
this.height = 30;
this.aiStyle = 5;
this.damage = 22;
this.defense = 8;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.knockBackResist = 0.5f;
this.value = 90f;
}
else if (this.type == 174)
{
this.npcSlots = 1f;
this.width = 52;
this.height = 26;
this.aiStyle = 41;
this.damage = 65;
this.defense = 26;
this.lifeMax = 220;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.3f;
this.value = 450f;
}
else if (this.type == 175)
{
this.noGravity = true;
this.noTileCollide = true;
this.width = 30;
this.height = 30;
this.aiStyle = 13;
this.damage = 100;
this.defense = 30;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.25f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 650f;
this.buffImmune[20] = true;
}
else if (this.type == 176)
{
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 70;
this.defense = 22;
this.lifeMax = 220;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.5f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 600f;
this.noGravity = true;
this.buffImmune[20] = true;
this.npcSlots = 1.5f;
}
else if (this.type == 177)
{
this.npcSlots = 1f;
this.width = 58;
this.height = 44;
this.aiStyle = 41;
this.damage = 80;
this.defense = 26;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit22;
this.DeathSound = SoundID.NPCDeath25;
this.knockBackResist = 0.5f;
this.value = 500f;
}
else if (this.type == 178)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 179)
{
this.width = 40;
this.height = 40;
this.aiStyle = 23;
this.damage = 80;
this.defense = 18;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath6;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.4f;
}
else if (this.type == 180)
{
this.width = 44;
this.height = 36;
this.aiStyle = 2;
this.damage = 70;
this.defense = 16;
this.lifeMax = 210;
this.HitSound = SoundID.NPCHit27;
this.DeathSound = SoundID.NPCDeath30;
this.knockBackResist = 0.5f;
this.value = 4000f;
this.buffImmune[31] = false;
}
else if (this.type == 181)
{
this.width = 18;
this.height = 44;
this.aiStyle = 3;
this.damage = 25;
this.defense = 10;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 200f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 182)
{
this.noGravity = true;
this.noTileCollide = true;
this.width = 24;
this.height = 62;
this.aiStyle = 22;
this.damage = 65;
this.defense = 18;
this.lifeMax = 240;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.alpha = 100;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.7f;
}
else if (this.type == 183)
{
this.width = 40;
this.height = 30;
this.aiStyle = 1;
this.damage = 60;
this.defense = 26;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 55;
this.value = 400f;
this.scale = 1.1f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 184)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 12;
this.defense = 8;
this.lifeMax = 60;
this.scale = 1.1f;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 50;
this.value = 200f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.coldDamage = true;
}
else if (this.type == 185)
{
this.width = 28;
this.height = 28;
this.aiStyle = 3;
this.damage = 26;
this.defense = 12;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 1.1f;
this.value = 200f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.coldDamage = true;
}
else if (this.type == 186)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 16;
this.defense = 8;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.45f;
this.value = 65f;
this.buffImmune[31] = false;
}
else if (this.type == 187)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 13;
this.defense = 6;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.55f;
this.value = 55f;
this.buffImmune[31] = false;
}
else if (this.type == 188)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 13;
this.defense = 8;
this.lifeMax = 45;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.45f;
this.value = 80f;
this.buffImmune[31] = false;
}
else if (this.type == 189)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 16;
this.defense = 4;
this.lifeMax = 45;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.55f;
this.value = 70f;
this.buffImmune[31] = false;
}
else if (this.type == 190)
{
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 18;
this.defense = 4;
this.lifeMax = 65;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.7f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 75f;
this.buffImmune[31] = false;
}
else if (this.type == 191)
{
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 16;
this.defense = 2;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.85f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 75f;
this.buffImmune[31] = false;
}
else if (this.type == 192)
{
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 18;
this.defense = 2;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 75f;
this.buffImmune[31] = false;
}
else if (this.type == 193)
{
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 20;
this.defense = 0;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 75f;
this.buffImmune[31] = false;
}
else if (this.type == 194)
{
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 14;
this.defense = 4;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 75f;
this.buffImmune[31] = false;
}
else if (this.type == 195)
{
this.width = 18;
this.height = 40;
this.aiStyle = 42;
this.damage = 10;
this.defense = 30;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.rarity = 1;
}
else if (this.type == 196)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 35;
this.defense = 16;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 10000f;
this.buffImmune[31] = false;
this.rarity = 1;
}
else if (this.type == 197)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 50;
this.defense = 28;
this.lifeMax = 280;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.45f;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 198)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 38;
this.defense = 20;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit26;
this.DeathSound = SoundID.NPCDeath29;
this.knockBackResist = 0.4f;
this.value = 650f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 199)
{
this.width = 42;
this.height = 30;
this.aiStyle = 3;
this.damage = 60;
this.defense = 30;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit26;
this.DeathSound = SoundID.NPCDeath29;
this.knockBackResist = 0.0f;
this.value = 650f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 200)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 12;
this.defense = 4;
this.lifeMax = 38;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.6f;
this.value = 65f;
this.buffImmune[31] = false;
}
else if (this.type == 201)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 12;
this.lifeMax = 55;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 202)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 18;
this.defense = 8;
this.lifeMax = 65;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 120f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 203)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 22;
this.defense = 8;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 110f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 204)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 28;
this.defense = 8;
this.lifeMax = 65;
this.scale = 1.15f;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 50;
this.value = 300f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 205)
{
this.width = 40;
this.height = 40;
this.aiStyle = 5;
this.damage = 70;
this.defense = 28;
this.lifeMax = 1000;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.4f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 600f;
this.noGravity = true;
this.buffImmune[20] = true;
this.rarity = 2;
}
else if (this.type == 206)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 30;
this.lifeMax = 280;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.value = 500f;
this.buffImmune[31] = false;
this.coldDamage = true;
}
else if (this.type == 207)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 208)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 209)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 210)
{
this.width = 12;
this.height = 12;
this.aiStyle = 5;
this.damage = 20;
this.defense = 5;
this.lifeMax = 20;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.5f;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.buffImmune[20] = true;
}
else if (this.type == 211)
{
this.width = 8;
this.height = 8;
this.aiStyle = 5;
this.damage = 15;
this.defense = 2;
this.lifeMax = 10;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.5f;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.buffImmune[20] = true;
}
else if (this.type == 212)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 35;
this.defense = 17;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.4f;
this.value = 700f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 213)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 50;
this.defense = 22;
this.lifeMax = 450;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.2f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 214)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 30;
this.defense = 14;
this.lifeMax = 225;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.3f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 215)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 35;
this.defense = 20;
this.lifeMax = 350;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.35f;
this.value = 1500f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 216)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 30;
this.lifeMax = 3000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.0f;
this.value = 50000f;
this.buffImmune[20] = true;
this.buffImmune[31] = true;
}
else if (this.type == 217)
{
this.width = 28;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath16;
this.value = 60f;
}
else if (this.type == 218)
{
this.width = 28;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath16;
this.value = 60f;
}
else if (this.type == 219)
{
this.width = 28;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath16;
this.value = 60f;
}
else if (this.type == 220)
{
this.width = 28;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 60f;
}
else if (this.type == 221)
{
this.noGravity = true;
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 20;
this.defense = 2;
this.lifeMax = 30;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 100f;
this.alpha = 20;
}
else if (this.type == 222)
{
this.width = 66;
this.height = 66;
this.aiStyle = 43;
this.damage = 30;
this.defense = 8;
this.lifeMax = 3400;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.timeLeft = NPC.activeTime * 30;
this.boss = true;
this.value = 100000f;
this.npcSlots = 7f;
}
else if (this.type == 223)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 16;
this.defense = 8;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.45f;
this.value = 70f;
this.buffImmune[31] = false;
}
else if (this.type == 224)
{
this.width = 32;
this.height = 18;
this.aiStyle = 44;
this.damage = 9;
this.defense = 4;
this.lifeMax = 20;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 90f;
this.buffImmune[31] = false;
}
if (this.type == 225)
{
this.width = 38;
this.height = 26;
this.aiStyle = 1;
this.damage = 10;
this.defense = 5;
this.lifeMax = 35;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.75f;
this.value = 25f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 226)
{
this.npcSlots = 0.5f;
this.width = 34;
this.height = 50;
this.aiStyle = 14;
this.damage = 85;
this.defense = 28;
this.lifeMax = 260;
this.HitSound = SoundID.NPCHit23;
this.knockBackResist = 0.65f;
this.DeathSound = SoundID.NPCDeath26;
this.value = 400f;
this.buffImmune[31] = false;
}
else if (this.type == 227)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 228)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 229)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 230)
{
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 261;
}
else if (this.type == 231)
{
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 22;
this.defense = 16;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.3f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else if (this.type == 232)
{
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 28;
this.defense = 12;
this.lifeMax = 42;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.6f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else if (this.type == 233)
{
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 30;
this.defense = 14;
this.lifeMax = 38;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.45f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else if (this.type == 234)
{
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 32;
this.defense = 6;
this.lifeMax = 42;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.55f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else if (this.type == 235)
{
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 34;
this.defense = 4;
this.lifeMax = 38;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.6f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else if (this.type == 236)
{
this.width = 50;
this.height = 20;
this.aiStyle = 3;
this.damage = 50;
this.defense = 14;
this.lifeMax = 120;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.25f;
this.value = 1000f;
this.timeLeft = NPC.activeTime * 2;
this.npcSlots = 0.75f;
this.buffImmune[20] = true;
}
else if (this.type == 237)
{
this.noGravity = true;
this.width = 36;
this.height = 36;
this.aiStyle = 40;
this.damage = 50;
this.defense = 14;
this.lifeMax = 120;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.25f;
this.value = 1000f;
this.timeLeft = NPC.activeTime * 2;
this.npcSlots = 0.75f;
this.buffImmune[20] = true;
}
else if (this.type == 239)
{
this.width = 50;
this.height = 20;
this.aiStyle = 3;
this.damage = 30;
this.defense = 8;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit20;
this.DeathSound = SoundID.NPCDeath23;
this.knockBackResist = 0.5f;
this.value = 130f;
this.timeLeft = NPC.activeTime * 2;
this.buffImmune[20] = true;
}
else if (this.type == 240)
{
this.noGravity = true;
this.width = 50;
this.height = 20;
this.aiStyle = 40;
this.damage = 30;
this.defense = 8;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit20;
this.DeathSound = SoundID.NPCDeath23;
this.knockBackResist = 0.5f;
this.value = 130f;
this.timeLeft = NPC.activeTime * 2;
this.buffImmune[20] = true;
}
else if (this.type == 241)
{
this.npcSlots = 0.5f;
this.noGravity = true;
this.width = 18;
this.height = 20;
this.aiStyle = 16;
this.damage = 30;
this.defense = 4;
this.lifeMax = 20;
this.HitSound = SoundID.NPCHit13;
this.DeathSound = SoundID.NPCDeath19;
this.value = 350f;
}
else if (this.type == 242)
{
this.noGravity = true;
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 75;
this.defense = 20;
this.lifeMax = 150;
this.HitSound = SoundID.NPCHit13;
this.DeathSound = SoundID.NPCDeath19;
this.value = 800f;
this.alpha = 20;
}
else if (this.type == 243)
{
this.width = 30;
this.height = 114;
this.aiStyle = 3;
this.damage = 60;
this.defense = 32;
this.lifeMax = 4000;
this.HitSound = SoundID.NPCHit5;
this.DeathSound = SoundID.NPCDeath7;
this.knockBackResist = 0.05f;
this.value = (float) Item.buyPrice(gold: 1, silver: 50);
this.buffImmune[20] = true;
this.buffImmune[44] = true;
this.coldDamage = true;
this.rarity = 2;
}
else if (this.type == 244)
{
this.width = 60;
this.height = 42;
this.aiStyle = 1;
this.damage = 85;
this.defense = 26;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 175;
this.value = (float) Item.buyPrice(silver: 20);
this.knockBackResist = 0.3f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.rarity = 1;
}
else if (this.type == 245)
{
this.width = 140;
this.height = 140;
this.aiStyle = 45;
this.damage = 72;
this.defense = 26;
this.lifeMax = 9000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.knockBackResist = 0.0f;
this.value = (float) Item.buyPrice(gold: 15);
this.alpha = (int) byte.MaxValue;
this.boss = true;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
}
else if (this.type == 246)
{
this.noGravity = true;
this.width = 70;
this.height = 70;
this.aiStyle = 46;
this.damage = 64;
this.defense = 20;
this.lifeMax = 16000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = (LegacySoundStyle) null;
this.knockBackResist = 0.0f;
this.alpha = (int) byte.MaxValue;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
}
else if (this.type == 247 || this.type == 248)
{
this.noGravity = true;
this.width = 40;
this.height = 30;
this.aiStyle = 47;
this.damage = 59;
this.defense = 28;
this.lifeMax = 7000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.alpha = (int) byte.MaxValue;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
}
else if (this.type == 249)
{
this.noGravity = true;
this.width = 70;
this.height = 70;
this.aiStyle = 48;
this.damage = 80;
this.defense = 32;
this.lifeMax = 11000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.knockBackResist = 0.0f;
this.dontTakeDamage = true;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
}
else if (this.type == 250)
{
this.width = 34;
this.height = 26;
this.aiStyle = 49;
this.damage = 50;
this.defense = 24;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit30;
this.DeathSound = SoundID.NPCDeath33;
this.knockBackResist = 0.3f;
this.value = 300f;
this.buffImmune[20] = true;
}
else if (this.type == 251)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 50;
this.defense = 30;
this.lifeMax = 1000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.3f;
this.value = (float) Item.buyPrice(silver: 50);
this.buffImmune[31] = false;
}
else if (this.type == 252)
{
this.noGravity = true;
this.npcSlots = 0.5f;
this.width = 32;
this.height = 32;
this.aiStyle = 5;
this.damage = 80;
this.defense = 12;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit46;
this.knockBackResist = 0.7f;
this.DeathSound = SoundID.NPCDeath48;
this.value = 500f;
this.buffImmune[31] = false;
}
else if (this.type == 254)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 40;
this.defense = 10;
this.lifeMax = 180;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[31] = false;
}
else if (this.type == (int) byte.MaxValue)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 38;
this.defense = 16;
this.lifeMax = 220;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.3f;
this.value = 1200f;
this.buffImmune[31] = false;
}
else if (this.type == 256)
{
this.noGravity = true;
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 90;
this.defense = 20;
this.lifeMax = 140;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.value = 1200f;
this.alpha = 20;
this.npcSlots = 0.3f;
}
else if (this.type == 257)
{
this.width = 44;
this.height = 34;
this.aiStyle = 3;
this.damage = 38;
this.defense = 24;
this.lifeMax = 230;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.3f;
this.value = 1300f;
this.buffImmune[31] = false;
this.npcSlots = 0.3f;
}
else if (this.type == 258)
{
this.width = 30;
this.height = 24;
this.aiStyle = 3;
this.damage = 60;
this.defense = 16;
this.lifeMax = 220;
this.HitSound = SoundID.NPCHit45;
this.DeathSound = SoundID.NPCDeath47;
this.knockBackResist = 0.3f;
this.value = 1500f;
this.buffImmune[31] = false;
this.npcSlots = 0.3f;
}
else if (this.type == 259)
{
this.noGravity = true;
this.noTileCollide = true;
this.width = 20;
this.height = 20;
this.aiStyle = 13;
this.damage = 24;
this.defense = 4;
this.lifeMax = 90;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.0f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 350f;
this.buffImmune[20] = true;
this.npcSlots = 0.3f;
}
else if (this.type == 260)
{
this.noGravity = true;
this.noTileCollide = true;
this.width = 36;
this.height = 36;
this.aiStyle = 13;
this.damage = 70;
this.defense = 20;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.0f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 1250f;
this.buffImmune[20] = true;
this.npcSlots = 0.3f;
}
else if (this.type == 261)
{
this.width = 12;
this.height = 12;
this.aiStyle = 50;
this.damage = 80;
this.defense = 0;
this.lifeMax = 1;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.npcSlots = 0.0f;
}
else if (this.type == 262)
{
this.noTileCollide = true;
this.width = 86;
this.height = 86;
this.aiStyle = 51;
this.damage = 50;
this.defense = 14;
this.lifeMax = 30000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.0f;
this.value = (float) Item.buyPrice(gold: 15);
this.noGravity = true;
this.boss = true;
this.npcSlots = 16f;
this.buffImmune[20] = true;
}
else if (this.type == 263)
{
this.noTileCollide = true;
this.noGravity = true;
this.width = 40;
this.height = 40;
this.aiStyle = 52;
this.damage = 60;
this.defense = 24;
this.lifeMax = 4000;
this.dontTakeDamage = true;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.buffImmune[20] = true;
}
else if (this.type == 264)
{
this.width = 24;
this.height = 24;
this.aiStyle = 53;
this.damage = 60;
this.defense = 20;
this.lifeMax = 1000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.buffImmune[20] = true;
}
else if (this.type == 265)
{
this.width = 18;
this.height = 18;
this.aiStyle = 50;
this.damage = 70;
this.defense = 0;
this.lifeMax = 1;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.npcSlots = 0.0f;
}
else if (this.type == 266)
{
this.dontTakeDamage = true;
this.width = 160;
this.height = 110;
this.aiStyle = 54;
this.damage = 30;
this.defense = 14;
this.lifeMax = 1000;
this.HitSound = SoundID.NPCHit9;
this.DeathSound = SoundID.NPCDeath11;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.timeLeft = NPC.activeTime * 30;
this.boss = true;
this.value = 50000f;
this.npcSlots = 6f;
}
else if (this.type == 267)
{
this.width = 30;
this.height = 30;
this.aiStyle = 55;
this.damage = 20;
this.defense = 10;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit9;
this.DeathSound = SoundID.NPCDeath11;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.8f;
}
else if (this.type == 268)
{
this.noGravity = true;
this.width = 28;
this.height = 56;
this.aiStyle = 22;
this.damage = 55;
this.defense = 20;
this.lifeMax = 340;
this.HitSound = SoundID.NPCHit13;
this.DeathSound = SoundID.NPCDeath19;
this.knockBackResist = 0.6f;
this.value = 450f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 269)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 34;
this.lifeMax = 550;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.3f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 270)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 55;
this.defense = 50;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.2f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 271)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 40;
this.lifeMax = 450;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.25f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 272)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 75;
this.defense = 28;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.35f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 273)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 45;
this.defense = 50;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.15f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 274)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 65;
this.defense = 34;
this.lifeMax = 350;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 275)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 45;
this.defense = 50;
this.lifeMax = 550;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.15f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 276)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 85;
this.defense = 54;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.2f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 277)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 32;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[31] = false;
}
else if (this.type == 278)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 65;
this.defense = 48;
this.lifeMax = 450;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.3f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[31] = false;
}
else if (this.type == 279)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 40;
this.defense = 54;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.2f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[31] = false;
}
else if (this.type == 280)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 75;
this.defense = 34;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[31] = false;
}
else if (this.type == 281)
{
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 40;
this.defense = 20;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.6f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else if (this.type == 282)
{
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 35;
this.defense = 28;
this.lifeMax = 450;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else if (this.type == 283)
{
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 50;
this.defense = 18;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.55f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else if (this.type == 284)
{
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 35;
this.defense = 24;
this.lifeMax = 450;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else if (this.type == 285)
{
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 50;
this.defense = 12;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.7f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else if (this.type == 286)
{
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 60;
this.defense = 10;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.65f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else if (this.type == 287)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 90;
this.defense = 42;
this.lifeMax = 1000;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.3f;
this.value = 2000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.rarity = 1;
}
else if (this.type == 288)
{
this.width = 20;
this.height = 20;
this.aiStyle = 56;
this.damage = 70;
this.defense = 30;
this.lifeMax = 200;
this.knockBackResist = 0.2f;
this.HitSound = SoundID.NPCHit36;
this.DeathSound = SoundID.NPCDeath39;
this.value = 500f;
this.noTileCollide = true;
this.noGravity = true;
flag = true;
}
else if (this.type == 289)
{
this.width = 44;
this.height = 44;
this.aiStyle = 10;
this.damage = 60;
this.defense = 20;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.noGravity = true;
this.noTileCollide = true;
this.value = 150f;
this.knockBackResist = 0.2f;
this.npcSlots = 0.75f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 290)
{
this.width = 34;
this.height = 62;
this.aiStyle = 3;
this.damage = 100;
this.defense = 50;
this.lifeMax = 5000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.0f;
this.value = 50000f;
this.buffImmune[20] = true;
this.buffImmune[31] = true;
this.rarity = 1;
}
else if (this.type == 291)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 28;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.rarity = 2;
}
else if (this.type == 292)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 28;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.rarity = 2;
}
else if (this.type == 293)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 28;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.rarity = 2;
}
else if (this.type == 294)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 34;
this.defense = 6;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.9f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 295)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 28;
this.defense = 12;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.7f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 296)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 24;
this.defense = 14;
this.lifeMax = 120;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.6f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 299)
{
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2018;
}
else if (this.type == 300)
{
this.width = 14;
this.height = 12;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath4;
this.npcSlots = 0.25f;
this.catchItem = (short) 2003;
}
else if (this.type == 301)
{
this.width = 36;
this.height = 26;
this.aiStyle = 17;
this.damage = 12;
this.defense = 2;
this.lifeMax = 35;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.85f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 50f;
}
if (this.type == 302)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 7;
this.defense = 2;
this.lifeMax = 25;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 25f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 304)
{
this.width = 34;
this.height = 28;
this.aiStyle = 1;
this.damage = 80;
this.defense = 20;
this.lifeMax = 175;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 500f;
this.scale = 1.1f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.knockBackResist = 0.5f;
this.npcSlots = 0.3f;
}
else if (this.type >= 305 && this.type <= 314)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.value = 1200f;
this.buffImmune[31] = false;
this.npcSlots = 0.5f;
if (this.type == 305 || this.type == 310)
{
this.damage = 60;
this.defense = 18;
this.lifeMax = 500;
this.knockBackResist = 0.4f;
}
else if (this.type == 306 || this.type == 311)
{
this.damage = 52;
this.defense = 14;
this.lifeMax = 400;
this.knockBackResist = 0.2f;
this.scale = 1.05f;
}
else if (this.type == 307 || this.type == 312)
{
this.damage = 78;
this.defense = 16;
this.lifeMax = 600;
this.knockBackResist = 0.25f;
this.scale = 0.9f;
}
else if (this.type == 308 || this.type == 313)
{
this.damage = 66;
this.defense = 14;
this.lifeMax = 650;
this.knockBackResist = 0.35f;
this.scale = 0.95f;
}
else if (this.type == 309 || this.type == 314)
{
this.damage = 52;
this.defense = 26;
this.lifeMax = 450;
this.knockBackResist = 0.5f;
this.scale = 1.1f;
}
}
else if (this.type == 315)
{
this.width = 74;
this.height = 70;
this.aiStyle = 26;
this.damage = 130;
this.defense = 40;
this.lifeMax = 10000;
this.HitSound = SoundID.NPCHit12;
this.DeathSound = SoundID.NPCDeath18;
this.knockBackResist = 0.0f;
this.value = 10000f;
flag = true;
}
else if (this.type == 316)
{
this.noGravity = true;
this.noTileCollide = true;
this.width = 24;
this.height = 44;
this.aiStyle = 22;
this.damage = 40;
this.defense = 14;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.alpha = 100;
this.value = 700f;
flag = true;
this.knockBackResist = 0.7f;
}
else if (this.type == 317)
{
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 16;
this.defense = 6;
this.lifeMax = 75;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.7f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 100f;
this.buffImmune[31] = false;
}
else if (this.type == 318)
{
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 20;
this.defense = 4;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.65f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 100f;
this.buffImmune[31] = false;
}
else if (this.type == 319)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 6;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.6f;
this.value = 85f;
this.buffImmune[31] = false;
this.scale = 0.9f;
}
else if (this.type == 320)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 15;
this.defense = 8;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 105f;
this.buffImmune[31] = false;
this.scale = 1.05f;
}
else if (this.type == 321)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 14;
this.lifeMax = 34;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.3f;
this.value = 120f;
this.buffImmune[31] = false;
this.scale = 1.1f;
}
else if (this.type == 322)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 23;
this.defense = 0;
this.lifeMax = 115;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.65f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 323)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 18;
this.defense = 10;
this.lifeMax = 65;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 120f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 324)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 22;
this.defense = 10;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.scale = 1.05f;
}
else if (this.type == 325)
{
this.width = 164;
this.height = 154;
this.aiStyle = 57;
this.damage = 120;
this.defense = 28;
this.lifeMax = 12000;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath5;
this.knockBackResist = 0.0f;
this.value = 10000f;
flag = true;
}
else if (this.type == 326)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 100;
this.defense = 32;
this.lifeMax = 900;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.2f;
this.value = 2000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 327)
{
this.width = 100;
this.height = 100;
this.aiStyle = 58;
this.damage = 50;
this.defense = 36;
this.lifeMax = 22000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.value = 50000f;
this.knockBackResist = 0.0f;
flag = true;
}
else if (this.type == 328)
{
this.width = 80;
this.height = 80;
this.aiStyle = 59;
this.damage = 65;
this.defense = 14;
this.lifeMax = 5000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
flag = true;
this.dontTakeDamage = true;
this.npcSlots = 0.0f;
}
else if (this.type == 329)
{
this.width = 46;
this.height = 30;
this.aiStyle = 26;
this.damage = 80;
this.defense = 38;
this.lifeMax = 1200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath5;
this.knockBackResist = 0.3f;
this.value = 3000f;
flag = true;
}
else if (this.type == 330)
{
this.noGravity = true;
this.noTileCollide = true;
this.width = 24;
this.height = 44;
this.aiStyle = 22;
this.damage = 90;
this.defense = 44;
this.lifeMax = 2000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.alpha = 100;
this.value = 4500f;
flag = true;
this.knockBackResist = 0.4f;
}
else if (this.type == 331)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 14;
this.defense = 6;
this.lifeMax = 45;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 60f;
this.buffImmune[31] = false;
}
else if (this.type == 332)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 14;
this.defense = 6;
this.lifeMax = 45;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 60f;
this.buffImmune[31] = false;
}
if (this.type == 333)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 7;
this.defense = 2;
this.lifeMax = 25;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 25f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
if (this.type == 334)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 6;
this.defense = 2;
this.lifeMax = 23;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.scale = 0.9f;
this.value = 25f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
if (this.type == 335)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 8;
this.defense = 3;
this.lifeMax = 29;
this.scale = 1.05f;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 25f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
if (this.type == 336)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 5;
this.defense = 1;
this.lifeMax = 22;
this.scale = 0.85f;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 25f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type >= 338 && this.type <= 340)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 1200f;
this.buffImmune[31] = false;
this.npcSlots = 0.5f;
if (this.type == 338)
{
this.damage = 65;
this.defense = 18;
this.lifeMax = 600;
this.knockBackResist = 0.4f;
}
else if (this.type == 339)
{
this.damage = 52;
this.defense = 24;
this.lifeMax = 700;
this.knockBackResist = 0.2f;
this.scale = 1.05f;
}
else if (this.type == 340)
{
this.damage = 78;
this.defense = 14;
this.lifeMax = 500;
this.knockBackResist = 0.25f;
this.scale = 0.9f;
}
}
else if (this.type == 341)
{
this.width = 24;
this.height = 24;
this.aiStyle = 25;
this.damage = 100;
this.defense = 32;
this.lifeMax = 900;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath6;
this.value = (float) Item.buyPrice(silver: 20);
this.knockBackResist = 0.25f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 342)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 90;
this.defense = 26;
this.lifeMax = 750;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.2f;
this.value = 1800f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 343)
{
this.width = 38;
this.height = 78;
this.aiStyle = 3;
this.damage = 140;
this.defense = 50;
this.lifeMax = 3500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.0f;
this.value = 3000f;
this.buffImmune[31] = false;
this.npcSlots = 2f;
}
else if (this.type == 344)
{
this.width = 172;
this.height = 130;
this.aiStyle = 57;
this.damage = 110;
this.defense = 38;
this.lifeMax = 13000;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath5;
this.knockBackResist = 0.0f;
this.value = 10000f;
this.buffImmune[20] = true;
this.npcSlots = 3f;
}
else if (this.type == 345)
{
this.width = 130;
this.height = 140;
this.aiStyle = 60;
this.damage = 120;
this.defense = 38;
this.lifeMax = 34000;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath5;
this.knockBackResist = 0.0f;
this.value = 10000f;
this.buffImmune[20] = true;
this.noTileCollide = true;
this.noGravity = true;
this.npcSlots = 5f;
this.coldDamage = true;
}
else if (this.type == 346)
{
this.width = 112;
this.height = 140;
this.aiStyle = 61;
this.damage = 120;
this.defense = 56;
this.lifeMax = 18000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.knockBackResist = 0.0f;
this.value = 10000f;
this.buffImmune[20] = true;
this.npcSlots = 4f;
}
else if (this.type == 347)
{
this.width = 50;
this.height = 50;
this.aiStyle = 62;
this.damage = 60;
this.defense = 28;
this.lifeMax = 1200;
this.HitSound = SoundID.NPCHit4;
this.knockBackResist = 0.4f;
this.DeathSound = SoundID.NPCDeath14;
this.value = 1000f;
this.noTileCollide = true;
this.noGravity = true;
this.npcSlots = 1.5f;
}
else if (this.type == 348)
{
this.width = 28;
this.height = 76;
this.aiStyle = 3;
this.damage = 80;
this.defense = 26;
this.lifeMax = 1800;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.4f;
this.value = 1500f;
this.buffImmune[31] = false;
this.npcSlots = 1.5f;
}
else if (this.type == 349)
{
this.width = 28;
this.height = 76;
this.aiStyle = 3;
this.damage = 100;
this.defense = 42;
this.lifeMax = 1800;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.1f;
this.value = 1500f;
this.buffImmune[31] = false;
this.npcSlots = 1.5f;
}
else if (this.type == 350)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 30;
this.lifeMax = 900;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.45f;
this.value = 900f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 351)
{
this.width = 18;
this.height = 90;
this.aiStyle = 3;
this.damage = 100;
this.defense = 40;
this.lifeMax = 2500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.1f;
this.value = 3000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.npcSlots = 1.75f;
}
else if (this.type == 352)
{
this.width = 54;
this.height = 54;
this.aiStyle = 63;
this.damage = 75;
this.defense = 8;
this.lifeMax = 450;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.4f;
this.noGravity = true;
this.noTileCollide = true;
this.npcSlots = 2f;
this.coldDamage = true;
}
else if (this.type == 353)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 354)
{
this.friendly = true;
this.width = 18;
this.height = 34;
this.aiStyle = 0;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.scale = 0.9f;
this.rarity = 1;
}
else if (this.type == 355)
{
this.width = 10;
this.height = 10;
this.aiStyle = 64;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.2f;
this.noGravity = true;
this.catchItem = (short) 1992;
}
else if (this.type == 356)
{
this.width = 10;
this.height = 10;
this.aiStyle = 65;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.25f;
this.noGravity = true;
this.catchItem = (short) 1994;
}
else if (this.type == 357)
{
this.width = 10;
this.height = 4;
this.aiStyle = 66;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.1f;
this.catchItem = (short) 2002;
this.friendly = true;
}
else if (this.type == 358)
{
this.width = 12;
this.height = 12;
this.aiStyle = 64;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.2f;
this.noGravity = true;
this.catchItem = (short) 2004;
}
else if (this.type == 359)
{
this.width = 12;
this.height = 12;
this.aiStyle = 67;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.5f;
this.noGravity = true;
this.catchItem = (short) 2006;
}
else if (this.type == 360)
{
this.width = 14;
this.height = 14;
this.aiStyle = 67;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.5f;
this.noGravity = true;
this.catchItem = (short) 2007;
}
else if (this.type == 361)
{
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2121;
}
else if (this.type == 362)
{
this.width = 22;
this.height = 26;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2122;
}
else if (this.type == 363)
{
this.width = 28;
this.height = 22;
this.aiStyle = 68;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2122;
}
else if (this.type == 364)
{
this.width = 22;
this.height = 26;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2123;
}
else if (this.type == 365)
{
this.width = 28;
this.height = 22;
this.aiStyle = 68;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2123;
}
else if (this.type == 366 || this.type == 367)
{
this.width = 26;
this.height = 18;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) (2156 + this.type - 366);
}
else if (this.type == 368)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 369)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.5f;
}
else if (this.type == 370)
{
this.width = 150;
this.height = 100;
this.aiStyle = 69;
this.damage = 100;
this.defense = 50;
this.lifeMax = 50000;
this.knockBackResist = 0.0f;
this.noTileCollide = true;
this.noGravity = true;
this.npcSlots = 10f;
this.HitSound = SoundID.NPCHit14;
this.DeathSound = SoundID.NPCDeath20;
this.value = 10000f;
this.boss = true;
this.netAlways = true;
this.timeLeft = NPC.activeTime * 30;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[31] = true;
this.buffImmune[44] = true;
}
else if (this.type == 371)
{
this.width = 36;
this.height = 36;
this.aiStyle = 70;
this.damage = 100;
this.defense = 0;
this.lifeMax = 1;
this.HitSound = SoundID.NPCHit3;
this.DeathSound = SoundID.NPCDeath3;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 372)
{
this.noGravity = true;
this.width = 120;
this.height = 24;
this.aiStyle = 71;
this.damage = 100;
this.defense = 100;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.0f;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 373)
{
this.noGravity = true;
this.width = 100;
this.height = 24;
this.aiStyle = 71;
this.damage = 120;
this.defense = 100;
this.lifeMax = 100;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.0f;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 374)
{
this.width = 20;
this.height = 10;
this.aiStyle = 66;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.15f;
this.catchItem = (short) 2673;
this.rarity = 4;
}
else if (this.type == 375)
{
this.width = 10;
this.height = 10;
this.aiStyle = 6;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.npcSlots = 0.15f;
this.catchItem = (short) 2673;
}
else if (this.type == 376)
{
this.friendly = true;
this.width = 34;
this.height = 8;
this.aiStyle = 0;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.5f;
this.scale = 0.9f;
this.rarity = 1;
}
else if (this.type == 377)
{
this.width = 14;
this.height = 12;
this.aiStyle = 1;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.friendly = true;
this.catchItem = (short) 2740;
this.npcSlots = 0.1f;
}
else if (this.type == 378)
{
this.npcSlots = 1f;
this.width = 20;
this.height = 26;
this.aiStyle = 41;
this.damage = 80;
this.defense = 30;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.value = 450f;
}
else if (this.type >= 379 && this.type <= 380)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 45;
this.defense = 14;
this.lifeMax = 210;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.55f;
this.value = 1000f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.netAlways = true;
this.chaseable = false;
}
else if (this.type >= 381 && this.type <= 382)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 50;
this.defense = 25;
this.lifeMax = 350;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.35f;
this.value = 1000f;
}
else if (this.type == 383)
{
this.lifeMax = 300;
this.defense = 50;
this.damage = 75;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.HitSound = SoundID.NPCHit43;
this.DeathSound = SoundID.NPCDeath45;
this.value = 1200f;
this.knockBackResist = 0.25f;
this.buffImmune[31] = false;
}
else if (this.type == 384)
{
this.lifeMax = 1000;
this.width = 18;
this.defense = 20;
this.height = 40;
this.aiStyle = 72;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
flag = true;
this.npcSlots = 0.0f;
this.noTileCollide = true;
this.canGhostHeal = false;
}
else if (this.type == 385)
{
this.lifeMax = 750;
this.defense = 30;
this.damage = 80;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.HitSound = SoundID.NPCHit43;
this.DeathSound = SoundID.NPCDeath45;
this.value = 600f;
this.knockBackResist = 0.0f;
this.npcSlots = 0.75f;
}
else if (this.type == 386)
{
this.lifeMax = 400;
this.defense = 34;
this.damage = 40;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.HitSound = SoundID.NPCHit43;
this.DeathSound = SoundID.NPCDeath45;
this.value = 1200f;
this.knockBackResist = 0.4f;
}
else if (this.type == 387)
{
this.width = 20;
this.height = 50;
this.aiStyle = 73;
this.damage = 10;
this.defense = 40;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit53;
this.DeathSound = SoundID.NPCDeath56;
this.knockBackResist = 0.0f;
this.buffImmune[31] = true;
this.canGhostHeal = false;
}
else if (this.type == 388)
{
this.width = 40;
this.height = 30;
this.aiStyle = 74;
this.damage = 60;
this.defense = 16;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit42;
this.knockBackResist = 0.4f;
this.DeathSound = SoundID.NPCDeath44;
this.value = 1000f;
this.noTileCollide = true;
this.noGravity = true;
this.npcSlots = 1.5f;
this.canGhostHeal = false;
}
else if (this.type == 389)
{
this.lifeMax = 600;
this.defense = 38;
this.damage = 75;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.HitSound = SoundID.NPCHit39;
this.DeathSound = SoundID.NPCDeath57;
this.value = 1200f;
this.npcSlots = 0.5f;
this.knockBackResist = 0.3f;
}
else if (this.type == 390)
{
this.damage = 65;
this.defense = 30;
this.lifeMax = 350;
this.width = 18;
this.height = 40;
this.aiStyle = 75;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 1200f;
this.npcSlots = 0.5f;
}
else if (this.type == 391)
{
this.lifeMax = 600;
this.defense = 30;
this.damage = 85;
this.width = 60;
this.height = 40;
this.aiStyle = 3;
this.HitSound = SoundID.NPCHit51;
this.DeathSound = SoundID.NPCDeath54;
this.value = 1200f;
this.npcSlots = 0.5f;
this.knockBackResist = 0.1f;
}
else if (this.type == 392)
{
this.lifeMax = 100;
this.defense = 100;
this.damage = 50;
this.width = 150;
this.height = 80;
this.aiStyle = 75;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.dontTakeDamage = true;
flag = true;
this.netAlways = true;
}
else if (this.type == 393)
{
this.lifeMax = 5000;
this.defense = 20;
this.damage = 60;
this.width = 40;
this.height = 16;
this.aiStyle = 75;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.value = 0.0f;
this.npcSlots = 1f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
flag = true;
this.netAlways = true;
}
else if (this.type == 394)
{
this.lifeMax = 3500;
this.defense = 20;
this.damage = 60;
this.width = 46;
this.height = 36;
this.aiStyle = 75;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.value = 0.0f;
this.npcSlots = 1f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
flag = true;
this.netAlways = true;
}
else if (this.type == 395)
{
this.lifeMax = 10000;
this.defense = 0;
this.damage = 80;
this.width = 46;
this.height = 36;
this.aiStyle = 76;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.value = 0.0f;
this.npcSlots = 6f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.dontTakeDamage = true;
this.boss = true;
flag = true;
this.netAlways = true;
}
else if (this.type == 399)
{
this.defense = 5;
this.damage = 5;
this.lifeMax = 500;
this.aiStyle = 80;
this.width = 42;
this.height = 72;
this.value = 0.0f;
this.knockBackResist = 0.0f;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.npcSlots = 0.0f;
this.noGravity = true;
this.timeLeft = NPC.activeTime * 30;
this.chaseable = false;
this.netAlways = true;
this.rarity = 1;
}
else if (this.type == 396)
{
this.lifeMax = 45000;
this.defense = 50;
this.damage = 0;
this.width = 38;
this.height = 56;
this.aiStyle = 79;
this.HitSound = SoundID.NPCHit57;
this.DeathSound = SoundID.NPCDeath62;
this.value = 0.0f;
this.npcSlots = 6f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.boss = true;
this.hide = true;
this.netAlways = true;
}
else if (this.type == 397)
{
this.lifeMax = 25000;
this.defense = 40;
this.damage = 0;
this.width = 46;
this.height = 66;
this.aiStyle = 78;
this.HitSound = SoundID.NPCHit57;
this.DeathSound = SoundID.NPCDeath62;
this.value = 0.0f;
this.npcSlots = 6f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.boss = true;
this.hide = true;
this.netAlways = true;
}
else if (this.type == 398)
{
this.lifeMax = 50000;
this.defense = 70;
this.damage = 0;
this.width = 46;
this.height = 66;
this.aiStyle = 77;
this.HitSound = SoundID.NPCHit57;
this.DeathSound = (LegacySoundStyle) null;
this.value = 0.0f;
this.npcSlots = 6f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.dontTakeDamage = true;
this.boss = true;
this.behindTiles = true;
this.hide = true;
this.netAlways = true;
}
else if (this.type == 400)
{
this.defense = 0;
this.damage = 60;
this.lifeMax = 100;
this.aiStyle = 81;
this.width = 60;
this.height = 60;
this.value = 0.0f;
this.knockBackResist = 0.0f;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.0f;
this.noGravity = true;
this.dontTakeDamage = true;
this.noTileCollide = true;
this.netAlways = true;
}
else if (this.type == 401)
{
this.lifeMax = 400;
this.defense = 0;
this.damage = 0;
this.width = 30;
this.height = 30;
this.aiStyle = 82;
this.HitSound = SoundID.NPCHit57;
this.DeathSound = SoundID.NPCDeath62;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.hide = true;
}
else if (this.type == 437)
{
this.lifeMax = 400;
this.defense = 0;
this.damage = 0;
this.width = 54;
this.height = 54;
this.aiStyle = 83;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.dontTakeDamage = true;
this.netAlways = true;
}
else if (this.type == 438)
{
this.lifeMax = 400;
this.defense = 0;
this.damage = 0;
this.width = 22;
this.height = 40;
this.aiStyle = 83;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.knockBackResist = 0.0f;
this.lavaImmune = true;
this.netAlways = true;
this.chaseable = false;
}
else if (this.type == 439)
{
this.width = 24;
this.height = 50;
this.aiStyle = 84;
this.damage = 50;
this.defense = 42;
this.lifeMax = 32000;
this.knockBackResist = 0.0f;
this.noTileCollide = true;
this.noGravity = true;
this.npcSlots = 10f;
this.HitSound = SoundID.NPCHit55;
this.DeathSound = SoundID.NPCDeath59;
this.value = 10000f;
this.boss = true;
this.netAlways = true;
this.timeLeft = NPC.activeTime * 30;
flag = true;
}
else if (this.type == 440)
{
this.width = 24;
this.height = 50;
this.aiStyle = 84;
this.damage = 0;
this.defense = 35;
this.lifeMax = 10000;
this.knockBackResist = 0.0f;
this.noTileCollide = true;
this.noGravity = true;
this.npcSlots = 0.0f;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.netAlways = true;
this.timeLeft = NPC.activeTime * 30;
flag = true;
this.chaseable = false;
}
else if (this.type == 442)
{
this.width = 14;
this.height = 14;
this.aiStyle = 24;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2889;
this.npcSlots = 0.4f;
this.rarity = 3;
}
else if (this.type == 443)
{
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2890;
this.rarity = 3;
}
else if (this.type == 444)
{
this.width = 10;
this.height = 10;
this.aiStyle = 65;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.25f;
this.noGravity = true;
this.catchItem = (short) 2891;
this.rarity = 3;
}
else if (this.type == 445)
{
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 2892;
this.rarity = 3;
}
else if (this.type == 446)
{
this.width = 14;
this.height = 12;
this.aiStyle = 1;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.friendly = true;
this.catchItem = (short) 2893;
this.npcSlots = 0.1f;
this.rarity = 3;
}
else if (this.type == 447)
{
this.width = 14;
this.height = 12;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath4;
this.npcSlots = 0.25f;
this.catchItem = (short) 2894;
this.rarity = 3;
}
else if (this.type == 448)
{
this.width = 10;
this.height = 4;
this.aiStyle = 66;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.1f;
this.catchItem = (short) 2895;
this.friendly = true;
this.rarity = 3;
}
else if (this.type == 449)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 8;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 100f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 450)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 12;
this.lifeMax = 55;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 451)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 18;
this.defense = 8;
this.lifeMax = 65;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 120f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 452)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 22;
this.defense = 8;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 110f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 453)
{
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 30;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.npcSlots = 7f;
}
else if (this.type == 454)
{
this.noTileCollide = true;
this.npcSlots = 5f;
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 80;
this.defense = 10;
this.lifeMax = 4000;
this.HitSound = SoundID.NPCHit56;
this.DeathSound = SoundID.NPCDeath60;
this.noGravity = true;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.scale = 1f;
flag = true;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 459)
{
this.noTileCollide = true;
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.HitSound = SoundID.NPCHit56;
this.DeathSound = SoundID.NPCDeath60;
this.noGravity = true;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.scale = 1f;
flag = true;
this.alpha = (int) byte.MaxValue;
this.dontCountMe = true;
}
else if (this.type == 455 || this.type == 456 || this.type == 457 || this.type == 458)
{
this.noTileCollide = true;
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.HitSound = SoundID.NPCHit56;
this.DeathSound = SoundID.NPCDeath60;
this.noGravity = true;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.scale = 1f;
flag = true;
this.alpha = (int) byte.MaxValue;
this.dontCountMe = true;
}
else if (this.type == 464)
{
this.width = 18;
this.height = 20;
this.aiStyle = 3;
this.damage = 21;
this.defense = 5;
this.lifeMax = 75;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 500f;
this.buffImmune[31] = false;
}
else if (this.type == 465)
{
this.noGravity = true;
this.width = 18;
this.height = 20;
this.aiStyle = 16;
this.damage = 31;
this.defense = 7;
this.lifeMax = 110;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 500f;
}
else if (this.type == 470)
{
this.width = 16;
this.height = 34;
this.aiStyle = 3;
this.damage = 21;
this.defense = 5;
this.lifeMax = 75;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 500f;
this.buffImmune[31] = false;
}
else if (this.type == 473 || this.type == 474 || this.type == 475 || this.type == 476)
{
this.width = 28;
this.height = 44;
this.aiStyle = 87;
this.damage = 90;
this.defense = 34;
this.lifeMax = 3500;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath6;
this.value = 30000f;
this.knockBackResist = 0.1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.rarity = 2;
}
else if (this.type == 480)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 30;
this.defense = 20;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.15f;
this.value = 1000f;
}
else if (this.type == 481)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 22;
this.defense = 10;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit2;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.4f;
this.value = 300f;
this.buffImmune[31] = false;
this.buffImmune[20] = true;
}
else if (this.type == 482)
{
this.width = 28;
this.height = 48;
this.aiStyle = 3;
this.damage = 30;
this.defense = 18;
this.lifeMax = 110;
this.HitSound = SoundID.NPCHit41;
this.DeathSound = SoundID.NPCDeath44;
this.knockBackResist = 0.35f;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
}
else if (this.type == 483)
{
this.npcSlots = 0.5f;
this.width = 20;
this.height = 30;
this.aiStyle = 91;
this.damage = 24;
this.defense = 8;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit7;
this.knockBackResist = 0.6f;
this.DeathSound = SoundID.NPCDeath6;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
}
else if (this.type >= 484 && this.type <= 487)
{
this.width = 10;
this.height = 4;
this.aiStyle = 66;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.1f;
this.catchItem = (short) (3191 + this.type - 484);
this.friendly = true;
}
else if (this.type == 488)
{
this.width = 18;
this.height = 40;
this.aiStyle = 92;
this.damage = 0;
this.defense = 0;
this.lifeMax = 1000;
this.HitSound = SoundID.NPCHit15;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.immortal = true;
this.netAlways = true;
}
else if (this.type == 489)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 8;
this.lifeMax = 75;
this.HitSound = SoundID.NPCHit18;
this.DeathSound = SoundID.NPCDeath21;
this.knockBackResist = 0.4f;
this.value = 150f;
this.buffImmune[31] = false;
}
else if (this.type == 490)
{
this.noGravity = true;
this.width = 28;
this.height = 30;
this.aiStyle = 22;
this.damage = 28;
this.defense = 14;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit19;
this.knockBackResist = 0.6f;
this.DeathSound = SoundID.NPCDeath22;
this.value = 150f;
this.buffImmune[31] = false;
}
else if (this.type == 491)
{
this.noGravity = true;
this.width = 350;
this.height = 120;
this.aiStyle = 93;
this.damage = 0;
this.defense = 100;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit19;
this.knockBackResist = 0.0f;
this.DeathSound = SoundID.NPCDeath22;
this.value = 0.0f;
flag = true;
this.dontTakeDamage = true;
this.netAlways = true;
}
else if (this.type == 492)
{
this.lifeMax = 2000;
this.defense = 20;
this.damage = 30;
this.width = 30;
this.height = 30;
this.aiStyle = 75;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.value = 0.0f;
this.npcSlots = 1f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
flag = true;
this.hide = true;
this.netAlways = true;
}
else if (this.type >= 494 && this.type <= 495)
{
this.width = 28;
this.height = 22;
this.aiStyle = 3;
this.damage = 28;
this.defense = 6;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit33;
this.DeathSound = SoundID.NPCDeath36;
this.value = 120f;
}
else if (this.type >= 496 && this.type <= 497)
{
this.width = 28;
this.height = 22;
this.aiStyle = 39;
this.damage = 16;
this.defense = 12;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit38;
this.DeathSound = SoundID.NPCDeath41;
this.knockBackResist = 0.75f;
this.value = 120f;
}
else if (this.type >= 498 && this.type <= 506)
{
this.width = 24;
this.height = 44;
this.aiStyle = 3;
this.damage = 18;
this.defense = 10;
this.lifeMax = 65;
this.HitSound = SoundID.NPCHit50;
this.DeathSound = SoundID.NPCDeath53;
this.knockBackResist = 0.45f;
this.value = 120f;
this.buffImmune[31] = false;
}
else if (this.type == 441)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 513)
{
this.npcSlots = 4f;
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.damage = 34;
this.defense = 0;
this.lifeMax = 80;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 140f;
}
else if (this.type == 514)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 18;
this.defense = 12;
this.lifeMax = 80;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 140f;
this.dontCountMe = true;
this.npcSlots = 0.0f;
}
else if (this.type == 515)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 16;
this.defense = 20;
this.lifeMax = 80;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 140f;
this.dontCountMe = true;
this.npcSlots = 0.0f;
}
else if (this.type == 510)
{
this.npcSlots = 5f;
this.width = 34;
this.height = 34;
this.aiStyle = 6;
this.damage = 58;
this.defense = 18;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 700f;
}
else if (this.type == 511)
{
this.width = 34;
this.height = 34;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 54;
this.defense = 28;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 700f;
this.dontCountMe = true;
this.npcSlots = 0.0f;
}
else if (this.type == 512)
{
this.width = 34;
this.height = 34;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 50;
this.defense = 34;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 700f;
this.dontCountMe = true;
this.npcSlots = 0.0f;
}
else if (this.type == 508)
{
this.width = 33;
this.height = 31;
this.aiStyle = 3;
this.damage = 24;
this.defense = 16;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit31;
this.DeathSound = SoundID.NPCDeath34;
this.knockBackResist = 0.2f;
this.value = 80f;
this.buffImmune[31] = false;
this.npcSlots = 0.8f;
}
else if (this.type == 509)
{
this.width = 40;
this.height = 31;
this.aiStyle = 44;
this.damage = 30;
this.defense = 12;
this.lifeMax = 50;
this.knockBackResist = 0.6f;
this.HitSound = SoundID.NPCHit32;
this.DeathSound = SoundID.NPCDeath35;
this.value = 90f;
this.buffImmune[31] = false;
this.npcSlots = 0.8f;
}
else if (this.type >= 524 && this.type <= 527)
{
this.width = 24;
this.height = 44;
this.aiStyle = 3;
this.damage = 50;
this.defense = 26;
this.lifeMax = 180;
this.HitSound = SoundID.NPCHit37;
this.DeathSound = SoundID.NPCDeath40;
this.knockBackResist = 0.6f;
this.value = 500f;
this.buffImmune[31] = false;
this.npcSlots = 0.5f;
switch (this.type)
{
case 525:
this.lifeMax += 70;
this.defense += 4;
this.damage += 10;
this.knockBackResist -= 0.1f;
this.value += 150f;
break;
case 526:
this.lifeMax += 40;
this.defense += 6;
this.damage += 14;
this.knockBackResist -= 0.1f;
this.value += 150f;
break;
case 527:
this.lifeMax += 120;
this.defense += 6;
this.damage += 4;
this.knockBackResist -= 0.2f;
this.value += 250f;
break;
}
}
else if (this.type >= 528 && this.type <= 529)
{
this.width = 24;
this.height = 44;
this.aiStyle = 3;
this.damage = 52;
this.defense = 28;
this.lifeMax = 350;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.35f;
this.value = 600f;
this.buffImmune[31] = false;
}
else if (this.type == 530)
{
this.width = 50;
this.height = 20;
this.aiStyle = 3;
this.damage = 66;
this.defense = 24;
this.lifeMax = 320;
this.HitSound = SoundID.NPCHit13;
this.DeathSound = SoundID.NPCDeath19;
this.knockBackResist = 0.5f;
this.value = 600f;
this.timeLeft = NPC.activeTime * 2;
this.buffImmune[20] = true;
this.buffImmune[70] = true;
}
else if (this.type == 531)
{
this.noGravity = true;
this.width = 36;
this.height = 36;
this.aiStyle = 40;
this.damage = 66;
this.defense = 24;
this.lifeMax = 320;
this.HitSound = SoundID.NPCHit13;
this.DeathSound = SoundID.NPCDeath19;
this.knockBackResist = 0.5f;
this.value = 600f;
this.timeLeft = NPC.activeTime * 2;
this.buffImmune[20] = true;
this.buffImmune[70] = true;
}
else if (this.type == 532)
{
this.width = 32;
this.height = 31;
this.aiStyle = 3;
this.damage = 65;
this.defense = 34;
this.lifeMax = 270;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.3f;
this.value = 800f;
this.buffImmune[31] = false;
this.npcSlots = 0.75f;
}
else if (this.type == 533)
{
this.width = 28;
this.height = 62;
this.aiStyle = 8;
this.damage = 40;
this.defense = 20;
this.lifeMax = 220;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.0f;
this.value = 1200f;
this.npcSlots = 2f;
flag = true;
}
else if (this.type == 493)
{
this.lifeMax = 20000;
this.defense = 20;
this.damage = 0;
this.width = 130;
this.height = 270;
this.aiStyle = 94;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 0.0f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
flag = true;
this.npcSlots = 0.0f;
}
else if (this.type == 402)
{
this.noTileCollide = true;
this.npcSlots = 1f;
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 80;
this.defense = 10;
this.lifeMax = 1200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.scale = 1f;
flag = true;
}
else if (this.type == 405)
{
this.width = 44;
this.height = 44;
this.aiStyle = 85;
this.damage = 120;
this.defense = 50;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.noGravity = true;
this.buffImmune[31] = true;
this.npcSlots = 2f;
}
else if (this.type == 406)
{
this.width = 22;
this.height = 22;
this.aiStyle = 95;
this.damage = 70;
this.defense = 0;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.4f;
this.noGravity = true;
this.buffImmune[31] = true;
}
else if (this.type == 411)
{
this.width = 22;
this.height = 56;
this.aiStyle = 3;
this.damage = 80;
this.defense = 34;
this.lifeMax = 700;
this.HitSound = SoundID.NPCHit6;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.4f;
this.buffImmune[31] = false;
}
else if (this.type == 409)
{
this.width = 34;
this.height = 42;
this.aiStyle = 3;
this.damage = 70;
this.defense = 40;
this.lifeMax = 800;
this.HitSound = SoundID.NPCHit6;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.4f;
this.buffImmune[31] = false;
this.npcSlots = 3f;
}
else if (this.type == 410)
{
this.width = 22;
this.height = 22;
this.aiStyle = 26;
this.damage = 80;
this.defense = 10;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath5;
this.knockBackResist = 0.3f;
this.buffImmune[31] = false;
this.npcSlots = 0.5f;
}
else if (this.type == 407)
{
this.width = 40;
this.height = 60;
this.aiStyle = 96;
this.damage = 70;
this.defense = 38;
this.lifeMax = 1500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.knockBackResist = 0.03f;
this.buffImmune[31] = true;
this.npcSlots = 3f;
}
else if (this.type == 507)
{
this.lifeMax = 20000;
this.defense = 20;
this.damage = 0;
this.width = 130;
this.height = 270;
this.aiStyle = 94;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 0.0f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
flag = true;
this.npcSlots = 0.0f;
}
else if (this.type == 423)
{
this.width = 50;
this.height = 44;
this.aiStyle = 26;
this.damage = 90;
this.defense = 46;
this.lifeMax = 850;
this.HitSound = SoundID.NPCHit6;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.2f;
flag = true;
this.npcSlots = 1f;
}
else if (this.type == 421)
{
this.width = 44;
this.height = 44;
this.aiStyle = 85;
this.damage = 70;
this.defense = 34;
this.lifeMax = 330;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.noGravity = true;
this.buffImmune[31] = true;
this.npcSlots = 1f;
}
else if (this.type == 424)
{
this.width = 22;
this.height = 56;
this.aiStyle = 3;
this.damage = 80;
this.defense = 30;
this.lifeMax = 700;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath5;
this.knockBackResist = 0.6f;
this.buffImmune[31] = false;
this.npcSlots = 2f;
}
else if (this.type == 420)
{
this.width = 40;
this.height = 40;
this.aiStyle = 97;
this.damage = 75;
this.defense = 20;
this.lifeMax = 1300;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.noTileCollide = true;
this.noGravity = true;
this.npcSlots = 3f;
}
else if (this.type == 422)
{
this.lifeMax = 20000;
this.defense = 20;
this.damage = 0;
this.width = 130;
this.height = 270;
this.aiStyle = 94;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 0.0f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
flag = true;
this.npcSlots = 0.0f;
}
else if (this.type == 425)
{
this.width = 30;
this.height = 56;
this.aiStyle = 3;
this.damage = 100;
this.defense = 40;
this.lifeMax = 800;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.4f;
this.buffImmune[31] = false;
}
else if (this.type == 429)
{
this.width = 22;
this.height = 56;
this.aiStyle = 3;
this.damage = 90;
this.defense = 34;
this.lifeMax = 700;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath5;
this.knockBackResist = 0.6f;
this.buffImmune[31] = false;
this.npcSlots = 2f;
}
else if (this.type == 428)
{
this.width = 24;
this.height = 26;
this.aiStyle = 3;
this.damage = 50;
this.defense = 6;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
}
else if (this.type == 427)
{
this.width = 40;
this.height = 28;
this.aiStyle = 3;
this.damage = 75;
this.defense = 20;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.5f;
this.buffImmune[31] = false;
this.npcSlots = 0.5f;
}
else if (this.type == 426)
{
this.width = 50;
this.height = 62;
this.aiStyle = 3;
this.damage = 100;
this.defense = 44;
this.lifeMax = 1000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.3f;
this.buffImmune[31] = false;
}
else if (this.type == 517)
{
this.lifeMax = 20000;
this.defense = 20;
this.damage = 0;
this.width = 130;
this.height = 270;
this.aiStyle = 94;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 0.0f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
flag = true;
this.npcSlots = 0.0f;
}
else if (this.type == 412)
{
this.width = 20;
this.height = 20;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 150;
this.defense = 1000;
this.lifeMax = 10000;
this.HitSound = SoundID.NPCHit11;
this.DeathSound = SoundID.NPCDeath22;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.dontTakeDamage = true;
this.npcSlots = 2f;
}
else if (this.type == 413)
{
this.width = 20;
this.height = 20;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 100;
this.defense = 1000;
this.lifeMax = 10000;
this.HitSound = SoundID.NPCHit11;
this.DeathSound = SoundID.NPCDeath22;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.dontCountMe = true;
this.dontTakeDamage = true;
this.npcSlots = 0.0f;
}
else if (this.type == 414)
{
this.width = 20;
this.height = 20;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 50;
this.defense = 0;
this.lifeMax = 10000;
this.HitSound = SoundID.NPCHit8;
this.DeathSound = SoundID.NPCDeath22;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.dontCountMe = true;
this.takenDamageMultiplier = 10f;
this.npcSlots = 0.0f;
}
else if (this.type == 415)
{
this.lifeMax = 800;
this.defense = 32;
this.damage = 55;
this.width = 60;
this.height = 40;
this.aiStyle = 3;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.2f;
}
else if (this.type == 416)
{
this.damage = 80;
this.defense = 28;
this.lifeMax = 800;
this.width = 18;
this.height = 40;
this.aiStyle = 75;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.2f;
}
else if (this.type == 518)
{
this.lifeMax = 1000;
this.defense = 28;
this.damage = 80;
this.width = 22;
this.height = 56;
this.aiStyle = 3;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.4f;
}
else if (this.type == 417)
{
this.npcSlots = 2f;
this.width = 46;
this.height = 32;
this.aiStyle = 39;
this.damage = 80;
this.defense = 34;
this.lifeMax = 700;
this.HitSound = SoundID.NPCHit7;
this.knockBackResist = 0.0f;
this.DeathSound = SoundID.NPCDeath5;
}
else if (this.type == 418)
{
this.width = 38;
this.height = 38;
this.aiStyle = 74;
this.damage = 70;
this.defense = 26;
this.lifeMax = 600;
this.HitSound = SoundID.NPCHit3;
this.DeathSound = SoundID.NPCDeath3;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.2f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else if (this.type == 419)
{
this.lifeMax = 800;
this.defense = 30;
this.damage = 90;
this.width = 22;
this.height = 56;
this.aiStyle = 3;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.4f;
}
else if (this.type == 516)
{
this.width = 26;
this.height = 26;
this.aiStyle = 9;
this.damage = 100;
this.defense = 0;
this.lifeMax = 1;
this.HitSound = (LegacySoundStyle) null;
this.DeathSound = (LegacySoundStyle) null;
this.noGravity = true;
this.noTileCollide = false;
this.alpha = 0;
this.knockBackResist = 0.0f;
}
else if (this.type == 519)
{
this.width = 26;
this.height = 26;
this.aiStyle = 99;
this.damage = 120;
this.defense = 0;
this.lifeMax = 1;
this.HitSound = (LegacySoundStyle) null;
this.DeathSound = (LegacySoundStyle) null;
this.noGravity = true;
this.noTileCollide = false;
this.alpha = 0;
this.knockBackResist = 0.0f;
}
else if (this.type == 162)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 65;
this.defense = 18;
this.lifeMax = 350;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.3f;
this.value = 600f;
this.buffImmune[31] = false;
}
else if (this.type == 166)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 26;
this.lifeMax = 450;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.2f;
this.value = 1000f;
this.buffImmune[31] = false;
this.buffImmune[20] = true;
}
else if (this.type == 253)
{
this.noGravity = true;
this.noTileCollide = true;
this.width = 24;
this.height = 44;
this.aiStyle = 22;
this.damage = 80;
this.defense = 22;
this.lifeMax = 700;
this.HitSound = SoundID.NPCHit49;
this.DeathSound = SoundID.NPCDeath51;
this.alpha = 100;
this.value = 1500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.6f;
}
else if (this.type == 158)
{
this.npcSlots = 2f;
this.width = 22;
this.height = 22;
this.aiStyle = 14;
this.damage = 60;
this.defense = 32;
this.lifeMax = 750;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.75f;
this.DeathSound = SoundID.NPCDeath6;
this.value = 5000f;
this.buffImmune[31] = false;
}
else if (this.type == 159)
{
this.npcSlots = 2f;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 80;
this.defense = 24;
this.lifeMax = 750;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.4f;
this.value = 5000f;
this.buffImmune[31] = false;
}
else if (this.type == 460)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 30;
this.lifeMax = 700;
this.HitSound = SoundID.NPCHit7;
this.DeathSound = SoundID.NPCDeath17;
this.knockBackResist = 0.25f;
this.value = 1000f;
this.buffImmune[31] = false;
}
else if (this.type == 461)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 22;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.3f;
this.value = 1000f;
}
else if (this.type == 462)
{
this.width = 20;
this.height = 24;
this.aiStyle = 3;
this.damage = 70;
this.defense = 14;
this.lifeMax = 270;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.7f;
this.value = 600f;
this.buffImmune[31] = false;
this.npcSlots = 0.5f;
}
else if (this.type == 463)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 100;
this.defense = 34;
this.lifeMax = 4000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.1f;
this.value = 3000f;
}
else if (this.type == 466)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 40;
this.lifeMax = 550;
this.HitSound = SoundID.NPCHit48;
this.DeathSound = SoundID.NPCDeath50;
this.knockBackResist = 0.5f;
this.value = 1500f;
}
else if (this.type == 467)
{
this.width = 22;
this.height = 22;
this.aiStyle = 85;
this.damage = 100;
this.defense = 80;
this.lifeMax = 350;
this.HitSound = SoundID.NPCHit34;
this.DeathSound = SoundID.NPCDeath37;
this.value = 900f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.7f;
this.noGravity = true;
}
else if (this.type == 469)
{
this.width = 38;
this.height = 26;
this.aiStyle = 3;
this.damage = 68;
this.defense = 28;
this.lifeMax = 600;
this.HitSound = SoundID.NPCHit47;
this.DeathSound = SoundID.NPCDeath49;
this.knockBackResist = 0.35f;
this.value = 1300f;
}
else if (this.type == 468)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 65;
this.defense = 24;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit35;
this.DeathSound = SoundID.NPCDeath38;
this.knockBackResist = 0.6f;
this.value = 1300f;
}
else if (this.type == 477)
{
this.noGravity = true;
this.width = 80;
this.height = 50;
this.aiStyle = 88;
this.damage = 80;
this.defense = 30;
this.lifeMax = 6000;
this.HitSound = SoundID.NPCHit44;
this.DeathSound = SoundID.NPCDeath46;
this.value = 50000f;
this.knockBackResist = 0.2f;
this.buffImmune[20] = true;
}
else if (this.type == 478)
{
this.width = 34;
this.height = 34;
this.aiStyle = 89;
this.damage = 0;
this.defense = 30;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 0.0f;
this.knockBackResist = 0.7f;
flag = true;
this.npcSlots = 0.0f;
}
else if (this.type == 479)
{
this.width = 46;
this.height = 30;
this.aiStyle = 90;
this.damage = 50;
this.defense = 14;
this.lifeMax = 700;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.3f;
this.value = 0.0f;
this.npcSlots = 0.1f;
}
else if (this.type == 26)
{
this.scale = 0.9f;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 12;
this.defense = 4;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.8f;
this.value = 100f;
this.buffImmune[31] = false;
}
else if (this.type == 27)
{
this.scale = 0.95f;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 6;
this.lifeMax = 80;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.7f;
this.value = 200f;
this.buffImmune[31] = false;
}
else if (this.type == 28)
{
this.scale = 1.1f;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 25;
this.defense = 8;
this.lifeMax = 110;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.value = 150f;
this.buffImmune[31] = false;
}
else if (this.type == 29)
{
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 20;
this.defense = 2;
this.lifeMax = 40;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.6f;
this.value = 200f;
}
else if (this.type == 30)
{
this.width = 16;
this.height = 16;
this.aiStyle = 9;
this.damage = 20;
this.defense = 0;
this.lifeMax = 1;
this.HitSound = SoundID.NPCHit3;
this.DeathSound = SoundID.NPCDeath3;
this.noGravity = true;
this.noTileCollide = true;
this.alpha = 100;
this.knockBackResist = 0.0f;
}
else if (this.type == 111)
{
this.scale = 0.95f;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 6;
this.lifeMax = 80;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.7f;
this.value = 200f;
this.buffImmune[31] = false;
}
else if (this.type == 471)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 80;
this.defense = 26;
this.lifeMax = 2000;
this.HitSound = SoundID.NPCHit40;
this.DeathSound = SoundID.NPCDeath42;
this.knockBackResist = 0.15f;
this.value = 5000f;
flag = true;
}
else if (this.type == 472)
{
this.width = 40;
this.height = 24;
this.aiStyle = 86;
this.damage = 50;
this.defense = 18;
this.lifeMax = 180;
this.HitSound = SoundID.NPCHit52;
this.DeathSound = SoundID.NPCDeath55;
this.knockBackResist = 0.0f;
this.value = 0.0f;
flag = true;
this.npcSlots = 0.1f;
}
else if (this.type == 520)
{
this.width = 34;
this.height = 110;
this.aiStyle = 3;
this.damage = 60;
this.defense = 40;
this.lifeMax = 2000;
this.HitSound = SoundID.NPCHit4;
this.DeathSound = SoundID.NPCDeath14;
this.knockBackResist = 0.0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
}
else if (this.type == 521)
{
this.width = 60;
this.height = 60;
this.aiStyle = 86;
this.damage = 90;
this.defense = 30;
this.lifeMax = 2000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.0f;
flag = true;
}
else if (this.type == 522)
{
this.width = 26;
this.height = 26;
this.aiStyle = 100;
this.damage = 120;
this.defense = 0;
this.lifeMax = 1;
this.HitSound = (LegacySoundStyle) null;
this.DeathSound = (LegacySoundStyle) null;
this.noGravity = true;
this.noTileCollide = true;
this.alpha = 0;
this.knockBackResist = 0.0f;
this.chaseable = false;
}
else if (this.type == 523)
{
this.width = 42;
this.height = 42;
this.aiStyle = 101;
this.damage = 30;
this.defense = 0;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.noGravity = true;
this.noTileCollide = true;
this.alpha = 0;
this.knockBackResist = 0.0f;
this.chaseable = false;
this.alpha = (int) byte.MaxValue;
this.canGhostHeal = false;
}
else if (this.type == 534)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 14;
this.defense = 20;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.3f;
this.value = 0.0f;
this.buffImmune[31] = false;
this.lavaImmune = true;
this.netAlways = true;
this.rarity = 1;
}
else if (this.type == 535)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 14;
this.defense = 5;
this.lifeMax = 50;
this.scale = 1.1f;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 0;
this.value = 40f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 536)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 14;
this.defense = 8;
this.lifeMax = 200;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.5f;
this.value = 1000f;
this.buffImmune[31] = false;
this.rarity = 2;
}
else if (this.type == 537)
{
this.npcSlots = 2f;
this.width = 30;
this.height = 24;
this.aiStyle = 1;
this.damage = 11;
this.defense = 8;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.alpha = 50;
this.color = new Color((int) byte.MaxValue, 250, 0, 0) * 0.2f;
this.value = 75f;
this.knockBackResist = 0.8f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else if (this.type == 538)
{
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 3563;
}
else if (this.type == 539)
{
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.catchItem = (short) 3564;
this.rarity = 3;
}
else if (this.type == 541)
{
this.width = 30;
this.height = 76;
this.aiStyle = 102;
this.damage = 40;
this.defense = 30;
this.lifeMax = 5000;
this.HitSound = SoundID.NPCHit23;
this.DeathSound = SoundID.NPCDeath39;
this.knockBackResist = 0.05f;
this.value = (float) Item.buyPrice(gold: 1, silver: 50);
this.buffImmune[20] = true;
this.buffImmune[44] = true;
this.rarity = 2;
}
else if (this.type == 542)
{
this.noGravity = true;
this.width = 100;
this.height = 24;
this.aiStyle = 103;
this.damage = 50;
this.defense = 20;
this.lifeMax = 360;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 400f;
this.knockBackResist = 0.9f;
this.behindTiles = true;
}
else if (this.type == 543)
{
this.noGravity = true;
this.width = 100;
this.height = 24;
this.aiStyle = 103;
this.damage = 60;
this.defense = 24;
this.lifeMax = 380;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 400f;
this.knockBackResist = 0.8f;
this.behindTiles = true;
}
else if (this.type == 544)
{
this.noGravity = true;
this.width = 100;
this.height = 24;
this.aiStyle = 103;
this.damage = 64;
this.defense = 22;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 400f;
this.knockBackResist = 0.8f;
this.behindTiles = true;
}
else if (this.type == 545)
{
this.noGravity = true;
this.width = 100;
this.height = 24;
this.aiStyle = 103;
this.damage = 54;
this.defense = 26;
this.lifeMax = 450;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 400f;
this.knockBackResist = 0.7f;
this.behindTiles = true;
}
else if (this.type == 546)
{
this.width = 30;
this.height = 30;
this.aiStyle = 26;
this.damage = 30;
this.defense = 10;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit11;
this.DeathSound = SoundID.NPCDeath15;
this.knockBackResist = 0.8f;
this.value = 130f;
this.behindTiles = true;
}
else if (this.type == 547)
{
this.width = 16;
this.height = 16;
this.aiStyle = 104;
this.defense = 10;
this.lifeMax = 10;
this.HitSound = SoundID.NPCHit11;
this.DeathSound = SoundID.NPCDeath15;
this.knockBackResist = 1f;
this.noGravity = true;
this.noTileCollide = true;
}
else if (this.type == 548)
{
this.width = 40;
this.height = 40;
this.aiStyle = 105;
this.defense = 14;
this.lifeMax = 1000;
this.HitSound = SoundID.DD2_CrystalCartImpact;
this.DeathSound = SoundID.NPCDeath15;
this.knockBackResist = 0.0f;
this.friendly = true;
this.npcSlots = 0.0f;
this.hide = true;
if (Main.hardMode && NPC.downedMechBossAny)
{
this.defense = 18;
this.lifeMax = 3000;
}
if (NPC.downedGolemBoss && Main.hardMode)
{
this.defense = 20;
this.lifeMax = 5000;
}
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 549)
{
this.lifeMax = 5;
this.defense = 20;
this.damage = 0;
this.width = 78;
this.height = 130;
this.aiStyle = 106;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.value = 0.0f;
this.knockBackResist = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
flag = true;
this.npcSlots = 0.0f;
this.behindTiles = true;
this.dontTakeDamage = true;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 552)
{
this.lifeMax = 30;
this.defense = 14;
this.damage = 18;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_GoblinHurt;
this.DeathSound = SoundID.DD2_GoblinDeath;
this.knockBackResist = 0.2f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 553)
{
this.lifeMax = 170;
this.defense = 20;
this.damage = 46;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_GoblinHurt;
this.DeathSound = SoundID.DD2_GoblinDeath;
this.knockBackResist = 0.2f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 554)
{
this.lifeMax = 560;
this.defense = 28;
this.damage = 70;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_GoblinHurt;
this.DeathSound = SoundID.DD2_GoblinDeath;
this.knockBackResist = 0.15f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 561)
{
this.lifeMax = 60;
this.defense = 18;
this.damage = 30;
this.width = 26;
this.height = 52;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_JavelinThrowersHurt;
this.DeathSound = SoundID.DD2_JavelinThrowersDeath;
this.knockBackResist = 0.1f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 562)
{
this.lifeMax = 300;
this.defense = 28;
this.damage = 60;
this.width = 26;
this.height = 52;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_JavelinThrowersHurt;
this.DeathSound = SoundID.DD2_JavelinThrowersDeath;
this.knockBackResist = 0.1f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 563)
{
this.lifeMax = 1000;
this.defense = 38;
this.damage = 80;
this.width = 26;
this.height = 52;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_JavelinThrowersHurt;
this.DeathSound = SoundID.DD2_JavelinThrowersDeath;
this.knockBackResist = 0.05f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 555)
{
this.lifeMax = 50;
this.defense = 16;
this.damage = 26;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_GoblinBomberHurt;
this.DeathSound = SoundID.DD2_GoblinBomberDeath;
this.knockBackResist = 0.2f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 556)
{
this.lifeMax = 200;
this.defense = 26;
this.damage = 55;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_GoblinBomberHurt;
this.DeathSound = SoundID.DD2_GoblinBomberDeath;
this.knockBackResist = 0.2f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 557)
{
this.lifeMax = 700;
this.defense = 34;
this.damage = 75;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_GoblinBomberHurt;
this.DeathSound = SoundID.DD2_GoblinBomberDeath;
this.knockBackResist = 0.15f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 558)
{
this.width = 38;
this.height = 38;
this.aiStyle = 108;
this.damage = 30;
this.defense = 4;
this.lifeMax = 60;
this.HitSound = SoundID.DD2_WyvernHurt;
this.DeathSound = SoundID.DD2_WyvernDeath;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.2f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 559)
{
this.width = 38;
this.height = 38;
this.aiStyle = 108;
this.damage = 75;
this.defense = 16;
this.lifeMax = 180;
this.HitSound = SoundID.DD2_WyvernHurt;
this.DeathSound = SoundID.DD2_WyvernDeath;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.2f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 560)
{
this.width = 38;
this.height = 38;
this.aiStyle = 108;
this.damage = 100;
this.defense = 30;
this.lifeMax = 600;
this.HitSound = SoundID.DD2_WyvernHurt;
this.DeathSound = SoundID.DD2_WyvernDeath;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.05f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 550)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 576)
{
this.lifeMax = 5000;
this.defense = 34;
this.damage = 70;
this.width = 96;
this.height = 124;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_OgreHurt;
this.DeathSound = SoundID.DD2_OgreDeath;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 577)
{
this.lifeMax = 13000;
this.defense = 40;
this.damage = 90;
this.width = 96;
this.height = 124;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_OgreHurt;
this.DeathSound = SoundID.DD2_OgreDeath;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 568)
{
this.lifeMax = 500;
this.defense = 30;
this.damage = 50;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_WitherBeastHurt;
this.DeathSound = SoundID.DD2_WitherBeastDeath;
this.knockBackResist = 0.15f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 569)
{
this.lifeMax = 1400;
this.defense = 40;
this.damage = 80;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_WitherBeastHurt;
this.DeathSound = SoundID.DD2_WitherBeastDeath;
this.knockBackResist = 0.05f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 566)
{
this.lifeMax = 25;
this.defense = 12;
this.damage = 18;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_SkeletonHurt;
this.DeathSound = SoundID.DD2_SkeletonDeath;
this.knockBackResist = 0.3f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 567)
{
this.lifeMax = 480;
this.defense = 22;
this.damage = 70;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_SkeletonHurt;
this.DeathSound = SoundID.DD2_SkeletonDeath;
this.knockBackResist = 0.2f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 572)
{
this.lifeMax = 260;
this.defense = 26;
this.damage = 60;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_KoboldHurt;
this.DeathSound = SoundID.DD2_KoboldDeath;
this.knockBackResist = 0.2f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 573)
{
this.lifeMax = 800;
this.defense = 32;
this.damage = 80;
this.width = 18;
this.height = 40;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_KoboldHurt;
this.DeathSound = SoundID.DD2_KoboldDeath;
this.knockBackResist = 0.1f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 570)
{
this.lifeMax = 900;
this.defense = 30;
this.damage = 60;
this.width = 42;
this.height = 58;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_DrakinHurt;
this.DeathSound = SoundID.DD2_DrakinDeath;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 571)
{
this.lifeMax = 3000;
this.defense = 40;
this.damage = 90;
this.width = 42;
this.height = 58;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_DrakinHurt;
this.DeathSound = SoundID.DD2_DrakinDeath;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 564)
{
this.lifeMax = 800;
this.defense = 18;
this.damage = 40;
this.width = 34;
this.height = 62;
this.aiStyle = 109;
this.HitSound = SoundID.DD2_DarkMageHurt;
this.DeathSound = SoundID.DD2_DarkMageDeath;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.noGravity = true;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 565)
{
this.lifeMax = 4000;
this.defense = 38;
this.damage = 90;
this.width = 34;
this.height = 62;
this.aiStyle = 109;
this.HitSound = SoundID.DD2_DarkMageHurt;
this.DeathSound = SoundID.DD2_DarkMageDeath;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.npcSlots = 0.0f;
this.noGravity = true;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 574)
{
this.width = 38;
this.height = 38;
this.aiStyle = 108;
this.damage = 50;
this.defense = 16;
this.lifeMax = 170;
this.HitSound = SoundID.DD2_KoboldFlyerHurt;
this.DeathSound = SoundID.DD2_KoboldFlyerDeath;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.4f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 575)
{
this.width = 38;
this.height = 38;
this.aiStyle = 108;
this.damage = 80;
this.defense = 32;
this.lifeMax = 580;
this.HitSound = SoundID.DD2_KoboldFlyerHurt;
this.DeathSound = SoundID.DD2_KoboldFlyerDeath;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.25f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 551)
{
this.damage = 80;
this.defense = 38;
this.lifeMax = 50000;
this.width = 190;
this.height = 90;
this.aiStyle = 110;
this.HitSound = SoundID.DD2_BetsyHurt;
this.DeathSound = SoundID.DD2_BetsyDeath;
this.knockBackResist = 0.0f;
this.value = 0.0f;
this.noGravity = true;
this.noTileCollide = true;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 578)
{
this.width = 30;
this.height = 24;
this.aiStyle = 111;
this.damage = 80;
this.defense = 36;
this.lifeMax = 500;
this.HitSound = SoundID.DD2_LightningBugHurt;
this.DeathSound = SoundID.DD2_LightningBugDeath;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.8f;
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
}
else if (this.type == 579)
{
this.friendly = true;
this.width = 34;
this.height = 8;
this.aiStyle = 0;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.5f;
this.scale = 1f;
this.rarity = 1;
}
if (flag)
{
for (int index = 0; index < 206; ++index)
this.buffImmune[index] = true;
}
if (Main.dedServ)
this.frame = new Microsoft.Xna.Framework.Rectangle();
else if (Main.NPCLoaded[this.type])
this.frame = new Microsoft.Xna.Framework.Rectangle(0, 0, Main.npcTexture[this.type].Width, Main.npcTexture[this.type].Height / Main.npcFrameCount[this.type]);
else
this.setFrameSize = true;
if ((double) scaleOverride > 0.0)
{
int num1 = (int) ((double) this.width * (double) this.scale);
int num2 = (int) ((double) this.height * (double) this.scale);
this.position.X += (float) (num1 / 2);
this.position.Y += (float) num2;
this.scale = scaleOverride;
this.width = (int) ((double) this.width * (double) this.scale);
this.height = (int) ((double) this.height * (double) this.scale);
if (this.height == 16 || this.height == 32)
++this.height;
this.position.X -= (float) (this.width / 2);
this.position.Y -= (float) this.height;
}
else
{
this.width = (int) ((double) this.width * (double) this.scale);
this.height = (int) ((double) this.height * (double) this.scale);
}
if (this.buffImmune[20])
this.buffImmune[70] = true;
if (this.buffImmune[39])
this.buffImmune[153] = true;
this.life = this.lifeMax;
this.defDamage = this.damage;
this.defDefense = this.defense;
this.netID = this.type;
if (!Main.expertMode)
return;
this.scaleStats();
}
}
private void LazySetLiquidMovementDD2()
{
this.waterMovementSpeed = 1f;
this.lavaMovementSpeed = 1f;
this.honeyMovementSpeed = 1f;
}
public static void setWorldMonsters()
{
UnifiedRandom unifiedRandom = new UnifiedRandom(Main.worldID);
int num1 = unifiedRandom.Next(3);
int num2 = unifiedRandom.Next(3);
while (num1 == num2)
num1 = unifiedRandom.Next(3);
for (int index1 = 0; index1 < 2; ++index1)
{
int num3 = num1;
if (index1 == 1)
num3 = num2;
for (int index2 = 0; index2 < 3; ++index2)
{
switch (num3)
{
case 0:
NPC.cavernMonsterType[index1, index2] = unifiedRandom.Next(494, 496);
break;
case 1:
NPC.cavernMonsterType[index1, index2] = unifiedRandom.Next(496, 498);
break;
default:
NPC.cavernMonsterType[index1, index2] = unifiedRandom.Next(498, 507);
break;
}
}
}
}
public void scaleStats()
{
if (!Main.expertMode)
return;
if (this.friendly)
{
int life = this.life;
}
if ((this.type < 0 || !NPCID.Sets.NeedsExpertScaling[this.type]) && (this.life <= 5 || this.damage == 0 || this.friendly || this.townNPC))
return;
bool flag = this.type >= 0 && NPCID.Sets.ProjectileNPC[this.type];
if (this.type != 5 && (this.type < 13 || this.type > 15) && this.type != 267 && (this.type < 113 || this.type > 119) && Main.hardMode && !this.boss && this.lifeMax < 1000)
{
int num1 = this.damage + this.defense + this.lifeMax / 4;
if (num1 == 0)
num1 = 1;
int num2 = 80;
if (NPC.downedPlantBoss)
num2 += 20;
if (num1 < num2)
{
float num3 = (float) (num2 / num1);
this.damage = (int) ((double) this.damage * (double) num3 * 0.9);
if (!flag)
{
this.defense = (int) ((double) this.defense * (double) num3);
this.lifeMax = (int) ((double) this.lifeMax * (double) num3 * 1.1);
this.value = (float) (int) ((double) this.value * (double) num3 * 0.8);
}
}
}
if (this.type == 210 || this.type == 211)
{
this.damage = (int) ((double) this.damage * 0.600000023841858);
this.lifeMax = (int) ((double) this.lifeMax * 0.800000011920929);
this.defense = (int) ((double) this.defense * 0.800000011920929);
}
if (!flag)
{
this.value = (float) (int) ((double) this.value * 2.5);
this.lifeMax = (int) ((double) this.lifeMax * (double) Main.expertLife);
}
this.damage = (int) ((double) this.damage * (double) Main.expertDamage);
this.knockBackResist *= Main.expertKnockBack;
int num4 = 0;
float num5 = 1f;
float num6 = 0.35f;
if (Main.netMode != 0)
{
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active)
++num4;
}
for (int index = 1; index < num4; ++index)
{
num5 += num6;
num6 += (float) ((1.0 - (double) num6) / 3.0);
}
}
if ((double) num5 > 8.0)
num5 = (float) (((double) num5 * 2.0 + 8.0) / 3.0);
if ((double) num5 > 1000.0)
num5 = 1000f;
if (this.type == 5)
this.lifeMax = (int) ((double) this.lifeMax * 0.75);
if (this.type == 4)
this.lifeMax = (int) ((double) this.lifeMax * 0.65 * (double) num5);
if (this.type >= 13 && this.type <= 15)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) num5);
if (this.type == 13)
this.damage = (int) ((double) this.damage * 1.1);
if (this.type == 14)
this.damage = (int) ((double) this.damage * 0.8);
if (this.type == 15)
this.damage = (int) ((double) this.damage * 0.8);
this.scale *= 1.2f;
this.defense += 2;
}
if (this.type == 266)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.85 * (double) num5);
this.damage = (int) ((double) this.damage * 0.9);
this.scale *= 1.05f;
}
if (this.type == 50)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) num5);
this.damage = (int) ((double) this.damage * 0.8);
}
if (this.type == 471)
this.lifeMax = (int) ((double) this.lifeMax * 0.85 * ((double) num5 * 2.0 + 1.0) / 3.0);
if (this.type == 472)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.85 * ((double) num5 + 1.0) / 2.0);
this.damage = (int) ((double) this.damage * 0.8);
}
if (this.type == 222)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) num5);
this.damage = (int) ((double) this.damage * 0.9);
}
if (this.type == 210 || this.type == 211)
this.lifeMax = (int) ((double) this.lifeMax * 0.75);
if (this.type == 35)
{
this.lifeMax = (int) ((double) this.lifeMax * (double) num5);
this.damage = (int) ((double) this.damage * 1.1);
}
else if (this.type == 36)
{
this.lifeMax = (int) ((double) this.lifeMax * 1.3 * (double) num5);
this.damage = (int) ((double) this.damage * 1.1);
}
if (this.type == 113 || this.type == 114)
{
this.defense += 6;
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) num5);
this.damage = (int) ((double) this.damage * 1.5);
}
else if (this.type == 115)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) num5);
if (num4 > 1)
this.knockBackResist *= 1f - num6;
this.defense += 6;
}
else if (this.type == 116)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) num5);
if (num4 > 1)
this.knockBackResist *= 1f - num6;
}
else if (this.type == 117 || this.type == 118 || this.type == 119)
this.lifeMax = (int) ((double) this.lifeMax * 0.8);
if (this.type >= 134 && this.type <= 136)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) num5);
if (this.type == 134)
this.damage *= 2;
if (this.type == 135)
this.damage = (int) ((double) this.damage * 0.85);
if (this.type == 136)
this.damage = (int) ((double) this.damage * 0.85);
this.scale *= 1.05f;
}
else if (this.type == 139)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * ((double) num5 * 2.0 + 1.0) / 3.0);
this.damage = (int) ((double) this.damage * 0.8);
this.scale *= 1.05f;
}
if (this.type >= (int) sbyte.MaxValue && this.type <= 131)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) num5);
this.damage = (int) ((double) this.damage * 0.85);
}
if (this.type >= 125 && this.type <= 126)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) num5);
this.damage = (int) ((double) this.damage * 0.85);
}
if (this.type >= 262 && this.type <= 262)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) num5);
this.damage = (int) ((double) this.damage * 1.15);
}
if (this.type >= 245 && this.type <= 249)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) num5);
this.damage = (int) ((double) this.damage * 0.8);
}
if (this.type == 370)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.6 * (double) num5);
this.damage = (int) ((double) this.damage * 0.7);
}
else if (this.type == 371 || this.type == 372 || this.type == 373)
{
if (this.type != 371)
this.lifeMax = (int) ((double) this.lifeMax * 0.75);
this.damage = (int) ((double) this.damage * 0.75);
}
if (this.type == 439 || this.type == 440 || this.type >= 454 && this.type <= 459 || this.type == 522 || this.type == 523)
{
if (this.type != 522)
this.lifeMax = (int) ((double) this.lifeMax * 0.625 * (double) num5);
this.damage = (int) ((double) this.damage * 0.75);
}
if (this.type == 397 || this.type == 396 || this.type == 398)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) num5);
this.damage = (int) ((double) this.damage * 0.75);
}
if (this.type == 551)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) num5);
this.damage = (int) ((double) this.damage * 0.65);
}
switch (this.type)
{
case 305:
case 306:
case 307:
case 308:
case 309:
case 310:
case 311:
case 312:
case 313:
case 314:
case 315:
case 326:
case 329:
case 330:
this.lifeMax = (int) ((double) this.lifeMax * 0.75);
this.damage = (int) ((double) this.damage * 0.75);
break;
case 325:
case 327:
this.lifeMax = (int) ((double) this.lifeMax * 0.65);
this.damage = (int) ((double) this.damage * 0.75);
break;
}
switch (this.type)
{
case 338:
case 339:
case 340:
case 341:
case 342:
case 343:
case 347:
case 348:
case 349:
case 350:
this.lifeMax = (int) ((double) this.lifeMax * 0.75);
this.damage = (int) ((double) this.damage * 0.75);
break;
case 344:
case 345:
case 346:
this.lifeMax = (int) ((double) this.lifeMax * 0.65);
this.damage = (int) ((double) this.damage * 0.75);
break;
}
this.defDefense = this.defense;
this.defDamage = this.damage;
this.life = this.lifeMax;
}
public static bool GetNPCLocation(
int i,
bool seekHead,
bool averageDirection,
out int index,
out Vector2 pos)
{
int type = Main.npc[i].type;
int index1 = -1;
int num1 = -1;
switch (type)
{
case 7:
num1 = 9;
index1 = 0;
break;
case 8:
case 9:
num1 = 7;
index1 = 1;
break;
case 10:
num1 = 12;
index1 = 0;
break;
case 11:
case 12:
num1 = 10;
index1 = 1;
break;
case 13:
num1 = 15;
index1 = 0;
break;
case 14:
case 15:
num1 = 13;
index1 = 1;
break;
case 39:
num1 = 41;
index1 = 0;
break;
case 40:
case 41:
num1 = 39;
index1 = 1;
break;
case 87:
num1 = 92;
index1 = 0;
break;
case 88:
case 89:
case 90:
case 91:
case 92:
num1 = 87;
index1 = 1;
break;
case 95:
num1 = 97;
index1 = 0;
break;
case 96:
case 97:
num1 = 95;
index1 = 1;
break;
case 98:
num1 = 100;
index1 = 0;
break;
case 99:
case 100:
num1 = 98;
index1 = 1;
break;
case 117:
num1 = 119;
index1 = 0;
break;
case 118:
case 119:
num1 = 117;
index1 = 1;
break;
case 134:
num1 = 136;
index1 = 0;
break;
case 135:
case 136:
num1 = 134;
index1 = 1;
break;
case 454:
num1 = 459;
index1 = 0;
break;
case 455:
case 456:
case 457:
case 458:
case 459:
num1 = 454;
index1 = 1;
break;
case 510:
num1 = 512;
index1 = 0;
break;
case 511:
case 512:
num1 = 510;
index1 = 1;
break;
case 513:
num1 = 515;
index1 = 0;
break;
case 514:
case 515:
num1 = 513;
index1 = 1;
break;
}
if (index1 != -1)
{
if (seekHead && index1 == 1)
{
index = -1;
pos = Vector2.Zero;
return false;
}
Vector2 center1 = Main.npc[i].Center;
int index2 = -1;
float num2 = -1f;
int index3 = -1;
Vector2 center2 = Main.player[Main.myPlayer].Center;
int index4 = (int) Main.npc[i].ai[index1];
for (int index5 = 0; index4 >= 0 && index4 < 200 && ++index5 < 100 && Main.npc[index4].active; index4 = (int) Main.npc[index4].ai[index1])
{
if (!averageDirection && (index3 == -1 || (double) Main.npc[index4].Distance(center2) < (double) num2))
{
num2 = Main.npc[index4].Distance(center2);
index3 = index4;
}
if (Main.npc[index4].type == num1)
{
index2 = index4;
break;
}
}
if (index2 >= 0)
{
if (!averageDirection)
{
pos = Main.npc[index3].Center;
index = index3;
}
else
{
Vector2 vector2 = center1 + Main.npc[index2].Center;
pos = vector2 / 2f;
index = index2;
}
return true;
}
pos = Vector2.Zero;
index = -1;
return false;
}
pos = Main.npc[i].Center;
index = i;
return true;
}
public void AI()
{
// ISSUE: The method is too long to display (119166 instructions)
}
private void AI_069_DukeFishron()
{
bool expertMode = Main.expertMode;
float num1 = expertMode ? 0.6f * Main.damageMultiplier : 1f;
bool flag1 = (double) this.life <= (double) this.lifeMax * 0.5;
bool flag2 = expertMode && (double) this.life <= (double) this.lifeMax * 0.15;
bool flag3 = (double) this.ai[0] > 4.0;
bool flag4 = (double) this.ai[0] > 9.0;
bool flag5 = (double) this.ai[3] < 10.0;
if (flag4)
{
this.damage = (int) ((double) this.defDamage * 1.10000002384186 * (double) num1);
this.defense = 0;
}
else if (flag3)
{
this.damage = (int) ((double) this.defDamage * 1.20000004768372 * (double) num1);
this.defense = (int) ((double) this.defDefense * 0.800000011920929);
}
else
{
this.damage = this.defDamage;
this.defense = this.defDefense;
}
int num2 = expertMode ? 40 : 60;
float moveSpeed = expertMode ? 0.55f : 0.45f;
float num3 = expertMode ? 8.5f : 7.5f;
if (flag4)
{
moveSpeed = 0.7f;
num3 = 12f;
num2 = 30;
}
else if (flag3 & flag5)
{
moveSpeed = expertMode ? 0.6f : 0.5f;
num3 = expertMode ? 10f : 8f;
num2 = expertMode ? 40 : 20;
}
else if (flag5 && !flag3 && !flag4)
num2 = 30;
int num4 = expertMode ? 28 : 30;
float num5 = expertMode ? 17f : 16f;
if (flag4)
{
num4 = 25;
num5 = 27f;
}
else if (flag5 & flag3)
{
num4 = expertMode ? 27 : 30;
if (expertMode)
num5 = 21f;
}
int num6 = 80;
int num7 = 4;
float num8 = 0.3f;
float num9 = 5f;
int num10 = 90;
int num11 = 180;
int num12 = 180;
int num13 = 30;
int num14 = 120;
int num15 = 4;
float num16 = 6f;
float num17 = 20f;
float num18 = 6.283185f / (float) (num14 / 2);
int num19 = 75;
Vector2 center = this.Center;
Player player = Main.player[this.target];
if (this.target < 0 || this.target == (int) byte.MaxValue || player.dead || !player.active)
{
this.TargetClosest();
player = Main.player[this.target];
this.netUpdate = true;
}
if (player.dead || (double) Vector2.Distance(player.Center, center) > 5600.0)
{
this.velocity.Y -= 0.4f;
if (this.timeLeft > 10)
this.timeLeft = 10;
this.ai[0] = (double) this.ai[0] <= 4.0 ? 0.0f : 5f;
this.ai[2] = 0.0f;
}
if (((double) player.position.Y < 800.0 || (double) player.position.Y > Main.worldSurface * 16.0 ? 1 : ((double) player.position.X <= 6400.0 ? 0 : ((double) player.position.X < (double) (Main.maxTilesX * 16 - 6400) ? 1 : 0))) != 0)
{
num2 = 20;
this.damage = this.defDamage * 2;
this.defense = this.defDefense * 2;
this.ai[3] = 0.0f;
num5 += 6f;
}
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
this.alpha = (int) byte.MaxValue;
this.rotation = 0.0f;
if (Main.netMode != 1)
{
this.ai[0] = -1f;
this.netUpdate = true;
}
}
float num20 = (float) Math.Atan2((double) player.Center.Y - (double) center.Y, (double) player.Center.X - (double) center.X);
if (this.spriteDirection == 1)
num20 += 3.141593f;
if ((double) num20 < 0.0)
num20 += 6.283185f;
if ((double) num20 > 6.28318548202515)
num20 -= 6.283185f;
if ((double) this.ai[0] == -1.0)
num20 = 0.0f;
if ((double) this.ai[0] == 3.0)
num20 = 0.0f;
if ((double) this.ai[0] == 4.0)
num20 = 0.0f;
if ((double) this.ai[0] == 8.0)
num20 = 0.0f;
float num21 = 0.04f;
if ((double) this.ai[0] == 1.0 || (double) this.ai[0] == 6.0)
num21 = 0.0f;
if ((double) this.ai[0] == 7.0)
num21 = 0.0f;
if ((double) this.ai[0] == 3.0)
num21 = 0.01f;
if ((double) this.ai[0] == 4.0)
num21 = 0.01f;
if ((double) this.ai[0] == 8.0)
num21 = 0.01f;
if ((double) this.rotation < (double) num20)
{
if ((double) num20 - (double) this.rotation > Math.PI)
this.rotation -= num21;
else
this.rotation += num21;
}
if ((double) this.rotation > (double) num20)
{
if ((double) this.rotation - (double) num20 > Math.PI)
this.rotation += num21;
else
this.rotation -= num21;
}
if ((double) this.rotation > (double) num20 - (double) num21 && (double) this.rotation < (double) num20 + (double) num21)
this.rotation = num20;
if ((double) this.rotation < 0.0)
this.rotation += 6.283185f;
if ((double) this.rotation > 6.28318548202515)
this.rotation -= 6.283185f;
if ((double) this.rotation > (double) num20 - (double) num21 && (double) this.rotation < (double) num20 + (double) num21)
this.rotation = num20;
if ((double) this.ai[0] != -1.0 && (double) this.ai[0] < 9.0)
{
if (Collision.SolidCollision(this.position, this.width, this.height))
this.alpha += 15;
else
this.alpha -= 15;
if (this.alpha < 0)
this.alpha = 0;
if (this.alpha > 150)
this.alpha = 150;
}
if ((double) this.ai[0] == -1.0)
{
this.velocity = this.velocity * 0.98f;
int num22 = Math.Sign(player.Center.X - center.X);
if (num22 != 0)
{
this.direction = num22;
this.spriteDirection = -this.direction;
}
if ((double) this.ai[2] > 20.0)
{
this.velocity.Y = -2f;
this.alpha -= 5;
if (Collision.SolidCollision(this.position, this.width, this.height))
this.alpha += 15;
if (this.alpha < 0)
this.alpha = 0;
if (this.alpha > 150)
this.alpha = 150;
}
if ((double) this.ai[2] == (double) (num10 - 30))
{
int num23 = 36;
for (int index1 = 0; index1 < num23; ++index1)
{
Vector2 vector2_1 = (Vector2.Normalize(this.velocity) * new Vector2((float) this.width / 2f, (float) this.height) * 0.75f * 0.5f).RotatedBy((double) (index1 - (num23 / 2 - 1)) * 6.28318548202515 / (double) num23) + this.Center;
Vector2 vector2_2 = vector2_1 - this.Center;
int index2 = Dust.NewDust(vector2_1 + vector2_2, 0, 0, 172, vector2_2.X * 2f, vector2_2.Y * 2f, 100, Scale: 1.4f);
Main.dust[index2].noGravity = true;
Main.dust[index2].noLight = true;
Main.dust[index2].velocity = Vector2.Normalize(vector2_2) * 3f;
}
Main.PlaySound(29, (int) center.X, (int) center.Y, 20);
}
++this.ai[2];
if ((double) this.ai[2] < (double) num19)
return;
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.netUpdate = true;
}
else if ((double) this.ai[0] == 0.0 && !player.dead)
{
if ((double) this.ai[1] == 0.0)
this.ai[1] = (float) (300 * Math.Sign((center - player.Center).X));
Vector2 vector2 = Vector2.Normalize(player.Center + new Vector2(this.ai[1], -200f) - center - this.velocity) * num3;
if ((double) this.velocity.X < (double) vector2.X)
{
this.velocity.X += moveSpeed;
if ((double) this.velocity.X < 0.0 && (double) vector2.X > 0.0)
this.velocity.X += moveSpeed;
}
else if ((double) this.velocity.X > (double) vector2.X)
{
this.velocity.X -= moveSpeed;
if ((double) this.velocity.X > 0.0 && (double) vector2.X < 0.0)
this.velocity.X -= moveSpeed;
}
if ((double) this.velocity.Y < (double) vector2.Y)
{
this.velocity.Y += moveSpeed;
if ((double) this.velocity.Y < 0.0 && (double) vector2.Y > 0.0)
this.velocity.Y += moveSpeed;
}
else if ((double) this.velocity.Y > (double) vector2.Y)
{
this.velocity.Y -= moveSpeed;
if ((double) this.velocity.Y > 0.0 && (double) vector2.Y < 0.0)
this.velocity.Y -= moveSpeed;
}
int num24 = Math.Sign(player.Center.X - center.X);
if (num24 != 0)
{
if ((double) this.ai[2] == 0.0 && num24 != this.direction)
this.rotation += 3.141593f;
this.direction = num24;
if (this.spriteDirection != -this.direction)
this.rotation += 3.141593f;
this.spriteDirection = -this.direction;
}
++this.ai[2];
if ((double) this.ai[2] < (double) num2)
return;
int num25 = 0;
switch ((int) this.ai[3])
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
num25 = 1;
break;
case 10:
this.ai[3] = 1f;
num25 = 2;
break;
case 11:
this.ai[3] = 0.0f;
num25 = 3;
break;
}
if (flag1)
num25 = 4;
switch (num25)
{
case 1:
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.velocity = Vector2.Normalize(player.Center - center) * num5;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X);
if (num24 != 0)
{
this.direction = num24;
if (this.spriteDirection == 1)
this.rotation += 3.141593f;
this.spriteDirection = -this.direction;
break;
}
break;
case 2:
this.ai[0] = 2f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
break;
case 3:
this.ai[0] = 3f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
break;
case 4:
this.ai[0] = 4f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
break;
}
this.netUpdate = true;
}
else if ((double) this.ai[0] == 1.0)
{
int num26 = 7;
for (int index3 = 0; index3 < num26; ++index3)
{
Vector2 vector2_3 = (Vector2.Normalize(this.velocity) * new Vector2((float) (this.width + 50) / 2f, (float) this.height) * 0.75f).RotatedBy((double) (index3 - (num26 / 2 - 1)) * Math.PI / (double) num26) + center;
Vector2 vector2_4 = ((float) (Main.rand.NextDouble() * 3.14159274101257) - 1.570796f).ToRotationVector2() * (float) Main.rand.Next(3, 8);
Vector2 vector2_5 = vector2_4;
int index4 = Dust.NewDust(vector2_3 + vector2_5, 0, 0, 172, vector2_4.X * 2f, vector2_4.Y * 2f, 100, Scale: 1.4f);
Main.dust[index4].noGravity = true;
Main.dust[index4].noLight = true;
Main.dust[index4].velocity /= 4f;
Main.dust[index4].velocity -= this.velocity;
}
++this.ai[2];
if ((double) this.ai[2] < (double) num4)
return;
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.ai[3] += 2f;
this.netUpdate = true;
}
else if ((double) this.ai[0] == 2.0)
{
if ((double) this.ai[1] == 0.0)
this.ai[1] = (float) (300 * Math.Sign((center - player.Center).X));
Vector2 vector2_6 = Vector2.Normalize(player.Center + new Vector2(this.ai[1], -200f) - center - this.velocity) * num9;
if ((double) this.velocity.X < (double) vector2_6.X)
{
this.velocity.X += num8;
if ((double) this.velocity.X < 0.0 && (double) vector2_6.X > 0.0)
this.velocity.X += num8;
}
else if ((double) this.velocity.X > (double) vector2_6.X)
{
this.velocity.X -= num8;
if ((double) this.velocity.X > 0.0 && (double) vector2_6.X < 0.0)
this.velocity.X -= num8;
}
if ((double) this.velocity.Y < (double) vector2_6.Y)
{
this.velocity.Y += num8;
if ((double) this.velocity.Y < 0.0 && (double) vector2_6.Y > 0.0)
this.velocity.Y += num8;
}
else if ((double) this.velocity.Y > (double) vector2_6.Y)
{
this.velocity.Y -= num8;
if ((double) this.velocity.Y > 0.0 && (double) vector2_6.Y < 0.0)
this.velocity.Y -= num8;
}
if ((double) this.ai[2] == 0.0)
Main.PlaySound(29, (int) center.X, (int) center.Y, 20);
if ((double) this.ai[2] % (double) num7 == 0.0)
{
Main.PlaySound(4, (int) this.Center.X, (int) this.Center.Y, 19);
if (Main.netMode != 1)
{
Vector2 vector2_7 = Vector2.Normalize(player.Center - center) * (float) (this.width + 20) / 2f + center;
NPC.NewNPC((int) vector2_7.X, (int) vector2_7.Y + 45, 371);
}
}
int num27 = Math.Sign(player.Center.X - center.X);
if (num27 != 0)
{
this.direction = num27;
if (this.spriteDirection != -this.direction)
this.rotation += 3.141593f;
this.spriteDirection = -this.direction;
}
++this.ai[2];
if ((double) this.ai[2] < (double) num6)
return;
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.netUpdate = true;
}
else if ((double) this.ai[0] == 3.0)
{
this.velocity = this.velocity * 0.98f;
this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0.0f, 0.02f);
if ((double) this.ai[2] == (double) (num10 - 30))
Main.PlaySound(29, (int) center.X, (int) center.Y, 9);
if (Main.netMode != 1 && (double) this.ai[2] == (double) (num10 - 30))
{
Vector2 vector2 = this.rotation.ToRotationVector2() * (Vector2.UnitX * (float) this.direction) * (float) (this.width + 20) / 2f + center;
Projectile.NewProjectile(vector2.X, vector2.Y, (float) (this.direction * 2), 8f, 385, 0, 0.0f, Main.myPlayer);
Projectile.NewProjectile(vector2.X, vector2.Y, (float) (-this.direction * 2), 8f, 385, 0, 0.0f, Main.myPlayer);
}
++this.ai[2];
if ((double) this.ai[2] < (double) num10)
return;
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.netUpdate = true;
}
else if ((double) this.ai[0] == 4.0)
{
this.velocity = this.velocity * 0.98f;
this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0.0f, 0.02f);
if ((double) this.ai[2] == (double) (num11 - 60))
Main.PlaySound(29, (int) center.X, (int) center.Y, 20);
++this.ai[2];
if ((double) this.ai[2] < (double) num11)
return;
this.ai[0] = 5f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.ai[3] = 0.0f;
this.netUpdate = true;
}
else if ((double) this.ai[0] == 5.0 && !player.dead)
{
if ((double) this.ai[1] == 0.0)
this.ai[1] = (float) (300 * Math.Sign((center - player.Center).X));
Vector2 vector2 = Vector2.Normalize(player.Center + new Vector2(this.ai[1], -200f) - center - this.velocity) * num3;
if ((double) this.velocity.X < (double) vector2.X)
{
this.velocity.X += moveSpeed;
if ((double) this.velocity.X < 0.0 && (double) vector2.X > 0.0)
this.velocity.X += moveSpeed;
}
else if ((double) this.velocity.X > (double) vector2.X)
{
this.velocity.X -= moveSpeed;
if ((double) this.velocity.X > 0.0 && (double) vector2.X < 0.0)
this.velocity.X -= moveSpeed;
}
if ((double) this.velocity.Y < (double) vector2.Y)
{
this.velocity.Y += moveSpeed;
if ((double) this.velocity.Y < 0.0 && (double) vector2.Y > 0.0)
this.velocity.Y += moveSpeed;
}
else if ((double) this.velocity.Y > (double) vector2.Y)
{
this.velocity.Y -= moveSpeed;
if ((double) this.velocity.Y > 0.0 && (double) vector2.Y < 0.0)
this.velocity.Y -= moveSpeed;
}
int num28 = Math.Sign(player.Center.X - center.X);
if (num28 != 0)
{
if ((double) this.ai[2] == 0.0 && num28 != this.direction)
this.rotation += 3.141593f;
this.direction = num28;
if (this.spriteDirection != -this.direction)
this.rotation += 3.141593f;
this.spriteDirection = -this.direction;
}
++this.ai[2];
if ((double) this.ai[2] < (double) num2)
return;
int num29 = 0;
switch ((int) this.ai[3])
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
num29 = 1;
break;
case 6:
this.ai[3] = 1f;
num29 = 2;
break;
case 7:
this.ai[3] = 0.0f;
num29 = 3;
break;
}
if (flag2)
num29 = 4;
switch (num29)
{
case 1:
this.ai[0] = 6f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.velocity = Vector2.Normalize(player.Center - center) * num5;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X);
if (num28 != 0)
{
this.direction = num28;
if (this.spriteDirection == 1)
this.rotation += 3.141593f;
this.spriteDirection = -this.direction;
break;
}
break;
case 2:
this.velocity = Vector2.Normalize(player.Center - center) * num17;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X);
if (num28 != 0)
{
this.direction = num28;
if (this.spriteDirection == 1)
this.rotation += 3.141593f;
this.spriteDirection = -this.direction;
}
this.ai[0] = 7f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
break;
case 3:
this.ai[0] = 8f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
break;
case 4:
this.ai[0] = 9f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
break;
}
this.netUpdate = true;
}
else if ((double) this.ai[0] == 6.0)
{
int num30 = 7;
for (int index5 = 0; index5 < num30; ++index5)
{
Vector2 vector2_8 = (Vector2.Normalize(this.velocity) * new Vector2((float) (this.width + 50) / 2f, (float) this.height) * 0.75f).RotatedBy((double) (index5 - (num30 / 2 - 1)) * Math.PI / (double) num30) + center;
Vector2 vector2_9 = ((float) (Main.rand.NextDouble() * 3.14159274101257) - 1.570796f).ToRotationVector2() * (float) Main.rand.Next(3, 8);
Vector2 vector2_10 = vector2_9;
int index6 = Dust.NewDust(vector2_8 + vector2_10, 0, 0, 172, vector2_9.X * 2f, vector2_9.Y * 2f, 100, Scale: 1.4f);
Main.dust[index6].noGravity = true;
Main.dust[index6].noLight = true;
Main.dust[index6].velocity /= 4f;
Main.dust[index6].velocity -= this.velocity;
}
++this.ai[2];
if ((double) this.ai[2] < (double) num4)
return;
this.ai[0] = 5f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.ai[3] += 2f;
this.netUpdate = true;
}
else if ((double) this.ai[0] == 7.0)
{
if ((double) this.ai[2] == 0.0)
Main.PlaySound(29, (int) center.X, (int) center.Y, 20);
if ((double) this.ai[2] % (double) num15 == 0.0)
{
Main.PlaySound(4, (int) this.Center.X, (int) this.Center.Y, 19);
if (Main.netMode != 1)
{
Vector2 vector2 = Vector2.Normalize(this.velocity) * (float) (this.width + 20) / 2f + center;
int index = NPC.NewNPC((int) vector2.X, (int) vector2.Y + 45, 371);
Main.npc[index].target = this.target;
Main.npc[index].velocity = Vector2.Normalize(this.velocity).RotatedBy(1.57079637050629 * (double) this.direction) * num16;
Main.npc[index].netUpdate = true;
Main.npc[index].ai[3] = (float) Main.rand.Next(80, 121) / 100f;
}
}
this.velocity = this.velocity.RotatedBy(-(double) num18 * (double) this.direction);
this.rotation -= num18 * (float) this.direction;
++this.ai[2];
if ((double) this.ai[2] < (double) num14)
return;
this.ai[0] = 5f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.netUpdate = true;
}
else if ((double) this.ai[0] == 8.0)
{
this.velocity = this.velocity * 0.98f;
this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0.0f, 0.02f);
if ((double) this.ai[2] == (double) (num10 - 30))
Main.PlaySound(29, (int) center.X, (int) center.Y, 20);
if (Main.netMode != 1 && (double) this.ai[2] == (double) (num10 - 30))
Projectile.NewProjectile(center.X, center.Y, 0.0f, 0.0f, 385, 0, 0.0f, Main.myPlayer, 1f, (float) (this.target + 1));
++this.ai[2];
if ((double) this.ai[2] < (double) num10)
return;
this.ai[0] = 5f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.netUpdate = true;
}
else if ((double) this.ai[0] == 9.0)
{
if ((double) this.ai[2] < (double) (num12 - 90))
{
if (Collision.SolidCollision(this.position, this.width, this.height))
this.alpha += 15;
else
this.alpha -= 15;
if (this.alpha < 0)
this.alpha = 0;
if (this.alpha > 150)
this.alpha = 150;
}
else if (this.alpha < (int) byte.MaxValue)
{
this.alpha += 4;
if (this.alpha > (int) byte.MaxValue)
this.alpha = (int) byte.MaxValue;
}
this.velocity = this.velocity * 0.98f;
this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0.0f, 0.02f);
if ((double) this.ai[2] == (double) (num12 - 60))
Main.PlaySound(29, (int) center.X, (int) center.Y, 20);
++this.ai[2];
if ((double) this.ai[2] < (double) num12)
return;
this.ai[0] = 10f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.ai[3] = 0.0f;
this.netUpdate = true;
}
else if ((double) this.ai[0] == 10.0 && !player.dead)
{
this.dontTakeDamage = false;
this.chaseable = false;
if (this.alpha < (int) byte.MaxValue)
{
this.alpha += 25;
if (this.alpha > (int) byte.MaxValue)
this.alpha = (int) byte.MaxValue;
}
if ((double) this.ai[1] == 0.0)
this.ai[1] = (float) (360 * Math.Sign((center - player.Center).X));
this.SimpleFlyMovement(Vector2.Normalize(player.Center + new Vector2(this.ai[1], -200f) - center - this.velocity) * num3, moveSpeed);
int num31 = Math.Sign(player.Center.X - center.X);
if (num31 != 0)
{
if ((double) this.ai[2] == 0.0 && num31 != this.direction)
{
this.rotation += 3.141593f;
for (int index = 0; index < this.oldPos.Length; ++index)
this.oldPos[index] = Vector2.Zero;
}
this.direction = num31;
if (this.spriteDirection != -this.direction)
this.rotation += 3.141593f;
this.spriteDirection = -this.direction;
}
++this.ai[2];
if ((double) this.ai[2] < (double) num2)
return;
int num32 = 0;
switch ((int) this.ai[3])
{
case 0:
case 2:
case 3:
case 5:
case 6:
case 7:
num32 = 1;
break;
case 1:
case 4:
case 8:
num32 = 2;
break;
}
switch (num32)
{
case 1:
this.ai[0] = 11f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.velocity = Vector2.Normalize(player.Center - center) * num5;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X);
if (num31 != 0)
{
this.direction = num31;
if (this.spriteDirection == 1)
this.rotation += 3.141593f;
this.spriteDirection = -this.direction;
break;
}
break;
case 2:
this.ai[0] = 12f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
break;
case 3:
this.ai[0] = 13f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
break;
}
this.netUpdate = true;
}
else if ((double) this.ai[0] == 11.0)
{
this.dontTakeDamage = false;
this.chaseable = true;
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
int num33 = 7;
for (int index7 = 0; index7 < num33; ++index7)
{
Vector2 vector2_11 = (Vector2.Normalize(this.velocity) * new Vector2((float) (this.width + 50) / 2f, (float) this.height) * 0.75f).RotatedBy((double) (index7 - (num33 / 2 - 1)) * Math.PI / (double) num33) + center;
Vector2 vector2_12 = ((float) (Main.rand.NextDouble() * 3.14159274101257) - 1.570796f).ToRotationVector2() * (float) Main.rand.Next(3, 8);
Vector2 vector2_13 = vector2_12;
int index8 = Dust.NewDust(vector2_11 + vector2_13, 0, 0, 172, vector2_12.X * 2f, vector2_12.Y * 2f, 100, Scale: 1.4f);
Main.dust[index8].noGravity = true;
Main.dust[index8].noLight = true;
Main.dust[index8].velocity /= 4f;
Main.dust[index8].velocity -= this.velocity;
}
++this.ai[2];
if ((double) this.ai[2] < (double) num4)
return;
this.ai[0] = 10f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
++this.ai[3];
this.netUpdate = true;
}
else if ((double) this.ai[0] == 12.0)
{
this.dontTakeDamage = true;
this.chaseable = false;
if (this.alpha < (int) byte.MaxValue)
{
this.alpha += 17;
if (this.alpha > (int) byte.MaxValue)
this.alpha = (int) byte.MaxValue;
}
this.velocity = this.velocity * 0.98f;
this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0.0f, 0.02f);
if ((double) this.ai[2] == (double) (num13 / 2))
Main.PlaySound(29, (int) center.X, (int) center.Y, 20);
if (Main.netMode != 1 && (double) this.ai[2] == (double) (num13 / 2))
{
if ((double) this.ai[1] == 0.0)
this.ai[1] = (float) (300 * Math.Sign((center - player.Center).X));
Vector2 vector2 = this.Center = player.Center + new Vector2(-this.ai[1], -200f);
int num34 = Math.Sign(player.Center.X - vector2.X);
if (num34 != 0)
{
if ((double) this.ai[2] == 0.0 && num34 != this.direction)
{
this.rotation += 3.141593f;
for (int index = 0; index < this.oldPos.Length; ++index)
this.oldPos[index] = Vector2.Zero;
}
this.direction = num34;
if (this.spriteDirection != -this.direction)
this.rotation += 3.141593f;
this.spriteDirection = -this.direction;
}
}
++this.ai[2];
if ((double) this.ai[2] < (double) num13)
return;
this.ai[0] = 10f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
++this.ai[3];
if ((double) this.ai[3] >= 9.0)
this.ai[3] = 0.0f;
this.netUpdate = true;
}
else
{
if ((double) this.ai[0] != 13.0)
return;
if ((double) this.ai[2] == 0.0)
Main.PlaySound(29, (int) center.X, (int) center.Y, 20);
this.velocity = this.velocity.RotatedBy(-(double) num18 * (double) this.direction);
this.rotation -= num18 * (float) this.direction;
++this.ai[2];
if ((double) this.ai[2] < (double) num14)
return;
this.ai[0] = 10f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
++this.ai[3];
this.netUpdate = true;
}
}
private void AI_037_Destroyer()
{
if ((double) this.ai[3] > 0.0)
this.realLife = (int) this.ai[3];
if (this.target < 0 || this.target == (int) byte.MaxValue || Main.player[this.target].dead)
this.TargetClosest();
if (this.type >= 134 && this.type <= 136)
{
double num = (double) this.velocity.Length();
if (this.type == 134 || this.type != 134 && Main.npc[(int) this.ai[1]].alpha < 128)
{
if (this.alpha != 0)
{
for (int index1 = 0; index1 < 2; ++index1)
{
int index2 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 182, Alpha: 100, Scale: 2f);
Main.dust[index2].noGravity = true;
Main.dust[index2].noLight = true;
}
}
this.alpha -= 42;
if (this.alpha < 0)
this.alpha = 0;
}
}
if (this.type > 134)
{
bool flag = false;
if ((double) this.ai[1] <= 0.0)
flag = true;
else if (Main.npc[(int) this.ai[1]].life <= 0)
flag = true;
if (flag)
{
this.life = 0;
this.HitEffect();
this.checkDead();
}
}
if (Main.netMode != 1)
{
if ((double) this.ai[0] == 0.0 && this.type == 134)
{
this.ai[3] = (float) this.whoAmI;
this.realLife = this.whoAmI;
int index3 = this.whoAmI;
int num = 80;
for (int index4 = 0; index4 <= num; ++index4)
{
int Type = 135;
if (index4 == num)
Type = 136;
int number = NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2)), (int) ((double) this.position.Y + (double) this.height), Type, this.whoAmI);
Main.npc[number].ai[3] = (float) this.whoAmI;
Main.npc[number].realLife = this.whoAmI;
Main.npc[number].ai[1] = (float) index3;
Main.npc[index3].ai[0] = (float) number;
NetMessage.SendData(23, number: number);
index3 = number;
}
}
if (this.type == 135)
{
this.localAI[0] += (float) Main.rand.Next(4);
if ((double) this.localAI[0] >= (double) Main.rand.Next(1400, 26000))
{
this.localAI[0] = 0.0f;
this.TargetClosest();
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) (this.height / 2));
float num1 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2.X + (float) Main.rand.Next(-20, 21);
float num2 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y + (float) Main.rand.Next(-20, 21);
float num3 = (float) (8.0 / Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2));
float num4 = num1 * num3;
float num5 = num2 * num3;
float SpeedX = num4 + (float) Main.rand.Next(-20, 21) * 0.05f;
float SpeedY = num5 + (float) Main.rand.Next(-20, 21) * 0.05f;
int Damage = 22;
if (Main.expertMode)
Damage = 18;
int Type = 100;
vector2.X += SpeedX * 5f;
vector2.Y += SpeedY * 5f;
int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, Damage, 0.0f, Main.myPlayer);
Main.projectile[index].timeLeft = 300;
this.netUpdate = true;
}
}
}
}
int num6 = (int) ((double) this.position.X / 16.0) - 1;
int num7 = (int) (((double) this.position.X + (double) this.width) / 16.0) + 2;
int num8 = (int) ((double) this.position.Y / 16.0) - 1;
int num9 = (int) (((double) this.position.Y + (double) this.height) / 16.0) + 2;
if (num6 < 0)
num6 = 0;
if (num7 > Main.maxTilesX)
num7 = Main.maxTilesX;
if (num8 < 0)
num8 = 0;
if (num9 > Main.maxTilesY)
num9 = Main.maxTilesY;
bool flag1 = false;
if (!flag1)
{
for (int index5 = num6; index5 < num7; ++index5)
{
for (int index6 = num8; index6 < num9; ++index6)
{
if (Main.tile[index5, index6] != null && (Main.tile[index5, index6].nactive() && (Main.tileSolid[(int) Main.tile[index5, index6].type] || Main.tileSolidTop[(int) Main.tile[index5, index6].type] && Main.tile[index5, index6].frameY == (short) 0) || Main.tile[index5, index6].liquid > (byte) 64))
{
Vector2 vector2;
vector2.X = (float) (index5 * 16);
vector2.Y = (float) (index6 * 16);
if ((double) this.position.X + (double) this.width > (double) vector2.X && (double) this.position.X < (double) vector2.X + 16.0 && (double) this.position.Y + (double) this.height > (double) vector2.Y && (double) this.position.Y < (double) vector2.Y + 16.0)
{
flag1 = true;
break;
}
}
}
}
}
if (!flag1)
{
if (this.type != 135 || (double) this.ai[2] != 1.0)
Lighting.AddLight((int) (((double) this.position.X + (double) (this.width / 2)) / 16.0), (int) (((double) this.position.Y + (double) (this.height / 2)) / 16.0), 0.3f, 0.1f, 0.05f);
this.localAI[1] = 1f;
if (this.type == 134)
{
Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height);
int num10 = 1000;
bool flag2 = true;
if ((double) this.position.Y > (double) Main.player[this.target].position.Y)
{
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active)
{
Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) Main.player[index].position.X - num10, (int) Main.player[index].position.Y - num10, num10 * 2, num10 * 2);
if (rectangle1.Intersects(rectangle2))
{
flag2 = false;
break;
}
}
}
if (flag2)
flag1 = true;
}
}
}
else
this.localAI[1] = 0.0f;
float num11 = 16f;
if (Main.dayTime || Main.player[this.target].dead)
{
flag1 = false;
++this.velocity.Y;
if ((double) this.position.Y > Main.worldSurface * 16.0)
{
++this.velocity.Y;
num11 = 32f;
}
if ((double) this.position.Y > Main.rockLayer * 16.0)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].aiStyle == this.aiStyle)
Main.npc[index].active = false;
}
}
}
float num12 = 0.1f;
float num13 = 0.15f;
Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num14 = Main.player[this.target].position.X + (float) (Main.player[this.target].width / 2);
float num15 = Main.player[this.target].position.Y + (float) (Main.player[this.target].height / 2);
float num16 = (float) ((int) ((double) num14 / 16.0) * 16);
float num17 = (float) ((int) ((double) num15 / 16.0) * 16);
vector2_1.X = (float) ((int) ((double) vector2_1.X / 16.0) * 16);
vector2_1.Y = (float) ((int) ((double) vector2_1.Y / 16.0) * 16);
float num18 = num16 - vector2_1.X;
float num19 = num17 - vector2_1.Y;
float num20 = (float) Math.Sqrt((double) num18 * (double) num18 + (double) num19 * (double) num19);
if ((double) this.ai[1] > 0.0)
{
if ((double) this.ai[1] < (double) Main.npc.Length)
{
try
{
Vector2 vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
num18 = Main.npc[(int) this.ai[1]].position.X + (float) (Main.npc[(int) this.ai[1]].width / 2) - vector2_2.X;
num19 = Main.npc[(int) this.ai[1]].position.Y + (float) (Main.npc[(int) this.ai[1]].height / 2) - vector2_2.Y;
}
catch
{
}
this.rotation = (float) Math.Atan2((double) num19, (double) num18) + 1.57f;
float num21 = (float) Math.Sqrt((double) num18 * (double) num18 + (double) num19 * (double) num19);
int num22 = (int) (44.0 * (double) this.scale);
float num23 = (num21 - (float) num22) / num21;
float num24 = num18 * num23;
float num25 = num19 * num23;
this.velocity = Vector2.Zero;
this.position.X += num24;
this.position.Y += num25;
return;
}
}
if (!flag1)
{
this.TargetClosest();
this.velocity.Y += 0.15f;
if ((double) this.velocity.Y > (double) num11)
this.velocity.Y = num11;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num11 * 0.4)
{
if ((double) this.velocity.X < 0.0)
this.velocity.X -= num12 * 1.1f;
else
this.velocity.X += num12 * 1.1f;
}
else if ((double) this.velocity.Y == (double) num11)
{
if ((double) this.velocity.X < (double) num18)
this.velocity.X += num12;
else if ((double) this.velocity.X > (double) num18)
this.velocity.X -= num12;
}
else if ((double) this.velocity.Y > 4.0)
{
if ((double) this.velocity.X < 0.0)
this.velocity.X += num12 * 0.9f;
else
this.velocity.X -= num12 * 0.9f;
}
}
else
{
if (this.soundDelay == 0)
{
float num26 = num20 / 40f;
if ((double) num26 < 10.0)
num26 = 10f;
if ((double) num26 > 20.0)
num26 = 20f;
this.soundDelay = (int) num26;
Main.PlaySound(15, (int) this.position.X, (int) this.position.Y);
}
float num27 = (float) Math.Sqrt((double) num18 * (double) num18 + (double) num19 * (double) num19);
float num28 = Math.Abs(num18);
float num29 = Math.Abs(num19);
float num30 = num11 / num27;
float num31 = num18 * num30;
float num32 = num19 * num30;
if (((double) this.velocity.X > 0.0 && (double) num31 > 0.0 || (double) this.velocity.X < 0.0 && (double) num31 < 0.0) && ((double) this.velocity.Y > 0.0 && (double) num32 > 0.0 || (double) this.velocity.Y < 0.0 && (double) num32 < 0.0))
{
if ((double) this.velocity.X < (double) num31)
this.velocity.X += num13;
else if ((double) this.velocity.X > (double) num31)
this.velocity.X -= num13;
if ((double) this.velocity.Y < (double) num32)
this.velocity.Y += num13;
else if ((double) this.velocity.Y > (double) num32)
this.velocity.Y -= num13;
}
if ((double) this.velocity.X > 0.0 && (double) num31 > 0.0 || (double) this.velocity.X < 0.0 && (double) num31 < 0.0 || (double) this.velocity.Y > 0.0 && (double) num32 > 0.0 || (double) this.velocity.Y < 0.0 && (double) num32 < 0.0)
{
if ((double) this.velocity.X < (double) num31)
this.velocity.X += num12;
else if ((double) this.velocity.X > (double) num31)
this.velocity.X -= num12;
if ((double) this.velocity.Y < (double) num32)
this.velocity.Y += num12;
else if ((double) this.velocity.Y > (double) num32)
this.velocity.Y -= num12;
if ((double) Math.Abs(num32) < (double) num11 * 0.2 && ((double) this.velocity.X > 0.0 && (double) num31 < 0.0 || (double) this.velocity.X < 0.0 && (double) num31 > 0.0))
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y += num12 * 2f;
else
this.velocity.Y -= num12 * 2f;
}
if ((double) Math.Abs(num31) < (double) num11 * 0.2 && ((double) this.velocity.Y > 0.0 && (double) num32 < 0.0 || (double) this.velocity.Y < 0.0 && (double) num32 > 0.0))
{
if ((double) this.velocity.X > 0.0)
this.velocity.X += num12 * 2f;
else
this.velocity.X -= num12 * 2f;
}
}
else if ((double) num28 > (double) num29)
{
if ((double) this.velocity.X < (double) num31)
this.velocity.X += num12 * 1.1f;
else if ((double) this.velocity.X > (double) num31)
this.velocity.X -= num12 * 1.1f;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num11 * 0.5)
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y += num12;
else
this.velocity.Y -= num12;
}
}
else
{
if ((double) this.velocity.Y < (double) num32)
this.velocity.Y += num12 * 1.1f;
else if ((double) this.velocity.Y > (double) num32)
this.velocity.Y -= num12 * 1.1f;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num11 * 0.5)
{
if ((double) this.velocity.X > 0.0)
this.velocity.X += num12;
else
this.velocity.X -= num12;
}
}
}
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
if (this.type != 134)
return;
if (flag1)
{
if ((double) this.localAI[0] != 1.0)
this.netUpdate = true;
this.localAI[0] = 1f;
}
else
{
if ((double) this.localAI[0] != 0.0)
this.netUpdate = true;
this.localAI[0] = 0.0f;
}
if (((double) this.velocity.X <= 0.0 || (double) this.oldVelocity.X >= 0.0) && ((double) this.velocity.X >= 0.0 || (double) this.oldVelocity.X <= 0.0) && ((double) this.velocity.Y <= 0.0 || (double) this.oldVelocity.Y >= 0.0) && ((double) this.velocity.Y >= 0.0 || (double) this.oldVelocity.Y <= 0.0) || this.justHit)
return;
this.netUpdate = true;
}
private void AI_005_EaterOfSouls()
{
if (this.target < 0 || this.target == (int) byte.MaxValue || Main.player[this.target].dead)
this.TargetClosest();
float num1 = 6f;
float num2 = 0.05f;
if (this.type == 6 || this.type == 173)
{
num1 = 4f;
num2 = 0.02f;
if (this.type == 6 && Main.expertMode)
num2 = 0.035f;
}
else if (this.type == 94)
{
num1 = 4.2f;
num2 = 0.022f;
}
else if (this.type == 252)
{
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
num1 = 6f;
num2 = 0.1f;
}
else
{
num2 = 0.01f;
num1 = 2f;
}
}
else if (this.type == 42 || this.type >= 231 && this.type <= 235)
{
float num3 = 3.5f;
float num4 = 0.021f;
if (this.type == 231)
{
num3 = 3f;
num4 = 0.017f;
}
num1 = num3 * (1f - this.scale);
num2 = num4 * (1f - this.scale);
}
else if (this.type == 205)
{
num1 = 3.25f;
num2 = 0.018f;
}
else if (this.type == 176)
{
num1 = 4f;
num2 = 0.017f;
}
else if (this.type == 23)
{
num1 = 1f;
num2 = 0.03f;
}
else if (this.type == 5)
{
num1 = 5f;
num2 = 0.03f;
}
else if (this.type == 210 || this.type == 211)
{
++this.localAI[0];
float num5 = (float) (((double) this.localAI[0] - 60.0) / 60.0);
if ((double) num5 > 1.0)
{
num5 = 1f;
}
else
{
if ((double) this.velocity.X > 6.0)
this.velocity.X = 6f;
if ((double) this.velocity.X < -6.0)
this.velocity.X = -6f;
if ((double) this.velocity.Y > 6.0)
this.velocity.Y = 6f;
if ((double) this.velocity.Y < -6.0)
this.velocity.Y = -6f;
}
num1 = 5f;
num2 = 0.1f * num5;
}
Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num6 = Main.player[this.target].position.X + (float) (Main.player[this.target].width / 2);
float num7 = Main.player[this.target].position.Y + (float) (Main.player[this.target].height / 2);
float num8 = (float) ((int) ((double) num6 / 8.0) * 8);
float num9 = (float) ((int) ((double) num7 / 8.0) * 8);
vector2_1.X = (float) ((int) ((double) vector2_1.X / 8.0) * 8);
vector2_1.Y = (float) ((int) ((double) vector2_1.Y / 8.0) * 8);
float num10 = num8 - vector2_1.X;
float num11 = num9 - vector2_1.Y;
float num12 = (float) Math.Sqrt((double) num10 * (double) num10 + (double) num11 * (double) num11);
float num13 = num12;
bool flag = false;
if ((double) num12 > 600.0)
flag = true;
float SpeedX1;
float SpeedY1;
if ((double) num12 == 0.0)
{
SpeedX1 = this.velocity.X;
SpeedY1 = this.velocity.Y;
}
else
{
float num14 = num1 / num12;
SpeedX1 = num10 * num14;
SpeedY1 = num11 * num14;
}
if (this.type == 6 || this.type == 42 || this.type == 94 || this.type == 139 || this.type == 173 || this.type == 176 || this.type == 205 || this.type == 210 || this.type == 211 || this.type >= 231 && this.type <= 235)
{
if ((double) num13 > 100.0 || this.type == 42 || this.type == 94 || this.type == 176 || this.type == 210 || this.type == 211 || this.type >= 231 && this.type <= 235)
{
++this.ai[0];
if ((double) this.ai[0] > 0.0)
this.velocity.Y += 23f / 1000f;
else
this.velocity.Y -= 23f / 1000f;
if ((double) this.ai[0] < -100.0 || (double) this.ai[0] > 100.0)
this.velocity.X += 23f / 1000f;
else
this.velocity.X -= 23f / 1000f;
if ((double) this.ai[0] > 200.0)
this.ai[0] = -200f;
}
if ((double) num13 < 150.0 && (this.type == 6 || this.type == 94 || this.type == 173))
{
this.velocity.X += SpeedX1 * 0.007f;
this.velocity.Y += SpeedY1 * 0.007f;
}
}
if (Main.player[this.target].dead)
{
SpeedX1 = (float) ((double) this.direction * (double) num1 / 2.0);
SpeedY1 = (float) (-(double) num1 / 2.0);
}
if ((double) this.velocity.X < (double) SpeedX1)
{
this.velocity.X += num2;
if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && (double) this.velocity.X < 0.0 && (double) SpeedX1 > 0.0)
this.velocity.X += num2;
}
else if ((double) this.velocity.X > (double) SpeedX1)
{
this.velocity.X -= num2;
if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && (double) this.velocity.X > 0.0 && (double) SpeedX1 < 0.0)
this.velocity.X -= num2;
}
if ((double) this.velocity.Y < (double) SpeedY1)
{
this.velocity.Y += num2;
if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && (double) this.velocity.Y < 0.0 && (double) SpeedY1 > 0.0)
this.velocity.Y += num2;
}
else if ((double) this.velocity.Y > (double) SpeedY1)
{
this.velocity.Y -= num2;
if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && (double) this.velocity.Y > 0.0 && (double) SpeedY1 < 0.0)
this.velocity.Y -= num2;
}
if (this.type == 23)
{
if ((double) SpeedX1 > 0.0)
{
this.spriteDirection = 1;
this.rotation = (float) Math.Atan2((double) SpeedY1, (double) SpeedX1);
}
else if ((double) SpeedX1 < 0.0)
{
this.spriteDirection = -1;
this.rotation = (float) Math.Atan2((double) SpeedY1, (double) SpeedX1) + 3.14f;
}
}
else if (this.type == 139)
{
++this.localAI[0];
if (this.justHit)
this.localAI[0] = 0.0f;
if (Main.netMode != 1 && (double) this.localAI[0] >= 120.0)
{
this.localAI[0] = 0.0f;
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
int Damage = 25;
if (Main.expertMode)
Damage = 22;
int Type = 84;
Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX1, SpeedY1, Type, Damage, 0.0f, Main.myPlayer);
}
}
if (!WorldGen.SolidTile(((int) this.position.X + this.width / 2) / 16, ((int) this.position.Y + this.height / 2) / 16))
Lighting.AddLight((int) (((double) this.position.X + (double) (this.width / 2)) / 16.0), (int) (((double) this.position.Y + (double) (this.height / 2)) / 16.0), 0.3f, 0.1f, 0.05f);
if ((double) SpeedX1 > 0.0)
{
this.spriteDirection = 1;
this.rotation = (float) Math.Atan2((double) SpeedY1, (double) SpeedX1);
}
if ((double) SpeedX1 < 0.0)
{
this.spriteDirection = -1;
this.rotation = (float) Math.Atan2((double) SpeedY1, (double) SpeedX1) + 3.14f;
}
}
else if (this.type == 6 || this.type == 94 || this.type == 173)
this.rotation = (float) Math.Atan2((double) SpeedY1, (double) SpeedX1) - 1.57f;
else if (this.type == 42 || this.type == 176 || this.type == 205 || this.type >= 231 && this.type <= 235)
{
if ((double) this.velocity.X > 0.0)
this.spriteDirection = 1;
if ((double) this.velocity.X < 0.0)
this.spriteDirection = -1;
this.rotation = this.velocity.X * 0.1f;
}
else
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) - 1.57f;
if (this.type == 6 || this.type == 23 || this.type == 42 || this.type == 94 || this.type == 139 || this.type == 173 || this.type == 176 || this.type == 205 || this.type == 210 || this.type == 211 || this.type >= 231 && this.type <= 235)
{
float num15 = 0.7f;
if (this.type == 6 || this.type == 173)
num15 = 0.4f;
if (this.collideX)
{
this.netUpdate = true;
this.velocity.X = this.oldVelocity.X * -num15;
if (this.direction == -1 && (double) this.velocity.X > 0.0 && (double) this.velocity.X < 2.0)
this.velocity.X = 2f;
if (this.direction == 1 && (double) this.velocity.X < 0.0 && (double) this.velocity.X > -2.0)
this.velocity.X = -2f;
}
if (this.collideY)
{
this.netUpdate = true;
this.velocity.Y = this.oldVelocity.Y * -num15;
if ((double) this.velocity.Y > 0.0 && (double) this.velocity.Y < 1.5)
this.velocity.Y = 2f;
if ((double) this.velocity.Y < 0.0 && (double) this.velocity.Y > -1.5)
this.velocity.Y = -2f;
}
if (this.type == 23)
{
int index = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 2f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity.X *= 0.3f;
Main.dust[index].velocity.Y *= 0.3f;
}
else if (this.type != 42 && this.type != 139 && this.type != 176 && this.type != 205 && this.type != 210 && this.type != 211 && this.type != 252 && (this.type < 231 || this.type > 235) && Main.rand.Next(20) == 0)
{
int Type = 18;
if (this.type == 173)
Type = 5;
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) this.height * 0.25f), this.width, (int) ((double) this.height * 0.5), Type, this.velocity.X, 2f, 75, this.color, this.scale);
Main.dust[index].velocity.X *= 0.5f;
Main.dust[index].velocity.Y *= 0.1f;
}
}
else if (this.type != 252 && Main.rand.Next(40) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) this.height * 0.25f), this.width, (int) ((double) this.height * 0.5), 5, this.velocity.X, 2f);
Main.dust[index].velocity.X *= 0.5f;
Main.dust[index].velocity.Y *= 0.1f;
}
if ((this.type == 6 || this.type == 94 || this.type == 173) && this.wet)
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.95f;
this.velocity.Y -= 0.3f;
if ((double) this.velocity.Y < -2.0)
this.velocity.Y = -2f;
}
if (this.type == 205 && this.wet)
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.95f;
this.velocity.Y -= 0.5f;
if ((double) this.velocity.Y < -4.0)
this.velocity.Y = -4f;
this.TargetClosest();
}
if (this.type == 42 || this.type == 176 || this.type >= 231 && this.type <= 235)
{
if (this.wet)
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.95f;
this.velocity.Y -= 0.5f;
if ((double) this.velocity.Y < -4.0)
this.velocity.Y = -4f;
this.TargetClosest();
}
if ((double) this.ai[1] == 101.0)
{
Main.PlaySound(SoundID.Item17, this.position);
this.ai[1] = 0.0f;
}
if (Main.netMode != 1)
{
this.ai[1] += (float) Main.rand.Next(5, 20) * 0.1f * this.scale;
if (this.type == 176)
this.ai[1] += (float) Main.rand.Next(5, 20) * 0.1f * this.scale;
if ((double) Main.player[this.target].stealth == 0.0 && Main.player[this.target].itemAnimation == 0)
this.ai[1] = 0.0f;
if ((double) this.ai[1] >= 130.0)
{
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num16 = 8f;
Vector2 vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) (this.height / 2));
float num17 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2_2.X + (float) Main.rand.Next(-20, 21);
float num18 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2_2.Y + (float) Main.rand.Next(-20, 21);
if ((double) num17 < 0.0 && (double) this.velocity.X < 0.0 || (double) num17 > 0.0 && (double) this.velocity.X > 0.0)
{
float num19 = (float) Math.Sqrt((double) num17 * (double) num17 + (double) num18 * (double) num18);
float num20 = num16 / num19;
float SpeedX2 = num17 * num20;
float SpeedY2 = num18 * num20;
int Damage = (int) (10.0 * (double) this.scale);
if (this.type == 176)
Damage = (int) (30.0 * (double) this.scale);
int Type = 55;
int index = Projectile.NewProjectile(vector2_2.X, vector2_2.Y, SpeedX2, SpeedY2, Type, Damage, 0.0f, Main.myPlayer);
Main.projectile[index].timeLeft = 300;
this.ai[1] = 101f;
this.netUpdate = true;
}
else
this.ai[1] = 0.0f;
}
else
this.ai[1] = 0.0f;
}
}
}
if (this.type == 139 & flag)
{
if ((double) this.velocity.X > 0.0 && (double) SpeedX1 > 0.0 || (double) this.velocity.X < 0.0 && (double) SpeedX1 < 0.0)
{
if ((double) Math.Abs(this.velocity.X) < 12.0)
this.velocity.X *= 1.05f;
}
else
this.velocity.X *= 0.9f;
}
if (Main.netMode != 1 && this.type == 94 && !Main.player[this.target].dead)
{
if (this.justHit)
this.localAI[0] = 0.0f;
++this.localAI[0];
if ((double) this.localAI[0] == 180.0)
{
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2) + (double) this.velocity.X), (int) ((double) this.position.Y + (double) (this.height / 2) + (double) this.velocity.Y), 112);
this.localAI[0] = 0.0f;
}
}
if (Main.dayTime && this.type != 173 && this.type != 6 && this.type != 23 && this.type != 42 && this.type != 94 && this.type != 176 && this.type != 205 && this.type != 210 && this.type != 211 && this.type != 252 && (this.type < 231 || this.type > 235) || Main.player[this.target].dead)
{
this.velocity.Y -= num2 * 2f;
if (this.timeLeft > 10)
this.timeLeft = 10;
}
if (((double) this.velocity.X <= 0.0 || (double) this.oldVelocity.X >= 0.0) && ((double) this.velocity.X >= 0.0 || (double) this.oldVelocity.X <= 0.0) && ((double) this.velocity.Y <= 0.0 || (double) this.oldVelocity.Y >= 0.0) && ((double) this.velocity.Y >= 0.0 || (double) this.oldVelocity.Y <= 0.0) || this.justHit)
return;
this.netUpdate = true;
}
private void AI_006_Worms()
{
if (this.type == 117 && (double) this.localAI[1] == 0.0)
{
this.localAI[1] = 1f;
Main.PlaySound(SoundID.NPCDeath13, this.position);
int num = 1;
if ((double) this.velocity.X < 0.0)
num = -1;
for (int index = 0; index < 20; ++index)
Dust.NewDust(new Vector2(this.position.X - 20f, this.position.Y - 20f), this.width + 40, this.height + 40, 5, (float) (num * 8), -1f);
}
if (this.type == 454 && (double) this.localAI[3] == 0.0)
{
Main.PlaySound(SoundID.Item119, this.position);
this.localAI[3] = 1f;
}
if (this.type >= 454 && this.type <= 459)
{
this.dontTakeDamage = this.alpha > 0;
if (this.type == 454 || this.type != 454 && Main.npc[(int) this.ai[1]].alpha < 85)
{
if (this.dontTakeDamage)
{
for (int index1 = 0; index1 < 2; ++index1)
{
int index2 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 228, Alpha: 100, Scale: 2f);
Main.dust[index2].noGravity = true;
Main.dust[index2].noLight = true;
}
}
this.alpha -= 42;
if (this.alpha < 0)
this.alpha = 0;
}
}
else if (this.type == 402 && (double) this.ai[1] == 0.0)
{
this.ai[1] = (float) Main.rand.Next(-2, 0);
this.netUpdate = true;
}
if (Main.netMode != 1 && Main.expertMode)
{
if (this.type == 14 && (double) this.position.Y / 16.0 < Main.worldSurface)
{
if (Main.rand.Next(900) == 0)
{
this.TargetClosest();
if (Collision.CanHitLine(this.Center, 1, 1, Main.player[this.target].Center, 1, 1))
NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2) + (double) this.velocity.X), (int) ((double) this.position.Y + (double) (this.height / 2) + (double) this.velocity.Y), 112, ai1: 1f);
}
}
else if (this.type == 13)
{
int maxValue = 90 + (int) ((double) this.life / (double) this.lifeMax * 60.0 * 5.0);
if (Main.rand.Next(maxValue) == 0)
{
this.TargetClosest();
if (Collision.CanHitLine(this.Center, 1, 1, Main.player[this.target].Center, 1, 1))
NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2) + (double) this.velocity.X), (int) ((double) this.position.Y + (double) (this.height / 2) + (double) this.velocity.Y), 112, ai1: 1f);
}
}
}
bool flag1 = false;
float num1 = 0.2f;
switch (this.type)
{
case 10:
case 39:
case 95:
case 117:
case 510:
flag1 = true;
break;
case 513:
flag1 = !Main.player[this.target].ZoneUndergroundDesert;
num1 = 0.1f;
break;
}
if (this.type >= 13 && this.type <= 15)
this.realLife = -1;
else if ((double) this.ai[3] > 0.0)
this.realLife = (int) this.ai[3];
if (this.target < 0 || this.target == (int) byte.MaxValue || Main.player[this.target].dead || flag1 && (double) Main.player[this.target].position.Y < Main.worldSurface * 16.0)
this.TargetClosest();
if (Main.player[this.target].dead || flag1 && (double) Main.player[this.target].position.Y < Main.worldSurface * 16.0)
{
if (this.timeLeft > 300)
this.timeLeft = 300;
if (flag1)
this.velocity.Y += num1;
}
if (Main.netMode != 1)
{
if (this.type == 87 && (double) this.ai[0] == 0.0)
{
this.ai[3] = (float) this.whoAmI;
this.realLife = this.whoAmI;
int index3 = this.whoAmI;
for (int index4 = 0; index4 < 14; ++index4)
{
int Type = 89;
if (index4 == 1 || index4 == 8)
{
Type = 88;
}
else
{
switch (index4)
{
case 11:
Type = 90;
break;
case 12:
Type = 91;
break;
case 13:
Type = 92;
break;
}
}
int number = NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2)), (int) ((double) this.position.Y + (double) this.height), Type, this.whoAmI);
Main.npc[number].ai[3] = (float) this.whoAmI;
Main.npc[number].realLife = this.whoAmI;
Main.npc[number].ai[1] = (float) index3;
Main.npc[index3].ai[0] = (float) number;
NetMessage.SendData(23, number: number);
index3 = number;
}
}
if (this.type == 454 && (double) this.ai[0] == 0.0)
{
this.ai[3] = (float) this.whoAmI;
this.realLife = this.whoAmI;
int index5 = this.whoAmI;
for (int index6 = 0; index6 < 30; ++index6)
{
int Type = 456;
if ((index6 - 2) % 4 == 0 && index6 < 26)
{
Type = 455;
}
else
{
switch (index6)
{
case 27:
Type = 457;
break;
case 28:
Type = 458;
break;
case 29:
Type = 459;
break;
}
}
int number = NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2)), (int) ((double) this.position.Y + (double) this.height), Type, this.whoAmI);
Main.npc[number].ai[3] = (float) this.whoAmI;
Main.npc[number].realLife = this.whoAmI;
Main.npc[number].ai[1] = (float) index5;
Main.npc[index5].ai[0] = (float) number;
NetMessage.SendData(23, number: number);
index5 = number;
}
}
if (this.type == 513 && (double) this.ai[0] == 0.0)
{
this.ai[3] = (float) this.whoAmI;
this.realLife = this.whoAmI;
int index7 = this.whoAmI;
int num2 = Main.rand.Next(6, 10);
for (int index8 = 0; index8 < num2; ++index8)
{
int Type = 514;
if (index8 == num2 - 1)
Type = 515;
int number = NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2)), (int) ((double) this.position.Y + (double) this.height), Type, this.whoAmI);
Main.npc[number].ai[3] = (float) this.whoAmI;
Main.npc[number].realLife = this.whoAmI;
Main.npc[number].ai[1] = (float) index7;
Main.npc[index7].ai[0] = (float) number;
NetMessage.SendData(23, number: number);
index7 = number;
}
}
if (this.type == 510 && (double) this.ai[0] == 0.0)
{
this.ai[3] = (float) this.whoAmI;
this.realLife = this.whoAmI;
int index9 = this.whoAmI;
int num3 = Main.rand.Next(12, 21);
for (int index10 = 0; index10 < num3; ++index10)
{
int Type = 511;
if (index10 == num3 - 1)
Type = 512;
int number = NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2)), (int) ((double) this.position.Y + (double) this.height), Type, this.whoAmI);
Main.npc[number].ai[3] = (float) this.whoAmI;
Main.npc[number].realLife = this.whoAmI;
Main.npc[number].ai[1] = (float) index9;
Main.npc[index9].ai[0] = (float) number;
NetMessage.SendData(23, number: number);
index9 = number;
}
}
else if ((this.type == 7 || this.type == 8 || this.type == 10 || this.type == 11 || this.type == 13 || this.type == 14 || this.type == 39 || this.type == 40 || this.type == 95 || this.type == 96 || this.type == 98 || this.type == 99 || this.type == 117 || this.type == 118) && (double) this.ai[0] == 0.0)
{
if (this.type == 7 || this.type == 10 || this.type == 13 || this.type == 39 || this.type == 95 || this.type == 98 || this.type == 117)
{
if (this.type < 13 || this.type > 15)
{
this.ai[3] = (float) this.whoAmI;
this.realLife = this.whoAmI;
}
this.ai[2] = (float) Main.rand.Next(8, 13);
if (this.type == 10)
this.ai[2] = (float) Main.rand.Next(4, 7);
if (this.type == 13)
{
this.ai[2] = (float) Main.rand.Next(45, 56);
if (Main.expertMode)
this.ai[2] = (float) (int) ((double) this.ai[2] * 1.10000002384186);
}
if (this.type == 39)
this.ai[2] = (float) Main.rand.Next(12, 19);
if (this.type == 95)
this.ai[2] = (float) Main.rand.Next(6, 12);
if (this.type == 98)
this.ai[2] = (float) Main.rand.Next(20, 26);
if (this.type == 117)
this.ai[2] = (float) Main.rand.Next(3, 6);
this.ai[0] = (float) NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2)), (int) ((double) this.position.Y + (double) this.height), this.type + 1, this.whoAmI);
}
else
this.ai[0] = this.type != 8 && this.type != 11 && this.type != 14 && this.type != 40 && this.type != 96 && this.type != 99 && this.type != 118 || (double) this.ai[2] <= 0.0 ? (float) NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2)), (int) ((double) this.position.Y + (double) this.height), this.type + 1, this.whoAmI) : (float) NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2)), (int) ((double) this.position.Y + (double) this.height), this.type, this.whoAmI);
if (this.type < 13 || this.type > 15)
{
Main.npc[(int) this.ai[0]].ai[3] = this.ai[3];
Main.npc[(int) this.ai[0]].realLife = this.realLife;
}
Main.npc[(int) this.ai[0]].ai[1] = (float) this.whoAmI;
Main.npc[(int) this.ai[0]].ai[2] = this.ai[2] - 1f;
this.netUpdate = true;
}
if (this.type == 412 && (double) this.ai[0] == 0.0)
{
this.ai[3] = (float) this.whoAmI;
this.realLife = this.whoAmI;
int index11 = this.whoAmI;
int num4 = 30;
for (int index12 = 0; index12 < num4; ++index12)
{
int Type = 413;
if (index12 == num4 - 1)
Type = 414;
int number = NPC.NewNPC((int) ((double) this.position.X + (double) (this.width / 2)), (int) ((double) this.position.Y + (double) this.height), Type, this.whoAmI);
Main.npc[number].ai[3] = (float) this.whoAmI;
Main.npc[number].realLife = this.whoAmI;
Main.npc[number].ai[1] = (float) index11;
Main.npc[index11].ai[0] = (float) number;
NetMessage.SendData(23, number: number);
index11 = number;
}
}
switch (this.type)
{
case 8:
case 9:
case 11:
case 12:
case 40:
case 41:
case 88:
case 89:
case 90:
case 91:
case 92:
case 96:
case 97:
case 99:
case 100:
case 118:
case 119:
case 413:
case 414:
case 455:
case 456:
case 457:
case 458:
case 459:
case 511:
case 512:
case 514:
case 515:
if (!Main.npc[(int) this.ai[1]].active || Main.npc[(int) this.ai[1]].aiStyle != this.aiStyle)
{
this.life = 0;
this.HitEffect();
this.active = false;
NetMessage.SendData(28, number: this.whoAmI, number2: -1f);
break;
}
break;
}
switch (this.type)
{
case 7:
case 8:
case 10:
case 11:
case 39:
case 40:
case 87:
case 88:
case 89:
case 90:
case 91:
case 95:
case 96:
case 98:
case 99:
case 117:
case 118:
case 412:
case 413:
case 454:
case 455:
case 456:
case 457:
case 458:
case 510:
case 511:
case 513:
case 514:
if (!Main.npc[(int) this.ai[0]].active || Main.npc[(int) this.ai[0]].aiStyle != this.aiStyle)
{
this.life = 0;
this.HitEffect();
this.active = false;
NetMessage.SendData(28, number: this.whoAmI, number2: -1f);
break;
}
break;
}
if (this.type == 13 || this.type == 14 || this.type == 15)
{
if (!Main.npc[(int) this.ai[1]].active && !Main.npc[(int) this.ai[0]].active)
{
this.life = 0;
this.HitEffect();
this.checkDead();
this.active = false;
NetMessage.SendData(28, number: this.whoAmI, number2: -1f);
}
if (this.type == 13 && !Main.npc[(int) this.ai[0]].active)
{
this.life = 0;
this.HitEffect();
this.checkDead();
this.active = false;
NetMessage.SendData(28, number: this.whoAmI, number2: -1f);
}
if (this.type == 15 && !Main.npc[(int) this.ai[1]].active)
{
this.life = 0;
this.HitEffect();
this.checkDead();
this.active = false;
NetMessage.SendData(28, number: this.whoAmI, number2: -1f);
}
if (this.type == 14 && (!Main.npc[(int) this.ai[1]].active || Main.npc[(int) this.ai[1]].aiStyle != this.aiStyle))
{
this.type = 13;
int whoAmI = this.whoAmI;
float num5 = (float) this.life / (float) this.lifeMax;
float num6 = this.ai[0];
this.SetDefaultsKeepPlayerInteraction(this.type);
this.life = (int) ((double) this.lifeMax * (double) num5);
this.ai[0] = num6;
this.TargetClosest();
this.netUpdate = true;
this.whoAmI = whoAmI;
}
if (this.type == 14 && (!Main.npc[(int) this.ai[0]].active || Main.npc[(int) this.ai[0]].aiStyle != this.aiStyle))
{
int whoAmI = this.whoAmI;
float num7 = (float) this.life / (float) this.lifeMax;
float num8 = this.ai[1];
this.SetDefaultsKeepPlayerInteraction(this.type);
this.life = (int) ((double) this.lifeMax * (double) num7);
this.ai[1] = num8;
this.TargetClosest();
this.netUpdate = true;
this.whoAmI = whoAmI;
}
}
if (!this.active && Main.netMode == 2)
NetMessage.SendData(28, number: this.whoAmI, number2: -1f);
}
int num9 = (int) ((double) this.position.X / 16.0) - 1;
int num10 = (int) (((double) this.position.X + (double) this.width) / 16.0) + 2;
int num11 = (int) ((double) this.position.Y / 16.0) - 1;
int num12 = (int) (((double) this.position.Y + (double) this.height) / 16.0) + 2;
if (num9 < 0)
num9 = 0;
if (num10 > Main.maxTilesX)
num10 = Main.maxTilesX;
if (num11 < 0)
num11 = 0;
if (num12 > Main.maxTilesY)
num12 = Main.maxTilesY;
bool flag2 = false;
if (this.type >= 87 && this.type <= 92)
flag2 = true;
if (this.type >= 454 && this.type <= 459)
flag2 = true;
if (this.type == 402 && (double) this.ai[1] == -1.0)
flag2 = true;
if (this.type >= 412 && this.type <= 414)
flag2 = true;
if (!flag2)
{
for (int i = num9; i < num10; ++i)
{
for (int j = num11; j < num12; ++j)
{
if (Main.tile[i, j] != null && (Main.tile[i, j].nactive() && (Main.tileSolid[(int) Main.tile[i, j].type] || Main.tileSolidTop[(int) Main.tile[i, j].type] && Main.tile[i, j].frameY == (short) 0) || Main.tile[i, j].liquid > (byte) 64))
{
Vector2 vector2;
vector2.X = (float) (i * 16);
vector2.Y = (float) (j * 16);
if ((double) this.position.X + (double) this.width > (double) vector2.X && (double) this.position.X < (double) vector2.X + 16.0 && (double) this.position.Y + (double) this.height > (double) vector2.Y && (double) this.position.Y < (double) vector2.Y + 16.0)
{
flag2 = true;
if (Main.rand.Next(100) == 0 && this.type != 117 && Main.tile[i, j].nactive())
WorldGen.KillTile(i, j, true, true);
}
}
}
}
}
if (!flag2 && (this.type == 7 || this.type == 10 || this.type == 13 || this.type == 39 || this.type == 95 || this.type == 98 || this.type == 117 || this.type == 375 || this.type == 454 || this.type == 510 || this.type == 513))
{
Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height);
int num13 = 1000;
bool flag3 = true;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active)
{
Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) Main.player[index].position.X - num13, (int) Main.player[index].position.Y - num13, num13 * 2, num13 * 2);
if (rectangle1.Intersects(rectangle2))
{
flag3 = false;
break;
}
}
}
if (flag3)
flag2 = true;
}
if (this.type >= 87 && this.type <= 92 || this.type >= 454 && this.type <= 459)
{
if ((double) this.velocity.X < 0.0)
this.spriteDirection = 1;
else if ((double) this.velocity.X > 0.0)
this.spriteDirection = -1;
}
if (this.type == 414)
{
if (this.justHit)
this.localAI[3] = 3f;
if ((double) this.localAI[2] > 0.0)
{
this.localAI[2] -= 16f;
if ((double) this.localAI[2] == 0.0)
this.localAI[2] = (float) sbyte.MinValue;
}
else if ((double) this.localAI[2] < 0.0)
this.localAI[2] += 16f;
else if ((double) this.localAI[3] > 0.0)
{
this.localAI[2] = 128f;
--this.localAI[3];
}
}
if (this.type == 412)
{
Vector2 vector2_1 = this.Center + (this.rotation - 1.570796f).ToRotationVector2() * 8f;
Vector2 vector2_2 = this.rotation.ToRotationVector2() * 16f;
Dust dust1 = Main.dust[Dust.NewDust(vector2_1 + vector2_2, 0, 0, 6, this.velocity.X, this.velocity.Y, 100, Color.Transparent, (float) (1.0 + (double) Main.rand.NextFloat() * 3.0))];
dust1.noGravity = true;
dust1.noLight = true;
dust1.position -= new Vector2(4f);
dust1.fadeIn = 1f;
dust1.velocity = Vector2.Zero;
Dust dust2 = Main.dust[Dust.NewDust(vector2_1 - vector2_2, 0, 0, 6, this.velocity.X, this.velocity.Y, 100, Color.Transparent, (float) (1.0 + (double) Main.rand.NextFloat() * 3.0))];
dust2.noGravity = true;
dust2.noLight = true;
dust2.position -= new Vector2(4f);
dust2.fadeIn = 1f;
dust2.velocity = Vector2.Zero;
}
float num14 = 8f;
float num15 = 0.07f;
if (this.type == 95)
{
num14 = 5.5f;
num15 = 0.045f;
}
if (this.type == 10)
{
num14 = 6f;
num15 = 0.05f;
}
if (this.type == 513)
{
num14 = 7f;
num15 = 0.1f;
}
if (this.type == 13)
{
num14 = 10f;
num15 = 0.07f;
if (Main.expertMode)
{
num14 = 12f;
num15 = 0.15f;
}
}
if (this.type == 510)
{
if (!Main.player[this.target].dead && Main.player[this.target].ZoneSandstorm)
{
num14 = 16f;
num15 = 0.35f;
}
else
{
num14 = 10f;
num15 = 0.25f;
}
}
if (this.type == 87)
{
num14 = 11f;
num15 = 0.25f;
}
if (this.type == 375)
{
num14 = 6f;
num15 = 0.15f;
}
if (this.type == 454)
{
num14 = 20f;
num15 = 0.55f;
}
if (this.type == 402)
{
num14 = 6f;
num15 = 0.2f;
}
if (this.type == 117 && Main.wof >= 0)
{
double num16;
if ((num16 = (double) ((float) Main.npc[Main.wof].life / (float) Main.npc[Main.wof].lifeMax)) < 0.5)
{
++num14;
num15 += 0.1f;
}
if (num16 < 0.25)
{
++num14;
num15 += 0.1f;
}
if (num16 < 0.1)
{
num14 += 2f;
num15 += 0.1f;
}
}
Vector2 vector2_3 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num17 = Main.player[this.target].position.X + (float) (Main.player[this.target].width / 2);
float num18 = Main.player[this.target].position.Y + (float) (Main.player[this.target].height / 2);
if (this.type == 412)
{
num14 = 10f;
num15 = 0.3f;
int num19 = -1;
int num20 = (int) ((double) Main.player[this.target].Center.X / 16.0);
int num21 = (int) ((double) Main.player[this.target].Center.Y / 16.0);
for (int i = num20 - 2; i <= num20 + 2; ++i)
{
for (int j = num21; j <= num21 + 15; ++j)
{
if (WorldGen.SolidTile2(i, j))
{
num19 = j;
break;
}
}
if (num19 > 0)
break;
}
if (num19 > 0)
{
num19 *= 16;
float num22 = (float) (num19 - 800);
if ((double) Main.player[this.target].position.Y > (double) num22)
{
num18 = num22;
if ((double) Math.Abs(this.Center.X - Main.player[this.target].Center.X) < 500.0)
num17 = (double) this.velocity.X <= 0.0 ? Main.player[this.target].Center.X - 600f : Main.player[this.target].Center.X + 600f;
}
}
else
{
num14 = 14f;
num15 = 0.5f;
}
float num23 = num14 * 1.3f;
float num24 = num14 * 0.7f;
float num25 = this.velocity.Length();
if ((double) num25 > 0.0)
{
if ((double) num25 > (double) num23)
{
this.velocity.Normalize();
this.velocity = this.velocity * num23;
}
else if ((double) num25 < (double) num24)
{
this.velocity.Normalize();
this.velocity = this.velocity * num24;
}
}
if (num19 > 0)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == this.type && index != this.whoAmI)
{
Vector2 vector2_4 = Main.npc[index].Center - this.Center;
if ((double) vector2_4.Length() < 400.0)
{
vector2_4.Normalize();
Vector2 vector2_5 = vector2_4 * 1000f;
num17 -= vector2_5.X;
num18 -= vector2_5.Y;
}
}
}
}
else
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == this.type && index != this.whoAmI)
{
Vector2 vector2_6 = Main.npc[index].Center - this.Center;
if ((double) vector2_6.Length() < 60.0)
{
vector2_6.Normalize();
Vector2 vector2_7 = vector2_6 * 200f;
num17 -= vector2_7.X;
num18 -= vector2_7.Y;
}
}
}
}
}
float num26 = (float) ((int) ((double) num17 / 16.0) * 16);
float num27 = (float) ((int) ((double) num18 / 16.0) * 16);
vector2_3.X = (float) ((int) ((double) vector2_3.X / 16.0) * 16);
vector2_3.Y = (float) ((int) ((double) vector2_3.Y / 16.0) * 16);
float num28 = num26 - vector2_3.X;
float num29 = num27 - vector2_3.Y;
if (this.type == 375)
{
num28 *= -1f;
num29 *= -1f;
}
float num30 = (float) Math.Sqrt((double) num28 * (double) num28 + (double) num29 * (double) num29);
if ((double) this.ai[1] > 0.0)
{
if ((double) this.ai[1] < (double) Main.npc.Length)
{
try
{
vector2_3 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
num28 = Main.npc[(int) this.ai[1]].position.X + (float) (Main.npc[(int) this.ai[1]].width / 2) - vector2_3.X;
num29 = Main.npc[(int) this.ai[1]].position.Y + (float) (Main.npc[(int) this.ai[1]].height / 2) - vector2_3.Y;
}
catch
{
}
this.rotation = (float) Math.Atan2((double) num29, (double) num28) + 1.57f;
float num31 = (float) Math.Sqrt((double) num28 * (double) num28 + (double) num29 * (double) num29);
int num32 = this.width;
if (this.type >= 87 && this.type <= 92)
num32 = 42;
if (this.type >= 454 && this.type <= 459)
num32 = 36;
if (this.type >= 13 && this.type <= 15)
num32 = (int) ((double) num32 * (double) this.scale);
if (this.type >= 412 && this.type <= 414)
num32 += 6;
float num33 = (num31 - (float) num32) / num31;
float num34 = num28 * num33;
float num35 = num29 * num33;
this.velocity = Vector2.Zero;
this.position.X += num34;
this.position.Y += num35;
if (this.type >= 87 && this.type <= 92)
{
if ((double) num34 < 0.0)
this.spriteDirection = 1;
else if ((double) num34 > 0.0)
this.spriteDirection = -1;
}
if (this.type < 454 || this.type > 459)
return;
if ((double) num34 < 0.0)
{
this.spriteDirection = 1;
return;
}
if ((double) num34 <= 0.0)
return;
this.spriteDirection = -1;
return;
}
}
if (!flag2)
{
this.TargetClosest();
this.velocity.Y += 0.11f;
if ((double) this.velocity.Y > (double) num14)
this.velocity.Y = num14;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num14 * 0.4)
{
if ((double) this.velocity.X < 0.0)
this.velocity.X -= num15 * 1.1f;
else
this.velocity.X += num15 * 1.1f;
}
else if ((double) this.velocity.Y == (double) num14)
{
if ((double) this.velocity.X < (double) num28)
this.velocity.X += num15;
else if ((double) this.velocity.X > (double) num28)
this.velocity.X -= num15;
}
else if ((double) this.velocity.Y > 4.0)
{
if ((double) this.velocity.X < 0.0)
this.velocity.X += num15 * 0.9f;
else
this.velocity.X -= num15 * 0.9f;
}
}
else
{
if (this.type != 87 && this.type != 117 && this.type != 454 && this.type != 412 && this.soundDelay == 0)
{
float num36 = num30 / 40f;
if ((double) num36 < 10.0)
num36 = 10f;
if ((double) num36 > 20.0)
num36 = 20f;
this.soundDelay = (int) num36;
Main.PlaySound(15, (int) this.position.X, (int) this.position.Y);
}
float num37 = (float) Math.Sqrt((double) num28 * (double) num28 + (double) num29 * (double) num29);
float num38 = Math.Abs(num28);
float num39 = Math.Abs(num29);
float num40 = num14 / num37;
float num41 = num28 * num40;
float num42 = num29 * num40;
bool flag4 = false;
if ((this.type == 7 || this.type == 13) && (!Main.player[this.target].ZoneCorrupt && !Main.player[this.target].ZoneCrimson || Main.player[this.target].dead))
flag4 = true;
if (this.type == 513 && (double) Main.player[this.target].position.Y < Main.worldSurface * 16.0 && !Main.player[this.target].ZoneSandstorm && !Main.player[this.target].ZoneUndergroundDesert || Main.player[this.target].dead)
flag4 = true;
if (this.type == 510 && (double) Main.player[this.target].position.Y < Main.worldSurface * 16.0 && !Main.player[this.target].ZoneSandstorm && !Main.player[this.target].ZoneUndergroundDesert || Main.player[this.target].dead)
flag4 = true;
if (flag4)
{
bool flag5 = true;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && !Main.player[index].dead && Main.player[index].ZoneCorrupt)
flag5 = false;
}
if (flag5)
{
if (Main.netMode != 1 && (double) this.position.Y / 16.0 > (Main.rockLayer + (double) Main.maxTilesY) / 2.0)
{
this.active = false;
int num43;
for (int number = (int) this.ai[0]; number > 0 && number < 200 && Main.npc[number].active && Main.npc[number].aiStyle == this.aiStyle; number = num43)
{
num43 = (int) Main.npc[number].ai[0];
Main.npc[number].active = false;
this.life = 0;
if (Main.netMode == 2)
NetMessage.SendData(23, number: number);
}
if (Main.netMode == 2)
NetMessage.SendData(23, number: this.whoAmI);
}
num41 = 0.0f;
num42 = num14;
}
}
bool flag6 = false;
if (this.type == 87)
{
if (((double) this.velocity.X > 0.0 && (double) num41 < 0.0 || (double) this.velocity.X < 0.0 && (double) num41 > 0.0 || (double) this.velocity.Y > 0.0 && (double) num42 < 0.0 || (double) this.velocity.Y < 0.0 && (double) num42 > 0.0) && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > (double) num15 / 2.0 && (double) num37 < 300.0)
{
flag6 = true;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num14)
this.velocity = this.velocity * 1.1f;
}
if ((double) this.position.Y > (double) Main.player[this.target].position.Y || (double) Main.player[this.target].position.Y / 16.0 > Main.worldSurface || Main.player[this.target].dead)
{
flag6 = true;
if ((double) Math.Abs(this.velocity.X) < (double) num14 / 2.0)
{
if ((double) this.velocity.X == 0.0)
this.velocity.X -= (float) this.direction;
this.velocity.X *= 1.1f;
}
else if ((double) this.velocity.Y > -(double) num14)
this.velocity.Y -= num15;
}
}
if (this.type == 454)
{
if (((double) this.velocity.X > 0.0 && (double) num41 < 0.0 || (double) this.velocity.X < 0.0 && (double) num41 > 0.0 || (double) this.velocity.Y > 0.0 && (double) num42 < 0.0 || (double) this.velocity.Y < 0.0 && (double) num42 > 0.0) && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > (double) num15 / 2.0 && (double) num37 < 300.0)
{
flag6 = true;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num14)
this.velocity = this.velocity * 1.1f;
}
if ((double) this.position.Y > (double) Main.player[this.target].position.Y || Main.player[this.target].dead)
{
flag6 = true;
if ((double) Math.Abs(this.velocity.X) < (double) num14 / 2.0)
{
if ((double) this.velocity.X == 0.0)
this.velocity.X -= (float) this.direction;
this.velocity.X *= 1.1f;
}
else if ((double) this.velocity.Y > -(double) num14)
this.velocity.Y -= num15;
}
}
if (!flag6)
{
if ((double) this.velocity.X > 0.0 && (double) num41 > 0.0 || (double) this.velocity.X < 0.0 && (double) num41 < 0.0 || (double) this.velocity.Y > 0.0 && (double) num42 > 0.0 || (double) this.velocity.Y < 0.0 && (double) num42 < 0.0)
{
if ((double) this.velocity.X < (double) num41)
this.velocity.X += num15;
else if ((double) this.velocity.X > (double) num41)
this.velocity.X -= num15;
if ((double) this.velocity.Y < (double) num42)
this.velocity.Y += num15;
else if ((double) this.velocity.Y > (double) num42)
this.velocity.Y -= num15;
if ((double) Math.Abs(num42) < (double) num14 * 0.2 && ((double) this.velocity.X > 0.0 && (double) num41 < 0.0 || (double) this.velocity.X < 0.0 && (double) num41 > 0.0))
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y += num15 * 2f;
else
this.velocity.Y -= num15 * 2f;
}
if ((double) Math.Abs(num41) < (double) num14 * 0.2 && ((double) this.velocity.Y > 0.0 && (double) num42 < 0.0 || (double) this.velocity.Y < 0.0 && (double) num42 > 0.0))
{
if ((double) this.velocity.X > 0.0)
this.velocity.X += num15 * 2f;
else
this.velocity.X -= num15 * 2f;
}
}
else if ((double) num38 > (double) num39)
{
if ((double) this.velocity.X < (double) num41)
this.velocity.X += num15 * 1.1f;
else if ((double) this.velocity.X > (double) num41)
this.velocity.X -= num15 * 1.1f;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num14 * 0.5)
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y += num15;
else
this.velocity.Y -= num15;
}
}
else
{
if ((double) this.velocity.Y < (double) num42)
this.velocity.Y += num15 * 1.1f;
else if ((double) this.velocity.Y > (double) num42)
this.velocity.Y -= num15 * 1.1f;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num14 * 0.5)
{
if ((double) this.velocity.X > 0.0)
this.velocity.X += num15;
else
this.velocity.X -= num15;
}
}
}
}
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
if (this.type == 7 || this.type == 10 || this.type == 13 || this.type == 39 || this.type == 95 || this.type == 98 || this.type == 117 || this.type == 510 || this.type == 513)
{
if (flag2)
{
if ((double) this.localAI[0] != 1.0)
this.netUpdate = true;
this.localAI[0] = 1f;
}
else
{
if ((double) this.localAI[0] != 0.0)
this.netUpdate = true;
this.localAI[0] = 0.0f;
}
if (((double) this.velocity.X > 0.0 && (double) this.oldVelocity.X < 0.0 || (double) this.velocity.X < 0.0 && (double) this.oldVelocity.X > 0.0 || (double) this.velocity.Y > 0.0 && (double) this.oldVelocity.Y < 0.0 || (double) this.velocity.Y < 0.0 && (double) this.oldVelocity.Y > 0.0) && !this.justHit)
this.netUpdate = true;
}
if (this.type != 454)
return;
float num44 = Vector2.Distance(Main.player[this.target].Center, this.Center);
int num45 = 0;
if ((double) Vector2.Normalize(Main.player[this.target].Center - this.Center).ToRotation().AngleTowards(this.velocity.ToRotation(), 1.570796f) == (double) this.velocity.ToRotation() && (double) num44 < 350.0)
num45 = 4;
if ((double) num45 > this.frameCounter)
++this.frameCounter;
if ((double) num45 < this.frameCounter)
--this.frameCounter;
if (this.frameCounter < 0.0)
this.frameCounter = 0.0;
if (this.frameCounter <= 4.0)
return;
this.frameCounter = 4.0;
}
private void AI_002_FloatingEye()
{
if ((this.type == 170 || this.type == 171 || this.type == 180) && Main.rand.Next(1000) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 9);
this.noGravity = true;
if (!this.noTileCollide)
{
if (this.collideX)
{
this.velocity.X = this.oldVelocity.X * -0.5f;
if (this.direction == -1 && (double) this.velocity.X > 0.0 && (double) this.velocity.X < 2.0)
this.velocity.X = 2f;
if (this.direction == 1 && (double) this.velocity.X < 0.0 && (double) this.velocity.X > -2.0)
this.velocity.X = -2f;
}
if (this.collideY)
{
this.velocity.Y = this.oldVelocity.Y * -0.5f;
if ((double) this.velocity.Y > 0.0 && (double) this.velocity.Y < 1.0)
this.velocity.Y = 1f;
if ((double) this.velocity.Y < 0.0 && (double) this.velocity.Y > -1.0)
this.velocity.Y = -1f;
}
}
if (Main.dayTime && (double) this.position.Y <= Main.worldSurface * 16.0 && (this.type == 2 || this.type == 133 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194 || this.type == 317 || this.type == 318))
{
if (this.timeLeft > 10)
this.timeLeft = 10;
this.directionY = -1;
if ((double) this.velocity.Y > 0.0)
this.direction = 1;
this.direction = -1;
if ((double) this.velocity.X > 0.0)
this.direction = 1;
}
else
this.TargetClosest();
if (this.type == 170 || this.type == 171 || this.type == 180)
{
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
if ((double) this.ai[1] > 0.0 && !Collision.SolidCollision(this.position, this.width, this.height))
{
this.ai[1] = 0.0f;
this.ai[0] = 0.0f;
this.netUpdate = true;
}
}
else if ((double) this.ai[1] == 0.0)
++this.ai[0];
if ((double) this.ai[0] >= 300.0)
{
this.ai[1] = 1f;
this.ai[0] = 0.0f;
this.netUpdate = true;
}
if ((double) this.ai[1] == 0.0)
{
this.alpha = 0;
this.noTileCollide = false;
}
else
{
this.wet = false;
this.alpha = 200;
this.noTileCollide = true;
}
this.rotation = this.velocity.Y * 0.1f * (float) this.direction;
this.TargetClosest();
if (this.direction == -1 && (double) this.velocity.X > -4.0 && (double) this.position.X > (double) Main.player[this.target].position.X + (double) Main.player[this.target].width)
{
this.velocity.X -= 0.08f;
if ((double) this.velocity.X > 4.0)
this.velocity.X -= 0.04f;
else if ((double) this.velocity.X > 0.0)
this.velocity.X -= 0.2f;
if ((double) this.velocity.X < -4.0)
this.velocity.X = -4f;
}
else if (this.direction == 1 && (double) this.velocity.X < 4.0 && (double) this.position.X + (double) this.width < (double) Main.player[this.target].position.X)
{
this.velocity.X += 0.08f;
if ((double) this.velocity.X < -4.0)
this.velocity.X += 0.04f;
else if ((double) this.velocity.X < 0.0)
this.velocity.X += 0.2f;
if ((double) this.velocity.X > 4.0)
this.velocity.X = 4f;
}
if (this.directionY == -1 && (double) this.velocity.Y > -2.5 && (double) this.position.Y > (double) Main.player[this.target].position.Y + (double) Main.player[this.target].height)
{
this.velocity.Y -= 0.1f;
if ((double) this.velocity.Y > 2.5)
this.velocity.Y -= 0.05f;
else if ((double) this.velocity.Y > 0.0)
this.velocity.Y -= 0.15f;
if ((double) this.velocity.Y < -2.5)
this.velocity.Y = -2.5f;
}
else if (this.directionY == 1 && (double) this.velocity.Y < 2.5 && (double) this.position.Y + (double) this.height < (double) Main.player[this.target].position.Y)
{
this.velocity.Y += 0.1f;
if ((double) this.velocity.Y < -2.5)
this.velocity.Y += 0.05f;
else if ((double) this.velocity.Y < 0.0)
this.velocity.Y += 0.15f;
if ((double) this.velocity.Y > 2.5)
this.velocity.Y = 2.5f;
}
}
else if (this.type == 116)
{
this.TargetClosest();
Lighting.AddLight((int) ((double) this.position.X + (double) (this.width / 2)) / 16, (int) ((double) this.position.Y + (double) (this.height / 2)) / 16, 0.3f, 0.2f, 0.1f);
if (this.direction == -1 && (double) this.velocity.X > -6.0)
{
this.velocity.X -= 0.1f;
if ((double) this.velocity.X > 6.0)
this.velocity.X -= 0.1f;
else if ((double) this.velocity.X > 0.0)
this.velocity.X -= 0.2f;
if ((double) this.velocity.X < -6.0)
this.velocity.X = -6f;
}
else if (this.direction == 1 && (double) this.velocity.X < 6.0)
{
this.velocity.X += 0.1f;
if ((double) this.velocity.X < -6.0)
this.velocity.X += 0.1f;
else if ((double) this.velocity.X < 0.0)
this.velocity.X += 0.2f;
if ((double) this.velocity.X > 6.0)
this.velocity.X = 6f;
}
if (this.directionY == -1 && (double) this.velocity.Y > -2.5)
{
this.velocity.Y -= 0.04f;
if ((double) this.velocity.Y > 2.5)
this.velocity.Y -= 0.05f;
else if ((double) this.velocity.Y > 0.0)
this.velocity.Y -= 0.15f;
if ((double) this.velocity.Y < -2.5)
this.velocity.Y = -2.5f;
}
else if (this.directionY == 1 && (double) this.velocity.Y < 1.5)
{
this.velocity.Y += 0.04f;
if ((double) this.velocity.Y < -2.5)
this.velocity.Y += 0.05f;
else if ((double) this.velocity.Y < 0.0)
this.velocity.Y += 0.15f;
if ((double) this.velocity.Y > 2.5)
this.velocity.Y = 2.5f;
}
if (Main.rand.Next(40) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) this.height * 0.25f), this.width, (int) ((double) this.height * 0.5), 5, this.velocity.X, 2f);
Main.dust[index].velocity.X *= 0.5f;
Main.dust[index].velocity.Y *= 0.1f;
}
}
else if (this.type == 133)
{
if ((double) this.life < (double) this.lifeMax * 0.5)
{
if (this.direction == -1 && (double) this.velocity.X > -6.0)
{
this.velocity.X -= 0.1f;
if ((double) this.velocity.X > 6.0)
this.velocity.X -= 0.1f;
else if ((double) this.velocity.X > 0.0)
this.velocity.X += 0.05f;
if ((double) this.velocity.X < -6.0)
this.velocity.X = -6f;
}
else if (this.direction == 1 && (double) this.velocity.X < 6.0)
{
this.velocity.X += 0.1f;
if ((double) this.velocity.X < -6.0)
this.velocity.X += 0.1f;
else if ((double) this.velocity.X < 0.0)
this.velocity.X -= 0.05f;
if ((double) this.velocity.X > 6.0)
this.velocity.X = 6f;
}
if (this.directionY == -1 && (double) this.velocity.Y > -4.0)
{
this.velocity.Y -= 0.1f;
if ((double) this.velocity.Y > 4.0)
this.velocity.Y -= 0.1f;
else if ((double) this.velocity.Y > 0.0)
this.velocity.Y += 0.05f;
if ((double) this.velocity.Y < -4.0)
this.velocity.Y = -4f;
}
else if (this.directionY == 1 && (double) this.velocity.Y < 4.0)
{
this.velocity.Y += 0.1f;
if ((double) this.velocity.Y < -4.0)
this.velocity.Y += 0.1f;
else if ((double) this.velocity.Y < 0.0)
this.velocity.Y -= 0.05f;
if ((double) this.velocity.Y > 4.0)
this.velocity.Y = 4f;
}
}
else
{
if (this.direction == -1 && (double) this.velocity.X > -4.0)
{
this.velocity.X -= 0.1f;
if ((double) this.velocity.X > 4.0)
this.velocity.X -= 0.1f;
else if ((double) this.velocity.X > 0.0)
this.velocity.X += 0.05f;
if ((double) this.velocity.X < -4.0)
this.velocity.X = -4f;
}
else if (this.direction == 1 && (double) this.velocity.X < 4.0)
{
this.velocity.X += 0.1f;
if ((double) this.velocity.X < -4.0)
this.velocity.X += 0.1f;
else if ((double) this.velocity.X < 0.0)
this.velocity.X -= 0.05f;
if ((double) this.velocity.X > 4.0)
this.velocity.X = 4f;
}
if (this.directionY == -1 && (double) this.velocity.Y > -1.5)
{
this.velocity.Y -= 0.04f;
if ((double) this.velocity.Y > 1.5)
this.velocity.Y -= 0.05f;
else if ((double) this.velocity.Y > 0.0)
this.velocity.Y += 0.03f;
if ((double) this.velocity.Y < -1.5)
this.velocity.Y = -1.5f;
}
else if (this.directionY == 1 && (double) this.velocity.Y < 1.5)
{
this.velocity.Y += 0.04f;
if ((double) this.velocity.Y < -1.5)
this.velocity.Y += 0.05f;
else if ((double) this.velocity.Y < 0.0)
this.velocity.Y -= 0.03f;
if ((double) this.velocity.Y > 1.5)
this.velocity.Y = 1.5f;
}
}
}
else
{
float num1 = 4f;
float num2 = 1.5f;
float num3 = num1 * (float) (1.0 + (1.0 - (double) this.scale));
float num4 = num2 * (float) (1.0 + (1.0 - (double) this.scale));
if (this.direction == -1 && (double) this.velocity.X > -(double) num3)
{
this.velocity.X -= 0.1f;
if ((double) this.velocity.X > (double) num3)
this.velocity.X -= 0.1f;
else if ((double) this.velocity.X > 0.0)
this.velocity.X += 0.05f;
if ((double) this.velocity.X < -(double) num3)
this.velocity.X = -num3;
}
else if (this.direction == 1 && (double) this.velocity.X < (double) num3)
{
this.velocity.X += 0.1f;
if ((double) this.velocity.X < -(double) num3)
this.velocity.X += 0.1f;
else if ((double) this.velocity.X < 0.0)
this.velocity.X -= 0.05f;
if ((double) this.velocity.X > (double) num3)
this.velocity.X = num3;
}
if (this.directionY == -1 && (double) this.velocity.Y > -(double) num4)
{
this.velocity.Y -= 0.04f;
if ((double) this.velocity.Y > (double) num4)
this.velocity.Y -= 0.05f;
else if ((double) this.velocity.Y > 0.0)
this.velocity.Y += 0.03f;
if ((double) this.velocity.Y < -(double) num4)
this.velocity.Y = -num4;
}
else if (this.directionY == 1 && (double) this.velocity.Y < (double) num4)
{
this.velocity.Y += 0.04f;
if ((double) this.velocity.Y < -(double) num4)
this.velocity.Y += 0.05f;
else if ((double) this.velocity.Y < 0.0)
this.velocity.Y -= 0.03f;
if ((double) this.velocity.Y > (double) num4)
this.velocity.Y = num4;
}
}
if ((this.type == 2 || this.type == 133 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194) && Main.rand.Next(40) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) this.height * 0.25f), this.width, (int) ((double) this.height * 0.5), 5, this.velocity.X, 2f);
Main.dust[index].velocity.X *= 0.5f;
Main.dust[index].velocity.Y *= 0.1f;
}
if (!this.wet || this.type == 170 || this.type == 171 || this.type == 172)
return;
if ((double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.95f;
this.velocity.Y -= 0.5f;
if ((double) this.velocity.Y < -4.0)
this.velocity.Y = -4f;
this.TargetClosest();
}
private void AI_007_TownEntities()
{
int maxValue1 = 300;
bool flag1 = Main.raining;
if (!Main.dayTime)
flag1 = true;
if (Main.eclipse)
flag1 = true;
if (Main.slimeRain)
flag1 = true;
float num1 = 1f;
this.defense = !Main.expertMode ? (this.dryadWard ? this.defDefense + 6 : this.defDefense) : (this.dryadWard ? this.defDefense + 10 : this.defDefense);
if (this.townNPC || this.type == 453)
{
if (NPC.downedBoss1)
{
num1 += 0.1f;
this.defense += 3;
}
if (NPC.downedBoss2)
{
num1 += 0.1f;
this.defense += 3;
}
if (NPC.downedBoss3)
{
num1 += 0.1f;
this.defense += 3;
}
if (NPC.downedQueenBee)
{
num1 += 0.1f;
this.defense += 3;
}
if (Main.hardMode)
{
num1 += 0.4f;
this.defense += 12;
}
if (NPC.downedMechBoss1)
{
num1 += 0.15f;
this.defense += 6;
}
if (NPC.downedMechBoss2)
{
num1 += 0.15f;
this.defense += 6;
}
if (NPC.downedMechBoss3)
{
num1 += 0.15f;
this.defense += 6;
}
if (NPC.downedPlantBoss)
{
num1 += 0.15f;
this.defense += 8;
}
if (NPC.downedGolemBoss)
{
num1 += 0.15f;
this.defense += 8;
}
if (NPC.downedAncientCultist)
{
num1 += 0.15f;
this.defense += 8;
}
}
if (this.type == 142 && Main.netMode != 1 && !Main.xMas)
{
this.StrikeNPCNoInteraction(9999, 0.0f, 0);
if (Main.netMode == 2)
NetMessage.SendData(28, number: this.whoAmI, number2: 9999f);
}
if ((this.type == 148 || this.type == 149) && (double) this.localAI[0] == 0.0)
this.localAI[0] = (float) Main.rand.Next(1, 5);
if (this.type == 124)
{
bool flag2 = false;
for (int index = 0; index < 1000; ++index)
{
if (Main.projectile[index].active && Main.projectile[index].type == 582 && (double) Main.projectile[index].ai[1] == (double) this.whoAmI)
{
flag2 = true;
break;
}
}
this.localAI[0] = (float) flag2.ToInt();
}
if ((this.type == 362 || this.type == 364) && Main.netMode != 1 && ((double) this.velocity.Y > 4.0 || (double) this.velocity.Y < -4.0 || this.wet))
{
int direction = this.direction;
this.Transform(this.type + 1);
this.TargetClosest();
this.direction = direction;
this.netUpdate = true;
}
else
{
switch (this.type)
{
case 107:
NPC.savedGoblin = true;
break;
case 108:
NPC.savedWizard = true;
break;
case 124:
NPC.savedMech = true;
break;
case 353:
NPC.savedStylist = true;
break;
case 369:
NPC.savedAngler = true;
break;
case 441:
NPC.savedTaxCollector = true;
break;
case 550:
NPC.savedBartender = true;
break;
}
if (this.type >= 0 && this.type < 580 && NPCID.Sets.TownCritter[this.type] && this.target == (int) byte.MaxValue)
{
this.TargetClosest();
if ((double) this.position.X < (double) Main.player[this.target].position.X)
{
this.direction = 1;
this.spriteDirection = this.direction;
}
if ((double) this.position.X > (double) Main.player[this.target].position.X)
{
this.direction = -1;
this.spriteDirection = this.direction;
}
if (this.homeTileX == -1)
this.homeTileX = (int) (((double) this.position.X + (double) (this.width / 2)) / 16.0);
}
else if (this.homeTileX == -1 && this.homeTileY == -1 && (double) this.velocity.Y == 0.0)
{
this.homeTileX = (int) this.Center.X / 16;
this.homeTileY = (int) ((double) this.position.Y + (double) this.height + 4.0) / 16;
}
bool flag3 = false;
int homeTileY = this.homeTileY;
if (this.type == 441)
NPC.taxCollector = true;
this.directionY = -1;
if (this.direction == 0)
this.direction = 1;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && Main.player[index].talkNPC == this.whoAmI)
{
flag3 = true;
if ((double) this.ai[0] != 0.0)
this.netUpdate = true;
this.ai[0] = 0.0f;
this.ai[1] = 300f;
this.localAI[3] = 100f;
if ((double) Main.player[index].position.X + (double) (Main.player[index].width / 2) < (double) this.position.X + (double) (this.width / 2))
this.direction = -1;
else
this.direction = 1;
}
}
if ((double) this.ai[3] == 1.0)
{
this.life = -1;
this.HitEffect();
this.active = false;
this.netUpdate = true;
if (this.type != 37)
return;
Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0);
}
else
{
if (this.type == 37 && Main.netMode != 1)
{
this.homeless = false;
this.homeTileX = Main.dungeonX;
this.homeTileY = Main.dungeonY;
if (NPC.downedBoss3)
{
this.ai[3] = 1f;
this.netUpdate = true;
}
}
if (Main.netMode != 1 && this.homeTileY > 0)
{
while (!WorldGen.SolidTile(this.homeTileX, homeTileY) && homeTileY < Main.maxTilesY - 20)
++homeTileY;
}
if (this.type == 368)
{
this.homeless = true;
if (!Main.dayTime)
{
this.homeTileX = (int) ((double) this.Center.X / 16.0);
this.homeTileY = (int) ((double) this.position.Y + (double) this.height + 2.0) / 16;
if (!flag3 && (double) this.ai[0] == 0.0)
{
this.ai[0] = 1f;
this.ai[1] = 200f;
}
flag1 = false;
}
}
if (this.type == 369 && this.homeless && this.wet)
{
if ((double) this.Center.X / 16.0 < 380.0 || (double) this.Center.X / 16.0 > (double) (Main.maxTilesX - 380))
{
this.homeTileX = Main.spawnTileX;
this.homeTileY = Main.spawnTileY;
this.ai[0] = 1f;
this.ai[1] = 200f;
}
if ((double) this.position.X / 16.0 < 200.0)
this.direction = 1;
else if ((double) this.position.X / 16.0 > (double) (Main.maxTilesX - 200))
this.direction = -1;
}
int x = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
int y = (int) ((double) this.position.Y + (double) this.height + 1.0) / 16;
if (!WorldGen.InWorld(x, y) || Main.tile[x, y] == null)
return;
if (!this.homeless && Main.netMode != 1 && this.townNPC && (flag1 || Main.tileDungeon[(int) Main.tile[x, y].type]) && (x != this.homeTileX || y != homeTileY))
{
bool flag4 = true;
for (int index1 = 0; index1 < 2; ++index1)
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) ((double) this.position.X + (double) (this.width / 2) - (double) (NPC.sWidth / 2) - (double) NPC.safeRangeX), (int) ((double) this.position.Y + (double) (this.height / 2) - (double) (NPC.sHeight / 2) - (double) NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2);
if (index1 == 1)
rectangle = new Microsoft.Xna.Framework.Rectangle(this.homeTileX * 16 + 8 - NPC.sWidth / 2 - NPC.safeRangeX, homeTileY * 16 + 8 - NPC.sHeight / 2 - NPC.safeRangeY, NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2);
for (int index2 = 0; index2 < (int) byte.MaxValue; ++index2)
{
if (Main.player[index2].active && new Microsoft.Xna.Framework.Rectangle((int) Main.player[index2].position.X, (int) Main.player[index2].position.Y, Main.player[index2].width, Main.player[index2].height).Intersects(rectangle))
{
flag4 = false;
break;
}
if (!flag4)
break;
}
}
if (flag4)
{
if (this.type == 37 || !Collision.SolidTiles(this.homeTileX - 1, this.homeTileX + 1, homeTileY - 3, homeTileY - 1))
{
this.velocity.X = 0.0f;
this.velocity.Y = 0.0f;
this.position.X = (float) (this.homeTileX * 16 + 8 - this.width / 2);
this.position.Y = (float) (homeTileY * 16 - this.height) - 0.1f;
this.netUpdate = true;
}
else
{
this.homeless = true;
WorldGen.QuickFindHome(this.whoAmI);
}
}
}
bool flag5 = this.type == 300 || this.type == 447;
float num2 = 200f;
if (NPCID.Sets.DangerDetectRange[this.type] != -1)
num2 = (float) NPCID.Sets.DangerDetectRange[this.type];
bool flag6 = false;
bool flag7 = false;
float num3 = -1f;
float num4 = -1f;
int num5 = 0;
int index3 = -1;
int index4 = -1;
if (Main.netMode != 1 && !flag3)
{
for (int index5 = 0; index5 < 200; ++index5)
{
if (Main.npc[index5].active && !Main.npc[index5].friendly && Main.npc[index5].damage > 0 && (double) Main.npc[index5].Distance(this.Center) < (double) num2 && (this.type != 453 || !NPCID.Sets.Skeletons.Contains(Main.npc[index5].netID)))
{
flag6 = true;
float num6 = Main.npc[index5].Center.X - this.Center.X;
if ((double) num6 < 0.0 && ((double) num3 == -1.0 || (double) num6 > (double) num3))
{
num3 = num6;
index3 = index5;
}
if ((double) num6 > 0.0 && ((double) num4 == -1.0 || (double) num6 < (double) num4))
{
num4 = num6;
index4 = index5;
}
}
}
if (flag6)
{
num5 = (double) num3 != -1.0 ? ((double) num4 != -1.0 ? ((double) num4 < -(double) num3).ToDirectionInt() : -1) : 1;
float num7 = 0.0f;
if ((double) num3 != -1.0)
num7 = -num3;
if ((double) num7 == 0.0 || (double) num4 < (double) num7 && (double) num4 > 0.0)
num7 = num4;
if ((double) this.ai[0] == 8.0)
{
if (this.direction == -num5)
{
this.ai[0] = 1f;
this.ai[1] = (float) (300 + Main.rand.Next(300));
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] != 10.0 && (double) this.ai[0] != 12.0 && (double) this.ai[0] != 13.0 && (double) this.ai[0] != 14.0 && (double) this.ai[0] != 15.0)
{
if (NPCID.Sets.PrettySafe[this.type] != -1 && (double) NPCID.Sets.PrettySafe[this.type] < (double) num7)
{
flag6 = false;
flag7 = true;
}
else if ((double) this.ai[0] != 1.0)
{
if (((double) this.ai[0] == 3.0 || (double) this.ai[0] == 4.0 || (double) this.ai[0] == 16.0 ? 1 : ((double) this.ai[0] == 17.0 ? 1 : 0)) != 0)
{
NPC npc = Main.npc[(int) this.ai[2]];
if (npc.active)
{
npc.ai[0] = 1f;
npc.ai[1] = (float) (120 + Main.rand.Next(120));
npc.ai[2] = 0.0f;
npc.localAI[3] = 0.0f;
npc.direction = -num5;
npc.netUpdate = true;
}
}
this.ai[0] = 1f;
this.ai[1] = (float) (120 + Main.rand.Next(120));
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.direction = -num5;
this.netUpdate = true;
}
else if ((double) this.ai[0] == 1.0 && this.direction != -num5)
{
this.direction = -num5;
this.netUpdate = true;
}
}
}
}
if ((double) this.ai[0] == 0.0)
{
if ((double) this.localAI[3] > 0.0)
--this.localAI[3];
if (flag1 && !flag3 && !NPCID.Sets.TownCritter[this.type])
{
if (Main.netMode != 1)
{
if (x == this.homeTileX && y == homeTileY)
{
if ((double) this.velocity.X != 0.0)
this.netUpdate = true;
if ((double) this.velocity.X > 0.100000001490116)
this.velocity.X -= 0.1f;
else if ((double) this.velocity.X < -0.100000001490116)
this.velocity.X += 0.1f;
else
this.velocity.X = 0.0f;
}
else
{
if (x > this.homeTileX)
this.direction = -1;
else
this.direction = 1;
this.ai[0] = 1f;
this.ai[1] = (float) (200 + Main.rand.Next(200));
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.netUpdate = true;
}
}
}
else
{
if (flag5)
this.velocity.X *= 0.5f;
if ((double) this.velocity.X > 0.100000001490116)
this.velocity.X -= 0.1f;
else if ((double) this.velocity.X < -0.100000001490116)
this.velocity.X += 0.1f;
else
this.velocity.X = 0.0f;
if (Main.netMode != 1)
{
if ((double) this.ai[1] > 0.0)
--this.ai[1];
if ((double) this.ai[1] <= 0.0)
{
this.ai[0] = 1f;
this.ai[1] = (float) (200 + Main.rand.Next(300));
this.ai[2] = 0.0f;
if (NPCID.Sets.TownCritter[this.type])
this.ai[1] += (float) Main.rand.Next(200, 400);
this.localAI[3] = 0.0f;
this.netUpdate = true;
}
}
}
if (Main.netMode != 1 && (!flag1 || x == this.homeTileX && y == homeTileY))
{
if (x < this.homeTileX - 25 || x > this.homeTileX + 25)
{
if ((double) this.localAI[3] == 0.0)
{
if (x < this.homeTileX - 50 && this.direction == -1)
{
this.direction = 1;
this.netUpdate = true;
}
else if (x > this.homeTileX + 50 && this.direction == 1)
{
this.direction = -1;
this.netUpdate = true;
}
}
}
else if (Main.rand.Next(80) == 0 && (double) this.localAI[3] == 0.0)
{
this.localAI[3] = 200f;
this.direction *= -1;
this.netUpdate = true;
}
}
}
else if ((double) this.ai[0] == 1.0)
{
if (Main.netMode != 1 & flag1 && x == this.homeTileX && y == this.homeTileY && !NPCID.Sets.TownCritter[this.type])
{
this.ai[0] = 0.0f;
this.ai[1] = (float) (200 + Main.rand.Next(200));
this.localAI[3] = 60f;
this.netUpdate = true;
}
else
{
bool flag8 = Collision.DrownCollision(this.position, this.width, this.height, 1f);
if (!flag8)
{
if (Main.netMode != 1 && !this.homeless && !Main.tileDungeon[(int) Main.tile[x, y].type] && (x < this.homeTileX - 35 || x > this.homeTileX + 35))
{
if ((double) this.position.X < (double) (this.homeTileX * 16) && this.direction == -1)
this.ai[1] -= 5f;
else if ((double) this.position.X > (double) (this.homeTileX * 16) && this.direction == 1)
this.ai[1] -= 5f;
}
--this.ai[1];
}
if ((double) this.ai[1] <= 0.0)
{
this.ai[0] = 0.0f;
this.ai[1] = (float) (300 + Main.rand.Next(300));
this.ai[2] = 0.0f;
if (NPCID.Sets.TownCritter[this.type])
this.ai[1] -= (float) Main.rand.Next(100);
else
this.ai[1] += (float) Main.rand.Next(900);
this.localAI[3] = 60f;
this.netUpdate = true;
}
if (this.closeDoor && (((double) this.position.X + (double) (this.width / 2)) / 16.0 > (double) (this.doorX + 2) || ((double) this.position.X + (double) (this.width / 2)) / 16.0 < (double) (this.doorX - 2)))
{
Tile tileSafely = Framing.GetTileSafely(this.doorX, this.doorY);
if (tileSafely.type == (ushort) 11)
{
if (WorldGen.CloseDoor(this.doorX, this.doorY))
{
this.closeDoor = false;
NetMessage.SendData(19, number: 1, number2: ((float) this.doorX), number3: ((float) this.doorY), number4: ((float) this.direction));
}
if (((double) this.position.X + (double) (this.width / 2)) / 16.0 > (double) (this.doorX + 4) || ((double) this.position.X + (double) (this.width / 2)) / 16.0 < (double) (this.doorX - 4) || ((double) this.position.Y + (double) (this.height / 2)) / 16.0 > (double) (this.doorY + 4) || ((double) this.position.Y + (double) (this.height / 2)) / 16.0 < (double) (this.doorY - 4))
this.closeDoor = false;
}
else if (tileSafely.type == (ushort) 389)
{
if (WorldGen.ShiftTallGate(this.doorX, this.doorY, true))
{
this.closeDoor = false;
NetMessage.SendData(19, number: 5, number2: ((float) this.doorX), number3: ((float) this.doorY));
}
if (((double) this.position.X + (double) (this.width / 2)) / 16.0 > (double) (this.doorX + 4) || ((double) this.position.X + (double) (this.width / 2)) / 16.0 < (double) (this.doorX - 4) || ((double) this.position.Y + (double) (this.height / 2)) / 16.0 > (double) (this.doorY + 4) || ((double) this.position.Y + (double) (this.height / 2)) / 16.0 < (double) (this.doorY - 4))
this.closeDoor = false;
}
else
this.closeDoor = false;
}
float num8 = 1f;
float num9 = 0.07f;
if (this.type == 299 || this.type == 539 || this.type == 538)
num8 = 1.5f;
if (flag5)
{
num8 = 2f;
num9 = 1f;
}
if (this.friendly && flag6 | flag8)
{
num8 = 1.5f + (float) (1.0 - (double) this.life / (double) this.lifeMax) * 0.9f;
num9 = 0.1f;
}
if ((double) this.velocity.X < -(double) num8 || (double) this.velocity.X > (double) num8)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num8 && this.direction == 1)
{
this.velocity.X += num9;
if ((double) this.velocity.X > (double) num8)
this.velocity.X = num8;
}
else if ((double) this.velocity.X > -(double) num8 && this.direction == -1)
{
this.velocity.X -= num9;
if ((double) this.velocity.X > (double) num8)
this.velocity.X = num8;
}
bool holdsMatching = true;
if ((double) (this.homeTileY * 16 - 32) > (double) this.position.Y)
holdsMatching = false;
if (this.direction == 1 && (double) this.position.Y + (double) (this.width / 2) > (double) (this.homeTileX * 16) || this.direction == -1 && (double) this.position.Y + (double) (this.width / 2) < (double) (this.homeTileX * 16))
holdsMatching = true;
if ((double) this.velocity.Y == 0.0)
Collision.StepDown(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY);
if ((double) this.velocity.Y >= 0.0)
Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, holdsMatching: holdsMatching, specialChecksMode: 1);
if ((double) this.velocity.Y == 0.0)
{
int num10 = (int) (((double) this.position.X + (double) (this.width / 2) + (double) (15 * this.direction)) / 16.0);
int j = (int) (((double) this.position.Y + (double) this.height - 16.0) / 16.0);
bool flag9 = false;
bool flag10 = true;
bool flag11 = x >= this.homeTileX - 35 && x <= this.homeTileX + 35;
if (this.townNPC && (double) this.ai[1] < 30.0)
{
flag9 = !Utils.PlotTileLine(this.Top, this.Bottom, (float) this.width, new Utils.PerLinePoint(DelegateMethods.SearchAvoidedByNPCs));
if (!flag9)
{
Microsoft.Xna.Framework.Rectangle hitbox = this.Hitbox;
hitbox.X -= 20;
hitbox.Width += 40;
for (int index6 = 0; index6 < 200; ++index6)
{
if (Main.npc[index6].active && Main.npc[index6].friendly && index6 != this.whoAmI && (double) Main.npc[index6].velocity.X == 0.0 && hitbox.Intersects(Main.npc[index6].Hitbox))
{
flag9 = true;
break;
}
}
}
}
if (!flag9 & flag8)
flag9 = true;
if (flag10 && (NPCID.Sets.TownCritter[this.type] || !flag11 && this.direction == Math.Sign(this.homeTileX - x)))
flag10 = false;
if (flag10)
{
int num11 = 0;
for (int index7 = -1; index7 <= 4; ++index7)
{
Tile tileSafely = Framing.GetTileSafely(num10 - this.direction * num11, j + index7);
if (tileSafely.lava() && tileSafely.liquid > (byte) 0)
{
flag10 = true;
break;
}
if (tileSafely.nactive() && Main.tileSolid[(int) tileSafely.type])
{
flag10 = false;
break;
}
}
}
if (!flag10 && this.wet)
{
bool flag12 = flag8;
bool flag13 = false;
if (!flag12)
flag13 = Collision.DrownCollision(this.position + new Vector2((float) (this.width * this.direction), 0.0f), this.width, this.height, 1f);
if ((flag13 || Collision.DrownCollision(this.position + new Vector2((float) (this.width * this.direction), (float) (this.height * 2 - 16 - (flag12 ? 16 : 0))), this.width, 16 + (flag12 ? 16 : 0), 1f)) && (double) this.localAI[3] <= 0.0)
{
flag10 = true;
this.localAI[3] = 600f;
}
}
if ((double) this.position.X == (double) this.localAI[3])
{
this.direction *= -1;
this.netUpdate = true;
this.localAI[3] = 600f;
}
if (flag8)
{
if ((double) this.localAI[3] > 0.0)
--this.localAI[3];
}
else
this.localAI[3] = -1f;
Tile tileSafely1 = Framing.GetTileSafely(num10, j);
Tile tileSafely2 = Framing.GetTileSafely(num10, j - 1);
Tile tileSafely3 = Framing.GetTileSafely(num10, j - 2);
if (this.townNPC && tileSafely3.nactive() && (tileSafely3.type == (ushort) 10 || tileSafely3.type == (ushort) 388) && Main.rand.Next(10) == 0 | flag1)
{
if (Main.netMode != 1)
{
if (WorldGen.OpenDoor(num10, j - 2, this.direction))
{
this.closeDoor = true;
this.doorX = num10;
this.doorY = j - 2;
NetMessage.SendData(19, number2: ((float) num10), number3: ((float) (j - 2)), number4: ((float) this.direction));
this.netUpdate = true;
this.ai[1] += 80f;
}
else if (WorldGen.OpenDoor(num10, j - 2, -this.direction))
{
this.closeDoor = true;
this.doorX = num10;
this.doorY = j - 2;
NetMessage.SendData(19, number2: ((float) num10), number3: ((float) (j - 2)), number4: ((float) -this.direction));
this.netUpdate = true;
this.ai[1] += 80f;
}
else if (WorldGen.ShiftTallGate(num10, j - 2, false))
{
this.closeDoor = true;
this.doorX = num10;
this.doorY = j - 2;
NetMessage.SendData(19, number: 4, number2: ((float) num10), number3: ((float) (j - 2)));
this.netUpdate = true;
this.ai[1] += 80f;
}
else
{
this.direction *= -1;
this.netUpdate = true;
}
}
}
else
{
if ((double) this.velocity.X < 0.0 && this.spriteDirection == -1 || (double) this.velocity.X > 0.0 && this.spriteDirection == 1)
{
if (tileSafely3.nactive() && Main.tileSolid[(int) tileSafely3.type] && !Main.tileSolidTop[(int) tileSafely3.type])
{
if (!Collision.SolidTilesVersatile(num10 - this.direction * 2, num10 - this.direction, j - 5, j - 1) && !Collision.SolidTiles(num10, num10, j - 5, j - 3))
{
this.velocity.Y = -6f;
this.netUpdate = true;
}
else if (flag5)
{
if (WorldGen.SolidTile((int) ((double) this.Center.X / 16.0) + this.direction, (int) ((double) this.Center.Y / 16.0)))
{
this.direction *= -1;
this.velocity.X *= 0.0f;
this.netUpdate = true;
}
}
else if (flag6)
{
flag9 = false;
this.velocity.X = 0.0f;
this.direction *= -1;
this.netUpdate = true;
this.ai[0] = 8f;
this.ai[1] = 240f;
}
else
{
this.direction *= -1;
this.netUpdate = true;
}
}
else if (tileSafely2.nactive() && Main.tileSolid[(int) tileSafely2.type] && !Main.tileSolidTop[(int) tileSafely2.type])
{
if (!Collision.SolidTilesVersatile(num10 - this.direction * 2, num10 - this.direction, j - 4, j - 1) && !Collision.SolidTiles(num10, num10, j - 4, j - 2))
{
this.velocity.Y = -5f;
this.netUpdate = true;
}
else if (flag6)
{
flag9 = false;
this.velocity.X = 0.0f;
this.direction *= -1;
this.netUpdate = true;
this.ai[0] = 8f;
this.ai[1] = 240f;
}
else
{
this.direction *= -1;
this.netUpdate = true;
}
}
else if ((double) this.position.Y + (double) this.height - (double) (j * 16) > 20.0 && tileSafely1.nactive() && Main.tileSolid[(int) tileSafely1.type] && !tileSafely1.topSlope())
{
if (!Collision.SolidTilesVersatile(num10 - this.direction * 2, num10, j - 3, j - 1))
{
this.velocity.Y = -4.4f;
this.netUpdate = true;
}
else if (flag6)
{
flag9 = false;
this.velocity.X = 0.0f;
this.direction *= -1;
this.netUpdate = true;
this.ai[0] = 8f;
this.ai[1] = 240f;
}
else
{
this.direction *= -1;
this.netUpdate = true;
}
}
else if (flag10)
{
this.direction *= -1;
this.velocity.X *= -1f;
this.netUpdate = true;
if (flag6)
{
flag9 = false;
this.velocity.X = 0.0f;
this.ai[0] = 8f;
this.ai[1] = 240f;
}
}
if (flag9)
{
this.ai[1] = 90f;
this.netUpdate = true;
}
if ((double) this.velocity.Y < 0.0)
this.localAI[3] = this.position.X;
}
if ((double) this.velocity.Y < 0.0 && this.wet)
this.velocity.Y *= 1.2f;
if ((double) this.velocity.Y < 0.0 && NPCID.Sets.TownCritter[this.type] && !flag5)
this.velocity.Y *= 1.2f;
}
}
}
}
else if ((double) this.ai[0] == 2.0 || (double) this.ai[0] == 11.0)
{
if (Main.netMode != 1)
{
--this.localAI[3];
if (Main.rand.Next(60) == 0 && (double) this.localAI[3] == 0.0)
{
this.localAI[3] = 60f;
this.direction *= -1;
this.netUpdate = true;
}
}
--this.ai[1];
this.velocity.X *= 0.8f;
if ((double) this.ai[1] <= 0.0)
{
this.localAI[3] = 40f;
this.ai[0] = 0.0f;
this.ai[1] = (float) (60 + Main.rand.Next(60));
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 3.0 || (double) this.ai[0] == 4.0 || (double) this.ai[0] == 5.0 || (double) this.ai[0] == 8.0 || (double) this.ai[0] == 9.0 || (double) this.ai[0] == 16.0 || (double) this.ai[0] == 17.0)
{
this.velocity.X *= 0.8f;
--this.ai[1];
if ((double) this.ai[0] == 8.0 && (double) this.ai[1] < 60.0 & flag6)
{
this.ai[1] = 180f;
this.netUpdate = true;
}
if ((double) this.ai[0] == 5.0)
{
Point tileCoordinates = this.Center.ToTileCoordinates();
if (Main.tile[tileCoordinates.X, tileCoordinates.Y].type != (ushort) 15)
this.ai[1] = 0.0f;
}
if ((double) this.ai[1] <= 0.0)
{
this.ai[0] = 0.0f;
this.ai[1] = (float) (60 + Main.rand.Next(60));
this.ai[2] = 0.0f;
this.localAI[3] = (float) (30 + Main.rand.Next(60));
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 6.0 || (double) this.ai[0] == 7.0 || (double) this.ai[0] == 18.0)
{
if ((double) this.ai[0] == 18.0 && ((double) this.localAI[3] < 1.0 || (double) this.localAI[3] > 2.0))
this.localAI[3] = 2f;
this.velocity.X *= 0.8f;
--this.ai[1];
int index8 = (int) this.ai[2];
if (index8 < 0 || index8 > (int) byte.MaxValue || !Main.player[index8].active || Main.player[index8].dead || (double) Main.player[index8].Distance(this.Center) > 200.0 || !Collision.CanHitLine(this.Top, 0, 0, Main.player[index8].Top, 0, 0))
this.ai[1] = 0.0f;
if ((double) this.ai[1] > 0.0)
{
int num12 = (double) this.Center.X < (double) Main.player[index8].Center.X ? 1 : -1;
if (num12 != this.direction)
this.netUpdate = true;
this.direction = num12;
}
else
{
this.ai[0] = 0.0f;
this.ai[1] = (float) (60 + Main.rand.Next(60));
this.ai[2] = 0.0f;
this.localAI[3] = (float) (30 + Main.rand.Next(60));
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 10.0)
{
int Type = 0;
int num13 = 0;
float KnockBack = 0.0f;
float num14 = 0.0f;
int num15 = 0;
int num16 = 0;
int maxValue2 = 0;
float num17 = 0.0f;
float num18 = (float) NPCID.Sets.DangerDetectRange[this.type];
float max = 0.0f;
if ((double) NPCID.Sets.AttackTime[this.type] == (double) this.ai[1])
{
this.frameCounter = 0.0;
this.localAI[3] = 0.0f;
}
if (this.type == 38)
{
Type = 30;
num14 = 6f;
num13 = 20;
num15 = 10;
num16 = 180;
maxValue2 = 120;
num17 = 16f;
KnockBack = 7f;
}
else if (this.type == 550)
{
Type = 669;
num14 = 6f;
num13 = 24;
num15 = 10;
num16 = 120;
maxValue2 = 60;
num17 = 16f;
KnockBack = 9f;
}
else if (this.type == 208)
{
Type = 588;
num14 = 6f;
num13 = 30;
num15 = 10;
num16 = 60;
maxValue2 = 120;
num17 = 16f;
KnockBack = 6f;
}
else if (this.type == 17)
{
Type = 48;
num14 = 9f;
num13 = 12;
num15 = 10;
num16 = 60;
maxValue2 = 60;
num17 = 16f;
KnockBack = 1.5f;
}
else if (this.type == 369)
{
Type = 520;
num14 = 12f;
num13 = 10;
num15 = 10;
num16 = 0;
maxValue2 = 1;
num17 = 16f;
KnockBack = 3f;
}
else if (this.type == 453)
{
Type = 21;
num14 = 14f;
num13 = 14;
num15 = 10;
num16 = 0;
maxValue2 = 1;
num17 = 16f;
KnockBack = 3f;
}
else if (this.type == 107)
{
Type = 24;
num14 = 5f;
num13 = 15;
num15 = 10;
num16 = 60;
maxValue2 = 60;
num17 = 16f;
KnockBack = 1f;
}
else if (this.type == 124)
{
Type = 582;
num14 = 10f;
num13 = 11;
num15 = 1;
num16 = 30;
maxValue2 = 30;
KnockBack = 3.5f;
}
else if (this.type == 18)
{
Type = 583;
num14 = 8f;
num13 = 8;
num15 = 1;
num16 = 15;
maxValue2 = 10;
KnockBack = 2f;
num17 = 10f;
}
else if (this.type == 142)
{
Type = 589;
num14 = 7f;
num13 = 22;
num15 = 1;
num16 = 10;
maxValue2 = 1;
KnockBack = 2f;
num17 = 10f;
}
if (Main.expertMode)
num13 = (int) ((double) num13 * (double) Main.expertNPCDamage);
int Damage = (int) ((double) num13 * (double) num1);
this.velocity.X *= 0.8f;
--this.ai[1];
++this.localAI[3];
if ((double) this.localAI[3] == (double) num15 && Main.netMode != 1)
{
Vector2 vec = -Vector2.UnitY;
if (num5 == 1 && this.spriteDirection == 1 && index4 != -1)
vec = this.DirectionTo(Main.npc[index4].Center + new Vector2(0.0f, -num17 * MathHelper.Clamp(this.Distance(Main.npc[index4].Center) / num18, 0.0f, 1f)));
if (num5 == -1 && this.spriteDirection == -1 && index3 != -1)
vec = this.DirectionTo(Main.npc[index3].Center + new Vector2(0.0f, -num17 * MathHelper.Clamp(this.Distance(Main.npc[index3].Center) / num18, 0.0f, 1f)));
if (vec.HasNaNs() || Math.Sign(vec.X) != this.spriteDirection)
vec = new Vector2((float) this.spriteDirection, -1f);
Vector2 vector2 = vec * num14 + Utils.RandomVector2(Main.rand, -max, max);
int index9 = this.type != 124 ? (this.type != 142 ? Projectile.NewProjectile(this.Center.X + (float) (this.spriteDirection * 16), this.Center.Y - 2f, vector2.X, vector2.Y, Type, Damage, KnockBack, Main.myPlayer) : Projectile.NewProjectile(this.Center.X + (float) (this.spriteDirection * 16), this.Center.Y - 2f, vector2.X, vector2.Y, Type, Damage, KnockBack, Main.myPlayer, ai1: ((float) Main.rand.Next(5)))) : Projectile.NewProjectile(this.Center.X + (float) (this.spriteDirection * 16), this.Center.Y - 2f, vector2.X, vector2.Y, Type, Damage, KnockBack, Main.myPlayer, ai1: ((float) this.whoAmI));
Main.projectile[index9].npcProj = true;
Main.projectile[index9].noDropItem = true;
}
if ((double) this.ai[1] <= 0.0)
{
this.ai[0] = (double) this.localAI[2] == 8.0 & flag6 ? 8f : 0.0f;
this.ai[1] = (float) (num16 + Main.rand.Next(maxValue2));
this.ai[2] = 0.0f;
this.localAI[1] = this.localAI[3] = (float) (num16 / 2 + Main.rand.Next(maxValue2));
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 12.0)
{
int Type = 0;
int num19 = 0;
float num20 = 0.0f;
int num21 = 0;
int num22 = 0;
int maxValue3 = 0;
float KnockBack = 0.0f;
int num23 = 0;
bool flag14 = false;
float max = 0.0f;
if ((double) NPCID.Sets.AttackTime[this.type] == (double) this.ai[1])
{
this.frameCounter = 0.0;
this.localAI[3] = 0.0f;
}
int index10 = -1;
if (num5 == 1 && this.spriteDirection == 1)
index10 = index4;
if (num5 == -1 && this.spriteDirection == -1)
index10 = index3;
if (this.type == 19)
{
Type = 14;
num20 = 13f;
num19 = 24;
num22 = 14;
maxValue3 = 4;
KnockBack = 3f;
num21 = 1;
max = 0.5f;
if ((double) NPCID.Sets.AttackTime[this.type] == (double) this.ai[1])
{
this.frameCounter = 0.0;
this.localAI[3] = 0.0f;
}
if (Main.hardMode)
{
num19 = 15;
if ((double) this.localAI[3] > (double) num21)
{
num21 = 10;
flag14 = true;
}
if ((double) this.localAI[3] > (double) num21)
{
num21 = 20;
flag14 = true;
}
if ((double) this.localAI[3] > (double) num21)
{
num21 = 30;
flag14 = true;
}
}
}
else if (this.type == 227)
{
Type = 587;
num20 = 10f;
num19 = 8;
num22 = 10;
maxValue3 = 1;
KnockBack = 1.75f;
num21 = 1;
max = 0.5f;
if ((double) this.localAI[3] > (double) num21)
{
num21 = 12;
flag14 = true;
}
if ((double) this.localAI[3] > (double) num21)
{
num21 = 24;
flag14 = true;
}
if (Main.hardMode)
num19 += 2;
}
else if (this.type == 368)
{
Type = 14;
num20 = 13f;
num19 = 24;
num22 = 12;
maxValue3 = 5;
KnockBack = 2f;
num21 = 1;
max = 0.2f;
if (Main.hardMode)
{
num19 = 30;
Type = 357;
}
}
else if (this.type == 22)
{
num20 = 10f;
num19 = 8;
num21 = 1;
if (Main.hardMode)
{
Type = 2;
num22 = 15;
maxValue3 = 10;
num19 += 6;
}
else
{
Type = 1;
num22 = 30;
maxValue3 = 20;
}
KnockBack = 2.75f;
num23 = 4;
max = 0.7f;
}
else if (this.type == 228)
{
Type = 267;
num20 = 14f;
num19 = 20;
num21 = 1;
num22 = 10;
maxValue3 = 1;
KnockBack = 3f;
num23 = 6;
max = 0.4f;
}
else if (this.type == 178)
{
Type = 242;
num20 = 13f;
num19 = 15;
num22 = 10;
maxValue3 = 1;
KnockBack = 2f;
num21 = 1;
if ((double) this.localAI[3] > (double) num21)
{
num21 = 8;
flag14 = true;
}
if ((double) this.localAI[3] > (double) num21)
{
num21 = 16;
flag14 = true;
}
max = 0.3f;
}
else if (this.type == 229)
{
Type = 14;
num20 = 14f;
num19 = 24;
num22 = 10;
maxValue3 = 1;
KnockBack = 2f;
num21 = 1;
max = 0.7f;
if ((double) this.localAI[3] > (double) num21)
{
num21 = 16;
flag14 = true;
}
if ((double) this.localAI[3] > (double) num21)
{
num21 = 24;
flag14 = true;
}
if ((double) this.localAI[3] > (double) num21)
{
num21 = 32;
flag14 = true;
}
if ((double) this.localAI[3] > (double) num21)
{
num21 = 40;
flag14 = true;
}
if ((double) this.localAI[3] > (double) num21)
{
num21 = 48;
flag14 = true;
}
if ((double) this.localAI[3] == 0.0 && index10 != -1 && (double) this.Distance(Main.npc[index10].Center) < (double) NPCID.Sets.PrettySafe[this.type])
{
max = 0.1f;
Type = 162;
num19 = 50;
KnockBack = 10f;
num20 = 24f;
}
}
else if (this.type == 209)
{
Type = Utils.SelectRandom<int>(Main.rand, 134, 133, 135);
num21 = 1;
switch (Type)
{
case 133:
num20 = 10f;
num19 = 25;
num22 = 10;
maxValue3 = 1;
KnockBack = 6f;
max = 0.2f;
break;
case 134:
num20 = 13f;
num19 = 20;
num22 = 20;
maxValue3 = 10;
KnockBack = 4f;
max = 0.1f;
break;
case 135:
num20 = 12f;
num19 = 30;
num22 = 30;
maxValue3 = 10;
KnockBack = 7f;
max = 0.2f;
break;
}
}
if (Main.expertMode)
num19 = (int) ((double) num19 * (double) Main.expertNPCDamage);
int Damage = (int) ((double) num19 * (double) num1);
this.velocity.X *= 0.8f;
--this.ai[1];
++this.localAI[3];
if ((double) this.localAI[3] == (double) num21 && Main.netMode != 1)
{
Vector2 vec = Vector2.Zero;
if (index10 != -1)
vec = this.DirectionTo(Main.npc[index10].Center + new Vector2(0.0f, (float) -num23));
if (vec.HasNaNs() || Math.Sign(vec.X) != this.spriteDirection)
vec = new Vector2((float) this.spriteDirection, 0.0f);
Vector2 vector2 = vec * num20 + Utils.RandomVector2(Main.rand, -max, max);
int index11 = this.type != 227 ? Projectile.NewProjectile(this.Center.X + (float) (this.spriteDirection * 16), this.Center.Y - 2f, vector2.X, vector2.Y, Type, Damage, KnockBack, Main.myPlayer) : Projectile.NewProjectile(this.Center.X + (float) (this.spriteDirection * 16), this.Center.Y - 2f, vector2.X, vector2.Y, Type, Damage, KnockBack, Main.myPlayer, ai1: ((float) Main.rand.Next(12) / 6f));
Main.projectile[index11].npcProj = true;
Main.projectile[index11].noDropItem = true;
}
if ((double) this.localAI[3] == (double) num21 & flag14 && index10 != -1)
{
Vector2 vector2 = this.DirectionTo(Main.npc[index10].Center);
if ((double) vector2.Y <= 0.5 && (double) vector2.Y >= -0.5)
this.ai[2] = vector2.Y;
}
if ((double) this.ai[1] <= 0.0)
{
this.ai[0] = (double) this.localAI[2] == 8.0 & flag6 ? 8f : 0.0f;
this.ai[1] = (float) (num22 + Main.rand.Next(maxValue3));
this.ai[2] = 0.0f;
this.localAI[1] = this.localAI[3] = (float) (num22 / 2 + Main.rand.Next(maxValue3));
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 13.0)
{
this.velocity.X *= 0.8f;
if ((double) NPCID.Sets.AttackTime[this.type] == (double) this.ai[1])
this.frameCounter = 0.0;
--this.ai[1];
++this.localAI[3];
if ((double) this.localAI[3] == 1.0 && Main.netMode != 1)
{
Vector2 vec = this.DirectionTo(Main.npc[(int) this.ai[2]].Center + new Vector2(0.0f, -20f));
if (vec.HasNaNs() || Math.Sign(vec.X) == -this.spriteDirection)
vec = new Vector2((float) this.spriteDirection, -1f);
Vector2 vector2 = vec * 8f;
int index12 = Projectile.NewProjectile(this.Center.X + (float) (this.spriteDirection * 16), this.Center.Y - 2f, vector2.X, vector2.Y, 584, 0, 0.0f, Main.myPlayer, this.ai[2]);
Main.projectile[index12].npcProj = true;
Main.projectile[index12].noDropItem = true;
}
if ((double) this.ai[1] <= 0.0)
{
this.ai[0] = 0.0f;
this.ai[1] = (float) (10 + Main.rand.Next(10));
this.ai[2] = 0.0f;
this.localAI[3] = (float) (5 + Main.rand.Next(10));
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 14.0)
{
int Type = 0;
int num24 = 0;
float num25 = 0.0f;
int num26 = 0;
int num27 = 0;
int maxValue4 = 0;
float KnockBack = 0.0f;
float num28 = 0.0f;
float num29 = (float) NPCID.Sets.DangerDetectRange[this.type];
float num30 = 1f;
float max = 0.0f;
if ((double) NPCID.Sets.AttackTime[this.type] == (double) this.ai[1])
{
this.frameCounter = 0.0;
this.localAI[3] = 0.0f;
}
int index13 = -1;
if (num5 == 1 && this.spriteDirection == 1)
index13 = index4;
if (num5 == -1 && this.spriteDirection == -1)
index13 = index3;
if (this.type == 54)
{
Type = 585;
num25 = 10f;
num24 = 16;
num26 = 30;
num27 = 20;
maxValue4 = 15;
KnockBack = 2f;
max = 1f;
}
else if (this.type == 108)
{
Type = 15;
num25 = 6f;
num24 = 18;
num26 = 15;
num27 = 15;
maxValue4 = 5;
KnockBack = 3f;
num28 = 20f;
}
else if (this.type == 160)
{
Type = 590;
num24 = 40;
num26 = 15;
num27 = 10;
maxValue4 = 1;
KnockBack = 3f;
while ((double) this.localAI[3] > (double) num26)
num26 += 15;
}
else if (this.type == 20)
{
Type = 586;
num26 = 24;
num27 = 10;
maxValue4 = 1;
KnockBack = 3f;
}
if (Main.expertMode)
num24 = (int) ((double) num24 * (double) Main.expertNPCDamage);
int Damage = (int) ((double) num24 * (double) num1);
this.velocity.X *= 0.8f;
--this.ai[1];
++this.localAI[3];
if ((double) this.localAI[3] == (double) num26 && Main.netMode != 1)
{
Vector2 vec = Vector2.Zero;
if (index13 != -1)
vec = this.DirectionTo(Main.npc[index13].Center + new Vector2(0.0f, -num28 * MathHelper.Clamp(this.Distance(Main.npc[index13].Center) / num29, 0.0f, 1f)));
if (vec.HasNaNs() || Math.Sign(vec.X) != this.spriteDirection)
vec = new Vector2((float) this.spriteDirection, 0.0f);
Vector2 vector2_1 = vec * num25 + Utils.RandomVector2(Main.rand, -max, max);
if (this.type == 108)
{
int num31 = Utils.SelectRandom<int>(Main.rand, 1, 1, 1, 1, 2, 2, 3);
for (int index14 = 0; index14 < num31; ++index14)
{
Vector2 vector2_2 = Utils.RandomVector2(Main.rand, -3.4f, 3.4f);
int index15 = Projectile.NewProjectile(this.Center.X + (float) (this.spriteDirection * 16), this.Center.Y - 2f, vector2_1.X + vector2_2.X, vector2_1.Y + vector2_2.Y, Type, Damage, KnockBack, Main.myPlayer);
Main.projectile[index15].npcProj = true;
Main.projectile[index15].noDropItem = true;
}
}
else if (this.type == 160)
{
if (index13 != -1)
{
Vector2 vector2_3 = Main.npc[index13].position - Main.npc[index13].Size * 2f + Main.npc[index13].Size * Utils.RandomVector2(Main.rand, 0.0f, 1f) * 5f;
for (int index16 = 10; index16 > 0 && WorldGen.SolidTile(Framing.GetTileSafely((int) vector2_3.X / 16, (int) vector2_3.Y / 16)); vector2_3 = Main.npc[index13].position - Main.npc[index13].Size * 2f + Main.npc[index13].Size * Utils.RandomVector2(Main.rand, 0.0f, 1f) * 5f)
--index16;
int index17 = Projectile.NewProjectile(vector2_3.X, vector2_3.Y, 0.0f, 0.0f, Type, Damage, KnockBack, Main.myPlayer);
Main.projectile[index17].npcProj = true;
Main.projectile[index17].noDropItem = true;
}
}
else if (this.type == 20)
{
int index18 = Projectile.NewProjectile(this.Center.X + (float) (this.spriteDirection * 16), this.Center.Y - 2f, vector2_1.X, vector2_1.Y, Type, Damage, KnockBack, Main.myPlayer, ai1: ((float) this.whoAmI));
Main.projectile[index18].npcProj = true;
Main.projectile[index18].noDropItem = true;
}
else
{
int index19 = Projectile.NewProjectile(this.Center.X + (float) (this.spriteDirection * 16), this.Center.Y - 2f, vector2_1.X, vector2_1.Y, Type, Damage, KnockBack, Main.myPlayer);
Main.projectile[index19].npcProj = true;
Main.projectile[index19].noDropItem = true;
}
}
if ((double) num30 > 0.0)
{
Vector3 vector3 = NPCID.Sets.MagicAuraColor[this.type].ToVector3() * num30;
Lighting.AddLight(this.Center, vector3.X, vector3.Y, vector3.Z);
}
if ((double) this.ai[1] <= 0.0)
{
this.ai[0] = (double) this.localAI[2] == 8.0 & flag6 ? 8f : 0.0f;
this.ai[1] = (float) (num27 + Main.rand.Next(maxValue4));
this.ai[2] = 0.0f;
this.localAI[1] = this.localAI[3] = (float) (num27 / 2 + Main.rand.Next(maxValue4));
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 15.0)
{
int num32 = 0;
int maxValue5 = 0;
if ((double) NPCID.Sets.AttackTime[this.type] == (double) this.ai[1])
{
this.frameCounter = 0.0;
this.localAI[3] = 0.0f;
}
int num33 = 0;
float num34 = 0.0f;
int num35 = 0;
int num36 = 0;
if (num5 == 1)
{
int spriteDirection1 = this.spriteDirection;
}
if (num5 == -1)
{
int spriteDirection2 = this.spriteDirection;
}
if (this.type == 207)
{
num33 = 11;
num35 = num36 = 32;
num32 = 12;
maxValue5 = 6;
num34 = 4.25f;
}
else if (this.type == 441)
{
num33 = 9;
num35 = num36 = 28;
num32 = 9;
maxValue5 = 3;
num34 = 3.5f;
}
else if (this.type == 353)
{
num33 = 10;
num35 = num36 = 32;
num32 = 15;
maxValue5 = 8;
num34 = 5f;
}
if (Main.expertMode)
num33 = (int) ((double) num33 * (double) Main.expertNPCDamage);
int Damage = (int) ((double) num33 * (double) num1);
this.velocity.X *= 0.8f;
--this.ai[1];
if (Main.netMode != 1)
{
Tuple<Vector2, float> swingStats = this.GetSwingStats(NPCID.Sets.AttackTime[this.type] * 2, (int) this.ai[1], this.spriteDirection, num35, num36);
Microsoft.Xna.Framework.Rectangle itemRectangle = new Microsoft.Xna.Framework.Rectangle((int) swingStats.Item1.X, (int) swingStats.Item1.Y, num35, num36);
if (this.spriteDirection == -1)
itemRectangle.X -= num35;
itemRectangle.Y -= num36;
this.TweakSwingStats(NPCID.Sets.AttackTime[this.type] * 2, (int) this.ai[1], this.spriteDirection, ref itemRectangle);
int player = Main.myPlayer;
for (int number = 0; number < 200; ++number)
{
NPC npc = Main.npc[number];
if (npc.active && npc.immune[player] == 0 && !npc.dontTakeDamage && !npc.friendly && npc.damage > 0 && itemRectangle.Intersects(npc.Hitbox) && (npc.noTileCollide || Collision.CanHit(this.position, this.width, this.height, npc.position, npc.width, npc.height)))
{
npc.StrikeNPCNoInteraction(Damage, num34, this.spriteDirection);
if (Main.netMode != 0)
NetMessage.SendData(28, number: number, number2: ((float) Damage), number3: num34, number4: ((float) this.spriteDirection));
npc.netUpdate = true;
npc.immune[player] = (int) this.ai[1] + 2;
}
}
}
if ((double) this.ai[1] <= 0.0)
{
bool flag15 = false;
if (flag6)
{
if (!Collision.CanHit(this.Center, 0, 0, this.Center + Vector2.UnitX * (float) -num5 * 32f, 0, 0) || (double) this.localAI[2] == 8.0)
flag15 = true;
if (flag15)
{
int num37 = NPCID.Sets.AttackTime[this.type];
int index20 = num5 == 1 ? index4 : index3;
int index21 = num5 == 1 ? index3 : index4;
if (index20 != -1 && !Collision.CanHit(this.Center, 0, 0, Main.npc[index20].Center, 0, 0))
index20 = index21 == -1 || !Collision.CanHit(this.Center, 0, 0, Main.npc[index21].Center, 0, 0) ? -1 : index21;
if (index20 != -1)
{
this.ai[0] = 15f;
this.ai[1] = (float) num37;
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index20].position.X ? 1 : -1;
this.netUpdate = true;
}
else
flag15 = false;
}
}
if (!flag15)
{
this.ai[0] = (double) this.localAI[2] == 8.0 & flag6 ? 8f : 0.0f;
this.ai[1] = (float) (num32 + Main.rand.Next(maxValue5));
this.ai[2] = 0.0f;
this.localAI[1] = this.localAI[3] = (float) (num32 / 2 + Main.rand.Next(maxValue5));
this.netUpdate = true;
}
}
}
if (Main.netMode == 1 || !this.townNPC && this.type != 453 || flag3)
return;
bool flag16 = (double) this.ai[0] < 2.0 && !flag6;
bool flag17 = ((double) this.ai[0] < 2.0 || (double) this.ai[0] == 8.0) && flag6 | flag7;
if ((double) this.localAI[1] > 0.0)
--this.localAI[1];
if ((double) this.localAI[1] > 0.0)
flag17 = false;
if (flag17 && this.type == 124 && (double) this.localAI[0] == 1.0)
flag17 = false;
if (flag17 && this.type == 20)
{
flag17 = false;
for (int index22 = 0; index22 < 200; ++index22)
{
NPC npc = Main.npc[index22];
if (npc.active && npc.townNPC && (double) this.Distance(npc.Center) <= 1200.0 && npc.FindBuffIndex(165) == -1)
{
flag17 = true;
break;
}
}
}
if (flag16 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(300) == 0)
{
int num38 = 420;
int num39 = Main.rand.Next(2) != 0 ? num38 * Main.rand.Next(1, 3) : num38 * Main.rand.Next(1, 4);
int num40 = 100;
int num41 = 20;
for (int index23 = 0; index23 < 200; ++index23)
{
NPC npc = Main.npc[index23];
bool flag18 = (double) npc.ai[0] == 1.0 && npc.closeDoor || (double) npc.ai[0] == 1.0 && (double) npc.ai[1] > 200.0 || (double) npc.ai[0] > 1.0;
if (npc != this && npc.active && npc.CanTalk && !flag18 && (double) npc.Distance(this.Center) < (double) num40 && (double) npc.Distance(this.Center) > (double) num41 && Collision.CanHit(this.Center, 0, 0, npc.Center, 0, 0))
{
int directionInt = ((double) this.position.X < (double) npc.position.X).ToDirectionInt();
this.ai[0] = 3f;
this.ai[1] = (float) num39;
this.ai[2] = (float) index23;
this.direction = directionInt;
this.netUpdate = true;
npc.ai[0] = 4f;
npc.ai[1] = (float) num39;
npc.ai[2] = (float) this.whoAmI;
npc.direction = -directionInt;
npc.netUpdate = true;
break;
}
}
}
else if (flag16 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(1800) == 0)
{
int num42 = 420;
int num43 = Main.rand.Next(2) != 0 ? num42 * Main.rand.Next(1, 3) : num42 * Main.rand.Next(1, 4);
int num44 = 100;
int num45 = 20;
for (int index24 = 0; index24 < 200; ++index24)
{
NPC npc = Main.npc[index24];
bool flag19 = (double) npc.ai[0] == 1.0 && npc.closeDoor || (double) npc.ai[0] == 1.0 && (double) npc.ai[1] > 200.0 || (double) npc.ai[0] > 1.0;
if (npc != this && npc.active && npc.CanTalk && !flag19 && (double) npc.Distance(this.Center) < (double) num44 && (double) npc.Distance(this.Center) > (double) num45 && Collision.CanHit(this.Center, 0, 0, npc.Center, 0, 0))
{
int directionInt = ((double) this.position.X < (double) npc.position.X).ToDirectionInt();
this.ai[0] = 16f;
this.ai[1] = (float) num43;
this.ai[2] = (float) index24;
this.localAI[2] = (float) Main.rand.Next(4);
this.localAI[3] = (float) Main.rand.Next(3 - (int) this.localAI[2]);
this.direction = directionInt;
this.netUpdate = true;
npc.ai[0] = 17f;
npc.ai[1] = (float) num43;
npc.ai[2] = (float) this.whoAmI;
npc.localAI[2] = 0.0f;
npc.localAI[3] = 0.0f;
npc.direction = -directionInt;
npc.netUpdate = true;
break;
}
}
}
else if (flag16 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(1200) == 0 && (this.type == 208 || BirthdayParty.PartyIsUp && NPCID.Sets.AttackType[this.type] == NPCID.Sets.AttackType[208]))
{
int num46 = 300;
int num47 = 150;
for (int index25 = 0; index25 < (int) byte.MaxValue; ++index25)
{
Player player = Main.player[index25];
if (player.active && !player.dead && (double) player.Distance(this.Center) < (double) num47 && Collision.CanHitLine(this.Top, 0, 0, player.Top, 0, 0))
{
int directionInt = ((double) this.position.X < (double) player.position.X).ToDirectionInt();
this.ai[0] = 6f;
this.ai[1] = (float) num46;
this.ai[2] = (float) index25;
this.direction = directionInt;
this.netUpdate = true;
break;
}
}
}
else if (flag16 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(600) == 0 && this.type == 550)
{
int num48 = 300;
int num49 = 150;
for (int index26 = 0; index26 < (int) byte.MaxValue; ++index26)
{
Player player = Main.player[index26];
if (player.active && !player.dead && (double) player.Distance(this.Center) < (double) num49 && Collision.CanHitLine(this.Top, 0, 0, player.Top, 0, 0))
{
int directionInt = ((double) this.position.X < (double) player.position.X).ToDirectionInt();
this.ai[0] = 18f;
this.ai[1] = (float) num48;
this.ai[2] = (float) index26;
this.direction = directionInt;
this.netUpdate = true;
break;
}
}
}
else if (flag16 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(1800) == 0)
{
this.ai[0] = 2f;
this.ai[1] = (float) (45 * Main.rand.Next(1, 2));
this.netUpdate = true;
}
else if (flag16 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(600) == 0 && this.type == 229 && !flag7)
{
this.ai[0] = 11f;
this.ai[1] = (float) (30 * Main.rand.Next(1, 4));
this.netUpdate = true;
}
else if (flag16 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(1200) == 0)
{
int num50 = 220;
int num51 = 150;
for (int index27 = 0; index27 < (int) byte.MaxValue; ++index27)
{
Player player = Main.player[index27];
if (player.active && !player.dead && (double) player.Distance(this.Center) < (double) num51 && Collision.CanHitLine(this.Top, 0, 0, player.Top, 0, 0))
{
int directionInt = ((double) this.position.X < (double) player.position.X).ToDirectionInt();
this.ai[0] = 7f;
this.ai[1] = (float) num50;
this.ai[2] = (float) index27;
this.direction = directionInt;
this.netUpdate = true;
break;
}
}
}
else if (flag16 && (double) this.ai[0] == 1.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(maxValue1) == 0)
{
Point tileCoordinates = this.Center.ToTileCoordinates();
bool flag20 = WorldGen.InWorld(tileCoordinates.X, tileCoordinates.Y, 1);
if (flag20)
{
for (int index28 = 0; index28 < 200; ++index28)
{
if (Main.npc[index28].active && Main.npc[index28].aiStyle == 7 && Main.npc[index28].townNPC && (double) Main.npc[index28].ai[0] == 5.0 && Main.npc[index28].Center.ToTileCoordinates() == tileCoordinates)
{
flag20 = false;
break;
}
}
}
if (flag20)
{
Tile tile = Main.tile[tileCoordinates.X, tileCoordinates.Y];
bool flag21 = tile.type == (ushort) 15;
if (flag21 && tile.frameY == (short) 1080)
flag21 = false;
if (flag21)
{
this.ai[0] = 5f;
this.ai[1] = (float) (900 + Main.rand.Next(10800));
this.direction = tile.frameX == (short) 0 ? -1 : 1;
this.Bottom = new Vector2((float) (tileCoordinates.X * 16 + 8 + 2 * this.direction), (float) (tileCoordinates.Y * 16 + 32));
this.velocity = Vector2.Zero;
this.localAI[3] = 0.0f;
this.netUpdate = true;
}
}
}
else if (flag16 && (double) this.ai[0] == 1.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(600) == 0 && Utils.PlotTileLine(this.Top, this.Bottom, (float) this.width, new Utils.PerLinePoint(DelegateMethods.SearchAvoidedByNPCs)))
{
Point tileCoordinates = (this.Center + new Vector2((float) (this.direction * 10), 0.0f)).ToTileCoordinates();
bool flag22 = WorldGen.InWorld(tileCoordinates.X, tileCoordinates.Y, 1);
if (flag22)
{
Tile tileSafely = Framing.GetTileSafely(tileCoordinates.X, tileCoordinates.Y);
if (!tileSafely.nactive() || !TileID.Sets.InteractibleByNPCs[(int) tileSafely.type])
flag22 = false;
}
if (flag22)
{
this.ai[0] = 9f;
this.ai[1] = (float) (40 + Main.rand.Next(90));
this.velocity = Vector2.Zero;
this.localAI[3] = 0.0f;
this.netUpdate = true;
}
}
if ((double) this.ai[0] < 2.0 && (double) this.velocity.Y == 0.0 && this.type == 18)
{
int index29 = -1;
for (int index30 = 0; index30 < 200; ++index30)
{
NPC npc = Main.npc[index30];
if (npc.active && npc.townNPC && npc.life != npc.lifeMax && (index29 == -1 || npc.lifeMax - npc.life > Main.npc[index29].lifeMax - Main.npc[index29].life) && Collision.CanHitLine(this.position, this.width, this.height, npc.position, npc.width, npc.height) && (double) this.Distance(npc.Center) < 500.0)
index29 = index30;
}
if (index29 != -1)
{
this.ai[0] = 13f;
this.ai[1] = 34f;
this.ai[2] = (float) index29;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index29].position.X ? 1 : -1;
this.netUpdate = true;
}
}
if (flag17 && (double) this.velocity.Y == 0.0 && NPCID.Sets.AttackType[this.type] == 0 && NPCID.Sets.AttackAverageChance[this.type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) == 0)
{
int num52 = NPCID.Sets.AttackTime[this.type];
int index31 = num5 == 1 ? index4 : index3;
int index32 = num5 == 1 ? index3 : index4;
if (index31 != -1 && !Collision.CanHit(this.Center, 0, 0, Main.npc[index31].Center, 0, 0))
index31 = index32 == -1 || !Collision.CanHit(this.Center, 0, 0, Main.npc[index32].Center, 0, 0) ? -1 : index32;
if (index31 != -1)
{
this.localAI[2] = this.ai[0];
this.ai[0] = 10f;
this.ai[1] = (float) num52;
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index31].position.X ? 1 : -1;
this.netUpdate = true;
}
}
else if (flag17 && (double) this.velocity.Y == 0.0 && NPCID.Sets.AttackType[this.type] == 1 && NPCID.Sets.AttackAverageChance[this.type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) == 0)
{
int num53 = NPCID.Sets.AttackTime[this.type];
int index33 = num5 == 1 ? index4 : index3;
int index34 = num5 == 1 ? index3 : index4;
if (index33 != -1 && !Collision.CanHitLine(this.Center, 0, 0, Main.npc[index33].Center, 0, 0))
index33 = index34 == -1 || !Collision.CanHitLine(this.Center, 0, 0, Main.npc[index34].Center, 0, 0) ? -1 : index34;
if (index33 != -1)
{
Vector2 vector2 = this.DirectionTo(Main.npc[index33].Center);
if ((double) vector2.Y <= 0.5 && (double) vector2.Y >= -0.5)
{
this.localAI[2] = this.ai[0];
this.ai[0] = 12f;
this.ai[1] = (float) num53;
this.ai[2] = vector2.Y;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index33].position.X ? 1 : -1;
this.netUpdate = true;
}
}
}
if (flag17 && (double) this.velocity.Y == 0.0 && NPCID.Sets.AttackType[this.type] == 2 && NPCID.Sets.AttackAverageChance[this.type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) == 0)
{
int num54 = NPCID.Sets.AttackTime[this.type];
int index35 = num5 == 1 ? index4 : index3;
int index36 = num5 == 1 ? index3 : index4;
if (index35 != -1 && !Collision.CanHitLine(this.Center, 0, 0, Main.npc[index35].Center, 0, 0))
index35 = index36 == -1 || !Collision.CanHitLine(this.Center, 0, 0, Main.npc[index36].Center, 0, 0) ? -1 : index36;
if (index35 != -1)
{
this.localAI[2] = this.ai[0];
this.ai[0] = 14f;
this.ai[1] = (float) num54;
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index35].position.X ? 1 : -1;
this.netUpdate = true;
}
else if (this.type == 20)
{
this.localAI[2] = this.ai[0];
this.ai[0] = 14f;
this.ai[1] = (float) num54;
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.netUpdate = true;
}
}
if (!flag17 || (double) this.velocity.Y != 0.0 || NPCID.Sets.AttackType[this.type] != 3 || NPCID.Sets.AttackAverageChance[this.type] <= 0 || Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) != 0)
return;
int num55 = NPCID.Sets.AttackTime[this.type];
int index37 = num5 == 1 ? index4 : index3;
int index38 = num5 == 1 ? index3 : index4;
if (index37 != -1 && !Collision.CanHit(this.Center, 0, 0, Main.npc[index37].Center, 0, 0))
index37 = index38 == -1 || !Collision.CanHit(this.Center, 0, 0, Main.npc[index38].Center, 0, 0) ? -1 : index38;
if (index37 == -1)
return;
this.localAI[2] = this.ai[0];
this.ai[0] = 15f;
this.ai[1] = (float) num55;
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index37].position.X ? 1 : -1;
this.netUpdate = true;
}
}
}
private void AI_003_Fighters()
{
if (this.type == 466)
{
int num = 200;
if ((double) this.ai[2] == 0.0)
{
this.alpha = num;
this.TargetClosest();
if (!Main.player[this.target].dead && (double) (Main.player[this.target].Center - this.Center).Length() < 170.0)
this.ai[2] = -16f;
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y >= 0.0 && (double) this.velocity.Y <= 2.0 && !this.justHit)
return;
this.ai[2] = -16f;
return;
}
if ((double) this.ai[2] < 0.0)
{
if (this.alpha > 0)
{
this.alpha -= num / 16;
if (this.alpha < 0)
this.alpha = 0;
}
++this.ai[2];
if ((double) this.ai[2] != 0.0)
return;
this.ai[2] = 1f;
this.velocity.X = (float) (this.direction * 2);
return;
}
this.alpha = 0;
}
if (this.type == 166)
{
if (Main.netMode != 1 && Main.rand.Next(240) == 0)
{
this.ai[2] = (float) Main.rand.Next(-480, -60);
this.netUpdate = true;
}
if ((double) this.ai[2] < 0.0)
{
this.TargetClosest();
if (this.justHit)
this.ai[2] = 0.0f;
if (Collision.CanHit(this.Center, 1, 1, Main.player[this.target].Center, 1, 1))
this.ai[2] = 0.0f;
}
if ((double) this.ai[2] < 0.0)
{
this.velocity.X *= 0.9f;
if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1)
this.velocity.X = 0.0f;
++this.ai[2];
if ((double) this.ai[2] != 0.0)
return;
this.velocity.X = (float) this.direction * 0.1f;
return;
}
}
if (this.type == 461)
{
if (this.wet)
{
this.knockBackResist = 0.0f;
this.ai[3] = -0.10101f;
this.noGravity = true;
Vector2 center = this.Center;
this.width = 34;
this.height = 24;
this.position.X = center.X - (float) (this.width / 2);
this.position.Y = center.Y - (float) (this.height / 2);
this.TargetClosest();
if (this.collideX)
this.velocity.X = -this.oldVelocity.X;
if ((double) this.velocity.X < 0.0)
this.direction = -1;
if ((double) this.velocity.X > 0.0)
this.direction = 1;
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].Center, 1, 1))
{
Vector2 vector2 = Main.player[this.target].Center - this.Center;
vector2.Normalize();
this.velocity = (this.velocity * 19f + vector2 * 5f) / 20f;
return;
}
float num = 5f;
if ((double) this.velocity.Y > 0.0)
num = 3f;
if ((double) this.velocity.Y < 0.0)
num = 8f;
Vector2 vector2_1 = new Vector2((float) this.direction, -1f);
vector2_1.Normalize();
vector2_1 *= num;
if ((double) num < 5.0)
{
this.velocity = (this.velocity * 24f + vector2_1) / 25f;
return;
}
this.velocity = (this.velocity * 9f + vector2_1) / 10f;
return;
}
this.knockBackResist = 0.4f * Main.knockBackMultiplier;
this.noGravity = false;
Vector2 center1 = this.Center;
this.width = 18;
this.height = 40;
this.position.X = center1.X - (float) (this.width / 2);
this.position.Y = center1.Y - (float) (this.height / 2);
if ((double) this.ai[3] == -0.101010002195835)
{
this.ai[3] = 0.0f;
float num = this.velocity.Length() * 2f;
if ((double) num > 10.0)
num = 10f;
this.velocity.Normalize();
this.velocity = this.velocity * num;
if ((double) this.velocity.X < 0.0)
this.direction = -1;
if ((double) this.velocity.X > 0.0)
this.direction = 1;
this.spriteDirection = this.direction;
}
}
if (this.type == 379 || this.type == 380)
{
if ((double) this.ai[3] < 0.0)
{
this.damage = 0;
this.velocity.X *= 0.93f;
if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1)
this.velocity.X = 0.0f;
int index = (int) (-(double) this.ai[3] - 1.0);
int num = Math.Sign(Main.npc[index].Center.X - this.Center.X);
if (num != this.direction)
{
this.velocity.X = 0.0f;
this.direction = num;
this.netUpdate = true;
}
if (this.justHit && Main.netMode != 1 && (double) Main.npc[index].localAI[0] == 0.0)
Main.npc[index].localAI[0] = 1f;
if ((double) this.ai[0] < 1000.0)
this.ai[0] = 1000f;
if ((double) ++this.ai[0] < 1300.0)
return;
this.ai[0] = 1000f;
this.netUpdate = true;
return;
}
if ((double) this.ai[0] >= 1000.0)
this.ai[0] = 0.0f;
this.damage = this.defDamage;
}
if (this.type == 383 && (double) this.ai[2] == 0.0 && (double) this.localAI[0] == 0.0 && Main.netMode != 1)
{
int index = NPC.NewNPC((int) this.Center.X, (int) this.Center.Y, 384, this.whoAmI);
this.ai[2] = (float) (index + 1);
this.localAI[0] = -1f;
this.netUpdate = true;
Main.npc[index].ai[0] = (float) this.whoAmI;
Main.npc[index].netUpdate = true;
}
if (this.type == 383)
{
int index = (int) this.ai[2] - 1;
if (index != -1 && Main.npc[index].active && Main.npc[index].type == 384)
{
this.dontTakeDamage = true;
}
else
{
this.dontTakeDamage = false;
this.ai[2] = 0.0f;
if ((double) this.localAI[0] == -1.0)
this.localAI[0] = 180f;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
}
}
if (this.type == 482)
{
int num1 = 300;
int num2 = 120;
this.dontTakeDamage = false;
if ((double) this.ai[2] < 0.0)
{
this.dontTakeDamage = true;
++this.ai[2];
this.velocity.X *= 0.9f;
if ((double) Math.Abs(this.velocity.X) < 0.001)
this.velocity.X = 1f / 1000f * (float) this.direction;
if ((double) Math.Abs(this.velocity.Y) > 1.0)
this.ai[2] += 10f;
if ((double) this.ai[2] < 0.0)
return;
this.netUpdate = true;
this.velocity.X += (float) this.direction * 0.3f;
return;
}
if ((double) this.ai[2] < (double) num1)
{
if (this.justHit)
this.ai[2] += 15f;
++this.ai[2];
}
else if ((double) this.velocity.Y == 0.0)
{
this.ai[2] = (float) -num2;
this.netUpdate = true;
}
}
if (this.type == 480)
{
int num3 = 180;
int num4 = 300;
int num5 = 180;
int num6 = 60;
int num7 = 20;
if (this.life < this.lifeMax / 3)
{
num3 = 120;
num4 = 240;
num5 = 240;
num6 = 90;
}
if ((double) this.ai[2] > 0.0)
--this.ai[2];
else if ((double) this.ai[2] == 0.0)
{
if (((double) Main.player[this.target].Center.X < (double) this.Center.X && this.direction < 0 || (double) Main.player[this.target].Center.X > (double) this.Center.X && this.direction > 0) && (double) this.velocity.Y == 0.0 && (double) this.Distance(Main.player[this.target].Center) < 900.0 && Collision.CanHit(this.Center, 1, 1, Main.player[this.target].Center, 1, 1))
{
this.ai[2] = (float) (-num5 - num7);
this.netUpdate = true;
}
}
else
{
if ((double) this.ai[2] < 0.0 && (double) this.ai[2] < (double) -num5)
{
this.velocity.X *= 0.9f;
if ((double) this.velocity.Y < -2.0 || (double) this.velocity.Y > 4.0 || this.justHit)
{
this.ai[2] = (float) num3;
}
else
{
++this.ai[2];
if ((double) this.ai[2] == 0.0)
this.ai[2] = (float) num4;
}
float num8 = this.ai[2] + (float) num5 + (float) num7;
if ((double) num8 == 1.0)
Main.PlaySound(4, (int) this.position.X, (int) this.position.Y, 17);
if ((double) num8 < (double) num7)
{
Vector2 Position = this.Top + new Vector2((float) (this.spriteDirection * 6), 6f);
float num9 = MathHelper.Lerp(20f, 30f, (float) (((double) num8 * 3.0 + 50.0) / 182.0));
double num10 = (double) Main.rand.NextFloat();
for (float num11 = 0.0f; (double) num11 < 2.0; ++num11)
{
Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * (float) ((double) Main.rand.NextFloat() * 0.5 + 0.5);
Dust dust = Main.dust[Dust.NewDust(Position, 0, 0, 228)];
dust.position = Position + vector2 * num9;
dust.noGravity = true;
dust.velocity = vector2 * 2f;
dust.scale = (float) (0.5 + (double) Main.rand.NextFloat() * 0.5);
}
}
Lighting.AddLight(this.Center, 0.9f, 0.75f, 0.1f);
return;
}
if ((double) this.ai[2] < 0.0 && (double) this.ai[2] >= (double) -num5)
{
Lighting.AddLight(this.Center, 0.9f, 0.75f, 0.1f);
this.velocity.X *= 0.9f;
if ((double) this.velocity.Y < -2.0 || (double) this.velocity.Y > 4.0 || this.justHit)
{
this.ai[2] = (float) num3;
}
else
{
++this.ai[2];
if ((double) this.ai[2] == 0.0)
this.ai[2] = (float) num4;
}
float num12 = this.ai[2] + (float) num5;
if ((double) num12 < 180.0 && (Main.rand.Next(3) == 0 || (double) this.ai[2] % 3.0 == 0.0))
{
Vector2 Position = this.Top + new Vector2((float) (this.spriteDirection * 10), 10f);
float num13 = MathHelper.Lerp(20f, 30f, (float) (((double) num12 * 3.0 + 50.0) / 182.0));
double num14 = (double) Main.rand.NextFloat();
for (float num15 = 0.0f; (double) num15 < 1.0; ++num15)
{
Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * (float) ((double) Main.rand.NextFloat() * 0.5 + 0.5);
Dust dust = Main.dust[Dust.NewDust(Position, 0, 0, 228)];
dust.position = Position + vector2 * num13;
dust.noGravity = true;
dust.velocity = vector2 * 4f;
dust.scale = 0.5f + Main.rand.NextFloat();
}
}
if (Main.netMode == 2)
return;
Player player1 = Main.player[Main.myPlayer];
int player2 = Main.myPlayer;
if (player1.dead || !player1.active || player1.FindBuffIndex(156) != -1)
return;
Vector2 vector2_2 = player1.Center - this.Center;
if ((double) vector2_2.Length() >= 700.0)
return;
bool flag = (double) vector2_2.Length() < 30.0;
if (!flag)
{
float x = 0.7853982f.ToRotationVector2().X;
Vector2 vector2_3 = Vector2.Normalize(vector2_2);
if ((double) vector2_3.X > (double) x || (double) vector2_3.X < -(double) x)
flag = true;
}
if (((double) player1.Center.X >= (double) this.Center.X || this.direction >= 0 || player1.direction <= 0) && ((double) player1.Center.X <= (double) this.Center.X || this.direction <= 0 || player1.direction >= 0) || !flag || (Collision.CanHitLine(this.Center, 1, 1, player1.Center, 1, 1) || Collision.CanHitLine(this.Center - Vector2.UnitY * 16f, 1, 1, player1.Center, 1, 1) ? 1 : (Collision.CanHitLine(this.Center + Vector2.UnitY * 8f, 1, 1, player1.Center, 1, 1) ? 1 : 0)) == 0)
return;
player1.AddBuff(156, num6 + (int) this.ai[2] * -1);
return;
}
}
}
if (this.type == 471)
{
if ((double) this.ai[3] < 0.0)
{
this.knockBackResist = 0.0f;
this.defense = (int) ((double) this.defDefense * 1.1);
this.noGravity = true;
this.noTileCollide = true;
if ((double) this.velocity.X < 0.0)
this.direction = -1;
else if ((double) this.velocity.X > 0.0)
this.direction = 1;
this.rotation = this.velocity.X * 0.1f;
if (Main.netMode != 1)
{
++this.localAI[3];
if ((double) this.localAI[3] > (double) Main.rand.Next(20, 180))
{
this.localAI[3] = 0.0f;
Vector2 vector2 = this.Center + this.velocity;
NPC.NewNPC((int) vector2.X, (int) vector2.Y, 30);
}
}
}
else
{
this.localAI[3] = 0.0f;
this.knockBackResist = 0.35f * Main.knockBackMultiplier;
this.rotation *= 0.9f;
this.defense = this.defDefense;
this.noGravity = false;
this.noTileCollide = false;
}
if ((double) this.ai[3] == 1.0)
{
this.knockBackResist = 0.0f;
this.defense += 10;
}
if ((double) this.ai[3] == -1.0)
{
this.TargetClosest();
float num16 = 8f;
float num17 = 40f;
Vector2 vector2_4 = Main.player[this.target].Center - this.Center;
float num18 = vector2_4.Length();
float num19 = num16 + num18 / 200f;
vector2_4.Normalize();
Vector2 vector2_5 = vector2_4 * num19;
this.velocity = (this.velocity * (num17 - 1f) + vector2_5) / num17;
if ((double) num18 >= 500.0 || Collision.SolidCollision(this.position, this.width, this.height))
return;
this.ai[3] = 0.0f;
this.ai[2] = 0.0f;
return;
}
if ((double) this.ai[3] == -2.0)
{
this.velocity.Y -= 0.2f;
if ((double) this.velocity.Y < -10.0)
this.velocity.Y = -10f;
if ((double) Main.player[this.target].Center.Y - (double) this.Center.Y > 200.0)
{
this.TargetClosest();
this.ai[3] = -3f;
this.ai[2] = (double) Main.player[this.target].Center.X <= (double) this.Center.X ? -1f : 1f;
}
this.velocity.X *= 0.99f;
return;
}
if ((double) this.ai[3] == -3.0)
{
if (this.direction == 0)
this.TargetClosest();
if ((double) this.ai[2] == 0.0)
this.ai[2] = (float) this.direction;
this.velocity.Y *= 0.9f;
this.velocity.X += this.ai[2] * 0.3f;
if ((double) this.velocity.X > 10.0)
this.velocity.X = 10f;
if ((double) this.velocity.X < -10.0)
this.velocity.X = -10f;
float num = Main.player[this.target].Center.X - this.Center.X;
if ((double) this.ai[2] < 0.0 && (double) num > 300.0 || (double) this.ai[2] > 0.0 && (double) num < -300.0)
{
this.ai[3] = -4f;
this.ai[2] = 0.0f;
return;
}
if ((double) Math.Abs(num) <= 800.0)
return;
this.ai[3] = -1f;
this.ai[2] = 0.0f;
return;
}
if ((double) this.ai[3] == -4.0)
{
++this.ai[2];
this.velocity.Y += 0.1f;
if ((double) this.velocity.Length() > 4.0)
this.velocity = this.velocity * 0.9f;
int index1 = (int) this.Center.X / 16;
int index2 = (int) ((double) this.position.Y + (double) this.height + 12.0) / 16;
bool flag = false;
for (int index3 = index1 - 1; index3 <= index1 + 1; ++index3)
{
if (Main.tile[index3, index2] == null)
Main.tile[index1, index2] = new Tile();
if (Main.tile[index3, index2].active() && Main.tileSolid[(int) Main.tile[index3, index2].type])
flag = true;
}
if (flag && !Collision.SolidCollision(this.position, this.width, this.height))
{
this.ai[3] = 0.0f;
this.ai[2] = 0.0f;
}
else if ((double) this.ai[2] > 300.0 || (double) this.Center.Y > (double) Main.player[this.target].Center.Y + 200.0)
{
this.ai[3] = -1f;
this.ai[2] = 0.0f;
}
}
else
{
if ((double) this.ai[3] == 1.0)
{
Vector2 center = this.Center;
center.Y -= 70f;
this.velocity.X *= 0.8f;
++this.ai[2];
if ((double) this.ai[2] == 60.0)
{
if (Main.netMode != 1)
NPC.NewNPC((int) center.X, (int) center.Y + 18, 472);
}
else if ((double) this.ai[2] >= 90.0)
{
this.ai[3] = -2f;
this.ai[2] = 0.0f;
}
for (int index4 = 0; index4 < 2; ++index4)
{
Vector2 vector2_6 = center;
Vector2 vector2_7 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
vector2_7.Normalize();
Vector2 vector2_8 = vector2_7 * ((float) Main.rand.Next(0, 100) * 0.1f);
Vector2 vector2_9 = vector2_8;
Vector2 Position = vector2_6 + vector2_9;
vector2_8.Normalize();
vector2_7 = vector2_8 * ((float) Main.rand.Next(50, 90) * 0.1f);
Color newColor = new Color();
int index5 = Dust.NewDust(Position, 1, 1, 27, newColor: newColor);
Main.dust[index5].velocity = -vector2_7 * 0.3f;
Main.dust[index5].alpha = 100;
if (Main.rand.Next(2) == 0)
{
Main.dust[index5].noGravity = true;
Main.dust[index5].scale += 0.3f;
}
}
return;
}
++this.ai[2];
int num = 10;
if ((double) this.velocity.Y == 0.0 && NPC.CountNPCS(472) < num)
{
if ((double) this.ai[2] >= 180.0)
{
this.ai[2] = 0.0f;
this.ai[3] = 1f;
}
}
else
{
if (NPC.CountNPCS(472) >= num)
++this.ai[2];
if ((double) this.ai[2] >= 360.0)
{
this.ai[2] = 0.0f;
this.ai[3] = -2f;
this.velocity.Y -= 3f;
}
}
if (this.target >= 0 && !Main.player[this.target].dead && (double) (Main.player[this.target].Center - this.Center).Length() > 800.0)
{
this.ai[3] = -1f;
this.ai[2] = 0.0f;
}
}
if (Main.player[this.target].dead)
{
this.TargetClosest();
if (Main.player[this.target].dead && this.timeLeft > 1)
this.timeLeft = 1;
}
}
if (this.type == 419)
{
this.reflectingProjectiles = false;
this.takenDamageMultiplier = 1f;
int num20 = 6;
int num21 = 10;
float num22 = 16f;
if ((double) this.ai[2] > 0.0)
--this.ai[2];
if ((double) this.ai[2] == 0.0)
{
if (((double) Main.player[this.target].Center.X < (double) this.Center.X && this.direction < 0 || (double) Main.player[this.target].Center.X > (double) this.Center.X && this.direction > 0) && Collision.CanHit(this.Center, 1, 1, Main.player[this.target].Center, 1, 1))
{
this.ai[2] = -1f;
this.netUpdate = true;
this.TargetClosest();
}
}
else
{
if ((double) this.ai[2] < 0.0 && (double) this.ai[2] > (double) -num20)
{
--this.ai[2];
this.velocity.X *= 0.9f;
return;
}
if ((double) this.ai[2] == (double) -num20)
{
--this.ai[2];
this.TargetClosest();
Vector2 vec = this.DirectionTo(Main.player[this.target].Top + new Vector2(0.0f, -30f));
if (vec.HasNaNs())
vec = Vector2.Normalize(new Vector2((float) this.spriteDirection, -1f));
this.velocity = vec * num22;
this.netUpdate = true;
return;
}
if ((double) this.ai[2] < (double) -num20)
{
--this.ai[2];
if ((double) this.velocity.Y == 0.0)
this.ai[2] = 60f;
else if ((double) this.ai[2] < (double) (-num20 - num21))
{
this.velocity.Y += 0.15f;
if ((double) this.velocity.Y > 24.0)
this.velocity.Y = 24f;
}
this.reflectingProjectiles = true;
this.takenDamageMultiplier = 3f;
if (!this.justHit)
return;
this.ai[2] = 60f;
this.netUpdate = true;
return;
}
}
}
if (this.type == 415)
{
int num23 = 42;
int num24 = 18;
if (this.justHit)
{
this.ai[2] = 120f;
this.netUpdate = true;
}
if ((double) this.ai[2] > 0.0)
--this.ai[2];
if ((double) this.ai[2] == 0.0)
{
int num25 = 0;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 516)
++num25;
}
if (num25 > 6)
this.ai[2] = 90f;
else if (((double) Main.player[this.target].Center.X < (double) this.Center.X && this.direction < 0 || (double) Main.player[this.target].Center.X > (double) this.Center.X && this.direction > 0) && Collision.CanHit(this.Center, 1, 1, Main.player[this.target].Center, 1, 1))
{
this.ai[2] = -1f;
this.netUpdate = true;
this.TargetClosest();
}
}
else if ((double) this.ai[2] < 0.0 && (double) this.ai[2] > (double) -num23)
{
--this.ai[2];
if ((double) this.ai[2] == (double) -num23)
this.ai[2] = (float) (180 + 30 * Main.rand.Next(10));
this.velocity.X *= 0.8f;
if ((double) this.ai[2] != (double) -num24 && (double) this.ai[2] != (double) (-num24 - 8) && (double) this.ai[2] != (double) (-num24 - 16))
return;
for (int index = 0; index < 20; ++index)
{
Vector2 Position = this.Center + Vector2.UnitX * (float) this.spriteDirection * 40f;
Dust dust = Main.dust[Dust.NewDust(Position, 0, 0, 259)];
Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.28318548202515);
dust.position = Position + vector2 * 4f;
dust.velocity = vector2 * 2f + Vector2.UnitX * Main.rand.NextFloat() * (float) this.spriteDirection * 3f;
dust.scale = (float) (0.300000011920929 + (double) vector2.X * (double) -this.spriteDirection);
dust.fadeIn = 0.7f;
dust.noGravity = true;
}
if ((double) this.velocity.X > -0.5 && (double) this.velocity.X < 0.5)
this.velocity.X = 0.0f;
if (Main.netMode == 1)
return;
NPC.NewNPC((int) this.Center.X + this.spriteDirection * 45, (int) this.Center.Y + 8, 516, Target: this.target);
return;
}
}
if (this.type == 428)
{
++this.localAI[0];
if ((double) this.localAI[0] >= 300.0)
{
int startX = (int) this.Center.X / 16 - 1;
int startY = (int) this.Center.Y / 16 - 1;
if (!Collision.SolidTiles(startX, startX + 2, startY, startY + 1) && Main.netMode != 1)
{
this.Transform(427);
this.life = this.lifeMax;
this.localAI[0] = 0.0f;
return;
}
}
int maxValue = (double) this.localAI[0] >= 60.0 ? ((double) this.localAI[0] >= 120.0 ? ((double) this.localAI[0] >= 180.0 ? ((double) this.localAI[0] >= 240.0 ? ((double) this.localAI[0] >= 300.0 ? 1 : 1) : 2) : 4) : 8) : 16;
if (Main.rand.Next(maxValue) == 0)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
dust.noGravity = true;
dust.scale = 1f;
dust.noLight = true;
dust.velocity = this.DirectionFrom(dust.position) * dust.velocity.Length();
dust.position -= dust.velocity * 5f;
dust.position.X += (float) (this.direction * 6);
dust.position.Y += 4f;
}
}
if (this.type == 427)
{
++this.localAI[0];
this.localAI[0] += Math.Abs(this.velocity.X) / 2f;
if ((double) this.localAI[0] >= 1200.0 && Main.netMode != 1)
{
int startX = (int) this.Center.X / 16 - 2;
int startY = (int) this.Center.Y / 16 - 3;
if (!Collision.SolidTiles(startX, startX + 4, startY, startY + 4))
{
this.Transform(426);
this.life = this.lifeMax;
this.localAI[0] = 0.0f;
return;
}
}
int maxValue = (double) this.localAI[0] >= 360.0 ? ((double) this.localAI[0] >= 720.0 ? ((double) this.localAI[0] >= 1080.0 ? ((double) this.localAI[0] >= 1440.0 ? ((double) this.localAI[0] >= 1800.0 ? 1 : 1) : 2) : 6) : 16) : 32;
if (Main.rand.Next(maxValue) == 0)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
dust.noGravity = true;
dust.scale = 1f;
dust.noLight = true;
}
}
bool flag1 = false;
if ((double) this.velocity.X == 0.0)
flag1 = true;
if (this.justHit)
flag1 = false;
if (Main.netMode != 1 && this.type == 198 && (double) this.life <= (double) this.lifeMax * 0.55)
this.Transform(199);
if (Main.netMode != 1 && this.type == 348 && (double) this.life <= (double) this.lifeMax * 0.55)
this.Transform(349);
int num26 = 60;
if (this.type == 120)
{
num26 = 180;
if ((double) this.ai[3] == -120.0)
{
this.velocity = this.velocity * 0.0f;
this.ai[3] = 0.0f;
Main.PlaySound(SoundID.Item8, this.position);
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num27 = this.oldPos[2].X + (float) this.width * 0.5f - vector2.X;
float num28 = this.oldPos[2].Y + (float) this.height * 0.5f - vector2.Y;
float num29 = 2f / (float) Math.Sqrt((double) num27 * (double) num27 + (double) num28 * (double) num28);
float SpeedX = num27 * num29;
float SpeedY = num28 * num29;
for (int index6 = 0; index6 < 20; ++index6)
{
int index7 = Dust.NewDust(this.position, this.width, this.height, 71, SpeedX, SpeedY, 200, Scale: 2f);
Main.dust[index7].noGravity = true;
Main.dust[index7].velocity.X *= 2f;
}
for (int index8 = 0; index8 < 20; ++index8)
{
int index9 = Dust.NewDust(this.oldPos[2], this.width, this.height, 71, -SpeedX, -SpeedY, 200, Scale: 2f);
Main.dust[index9].noGravity = true;
Main.dust[index9].velocity.X *= 2f;
}
}
}
bool flag2 = false;
bool flag3 = true;
if (this.type == 343 || this.type == 47 || this.type == 67 || this.type == 109 || this.type == 110 || this.type == 111 || this.type == 120 || this.type == 163 || this.type == 164 || this.type == 239 || this.type == 168 || this.type == 199 || this.type == 206 || this.type == 214 || this.type == 215 || this.type == 216 || this.type == 217 || this.type == 218 || this.type == 219 || this.type == 220 || this.type == 226 || this.type == 243 || this.type == 251 || this.type == 257 || this.type == 258 || this.type == 290 || this.type == 291 || this.type == 292 || this.type == 293 || this.type == 305 || this.type == 306 || this.type == 307 || this.type == 308 || this.type == 309 || this.type == 348 || this.type == 349 || this.type == 350 || this.type == 351 || this.type == 379 || this.type >= 430 && this.type <= 436 || this.type == 380 || this.type == 381 || this.type == 382 || this.type == 383 || this.type == 386 || this.type == 391 || this.type >= 449 && this.type <= 452 || this.type == 466 || this.type == 464 || this.type == 166 || this.type == 469 || this.type == 468 || this.type == 471 || this.type == 470 || this.type == 480 || this.type == 481 || this.type == 482 || this.type == 411 || this.type == 424 || this.type == 409 || this.type >= 494 && this.type <= 506 || this.type == 425 || this.type == 427 || this.type == 426 || this.type == 428 || this.type == 508 || this.type == 415 || this.type == 419 || this.type == 520 || this.type >= 524 && this.type <= 527 || this.type == 528 || this.type == 529 || this.type == 530 || this.type == 532)
flag3 = false;
bool flag4 = false;
switch (this.type)
{
case 425:
case 471:
flag4 = true;
break;
}
bool flag5 = true;
switch (this.type)
{
case 110:
case 111:
case 206:
case 214:
case 215:
case 216:
case 291:
case 292:
case 293:
case 350:
case 379:
case 380:
case 381:
case 382:
case 409:
case 411:
case 424:
case 426:
case 466:
case 498:
case 499:
case 500:
case 501:
case 502:
case 503:
case 504:
case 505:
case 506:
case 520:
if ((double) this.ai[2] > 0.0)
{
flag5 = false;
break;
}
break;
}
if (!flag4 & flag5)
{
if ((double) this.velocity.Y == 0.0 && ((double) this.velocity.X > 0.0 && this.direction < 0 || (double) this.velocity.X < 0.0 && this.direction > 0))
flag2 = true;
if ((((double) this.position.X == (double) this.oldPosition.X ? 1 : ((double) this.ai[3] >= (double) num26 ? 1 : 0)) | (flag2 ? 1 : 0)) != 0)
++this.ai[3];
else if ((double) Math.Abs(this.velocity.X) > 0.9 && (double) this.ai[3] > 0.0)
--this.ai[3];
if ((double) this.ai[3] > (double) (num26 * 10))
this.ai[3] = 0.0f;
if (this.justHit)
this.ai[3] = 0.0f;
if ((double) this.ai[3] == (double) num26)
this.netUpdate = true;
}
if (this.type == 463 && Main.netMode != 1)
{
if ((double) this.localAI[3] > 0.0)
--this.localAI[3];
if (this.justHit && (double) this.localAI[3] <= 0.0 && Main.rand.Next(3) == 0)
{
this.localAI[3] = 30f;
int length = Main.rand.Next(3, 6);
int[] numArray = new int[length];
int maxValue = 0;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && !Main.player[index].dead && Collision.CanHitLine(this.position, this.width, this.height, Main.player[index].position, Main.player[index].width, Main.player[index].height))
{
numArray[maxValue] = index;
++maxValue;
if (maxValue == length)
break;
}
}
if (maxValue > 1)
{
for (int index10 = 0; index10 < 100; ++index10)
{
int index11 = Main.rand.Next(maxValue);
int index12 = index11;
while (index12 == index11)
index12 = Main.rand.Next(maxValue);
int num30 = numArray[index11];
numArray[index11] = numArray[index12];
numArray[index12] = num30;
}
}
Vector2 vector2_10 = new Vector2(-1f, -1f);
for (int index = 0; index < maxValue; ++index)
{
Vector2 vector2_11 = Main.npc[numArray[index]].Center - this.Center;
vector2_11.Normalize();
vector2_10 += vector2_11;
}
vector2_10.Normalize();
for (int index = 0; index < length; ++index)
{
float num31 = (float) Main.rand.Next(8, 13);
Vector2 vector2_12 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
vector2_12.Normalize();
if (maxValue > 0)
{
vector2_12 += vector2_10;
vector2_12.Normalize();
}
vector2_12 *= num31;
if (maxValue > 0)
{
--maxValue;
vector2_12 = Main.player[numArray[maxValue]].Center - this.Center;
vector2_12.Normalize();
vector2_12 *= num31;
}
Projectile.NewProjectile(this.Center.X, this.position.Y + (float) (this.width / 4), vector2_12.X, vector2_12.Y, 498, (int) ((double) this.damage * 0.15), 1f);
}
}
}
if (this.type == 460)
this.knockBackResist = (double) this.velocity.Y < -(double) NPC.gravity || (double) this.velocity.Y > (double) NPC.gravity ? 0.0f : 0.25f * Main.knockBackMultiplier;
if (this.type == 469)
{
this.knockBackResist = 0.45f * Main.knockBackMultiplier;
if ((double) this.ai[2] == 1.0)
this.knockBackResist = 0.0f;
bool flag6 = false;
int num32 = (int) this.Center.X / 16;
int num33 = (int) this.Center.Y / 16;
for (int index13 = num32 - 1; index13 <= num32 + 1; ++index13)
{
for (int index14 = num33 - 1; index14 <= num33 + 1; ++index14)
{
if (Main.tile[index13, index14] != null && Main.tile[index13, index14].wall > (byte) 0)
{
flag6 = true;
break;
}
}
if (flag6)
break;
}
if ((double) this.ai[2] == 0.0 & flag6)
{
if ((double) this.velocity.Y == 0.0)
{
this.velocity.Y = -4.6f;
this.velocity.X *= 1.3f;
}
else if ((double) this.velocity.Y > 0.0)
this.ai[2] = 1f;
}
if (flag6 && (double) this.ai[2] == 1.0 && Collision.CanHit(this.Center, 1, 1, Main.player[this.target].Center, 1, 1))
{
Vector2 vector2 = Main.player[this.target].Center - this.Center;
float num34 = vector2.Length();
vector2.Normalize();
this.velocity = (this.velocity * 29f + vector2 * (float) (4.5 + (double) num34 / 300.0)) / 30f;
this.noGravity = true;
this.ai[2] = 1f;
return;
}
this.noGravity = false;
this.ai[2] = 0.0f;
}
if (this.type == 462 && (double) this.velocity.Y == 0.0 && (double) (Main.player[this.target].Center - this.Center).Length() < 150.0 && (double) Math.Abs(this.velocity.X) > 3.0 && ((double) this.velocity.X < 0.0 && (double) this.Center.X > (double) Main.player[this.target].Center.X || (double) this.velocity.X > 0.0 && (double) this.Center.X < (double) Main.player[this.target].Center.X))
{
this.velocity.X *= 1.75f;
this.velocity.Y -= 4.5f;
if ((double) this.Center.Y - (double) Main.player[this.target].Center.Y > 20.0)
this.velocity.Y -= 0.5f;
if ((double) this.Center.Y - (double) Main.player[this.target].Center.Y > 40.0)
--this.velocity.Y;
if ((double) this.Center.Y - (double) Main.player[this.target].Center.Y > 80.0)
this.velocity.Y -= 1.5f;
if ((double) this.Center.Y - (double) Main.player[this.target].Center.Y > 100.0)
this.velocity.Y -= 1.5f;
if ((double) Math.Abs(this.velocity.X) > 7.0)
{
if ((double) this.velocity.X < 0.0)
this.velocity.X = -7f;
else
this.velocity.X = 7f;
}
}
if ((double) this.ai[3] < (double) num26 && (Main.eclipse || !Main.dayTime || (double) this.position.Y > Main.worldSurface * 16.0 || Main.invasionType == 1 && (this.type == 343 || this.type == 350) || Main.invasionType == 1 && (this.type == 26 || this.type == 27 || this.type == 28 || this.type == 111 || this.type == 471) || this.type == 73 || Main.invasionType == 3 && this.type >= 212 && this.type <= 216 || Main.invasionType == 4 && (this.type == 381 || this.type == 382 || this.type == 383 || this.type == 385 || this.type == 386 || this.type == 389 || this.type == 391 || this.type == 520) || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 47 || this.type == 67 || this.type == 77 || this.type == 78 || this.type == 79 || this.type == 80 || this.type == 110 || this.type == 120 || this.type == 168 || this.type == 181 || this.type == 185 || this.type == 198 || this.type == 199 || this.type == 206 || this.type == 217 || this.type == 218 || this.type == 219 || this.type == 220 || this.type == 239 || this.type == 243 || this.type == 254 || this.type == (int) byte.MaxValue || this.type == 257 || this.type == 258 || this.type == 291 || this.type == 292 || this.type == 293 || this.type == 379 || this.type == 380 || this.type == 464 || this.type == 470 || this.type == 424 || this.type == 411 && ((double) this.ai[1] >= 180.0 || (double) this.ai[1] < 90.0) || this.type == 409 || this.type == 425 || this.type == 429 || this.type == 427 || this.type == 428 || this.type == 508 || this.type == 415 || this.type == 419 || this.type >= 524 && this.type <= 527 || this.type == 528 || this.type == 529 || this.type == 530 || this.type == 532))
{
if ((this.type == 3 || this.type == 331 || this.type == 332 || this.type == 21 || this.type >= 449 && this.type <= 452 || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 77 || this.type == 110 || this.type == 132 || this.type == 167 || this.type == 161 || this.type == 162 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 197 || this.type == 200 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 223 || this.type == 291 || this.type == 292 || this.type == 293 || this.type == 320 || this.type == 321 || this.type == 319 || this.type == 481) && Main.rand.Next(1000) == 0)
Main.PlaySound(14, (int) this.position.X, (int) this.position.Y);
if (this.type == 489 && Main.rand.Next(800) == 0)
Main.PlaySound(14, (int) this.position.X, (int) this.position.Y, this.type);
if ((this.type == 78 || this.type == 79 || this.type == 80) && Main.rand.Next(500) == 0)
Main.PlaySound(26, (int) this.position.X, (int) this.position.Y);
if (this.type == 159 && Main.rand.Next(500) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 7);
if (this.type == 162 && Main.rand.Next(500) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 6);
if (this.type == 181 && Main.rand.Next(500) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 8);
if (this.type >= 269 && this.type <= 280 && Main.rand.Next(1000) == 0)
Main.PlaySound(14, (int) this.position.X, (int) this.position.Y);
this.TargetClosest();
}
else if ((double) this.ai[2] <= 0.0 || this.type != 110 && this.type != 111 && this.type != 206 && this.type != 216 && this.type != 214 && this.type != 215 && this.type != 291 && this.type != 292 && this.type != 293 && this.type != 350 && this.type != 381 && this.type != 382 && this.type != 383 && this.type != 385 && this.type != 386 && this.type != 389 && this.type != 391 && this.type != 469 && this.type != 166 && this.type != 466 && this.type != 471 && this.type != 411 && this.type != 409 && this.type != 424 && this.type != 425 && this.type != 426 && this.type != 415 && this.type != 419 && this.type != 520)
{
if (Main.dayTime && (double) this.position.Y / 16.0 < Main.worldSurface && this.timeLeft > 10)
this.timeLeft = 10;
if ((double) this.velocity.X == 0.0)
{
if ((double) this.velocity.Y == 0.0)
{
++this.ai[0];
if ((double) this.ai[0] >= 2.0)
{
this.direction *= -1;
this.spriteDirection = this.direction;
this.ai[0] = 0.0f;
}
}
}
else
this.ai[0] = 0.0f;
if (this.direction == 0)
this.direction = 1;
}
if (this.type == 159 || this.type == 349)
{
if (this.type == 159 && ((double) this.velocity.X > 0.0 && this.direction < 0 || (double) this.velocity.X < 0.0 && this.direction > 0))
this.velocity.X *= 0.95f;
if ((double) this.velocity.X < -6.0 || (double) this.velocity.X > 6.0)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < 6.0 && this.direction == 1)
{
if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X < 0.0)
this.velocity.X *= 0.99f;
this.velocity.X += 0.07f;
if ((double) this.velocity.X > 6.0)
this.velocity.X = 6f;
}
else if ((double) this.velocity.X > -6.0 && this.direction == -1)
{
if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X > 0.0)
this.velocity.X *= 0.99f;
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -6.0)
this.velocity.X = -6f;
}
}
else if (this.type == 199)
{
if ((double) this.velocity.X < -4.0 || (double) this.velocity.X > 4.0)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < 4.0 && this.direction == 1)
{
if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X < 0.0)
this.velocity.X *= 0.8f;
this.velocity.X += 0.1f;
if ((double) this.velocity.X > 4.0)
this.velocity.X = 4f;
}
else if ((double) this.velocity.X > -4.0 && this.direction == -1)
{
if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X > 0.0)
this.velocity.X *= 0.8f;
this.velocity.X -= 0.1f;
if ((double) this.velocity.X < -4.0)
this.velocity.X = -4f;
}
}
else if (this.type == 120 || this.type == 166 || this.type == 213 || this.type == 258 || this.type == 528 || this.type == 529)
{
if ((double) this.velocity.X < -3.0 || (double) this.velocity.X > 3.0)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < 3.0 && this.direction == 1)
{
if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X < 0.0)
this.velocity.X *= 0.99f;
this.velocity.X += 0.07f;
if ((double) this.velocity.X > 3.0)
this.velocity.X = 3f;
}
else if ((double) this.velocity.X > -3.0 && this.direction == -1)
{
if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X > 0.0)
this.velocity.X *= 0.99f;
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -3.0)
this.velocity.X = -3f;
}
}
else if (this.type == 461 || this.type == 27 || this.type == 77 || this.type == 104 || this.type == 163 || this.type == 162 || this.type == 196 || this.type == 197 || this.type == 212 || this.type == 257 || this.type == 326 || this.type == 343 || this.type == 348 || this.type == 351 || this.type >= 524 && this.type <= 527 || this.type == 530)
{
if ((double) this.velocity.X < -2.0 || (double) this.velocity.X > 2.0)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < 2.0 && this.direction == 1)
{
this.velocity.X += 0.07f;
if ((double) this.velocity.X > 2.0)
this.velocity.X = 2f;
}
else if ((double) this.velocity.X > -2.0 && this.direction == -1)
{
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -2.0)
this.velocity.X = -2f;
}
}
else if (this.type == 109)
{
if ((double) this.velocity.X < -2.0 || (double) this.velocity.X > 2.0)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < 2.0 && this.direction == 1)
{
this.velocity.X += 0.04f;
if ((double) this.velocity.X > 2.0)
this.velocity.X = 2f;
}
else if ((double) this.velocity.X > -2.0 && this.direction == -1)
{
this.velocity.X -= 0.04f;
if ((double) this.velocity.X < -2.0)
this.velocity.X = -2f;
}
}
else if (this.type == 21 || this.type == 26 || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 47 || this.type == 73 || this.type == 140 || this.type == 164 || this.type == 239 || this.type == 167 || this.type == 168 || this.type == 185 || this.type == 198 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 217 || this.type == 218 || this.type == 219 || this.type == 226 || this.type == 181 || this.type == 254 || this.type == 338 || this.type == 339 || this.type == 340 || this.type == 342 || this.type == 385 || this.type == 389 || this.type == 462 || this.type == 463 || this.type == 466 || this.type == 464 || this.type == 469 || this.type == 470 || this.type == 480 || this.type == 482 || this.type == 425 || this.type == 429)
{
float num35 = 1.5f;
if (this.type == 294)
num35 = 2f;
else if (this.type == 295)
num35 = 1.75f;
else if (this.type == 296)
num35 = 1.25f;
else if (this.type == 201)
num35 = 1.1f;
else if (this.type == 202)
num35 = 0.9f;
else if (this.type == 203)
num35 = 1.2f;
else if (this.type == 338)
num35 = 1.75f;
else if (this.type == 339)
num35 = 1.25f;
else if (this.type == 340)
num35 = 2f;
else if (this.type == 385)
num35 = 1.8f;
else if (this.type == 389)
num35 = 2.25f;
else if (this.type == 462)
num35 = 4f;
else if (this.type == 463)
num35 = 0.75f;
else if (this.type == 466)
num35 = 3.75f;
else if (this.type == 469)
num35 = 3.25f;
else if (this.type == 480)
num35 = (float) (1.5 + (1.0 - (double) this.life / (double) this.lifeMax) * 2.0);
else if (this.type == 425)
num35 = 6f;
else if (this.type == 429)
num35 = 4f;
if (this.type == 21 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 342)
num35 *= (float) (1.0 + (1.0 - (double) this.scale));
if ((double) this.velocity.X < -(double) num35 || (double) this.velocity.X > (double) num35)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num35 && this.direction == 1)
{
if (this.type == 466 && (double) this.velocity.X < -2.0)
this.velocity.X *= 0.9f;
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num35)
this.velocity.X = num35;
}
else if ((double) this.velocity.X > -(double) num35 && this.direction == -1)
{
if (this.type == 466 && (double) this.velocity.X > 2.0)
this.velocity.X *= 0.9f;
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num35)
this.velocity.X = -num35;
}
if ((double) this.velocity.Y == 0.0 && this.type == 462 && (this.direction > 0 && (double) this.velocity.X < 0.0 || this.direction < 0 && (double) this.velocity.X > 0.0))
this.velocity.X *= 0.9f;
}
else if (this.type >= 269 && this.type <= 280)
{
float num36 = 1.5f;
if (this.type == 269)
num36 = 2f;
if (this.type == 270)
num36 = 1f;
if (this.type == 271)
num36 = 1.5f;
if (this.type == 272)
num36 = 3f;
if (this.type == 273)
num36 = 1.25f;
if (this.type == 274)
num36 = 3f;
if (this.type == 275)
num36 = 3.25f;
if (this.type == 276)
num36 = 2f;
if (this.type == 277)
num36 = 2.75f;
if (this.type == 278)
num36 = 1.8f;
if (this.type == 279)
num36 = 1.3f;
if (this.type == 280)
num36 = 2.5f;
float num37 = num36 * (float) (1.0 + (1.0 - (double) this.scale));
if ((double) this.velocity.X < -(double) num37 || (double) this.velocity.X > (double) num37)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num37 && this.direction == 1)
{
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num37)
this.velocity.X = num37;
}
else if ((double) this.velocity.X > -(double) num37 && this.direction == -1)
{
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num37)
this.velocity.X = -num37;
}
}
else if (this.type >= 305 && this.type <= 314)
{
float num38 = 1.5f;
if (this.type == 305 || this.type == 310)
num38 = 2f;
if (this.type == 306 || this.type == 311)
num38 = 1.25f;
if (this.type == 307 || this.type == 312)
num38 = 2.25f;
if (this.type == 308 || this.type == 313)
num38 = 1.5f;
if (this.type == 309 || this.type == 314)
num38 = 1f;
if (this.type < 310)
{
if ((double) this.velocity.Y == 0.0)
{
this.velocity.X *= 0.85f;
if ((double) this.velocity.X > -0.3 && (double) this.velocity.X < 0.3)
{
this.velocity.Y = -7f;
this.velocity.X = num38 * (float) this.direction;
}
}
else if (this.spriteDirection == this.direction)
this.velocity.X = (float) (((double) this.velocity.X * 10.0 + (double) num38 * (double) this.direction) / 11.0);
}
else if ((double) this.velocity.X < -(double) num38 || (double) this.velocity.X > (double) num38)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num38 && this.direction == 1)
{
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num38)
this.velocity.X = num38;
}
else if ((double) this.velocity.X > -(double) num38 && this.direction == -1)
{
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num38)
this.velocity.X = -num38;
}
}
else if (this.type == 67 || this.type == 220 || this.type == 428)
{
if ((double) this.velocity.X < -0.5 || (double) this.velocity.X > 0.5)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.7f;
}
else if ((double) this.velocity.X < 0.5 && this.direction == 1)
{
this.velocity.X += 0.03f;
if ((double) this.velocity.X > 0.5)
this.velocity.X = 0.5f;
}
else if ((double) this.velocity.X > -0.5 && this.direction == -1)
{
this.velocity.X -= 0.03f;
if ((double) this.velocity.X < -0.5)
this.velocity.X = -0.5f;
}
}
else if (this.type == 78 || this.type == 79 || this.type == 80)
{
float num39 = 1f;
float num40 = 0.05f;
if (this.life < this.lifeMax / 2)
{
num39 = 2f;
num40 = 0.1f;
}
if (this.type == 79)
num39 *= 1.5f;
if ((double) this.velocity.X < -(double) num39 || (double) this.velocity.X > (double) num39)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.7f;
}
else if ((double) this.velocity.X < (double) num39 && this.direction == 1)
{
this.velocity.X += num40;
if ((double) this.velocity.X > (double) num39)
this.velocity.X = num39;
}
else if ((double) this.velocity.X > -(double) num39 && this.direction == -1)
{
this.velocity.X -= num40;
if ((double) this.velocity.X < -(double) num39)
this.velocity.X = -num39;
}
}
else if (this.type == 287)
{
float num41 = 5f;
float num42 = 0.2f;
if ((double) this.velocity.X < -(double) num41 || (double) this.velocity.X > (double) num41)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.7f;
}
else if ((double) this.velocity.X < (double) num41 && this.direction == 1)
{
this.velocity.X += num42;
if ((double) this.velocity.X > (double) num41)
this.velocity.X = num41;
}
else if ((double) this.velocity.X > -(double) num41 && this.direction == -1)
{
this.velocity.X -= num42;
if ((double) this.velocity.X < -(double) num41)
this.velocity.X = -num41;
}
}
else if (this.type == 243)
{
float num43 = 1f;
float num44 = 0.07f;
float num45 = num43 + (float) ((1.0 - (double) this.life / (double) this.lifeMax) * 1.5);
float num46 = num44 + (float) ((1.0 - (double) this.life / (double) this.lifeMax) * 0.150000005960464);
if ((double) this.velocity.X < -(double) num45 || (double) this.velocity.X > (double) num45)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.7f;
}
else if ((double) this.velocity.X < (double) num45 && this.direction == 1)
{
this.velocity.X += num46;
if ((double) this.velocity.X > (double) num45)
this.velocity.X = num45;
}
else if ((double) this.velocity.X > -(double) num45 && this.direction == -1)
{
this.velocity.X -= num46;
if ((double) this.velocity.X < -(double) num45)
this.velocity.X = -num45;
}
}
else if (this.type == 251)
{
float num47 = 1f;
float num48 = 0.08f;
float num49 = num47 + (float) ((1.0 - (double) this.life / (double) this.lifeMax) * 2.0);
float num50 = num48 + (float) ((1.0 - (double) this.life / (double) this.lifeMax) * 0.200000002980232);
if ((double) this.velocity.X < -(double) num49 || (double) this.velocity.X > (double) num49)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.7f;
}
else if ((double) this.velocity.X < (double) num49 && this.direction == 1)
{
this.velocity.X += num50;
if ((double) this.velocity.X > (double) num49)
this.velocity.X = num49;
}
else if ((double) this.velocity.X > -(double) num49 && this.direction == -1)
{
this.velocity.X -= num50;
if ((double) this.velocity.X < -(double) num49)
this.velocity.X = -num49;
}
}
else if (this.type == 386)
{
if ((double) this.ai[2] > 0.0)
{
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.8f;
}
else
{
float num51 = 0.15f;
float num52 = 1.5f;
if ((double) this.velocity.X < -(double) num52 || (double) this.velocity.X > (double) num52)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.7f;
}
else if ((double) this.velocity.X < (double) num52 && this.direction == 1)
{
this.velocity.X += num51;
if ((double) this.velocity.X > (double) num52)
this.velocity.X = num52;
}
else if ((double) this.velocity.X > -(double) num52 && this.direction == -1)
{
this.velocity.X -= num51;
if ((double) this.velocity.X < -(double) num52)
this.velocity.X = -num52;
}
}
}
else if (this.type == 460)
{
float num53 = 3f;
float num54 = 0.1f;
if ((double) Math.Abs(this.velocity.X) > 2.0)
num54 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 2.5)
num54 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 3.0)
num54 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 3.5)
num54 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 4.0)
num54 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 4.5)
num54 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 5.0)
num54 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 5.5)
num54 *= 0.8f;
float num55 = num53 + (float) ((1.0 - (double) this.life / (double) this.lifeMax) * 3.0);
if ((double) this.velocity.X < -(double) num55 || (double) this.velocity.X > (double) num55)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.7f;
}
else if ((double) this.velocity.X < (double) num55 && this.direction == 1)
{
if ((double) this.velocity.X < 0.0)
this.velocity.X *= 0.93f;
this.velocity.X += num54;
if ((double) this.velocity.X > (double) num55)
this.velocity.X = num55;
}
else if ((double) this.velocity.X > -(double) num55 && this.direction == -1)
{
if ((double) this.velocity.X > 0.0)
this.velocity.X *= 0.93f;
this.velocity.X -= num54;
if ((double) this.velocity.X < -(double) num55)
this.velocity.X = -num55;
}
}
else if (this.type == 508)
{
float num56 = 2.5f;
float num57 = 40f;
float num58 = Math.Abs(this.velocity.X);
if ((double) num58 > 2.75)
{
num56 = 3.5f;
num57 += 80f;
}
else if ((double) num58 > 2.25)
{
num56 = 3f;
num57 += 60f;
}
if ((double) Math.Abs(this.velocity.Y) < 0.5)
{
if ((double) this.velocity.X > 0.0 && this.direction < 0)
this.velocity = this.velocity * 0.9f;
if ((double) this.velocity.X < 0.0 && this.direction > 0)
this.velocity = this.velocity * 0.9f;
}
if ((double) Math.Abs(this.velocity.Y) > (double) NPC.gravity)
num57 *= 3f;
if ((double) this.velocity.X <= 0.0 && this.direction < 0)
this.velocity.X = (float) (((double) this.velocity.X * (double) num57 - (double) num56) / ((double) num57 + 1.0));
else if ((double) this.velocity.X >= 0.0 && this.direction > 0)
this.velocity.X = (float) (((double) this.velocity.X * (double) num57 + (double) num56) / ((double) num57 + 1.0));
else if ((double) Math.Abs(this.Center.X - Main.player[this.target].Center.X) > 20.0 && (double) Math.Abs(this.velocity.Y) <= (double) NPC.gravity)
{
this.velocity.X *= 0.99f;
this.velocity.X += (float) this.direction * 0.025f;
}
}
else if (this.type == 391 || this.type == 427 || this.type == 415 || this.type == 419 || this.type == 518 || this.type == 532)
{
float num59 = 5f;
float num60 = 0.25f;
float num61 = 0.7f;
if (this.type == 427)
{
num59 = 6f;
num60 = 0.2f;
num61 = 0.8f;
}
else if (this.type == 415)
{
num59 = 4f;
num60 = 0.1f;
num61 = 0.95f;
}
else if (this.type == 419)
{
num59 = 6f;
num60 = 0.15f;
num61 = 0.85f;
}
else if (this.type == 518)
{
num59 = 5f;
num60 = 0.1f;
num61 = 0.95f;
}
else if (this.type == 532)
{
num59 = 5f;
num60 = 0.15f;
num61 = 0.98f;
}
if ((double) this.velocity.X < -(double) num59 || (double) this.velocity.X > (double) num59)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * num61;
}
else if ((double) this.velocity.X < (double) num59 && this.direction == 1)
{
this.velocity.X += num60;
if ((double) this.velocity.X > (double) num59)
this.velocity.X = num59;
}
else if ((double) this.velocity.X > -(double) num59 && this.direction == -1)
{
this.velocity.X -= num60;
if ((double) this.velocity.X < -(double) num59)
this.velocity.X = -num59;
}
}
else if (this.type >= 430 && this.type <= 436 || this.type == 494 || this.type == 495)
{
if ((double) this.ai[2] == 0.0)
{
this.damage = this.defDamage;
float num62 = 1f * (float) (1.0 + (1.0 - (double) this.scale));
if ((double) this.velocity.X < -(double) num62 || (double) this.velocity.X > (double) num62)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num62 && this.direction == 1)
{
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num62)
this.velocity.X = num62;
}
else if ((double) this.velocity.X > -(double) num62 && this.direction == -1)
{
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num62)
this.velocity.X = -num62;
}
if ((double) this.velocity.Y == 0.0 && (!Main.dayTime || (double) this.position.Y > Main.worldSurface * 16.0) && !Main.player[this.target].dead)
{
Vector2 vector2 = this.Center - Main.player[this.target].Center;
int num63 = 50;
if (this.type >= 494 && this.type <= 495)
num63 = 42;
if ((double) vector2.Length() < (double) num63 && Collision.CanHit(this.Center, 1, 1, Main.player[this.target].Center, 1, 1))
{
this.velocity.X *= 0.7f;
this.ai[2] = 1f;
}
}
}
else
{
this.damage = (int) ((double) this.defDamage * 1.5);
this.ai[3] = 1f;
this.velocity.X *= 0.9f;
if ((double) Math.Abs(this.velocity.X) < 0.1)
this.velocity.X = 0.0f;
++this.ai[2];
if ((double) this.ai[2] >= 20.0 || (double) this.velocity.Y != 0.0 || Main.dayTime && (double) this.position.Y < Main.worldSurface * 16.0)
this.ai[2] = 0.0f;
}
}
else if (this.type != 110 && this.type != 111 && this.type != 206 && this.type != 214 && this.type != 215 && this.type != 216 && this.type != 290 && this.type != 291 && this.type != 292 && this.type != 293 && this.type != 350 && this.type != 379 && this.type != 380 && this.type != 381 && this.type != 382 && (this.type < 449 || this.type > 452) && this.type != 468 && this.type != 481 && this.type != 411 && this.type != 409 && (this.type < 498 || this.type > 506) && this.type != 424 && this.type != 426 && this.type != 520)
{
float num64 = 1f;
if (this.type == 186)
num64 = 1.1f;
if (this.type == 187)
num64 = 0.9f;
if (this.type == 188)
num64 = 1.2f;
if (this.type == 189)
num64 = 0.8f;
if (this.type == 132)
num64 = 0.95f;
if (this.type == 200)
num64 = 0.87f;
if (this.type == 223)
num64 = 1.05f;
if (this.type == 489)
{
float num65 = (Main.player[this.target].Center - this.Center).Length() * (1f / 400f);
if ((double) num65 > 1.5)
num65 = 1.5f;
num64 = (!Main.expertMode ? 2.5f - num65 : 3f - num65) * 0.8f;
}
if (this.type == 489 || this.type == 3 || this.type == 132 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223 || this.type == 331 || this.type == 332)
num64 *= (float) (1.0 + (1.0 - (double) this.scale));
if ((double) this.velocity.X < -(double) num64 || (double) this.velocity.X > (double) num64)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num64 && this.direction == 1)
{
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num64)
this.velocity.X = num64;
}
else if ((double) this.velocity.X > -(double) num64 && this.direction == -1)
{
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num64)
this.velocity.X = -num64;
}
}
if (this.type >= 277 && this.type <= 280)
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.2f, 0.1f, 0.0f);
else if (this.type == 520)
Lighting.AddLight(this.Top + new Vector2(0.0f, 20f), 0.3f, 0.3f, 0.7f);
else if (this.type == 525)
Lighting.AddLight(this.Top + new Vector2(0.0f, 15f), new Vector3(0.7f, 1f, 0.2f) * 0.5f);
else if (this.type == 526)
Lighting.AddLight(this.Top + new Vector2(0.0f, 15f), new Vector3(1f, 1f, 0.5f) * 0.4f);
else if (this.type == 527)
Lighting.AddLight(this.Top + new Vector2(0.0f, 15f), new Vector3(0.6f, 0.3f, 1f) * 0.4f);
else if (this.type == 415)
{
this.hide = false;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 416 && (double) Main.npc[index].ai[0] == (double) this.whoAmI)
{
this.hide = true;
break;
}
}
}
else if (this.type == 258)
{
if ((double) this.velocity.Y != 0.0)
{
this.TargetClosest();
this.spriteDirection = this.direction;
if ((double) Main.player[this.target].Center.X < (double) this.position.X && (double) this.velocity.X > 0.0)
this.velocity.X *= 0.95f;
else if ((double) Main.player[this.target].Center.X > (double) this.position.X + (double) this.width && (double) this.velocity.X < 0.0)
this.velocity.X *= 0.95f;
if ((double) Main.player[this.target].Center.X < (double) this.position.X && (double) this.velocity.X > -5.0)
this.velocity.X -= 0.1f;
else if ((double) Main.player[this.target].Center.X > (double) this.position.X + (double) this.width && (double) this.velocity.X < 5.0)
this.velocity.X += 0.1f;
}
else if ((double) Main.player[this.target].Center.Y + 50.0 < (double) this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
this.velocity.Y = -7f;
}
else if (this.type == 425)
{
if ((double) this.velocity.Y == 0.0)
this.ai[2] = 0.0f;
if ((double) this.velocity.Y != 0.0 && (double) this.ai[2] == 1.0)
{
this.TargetClosest();
this.spriteDirection = -this.direction;
if (Collision.CanHit(this.Center, 0, 0, Main.player[this.target].Center, 0, 0))
{
float num66 = Main.player[this.target].Center.X - (float) (this.direction * 400) - this.Center.X;
float num67 = Main.player[this.target].Bottom.Y - this.Bottom.Y;
if ((double) num66 < 0.0 && (double) this.velocity.X > 0.0)
this.velocity.X *= 0.9f;
else if ((double) num66 > 0.0 && (double) this.velocity.X < 0.0)
this.velocity.X *= 0.9f;
if ((double) num66 < 0.0 && (double) this.velocity.X > -5.0)
this.velocity.X -= 0.1f;
else if ((double) num66 > 0.0 && (double) this.velocity.X < 5.0)
this.velocity.X += 0.1f;
if ((double) this.velocity.X > 6.0)
this.velocity.X = 6f;
if ((double) this.velocity.X < -6.0)
this.velocity.X = -6f;
if ((double) num67 < -20.0 && (double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.8f;
else if ((double) num67 > 20.0 && (double) this.velocity.Y < 0.0)
this.velocity.Y *= 0.8f;
if ((double) num67 < -20.0 && (double) this.velocity.Y > -5.0)
this.velocity.Y -= 0.3f;
else if ((double) num67 > 20.0 && (double) this.velocity.Y < 5.0)
this.velocity.Y += 0.3f;
}
if (Main.rand.Next(3) == 0)
{
Vector2 Position = this.Center + new Vector2((float) (this.direction * -14), -8f) - Vector2.One * 4f;
Vector2 vector2 = new Vector2((float) (this.direction * -6), 12f) * 0.2f + Utils.RandomVector2(Main.rand, -1f, 1f) * 0.1f;
Dust dust = Main.dust[Dust.NewDust(Position, 8, 8, 229, vector2.X, vector2.Y, 100, Color.Transparent, (float) (1.0 + (double) Main.rand.NextFloat() * 0.5))];
dust.noGravity = true;
dust.velocity = vector2;
dust.customData = (object) this;
}
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && Main.npc[index].type == this.type && (double) Math.Abs(this.position.X - Main.npc[index].position.X) + (double) Math.Abs(this.position.Y - Main.npc[index].position.Y) < (double) this.width)
{
if ((double) this.position.X < (double) Main.npc[index].position.X)
this.velocity.X -= 0.05f;
else
this.velocity.X += 0.05f;
if ((double) this.position.Y < (double) Main.npc[index].position.Y)
this.velocity.Y -= 0.05f;
else
this.velocity.Y += 0.05f;
}
}
}
else if ((double) Main.player[this.target].Center.Y + 100.0 < (double) this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.velocity.Y = -5f;
this.ai[2] = 1f;
}
if (Main.netMode != 1)
{
++this.localAI[2];
if ((double) this.localAI[2] >= (double) (360 + Main.rand.Next(360)) && (double) this.Distance(Main.player[this.target].Center) < 400.0 && (double) Math.Abs(this.DirectionTo(Main.player[this.target].Center).Y) < 0.5 && Collision.CanHitLine(this.Center, 0, 0, Main.player[this.target].Center, 0, 0))
{
this.localAI[2] = 0.0f;
Vector2 vector2_13 = this.Center + new Vector2((float) (this.direction * 30), 2f);
Vector2 vec = this.DirectionTo(Main.player[this.target].Center) * 7f;
if (vec.HasNaNs())
vec = new Vector2((float) (this.direction * 8), 0.0f);
int Damage = Main.expertMode ? 50 : 75;
for (int index = 0; index < 4; ++index)
{
Vector2 vector2_14 = vec + Utils.RandomVector2(Main.rand, -0.8f, 0.8f);
Projectile.NewProjectile(vector2_13.X, vector2_13.Y, vector2_14.X, vector2_14.Y, 577, Damage, 1f, Main.myPlayer);
}
}
}
}
else if (this.type == 427)
{
if ((double) this.velocity.Y == 0.0)
{
this.ai[2] = 0.0f;
this.rotation = 0.0f;
}
else
this.rotation = this.velocity.X * 0.1f;
if ((double) this.velocity.Y != 0.0 && (double) this.ai[2] == 1.0)
{
this.TargetClosest();
this.spriteDirection = -this.direction;
if (Collision.CanHit(this.Center, 0, 0, Main.player[this.target].Center, 0, 0))
{
float num68 = Main.player[this.target].Center.X - this.Center.X;
float num69 = Main.player[this.target].Center.Y - this.Center.Y;
if ((double) num68 < 0.0 && (double) this.velocity.X > 0.0)
this.velocity.X *= 0.98f;
else if ((double) num68 > 0.0 && (double) this.velocity.X < 0.0)
this.velocity.X *= 0.98f;
if ((double) num68 < -20.0 && (double) this.velocity.X > -6.0)
this.velocity.X -= 0.015f;
else if ((double) num68 > 20.0 && (double) this.velocity.X < 6.0)
this.velocity.X += 0.015f;
if ((double) this.velocity.X > 6.0)
this.velocity.X = 6f;
if ((double) this.velocity.X < -6.0)
this.velocity.X = -6f;
if ((double) num69 < -20.0 && (double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.98f;
else if ((double) num69 > 20.0 && (double) this.velocity.Y < 0.0)
this.velocity.Y *= 0.98f;
if ((double) num69 < -20.0 && (double) this.velocity.Y > -6.0)
this.velocity.Y -= 0.15f;
else if ((double) num69 > 20.0 && (double) this.velocity.Y < 6.0)
this.velocity.Y += 0.15f;
}
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && Main.npc[index].type == this.type && (double) Math.Abs(this.position.X - Main.npc[index].position.X) + (double) Math.Abs(this.position.Y - Main.npc[index].position.Y) < (double) this.width)
{
if ((double) this.position.X < (double) Main.npc[index].position.X)
this.velocity.X -= 0.05f;
else
this.velocity.X += 0.05f;
if ((double) this.position.Y < (double) Main.npc[index].position.Y)
this.velocity.Y -= 0.05f;
else
this.velocity.Y += 0.05f;
}
}
}
else if ((double) Main.player[this.target].Center.Y + 100.0 < (double) this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.velocity.Y = -5f;
this.ai[2] = 1f;
}
}
else if (this.type == 426)
{
if ((double) this.ai[1] > 0.0 && (double) this.velocity.Y > 0.0)
{
this.velocity.Y *= 0.85f;
if ((double) this.velocity.Y == 0.0)
this.velocity.Y = -0.4f;
}
if ((double) this.velocity.Y != 0.0)
{
this.TargetClosest();
this.spriteDirection = this.direction;
if (Collision.CanHit(this.Center, 0, 0, Main.player[this.target].Center, 0, 0))
{
float num70 = Main.player[this.target].Center.X - (float) (this.direction * 300) - this.Center.X;
if ((double) num70 < 40.0 && (double) this.velocity.X > 0.0)
this.velocity.X *= 0.98f;
else if ((double) num70 > 40.0 && (double) this.velocity.X < 0.0)
this.velocity.X *= 0.98f;
if ((double) num70 < 40.0 && (double) this.velocity.X > -5.0)
this.velocity.X -= 0.2f;
else if ((double) num70 > 40.0 && (double) this.velocity.X < 5.0)
this.velocity.X += 0.2f;
if ((double) this.velocity.X > 6.0)
this.velocity.X = 6f;
if ((double) this.velocity.X < -6.0)
this.velocity.X = -6f;
}
}
else if ((double) Main.player[this.target].Center.Y + 100.0 < (double) this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
this.velocity.Y = -6f;
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && Main.npc[index].type == this.type && (double) Math.Abs(this.position.X - Main.npc[index].position.X) + (double) Math.Abs(this.position.Y - Main.npc[index].position.Y) < (double) this.width)
{
if ((double) this.position.X < (double) Main.npc[index].position.X)
this.velocity.X -= 0.1f;
else
this.velocity.X += 0.1f;
if ((double) this.position.Y < (double) Main.npc[index].position.Y)
this.velocity.Y -= 0.1f;
else
this.velocity.Y += 0.1f;
}
}
if (Main.rand.Next(6) == 0 && (double) this.ai[1] <= 20.0)
{
Dust dust = Main.dust[Dust.NewDust(this.Center + new Vector2(this.spriteDirection == 1 ? 8f : -20f, -20f), 8, 8, 229, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = dust.velocity / 4f + this.velocity / 2f;
dust.scale = 0.6f;
dust.noLight = true;
}
if ((double) this.ai[1] >= 57.0)
{
int Type = Utils.SelectRandom<int>(Main.rand, 161, 229);
Dust dust = Main.dust[Dust.NewDust(this.Center + new Vector2(this.spriteDirection == 1 ? 8f : -20f, -20f), 8, 8, Type, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = dust.velocity / 4f + this.DirectionTo(Main.player[this.target].Top);
dust.scale = 1.2f;
dust.noLight = true;
}
if (Main.rand.Next(6) == 0)
{
Dust dust = Main.dust[Dust.NewDust(this.Center, 2, 2, 229)];
dust.position = this.Center + new Vector2(this.spriteDirection == 1 ? 26f : -26f, 24f);
dust.velocity.X = 0.0f;
if ((double) dust.velocity.Y < 0.0)
dust.velocity.Y = 0.0f;
dust.noGravity = true;
dust.scale = 1f;
dust.noLight = true;
}
}
else if (this.type == 185)
{
if ((double) this.velocity.Y == 0.0)
{
this.rotation = 0.0f;
this.localAI[0] = 0.0f;
}
else if ((double) this.localAI[0] == 1.0)
this.rotation += this.velocity.X * 0.05f;
}
else if (this.type == 428)
{
if ((double) this.velocity.Y == 0.0)
this.rotation = 0.0f;
else
this.rotation += this.velocity.X * 0.08f;
}
if (this.type == 159 && Main.netMode != 1)
{
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
double num71 = (double) Main.player[this.target].position.X + (double) Main.player[this.target].width * 0.5 - (double) vector2.X;
float num72 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y;
if (Math.Sqrt(num71 * num71 + (double) num72 * (double) num72) > 300.0)
this.Transform(158);
}
if (this.type == 164 && Main.netMode != 1 && (double) this.velocity.Y == 0.0)
{
int num73 = (int) this.Center.X / 16;
int num74 = (int) this.Center.Y / 16;
bool flag7 = false;
for (int index15 = num73 - 1; index15 <= num73 + 1; ++index15)
{
for (int index16 = num74 - 1; index16 <= num74 + 1; ++index16)
{
if (Main.tile[index15, index16].wall > (byte) 0)
flag7 = true;
}
}
if (flag7)
this.Transform(165);
}
if (this.type == 239 && Main.netMode != 1 && (double) this.velocity.Y == 0.0)
{
int num75 = (int) this.Center.X / 16;
int num76 = (int) this.Center.Y / 16;
bool flag8 = false;
for (int index17 = num75 - 1; index17 <= num75 + 1; ++index17)
{
for (int index18 = num76 - 1; index18 <= num76 + 1; ++index18)
{
if (Main.tile[index17, index18].wall > (byte) 0)
flag8 = true;
}
}
if (flag8)
this.Transform(240);
}
if (this.type == 530 && Main.netMode != 1 && (double) this.velocity.Y == 0.0)
{
int num77 = (int) this.Center.X / 16;
int num78 = (int) this.Center.Y / 16;
bool flag9 = false;
for (int index19 = num77 - 1; index19 <= num77 + 1; ++index19)
{
for (int index20 = num78 - 1; index20 <= num78 + 1; ++index20)
{
if (Main.tile[index19, index20].wall > (byte) 0)
flag9 = true;
}
}
if (flag9)
this.Transform(531);
}
if (Main.netMode != 1 && Main.expertMode && this.target >= 0 && (this.type == 163 || this.type == 238) && Collision.CanHit(this.Center, 1, 1, Main.player[this.target].Center, 1, 1))
{
++this.localAI[0];
if (this.justHit)
{
this.localAI[0] -= (float) Main.rand.Next(20, 60);
if ((double) this.localAI[0] < 0.0)
this.localAI[0] = 0.0f;
}
if ((double) this.localAI[0] > (double) Main.rand.Next(180, 900))
{
this.localAI[0] = 0.0f;
Vector2 vector2 = Main.player[this.target].Center - this.Center;
vector2.Normalize();
vector2 *= 8f;
Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2.X, vector2.Y, 472, 18, 0.0f, Main.myPlayer);
}
}
if (this.type == 163 && Main.netMode != 1 && (double) this.velocity.Y == 0.0)
{
int num79 = (int) this.Center.X / 16;
int num80 = (int) this.Center.Y / 16;
bool flag10 = false;
for (int index21 = num79 - 1; index21 <= num79 + 1; ++index21)
{
for (int index22 = num80 - 1; index22 <= num80 + 1; ++index22)
{
if (Main.tile[index21, index22].wall > (byte) 0)
flag10 = true;
}
}
if (flag10)
this.Transform(238);
}
if (this.type == 236 && Main.netMode != 1 && (double) this.velocity.Y == 0.0)
{
int num81 = (int) this.Center.X / 16;
int num82 = (int) this.Center.Y / 16;
bool flag11 = false;
for (int index23 = num81 - 1; index23 <= num81 + 1; ++index23)
{
for (int index24 = num82 - 1; index24 <= num82 + 1; ++index24)
{
if (Main.tile[index23, index24].wall > (byte) 0)
flag11 = true;
}
}
if (flag11)
this.Transform(237);
}
if (this.type == 243)
{
if (this.justHit && Main.rand.Next(3) == 0)
this.ai[2] -= (float) Main.rand.Next(30);
if ((double) this.ai[2] < 0.0)
this.ai[2] = 0.0f;
if (this.confused)
this.ai[2] = 0.0f;
++this.ai[2];
float num83 = (float) Main.rand.Next(30, 900) * ((float) this.life / (float) this.lifeMax) + 30f;
if (Main.netMode != 1 && (double) this.ai[2] >= (double) num83 && (double) this.velocity.Y == 0.0 && !Main.player[this.target].dead && !Main.player[this.target].frozen && (this.direction > 0 && (double) this.Center.X < (double) Main.player[this.target].Center.X || this.direction < 0 && (double) this.Center.X > (double) Main.player[this.target].Center.X) && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + 20f);
vector2.X += (float) (10 * this.direction);
float num84 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2.X;
float num85 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y;
float num86 = num84 + (float) Main.rand.Next(-40, 41);
float num87 = num85 + (float) Main.rand.Next(-40, 41);
float num88 = (float) Math.Sqrt((double) num86 * (double) num86 + (double) num87 * (double) num87);
this.netUpdate = true;
float num89 = (float) (15.0 / (double) num88);
float SpeedX = num86 * num89;
float SpeedY = num87 * num89;
int Damage = 32;
int Type = 257;
vector2.X += SpeedX * 3f;
vector2.Y += SpeedY * 3f;
Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, Damage, 0.0f, Main.myPlayer);
this.ai[2] = 0.0f;
}
}
if (this.type == 251)
{
if (this.justHit)
this.ai[2] -= (float) Main.rand.Next(30);
if ((double) this.ai[2] < 0.0)
this.ai[2] = 0.0f;
if (this.confused)
this.ai[2] = 0.0f;
++this.ai[2];
float num90 = (float) Main.rand.Next(60, 1800) * ((float) this.life / (float) this.lifeMax) + 15f;
if (Main.netMode != 1 && (double) this.ai[2] >= (double) num90 && (double) this.velocity.Y == 0.0 && !Main.player[this.target].dead && !Main.player[this.target].frozen && (this.direction > 0 && (double) this.Center.X < (double) Main.player[this.target].Center.X || this.direction < 0 && (double) this.Center.X > (double) Main.player[this.target].Center.X) && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + 12f);
vector2.X += (float) (6 * this.direction);
float num91 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2.X;
float num92 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y;
float num93 = num91 + (float) Main.rand.Next(-40, 41);
float num94 = num92 + (float) Main.rand.Next(-30, 0);
float num95 = (float) Math.Sqrt((double) num93 * (double) num93 + (double) num94 * (double) num94);
this.netUpdate = true;
float num96 = (float) (15.0 / (double) num95);
float SpeedX = num93 * num96;
float SpeedY = num94 * num96;
int Damage = 30;
int Type = 83;
vector2.X += SpeedX * 3f;
vector2.Y += SpeedY * 3f;
Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, Damage, 0.0f, Main.myPlayer);
this.ai[2] = 0.0f;
}
}
if (this.type == 386)
{
if (this.confused)
{
this.ai[2] = -60f;
}
else
{
if ((double) this.ai[2] < 60.0)
++this.ai[2];
if ((double) this.ai[2] > 0.0 && NPC.CountNPCS(387) >= 4 * NPC.CountNPCS(386))
this.ai[2] = 0.0f;
if (this.justHit)
this.ai[2] = -30f;
if ((double) this.ai[2] == 30.0)
{
int num97 = (int) this.position.X / 16;
int num98 = (int) this.position.Y / 16;
int num99 = (int) this.position.X / 16;
int num100 = (int) this.position.Y / 16;
int num101 = 5;
int num102 = 0;
bool flag12 = false;
int num103 = 2;
int num104 = 0;
while (!flag12 && num102 < 100)
{
++num102;
int index25 = Main.rand.Next(num97 - num101, num97 + num101);
for (int index26 = Main.rand.Next(num98 - num101, num98 + num101); index26 < num98 + num101; ++index26)
{
if ((index26 < num98 - num103 || index26 > num98 + num103 || index25 < num97 - num103 || index25 > num97 + num103) && (index26 < num100 - num104 || index26 > num100 + num104 || index25 < num99 - num104 || index25 > num99 + num104) && Main.tile[index25, index26].nactive())
{
bool flag13 = true;
if (Main.tile[index25, index26 - 1].lava())
flag13 = false;
if (flag13 && Main.tileSolid[(int) Main.tile[index25, index26].type] && !Collision.SolidTiles(index25 - 1, index25 + 1, index26 - 4, index26 - 1))
{
int index27 = NPC.NewNPC(index25 * 16 - this.width / 2, index26 * 16, 387);
Main.npc[index27].position.Y = (float) (index26 * 16 - Main.npc[index27].height);
flag12 = true;
this.netUpdate = true;
break;
}
}
}
}
}
if ((double) this.ai[2] == 60.0)
this.ai[2] = -120f;
}
}
if (this.type == 389)
{
if (this.confused)
{
this.ai[2] = -60f;
}
else
{
if ((double) this.ai[2] < 20.0)
++this.ai[2];
if (this.justHit)
this.ai[2] = -30f;
if ((double) this.ai[2] == 20.0 && Main.netMode != 1)
{
this.ai[2] = (float) (Main.rand.Next(3) * -10 - 10);
Projectile.NewProjectile(this.Center.X, this.Center.Y + 8f, (float) (this.direction * 6), 0.0f, 437, 25, 1f, Main.myPlayer);
}
}
}
if (this.type == 110 || this.type == 111 || this.type == 206 || this.type == 214 || this.type == 215 || this.type == 216 || this.type == 290 || this.type == 291 || this.type == 292 || this.type == 293 || this.type == 350 || this.type == 379 || this.type == 380 || this.type == 381 || this.type == 382 || this.type >= 449 && this.type <= 452 || this.type == 468 || this.type == 481 || this.type == 411 || this.type == 409 || this.type >= 498 && this.type <= 506 || this.type == 424 || this.type == 426 || this.type == 520)
{
bool flag14 = this.type == 381 || this.type == 382 || this.type == 520;
bool flag15 = this.type == 426;
bool flag16 = true;
int num105 = -1;
int num106 = -1;
if (this.type == 411)
{
flag14 = true;
num105 = 90;
num106 = 90;
if ((double) this.ai[1] <= 150.0)
flag16 = false;
}
if (this.confused)
{
this.ai[2] = 0.0f;
}
else
{
if ((double) this.ai[1] > 0.0)
--this.ai[1];
if (this.justHit)
{
this.ai[1] = 30f;
this.ai[2] = 0.0f;
}
int num107 = 70;
if (this.type == 379 || this.type == 380)
num107 = 80;
if (this.type == 381 || this.type == 382)
num107 = 80;
if (this.type == 520)
num107 = 15;
if (this.type == 350)
num107 = 110;
if (this.type == 291)
num107 = 200;
if (this.type == 292)
num107 = 120;
if (this.type == 293)
num107 = 90;
if (this.type == 111)
num107 = 180;
if (this.type == 206)
num107 = 50;
if (this.type == 481)
num107 = 100;
if (this.type == 214)
num107 = 40;
if (this.type == 215)
num107 = 80;
if (this.type == 290)
num107 = 30;
if (this.type == 411)
num107 = 300;
if (this.type == 409)
num107 = 60;
if (this.type == 424)
num107 = 180;
if (this.type == 426)
num107 = 60;
bool flag17 = false;
if (this.type == 216)
{
if ((double) this.localAI[2] >= 20.0)
flag17 = true;
num107 = !flag17 ? 8 : 60;
}
int num108 = num107 / 2;
if (this.type == 424)
num108 = num107 - 1;
if (this.type == 426)
num108 = num107 - 1;
if ((double) this.ai[2] > 0.0)
{
if (flag16)
this.TargetClosest();
if ((double) this.ai[1] == (double) num108)
{
if (this.type == 216)
++this.localAI[2];
float num109 = 11f;
if (this.type == 111)
num109 = 9f;
if (this.type == 206)
num109 = 7f;
if (this.type == 290)
num109 = 9f;
if (this.type == 293)
num109 = 4f;
if (this.type == 214)
num109 = 14f;
if (this.type == 215)
num109 = 16f;
if (this.type == 382)
num109 = 7f;
if (this.type == 520)
num109 = 8f;
if (this.type == 409)
num109 = 4f;
if (this.type >= 449 && this.type <= 452)
num109 = 7f;
if (this.type == 481)
num109 = 8f;
if (this.type == 468)
num109 = 7.5f;
if (this.type == 411)
num109 = 1f;
if (this.type >= 498 && this.type <= 506)
num109 = 7f;
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
if (this.type == 481)
vector2.Y -= 14f;
if (this.type == 206)
vector2.Y -= 10f;
if (this.type == 290)
vector2.Y -= 10f;
if (this.type == 381 || this.type == 382)
vector2.Y += 6f;
if (this.type == 520)
vector2.Y = this.position.Y + 20f;
if (this.type >= 498 && this.type <= 506)
vector2.Y -= 8f;
if (this.type == 426)
vector2 += new Vector2((float) (this.spriteDirection * 2), -12f);
float num110 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2.X;
float num111 = Math.Abs(num110) * 0.1f;
if (this.type == 291 || this.type == 292)
num111 = 0.0f;
if (this.type == 215)
num111 = Math.Abs(num110) * 0.08f;
if (this.type == 214 || this.type == 216 && !flag17)
num111 = 0.0f;
if (this.type == 381 || this.type == 382 || this.type == 520)
num111 = 0.0f;
if (this.type >= 449 && this.type <= 452)
num111 = (float) ((double) Math.Abs(num110) * (double) Main.rand.Next(10, 50) * 0.00999999977648258);
if (this.type == 468)
num111 = (float) ((double) Math.Abs(num110) * (double) Main.rand.Next(10, 50) * 0.00999999977648258);
if (this.type == 481)
num111 = (float) ((double) Math.Abs(num110) * (double) Main.rand.Next(-10, 11) * 0.00350000010803342);
if (this.type >= 498 && this.type <= 506)
num111 = (float) ((double) Math.Abs(num110) * (double) Main.rand.Next(1, 11) * (1.0 / 400.0));
float num112 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y - num111;
if (this.type == 291)
{
num110 += (float) Main.rand.Next(-40, 41) * 0.2f;
num112 += (float) Main.rand.Next(-40, 41) * 0.2f;
}
else if (this.type == 381 || this.type == 382 || this.type == 520)
{
float num113 = num110 + (float) Main.rand.Next(-100, 101) * 0.4f;
float num114 = num112 + (float) Main.rand.Next(-100, 101) * 0.4f;
num110 = num113 * ((float) Main.rand.Next(85, 116) * 0.01f);
num112 = num114 * ((float) Main.rand.Next(85, 116) * 0.01f);
if (this.type == 520)
{
float num115 = num110 + (float) Main.rand.Next(-100, 101) * 0.6f;
float num116 = num112 + (float) Main.rand.Next(-100, 101) * 0.6f;
num110 = num115 * ((float) Main.rand.Next(85, 116) * 0.015f);
num112 = num116 * ((float) Main.rand.Next(85, 116) * 0.015f);
}
}
else if (this.type == 481)
{
num110 += (float) Main.rand.Next(-40, 41) * 0.4f;
num112 += (float) Main.rand.Next(-40, 41) * 0.4f;
}
else if (this.type >= 498 && this.type <= 506)
{
num110 += (float) Main.rand.Next(-40, 41) * 0.3f;
num112 += (float) Main.rand.Next(-40, 41) * 0.3f;
}
else if (this.type != 292)
{
num110 += (float) Main.rand.Next(-40, 41);
num112 += (float) Main.rand.Next(-40, 41);
}
float num117 = (float) Math.Sqrt((double) num110 * (double) num110 + (double) num112 * (double) num112);
this.netUpdate = true;
float num118 = num109 / num117;
float num119 = num110 * num118;
float SpeedY = num112 * num118;
int Damage = 35;
int Type = 82;
if (this.type == 111)
Damage = 11;
if (this.type == 206)
Damage = 37;
if (this.type == 379 || this.type == 380)
Damage = 40;
if (this.type == 350)
Damage = 45;
if (this.type == 468)
Damage = 50;
if (this.type == 111)
Type = 81;
if (this.type == 379 || this.type == 380)
Type = 81;
if (this.type == 381)
{
Type = 436;
Damage = 24;
}
if (this.type == 382)
{
Type = 438;
Damage = 30;
}
if (this.type == 520)
{
Type = 592;
Damage = 35;
}
if (this.type >= 449 && this.type <= 452)
{
Type = 471;
Damage = 20;
}
if (this.type >= 498 && this.type <= 506)
{
Type = 572;
Damage = 14;
}
if (this.type == 481)
{
Type = 508;
Damage = 18;
}
if (this.type == 206)
Type = 177;
if (this.type == 468)
Type = 501;
if (this.type == 411)
{
Type = 537;
Damage = Main.expertMode ? 45 : 60;
}
if (this.type == 424)
{
Type = 573;
Damage = Main.expertMode ? 45 : 60;
}
if (this.type == 426)
{
Type = 581;
Damage = Main.expertMode ? 45 : 60;
}
if (this.type == 291)
{
Type = 302;
Damage = 100;
}
if (this.type == 290)
{
Type = 300;
Damage = 60;
}
if (this.type == 293)
{
Type = 303;
Damage = 60;
}
if (this.type == 214)
{
Type = 180;
Damage = 25;
}
if (this.type == 215)
{
Type = 82;
Damage = 40;
}
if (this.type == 292)
{
Damage = 50;
Type = 180;
}
if (this.type == 216)
{
Type = 180;
Damage = 30;
if (flag17)
{
Damage = 100;
Type = 240;
this.localAI[2] = 0.0f;
}
}
vector2.X += num119;
vector2.Y += SpeedY;
if (Main.expertMode && this.type == 290)
Damage = (int) ((double) Damage * 0.75);
if (Main.expertMode && this.type >= 381 && this.type <= 392)
Damage = (int) ((double) Damage * 0.8);
if (Main.netMode != 1)
{
if (this.type == 292)
{
for (int index = 0; index < 4; ++index)
{
float num120 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2.X;
float num121 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y;
float num122 = 12f / (float) Math.Sqrt((double) num120 * (double) num120 + (double) num121 * (double) num121);
float num123;
float num124 = num123 = num120 + (float) Main.rand.Next(-40, 41);
float num125;
float num126 = num125 = num121 + (float) Main.rand.Next(-40, 41);
num119 = num124 * num122;
SpeedY = num126 * num122;
Projectile.NewProjectile(vector2.X, vector2.Y, num119, SpeedY, Type, Damage, 0.0f, Main.myPlayer);
}
}
else if (this.type == 411)
Projectile.NewProjectile(vector2.X, vector2.Y, num119, SpeedY, Type, Damage, 0.0f, Main.myPlayer, ai1: ((float) this.whoAmI));
else if (this.type == 424)
{
for (int index = 0; index < 4; ++index)
Projectile.NewProjectile(this.Center.X - (float) (this.spriteDirection * 4), this.Center.Y + 6f, (float) (2 * index - 3) * 0.15f, (float) ((double) -Main.rand.Next(0, 3) * 0.200000002980232 - 0.100000001490116), Type, Damage, 0.0f, Main.myPlayer, ai1: ((float) this.whoAmI));
}
else if (this.type == 409)
{
int index = NPC.NewNPC((int) this.Center.X, (int) this.Center.Y, 410, this.whoAmI);
Main.npc[index].velocity = new Vector2(num119, SpeedY - 6f);
}
else
Projectile.NewProjectile(vector2.X, vector2.Y, num119, SpeedY, Type, Damage, 0.0f, Main.myPlayer);
}
this.ai[2] = (double) Math.Abs(SpeedY) <= (double) Math.Abs(num119) * 2.0 ? ((double) Math.Abs(num119) <= (double) Math.Abs(SpeedY) * 2.0 ? ((double) SpeedY <= 0.0 ? 4f : 2f) : 3f) : ((double) SpeedY <= 0.0 ? 5f : 1f);
}
if ((double) this.velocity.Y != 0.0 && !flag15 || (double) this.ai[1] <= 0.0)
{
this.ai[2] = 0.0f;
this.ai[1] = 0.0f;
}
else if (!flag14 || num105 != -1 && (double) this.ai[1] >= (double) num105 && (double) this.ai[1] < (double) (num105 + num106) && (!flag15 || (double) this.velocity.Y == 0.0))
{
this.velocity.X *= 0.9f;
this.spriteDirection = this.direction;
}
}
if (this.type == 468 && !Main.eclipse)
flag14 = true;
else if ((double) this.ai[2] <= 0.0 | flag14 && (double) this.velocity.Y == 0.0 | flag15 && (double) this.ai[1] <= 0.0 && !Main.player[this.target].dead)
{
bool flag18 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height);
if (this.type == 520)
flag18 = Collision.CanHitLine(this.Top + new Vector2(0.0f, 20f), 0, 0, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height);
if ((double) Main.player[this.target].stealth == 0.0 && Main.player[this.target].itemAnimation == 0)
flag18 = false;
if (flag18)
{
float num127 = 10f;
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num128 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2.X;
float num129 = Math.Abs(num128) * 0.1f;
float num130 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y - num129;
float num131 = num128 + (float) Main.rand.Next(-40, 41);
float num132 = num130 + (float) Main.rand.Next(-40, 41);
float num133 = (float) Math.Sqrt((double) num131 * (double) num131 + (double) num132 * (double) num132);
float num134 = 700f;
if (this.type == 214)
num134 = 550f;
if (this.type == 215)
num134 = 800f;
if (this.type >= 498 && this.type <= 506)
num134 = 190f;
if (this.type >= 449 && this.type <= 452)
num134 = 200f;
if (this.type == 481)
num134 = 400f;
if (this.type == 468)
num134 = 400f;
if ((double) num133 < (double) num134)
{
this.netUpdate = true;
this.velocity.X *= 0.5f;
float num135 = num127 / num133;
float num136 = num131 * num135;
float num137 = num132 * num135;
this.ai[2] = 3f;
this.ai[1] = (float) num107;
this.ai[2] = (double) Math.Abs(num137) <= (double) Math.Abs(num136) * 2.0 ? ((double) Math.Abs(num136) <= (double) Math.Abs(num137) * 2.0 ? ((double) num137 <= 0.0 ? 4f : 2f) : 3f) : ((double) num137 <= 0.0 ? 5f : 1f);
}
}
}
if ((double) this.ai[2] <= 0.0 || flag14 && (num105 == -1 || (double) this.ai[1] < (double) num105 || (double) this.ai[1] >= (double) (num105 + num106)))
{
float num138 = 1f;
float num139 = 0.07f;
float num140 = 0.8f;
if (this.type == 214)
{
num138 = 2f;
num139 = 0.09f;
}
else if (this.type == 215)
{
num138 = 1.5f;
num139 = 0.08f;
}
else if (this.type == 381 || this.type == 382)
{
num138 = 2f;
num139 = 0.5f;
}
else if (this.type == 520)
{
num138 = 4f;
num139 = 1f;
num140 = 0.7f;
}
else if (this.type == 411)
{
num138 = 2f;
num139 = 0.5f;
}
else if (this.type == 409)
{
num138 = 2f;
num139 = 0.5f;
}
bool flag19 = false;
if ((this.type == 381 || this.type == 382) && (double) Vector2.Distance(this.Center, Main.player[this.target].Center) < 300.0 && Collision.CanHitLine(this.Center, 0, 0, Main.player[this.target].Center, 0, 0))
{
flag19 = true;
this.ai[3] = 0.0f;
}
if (this.type == 520 && (double) Vector2.Distance(this.Center, Main.player[this.target].Center) < 400.0 && Collision.CanHitLine(this.Center, 0, 0, Main.player[this.target].Center, 0, 0))
{
flag19 = true;
this.ai[3] = 0.0f;
}
if ((((double) this.velocity.X < -(double) num138 ? 1 : ((double) this.velocity.X > (double) num138 ? 1 : 0)) | (flag19 ? 1 : 0)) != 0)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * num140;
}
else if ((double) this.velocity.X < (double) num138 && this.direction == 1)
{
this.velocity.X += num139;
if ((double) this.velocity.X > (double) num138)
this.velocity.X = num138;
}
else if ((double) this.velocity.X > -(double) num138 && this.direction == -1)
{
this.velocity.X -= num139;
if ((double) this.velocity.X < -(double) num138)
this.velocity.X = -num138;
}
}
if (this.type == 520)
{
++this.localAI[2];
if ((double) this.localAI[2] >= 6.0)
{
this.localAI[2] = 0.0f;
this.localAI[3] = Main.player[this.target].DirectionFrom(this.Top + new Vector2(0.0f, 20f)).ToRotation();
}
}
}
}
if (this.type == 109 && Main.netMode != 1 && !Main.player[this.target].dead)
{
if (this.justHit)
this.ai[2] = 0.0f;
++this.ai[2];
if ((double) this.ai[2] > 450.0)
{
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f - (float) (this.direction * 24), this.position.Y + 4f);
int num141 = 3 * this.direction;
int num142 = -5;
int index = Projectile.NewProjectile(vector2.X, vector2.Y, (float) num141, (float) num142, 75, 0, 0.0f, Main.myPlayer);
Main.projectile[index].timeLeft = 300;
this.ai[2] = 0.0f;
}
}
bool flag20 = false;
if ((double) this.velocity.Y == 0.0)
{
int index28 = (int) ((double) this.position.Y + (double) this.height + 7.0) / 16;
int num143 = (int) this.position.X / 16;
int num144 = (int) ((double) this.position.X + (double) this.width) / 16;
for (int index29 = num143; index29 <= num144; ++index29)
{
if (Main.tile[index29, index28] == null)
return;
if (Main.tile[index29, index28].nactive() && Main.tileSolid[(int) Main.tile[index29, index28].type])
{
flag20 = true;
break;
}
}
}
if (this.type == 428)
flag20 = false;
if ((double) this.velocity.Y >= 0.0)
{
int num145 = 0;
if ((double) this.velocity.X < 0.0)
num145 = -1;
if ((double) this.velocity.X > 0.0)
num145 = 1;
Vector2 position = this.position;
position.X += this.velocity.X;
int index30 = (int) (((double) position.X + (double) (this.width / 2) + (double) ((this.width / 2 + 1) * num145)) / 16.0);
int index31 = (int) (((double) position.Y + (double) this.height - 1.0) / 16.0);
if (Main.tile[index30, index31] == null)
Main.tile[index30, index31] = new Tile();
if (Main.tile[index30, index31 - 1] == null)
Main.tile[index30, index31 - 1] = new Tile();
if (Main.tile[index30, index31 - 2] == null)
Main.tile[index30, index31 - 2] = new Tile();
if (Main.tile[index30, index31 - 3] == null)
Main.tile[index30, index31 - 3] = new Tile();
if (Main.tile[index30, index31 + 1] == null)
Main.tile[index30, index31 + 1] = new Tile();
if (Main.tile[index30 - num145, index31 - 3] == null)
Main.tile[index30 - num145, index31 - 3] = new Tile();
if ((double) (index30 * 16) < (double) position.X + (double) this.width && (double) (index30 * 16 + 16) > (double) position.X && (Main.tile[index30, index31].nactive() && !Main.tile[index30, index31].topSlope() && !Main.tile[index30, index31 - 1].topSlope() && Main.tileSolid[(int) Main.tile[index30, index31].type] && !Main.tileSolidTop[(int) Main.tile[index30, index31].type] || Main.tile[index30, index31 - 1].halfBrick() && Main.tile[index30, index31 - 1].nactive()) && (!Main.tile[index30, index31 - 1].nactive() || !Main.tileSolid[(int) Main.tile[index30, index31 - 1].type] || Main.tileSolidTop[(int) Main.tile[index30, index31 - 1].type] || Main.tile[index30, index31 - 1].halfBrick() && (!Main.tile[index30, index31 - 4].nactive() || !Main.tileSolid[(int) Main.tile[index30, index31 - 4].type] || Main.tileSolidTop[(int) Main.tile[index30, index31 - 4].type])) && (!Main.tile[index30, index31 - 2].nactive() || !Main.tileSolid[(int) Main.tile[index30, index31 - 2].type] || Main.tileSolidTop[(int) Main.tile[index30, index31 - 2].type]) && (!Main.tile[index30, index31 - 3].nactive() || !Main.tileSolid[(int) Main.tile[index30, index31 - 3].type] || Main.tileSolidTop[(int) Main.tile[index30, index31 - 3].type]) && (!Main.tile[index30 - num145, index31 - 3].nactive() || !Main.tileSolid[(int) Main.tile[index30 - num145, index31 - 3].type]))
{
float num146 = (float) (index31 * 16);
if (Main.tile[index30, index31].halfBrick())
num146 += 8f;
if (Main.tile[index30, index31 - 1].halfBrick())
num146 -= 8f;
if ((double) num146 < (double) position.Y + (double) this.height)
{
float num147 = position.Y + (float) this.height - num146;
float num148 = 16.1f;
if (this.type == 163 || this.type == 164 || this.type == 236 || this.type == 239 || this.type == 530)
num148 += 8f;
if ((double) num147 <= (double) num148)
{
this.gfxOffY += this.position.Y + (float) this.height - num146;
this.position.Y = num146 - (float) this.height;
this.stepSpeed = (double) num147 >= 9.0 ? 2f : 1f;
}
}
}
}
if (flag20)
{
int index32 = (int) (((double) this.position.X + (double) (this.width / 2) + (double) (15 * this.direction)) / 16.0);
int index33 = (int) (((double) this.position.Y + (double) this.height - 15.0) / 16.0);
if (this.type == 109 || this.type == 163 || this.type == 164 || this.type == 199 || this.type == 236 || this.type == 239 || this.type == 257 || this.type == 258 || this.type == 290 || this.type == 391 || this.type == 425 || this.type == 427 || this.type == 426 || this.type == 508 || this.type == 415 || this.type == 530 || this.type == 532)
index32 = (int) (((double) this.position.X + (double) (this.width / 2) + (double) ((this.width / 2 + 16) * this.direction)) / 16.0);
if (Main.tile[index32, index33] == null)
Main.tile[index32, index33] = new Tile();
if (Main.tile[index32, index33 - 1] == null)
Main.tile[index32, index33 - 1] = new Tile();
if (Main.tile[index32, index33 - 2] == null)
Main.tile[index32, index33 - 2] = new Tile();
if (Main.tile[index32, index33 - 3] == null)
Main.tile[index32, index33 - 3] = new Tile();
if (Main.tile[index32, index33 + 1] == null)
Main.tile[index32, index33 + 1] = new Tile();
if (Main.tile[index32 + this.direction, index33 - 1] == null)
Main.tile[index32 + this.direction, index33 - 1] = new Tile();
if (Main.tile[index32 + this.direction, index33 + 1] == null)
Main.tile[index32 + this.direction, index33 + 1] = new Tile();
if (Main.tile[index32 - this.direction, index33 + 1] == null)
Main.tile[index32 - this.direction, index33 + 1] = new Tile();
Main.tile[index32, index33 + 1].halfBrick();
if (((!Main.tile[index32, index33 - 1].nactive() ? 0 : (Main.tile[index32, index33 - 1].type == (ushort) 10 ? 1 : (Main.tile[index32, index33 - 1].type == (ushort) 388 ? 1 : 0))) & (flag3 ? 1 : 0)) != 0)
{
++this.ai[2];
this.ai[3] = 0.0f;
if ((double) this.ai[2] >= 60.0)
{
if (!Main.bloodMoon && (this.type == 3 || this.type == 331 || this.type == 332 || this.type == 132 || this.type == 161 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223 || this.type == 320 || this.type == 321 || this.type == 319))
this.ai[1] = 0.0f;
this.velocity.X = 0.5f * (float) -this.direction;
int num149 = 5;
if (Main.tile[index32, index33 - 1].type == (ushort) 388)
num149 = 2;
this.ai[1] += (float) num149;
if (this.type == 27)
++this.ai[1];
if (this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296)
this.ai[1] += 6f;
this.ai[2] = 0.0f;
bool flag21 = false;
if ((double) this.ai[1] >= 10.0)
{
flag21 = true;
this.ai[1] = 10f;
}
if (this.type == 460)
flag21 = true;
WorldGen.KillTile(index32, index33 - 1, true);
if ((Main.netMode != 1 || !flag21) && flag21 && Main.netMode != 1)
{
if (this.type == 26)
{
WorldGen.KillTile(index32, index33 - 1);
if (Main.netMode == 2)
NetMessage.SendData(17, number2: ((float) index32), number3: ((float) (index33 - 1)));
}
else
{
if (Main.tile[index32, index33 - 1].type == (ushort) 10)
{
bool flag22 = WorldGen.OpenDoor(index32, index33 - 1, this.direction);
if (!flag22)
{
this.ai[3] = (float) num26;
this.netUpdate = true;
}
if (Main.netMode == 2 & flag22)
NetMessage.SendData(19, number2: ((float) index32), number3: ((float) (index33 - 1)), number4: ((float) this.direction));
}
if (Main.tile[index32, index33 - 1].type == (ushort) 388)
{
bool flag23 = WorldGen.ShiftTallGate(index32, index33 - 1, false);
if (!flag23)
{
this.ai[3] = (float) num26;
this.netUpdate = true;
}
if (Main.netMode == 2 & flag23)
NetMessage.SendData(19, number: 4, number2: ((float) index32), number3: ((float) (index33 - 1)));
}
}
}
}
}
else
{
int spriteDirection = this.spriteDirection;
if (this.type == 425)
spriteDirection *= -1;
if ((double) this.velocity.X < 0.0 && spriteDirection == -1 || (double) this.velocity.X > 0.0 && spriteDirection == 1)
{
if (this.height >= 32 && Main.tile[index32, index33 - 2].nactive() && Main.tileSolid[(int) Main.tile[index32, index33 - 2].type])
{
if (Main.tile[index32, index33 - 3].nactive() && Main.tileSolid[(int) Main.tile[index32, index33 - 3].type])
{
this.velocity.Y = -8f;
this.netUpdate = true;
}
else
{
this.velocity.Y = -7f;
this.netUpdate = true;
}
}
else if (Main.tile[index32, index33 - 1].nactive() && Main.tileSolid[(int) Main.tile[index32, index33 - 1].type])
{
this.velocity.Y = -6f;
this.netUpdate = true;
}
else if ((double) this.position.Y + (double) this.height - (double) (index33 * 16) > 20.0 && Main.tile[index32, index33].nactive() && !Main.tile[index32, index33].topSlope() && Main.tileSolid[(int) Main.tile[index32, index33].type])
{
this.velocity.Y = -5f;
this.netUpdate = true;
}
else if (this.directionY < 0 && this.type != 67 && (!Main.tile[index32, index33 + 1].nactive() || !Main.tileSolid[(int) Main.tile[index32, index33 + 1].type]) && (!Main.tile[index32 + this.direction, index33 + 1].nactive() || !Main.tileSolid[(int) Main.tile[index32 + this.direction, index33 + 1].type]))
{
this.velocity.Y = -8f;
this.velocity.X *= 1.5f;
this.netUpdate = true;
}
else if (flag3)
{
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
}
if ((double) this.velocity.Y == 0.0 & flag1 && (double) this.ai[3] == 1.0)
this.velocity.Y = -5f;
}
if ((this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 47 || this.type == 77 || this.type == 104 || this.type == 168 || this.type == 196 || this.type == 385 || this.type == 389 || this.type == 464 || this.type == 470 || this.type >= 524 && this.type <= 527) && (double) this.velocity.Y == 0.0 && (double) Math.Abs((float) ((double) this.position.X + (double) (this.width / 2) - ((double) Main.player[this.target].position.X + (double) (Main.player[this.target].width / 2)))) < 100.0 && (double) Math.Abs((float) ((double) this.position.Y + (double) (this.height / 2) - ((double) Main.player[this.target].position.Y + (double) (Main.player[this.target].height / 2)))) < 50.0 && (this.direction > 0 && (double) this.velocity.X >= 1.0 || this.direction < 0 && (double) this.velocity.X <= -1.0))
{
this.velocity.X *= 2f;
if ((double) this.velocity.X > 3.0)
this.velocity.X = 3f;
if ((double) this.velocity.X < -3.0)
this.velocity.X = -3f;
this.velocity.Y = -4f;
this.netUpdate = true;
}
if (this.type == 120 && (double) this.velocity.Y < 0.0)
this.velocity.Y *= 1.1f;
if (this.type == 287 && (double) this.velocity.Y == 0.0 && (double) Math.Abs((float) ((double) this.position.X + (double) (this.width / 2) - ((double) Main.player[this.target].position.X + (double) (Main.player[this.target].width / 2)))) < 150.0 && (double) Math.Abs((float) ((double) this.position.Y + (double) (this.height / 2) - ((double) Main.player[this.target].position.Y + (double) (Main.player[this.target].height / 2)))) < 50.0 && (this.direction > 0 && (double) this.velocity.X >= 1.0 || this.direction < 0 && (double) this.velocity.X <= -1.0))
{
this.velocity.X = (float) (8 * this.direction);
this.velocity.Y = -4f;
this.netUpdate = true;
}
if (this.type == 287 && (double) this.velocity.Y < 0.0)
{
this.velocity.X *= 1.2f;
this.velocity.Y *= 1.1f;
}
if (this.type == 460 && (double) this.velocity.Y < 0.0)
{
this.velocity.X *= 1.3f;
this.velocity.Y *= 1.1f;
}
}
}
else if (flag3)
{
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
}
if (Main.netMode == 1 || this.type != 120 || (double) this.ai[3] < (double) num26)
return;
int num150 = (int) Main.player[this.target].position.X / 16;
int num151 = (int) Main.player[this.target].position.Y / 16;
int num152 = (int) this.position.X / 16;
int num153 = (int) this.position.Y / 16;
int num154 = 20;
int num155 = 0;
bool flag24 = false;
if ((double) Math.Abs(this.position.X - Main.player[this.target].position.X) + (double) Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000.0)
{
num155 = 100;
flag24 = true;
}
while (!flag24 && num155 < 100)
{
++num155;
int index34 = Main.rand.Next(num150 - num154, num150 + num154);
for (int index35 = Main.rand.Next(num151 - num154, num151 + num154); index35 < num151 + num154; ++index35)
{
if ((index35 < num151 - 4 || index35 > num151 + 4 || index34 < num150 - 4 || index34 > num150 + 4) && (index35 < num153 - 1 || index35 > num153 + 1 || index34 < num152 - 1 || index34 > num152 + 1) && Main.tile[index34, index35].nactive())
{
bool flag25 = true;
if (this.type == 32 && Main.tile[index34, index35 - 1].wall == (byte) 0)
flag25 = false;
else if (Main.tile[index34, index35 - 1].lava())
flag25 = false;
if (flag25 && Main.tileSolid[(int) Main.tile[index34, index35].type] && !Collision.SolidTiles(index34 - 1, index34 + 1, index35 - 4, index35 - 1))
{
this.position.X = (float) (index34 * 16 - this.width / 2);
this.position.Y = (float) (index35 * 16 - this.height);
this.netUpdate = true;
this.ai[3] = -120f;
}
}
}
}
}
private void AI_001_Slimes()
{
if (this.type == 1 && ((double) this.ai[1] == 1.0 || (double) this.ai[1] == 2.0 || (double) this.ai[1] == 3.0))
this.ai[1] = -1f;
if (this.type == 1 && (double) this.ai[1] == 0.0 && Main.netMode != 1 && (double) this.value > 0.0)
{
this.ai[1] = -1f;
if (Main.rand.Next(20) == 0)
{
int num;
switch (Main.rand.Next(4))
{
case 0:
switch (Main.rand.Next(7))
{
case 0:
num = 290;
break;
case 1:
num = 292;
break;
case 2:
num = 296;
break;
case 3:
num = 2322;
break;
default:
num = Main.netMode == 0 || Main.rand.Next(2) != 0 ? 2350 : 2997;
break;
}
break;
case 1:
switch (Main.rand.Next(4))
{
case 0:
num = 8;
break;
case 1:
num = 166;
break;
case 2:
num = 965;
break;
default:
num = 58;
break;
}
break;
case 2:
num = Main.rand.Next(2) != 0 ? Main.rand.Next(699, 703) : Main.rand.Next(11, 15);
break;
default:
switch (Main.rand.Next(3))
{
case 0:
num = 71;
break;
case 1:
num = 72;
break;
default:
num = 73;
break;
}
break;
}
this.ai[1] = (float) num;
this.netUpdate = true;
}
}
if (this.type == 244)
{
Lighting.AddLight((int) (((double) this.position.X + (double) (this.width / 2)) / 16.0), (int) (((double) this.position.Y + (double) (this.height / 2)) / 16.0), (float) Main.DiscoR / (float) byte.MaxValue * 1f, (float) Main.DiscoG / (float) byte.MaxValue * 1f, (float) Main.DiscoB / (float) byte.MaxValue * 1f);
this.color.R = (byte) Main.DiscoR;
this.color.G = (byte) Main.DiscoG;
this.color.B = (byte) Main.DiscoB;
this.color.A = (byte) 100;
this.alpha = 175;
}
bool flag = false;
if (!Main.dayTime || this.life != this.lifeMax || (double) this.position.Y > Main.worldSurface * 16.0 || Main.slimeRain)
flag = true;
if (this.type == 81)
{
flag = true;
if (Main.rand.Next(30) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 14, Alpha: this.alpha, newColor: this.color);
Main.dust[index].velocity *= 0.3f;
}
}
if ((this.type == 377 || this.type == 446) && this.target != (int) byte.MaxValue && !Main.player[this.target].dead && (double) Vector2.Distance(this.Center, Main.player[this.target].Center) <= 200.0)
flag = true;
if (this.type == 183)
flag = true;
if (this.type == 304)
flag = true;
if (this.type == 244)
{
flag = true;
this.ai[0] += 2f;
}
if (this.type == 147 && Main.rand.Next(10) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 76);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.1f;
}
if (this.type == 184)
{
if (Main.rand.Next(8) == 0)
{
int index = Dust.NewDust(this.position - this.velocity, this.width, this.height, 76);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.15f;
}
flag = true;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
if (!this.wet && !Main.player[this.target].npcTypeNoAggro[this.type])
{
Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num1 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2_1.X;
float num2 = Main.player[this.target].position.Y - vector2_1.Y;
float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2);
if (Main.expertMode && (double) num3 < 120.0 && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && (double) this.velocity.Y == 0.0)
{
this.ai[0] = -40f;
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.9f;
if (Main.netMode != 1 && (double) this.localAI[0] == 0.0)
{
for (int index = 0; index < 5; ++index)
{
Vector2 vector2_2 = new Vector2((float) (index - 2), -4f);
vector2_2.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00499999988824129);
vector2_2.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00499999988824129);
vector2_2.Normalize();
vector2_2 *= (float) (4.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_2.X, vector2_2.Y, 174, 9, 0.0f, Main.myPlayer);
this.localAI[0] = 30f;
}
}
}
else if ((double) num3 < 200.0 && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && (double) this.velocity.Y == 0.0)
{
this.ai[0] = -40f;
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.9f;
if (Main.netMode != 1 && (double) this.localAI[0] == 0.0)
{
float num4 = Main.player[this.target].position.Y - vector2_1.Y - (float) Main.rand.Next(0, 200);
float num5 = 4.5f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num4 * (double) num4);
float SpeedX = num1 * num5;
float SpeedY = num4 * num5;
this.localAI[0] = 50f;
Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, 174, 9, 0.0f, Main.myPlayer);
}
}
}
}
if (this.type == 535)
{
flag = true;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
if (!this.wet && !Main.player[this.target].npcTypeNoAggro[this.type])
{
Vector2 vector2_3 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num6 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2_3.X;
float num7 = Main.player[this.target].position.Y - vector2_3.Y;
float num8 = (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7);
if (Main.expertMode && (double) num8 < 120.0 && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && (double) this.velocity.Y == 0.0)
{
this.ai[0] = -40f;
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.9f;
if (Main.netMode != 1 && (double) this.localAI[0] == 0.0)
{
for (int index = 0; index < 5; ++index)
{
Vector2 vector2_4 = new Vector2((float) (index - 2), -4f);
vector2_4.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00499999988824129);
vector2_4.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00499999988824129);
vector2_4.Normalize();
vector2_4 *= (float) (4.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
Projectile.NewProjectile(vector2_3.X, vector2_3.Y, vector2_4.X, vector2_4.Y, 605, 9, 0.0f, Main.myPlayer);
this.localAI[0] = 30f;
}
}
}
else if ((double) num8 < 200.0 && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && (double) this.velocity.Y == 0.0)
{
this.ai[0] = -40f;
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.9f;
if (Main.netMode != 1 && (double) this.localAI[0] == 0.0)
{
float num9 = Main.player[this.target].position.Y - vector2_3.Y - (float) Main.rand.Next(0, 200);
float num10 = 4.5f / (float) Math.Sqrt((double) num6 * (double) num6 + (double) num9 * (double) num9);
float SpeedX = num6 * num10;
float SpeedY = num9 * num10;
this.localAI[0] = 50f;
Projectile.NewProjectile(vector2_3.X, vector2_3.Y, SpeedX, SpeedY, 605, 9, 0.0f, Main.myPlayer);
}
}
}
}
if (this.type == 204)
{
flag = true;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
if (!this.wet && !Main.player[this.target].npcTypeNoAggro[this.type])
{
Vector2 vector2_5 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num11 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2_5.X;
float num12 = Main.player[this.target].position.Y - vector2_5.Y;
float num13 = (float) Math.Sqrt((double) num11 * (double) num11 + (double) num12 * (double) num12);
if (Main.expertMode && (double) num13 < 200.0 && Collision.CanHit(new Vector2(this.position.X, this.position.Y - 20f), this.width, this.height + 20, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && (double) this.velocity.Y == 0.0)
{
this.ai[0] = -40f;
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.9f;
if (Main.netMode != 1 && (double) this.localAI[0] == 0.0)
{
for (int index = 0; index < 5; ++index)
{
Vector2 vector2_6 = new Vector2((float) (index - 2), -2f);
vector2_6.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.0199999995529652);
vector2_6.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.0199999995529652);
vector2_6.Normalize();
vector2_6 *= (float) (3.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
Projectile.NewProjectile(vector2_5.X, vector2_5.Y, vector2_6.X, vector2_6.Y, 176, 13, 0.0f, Main.myPlayer);
this.localAI[0] = 80f;
}
}
}
if ((double) num13 < 400.0 && Collision.CanHit(new Vector2(this.position.X, this.position.Y - 20f), this.width, this.height + 20, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && (double) this.velocity.Y == 0.0)
{
this.ai[0] = -80f;
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.9f;
if (Main.netMode != 1 && (double) this.localAI[0] == 0.0)
{
float num14 = Main.player[this.target].position.Y - vector2_5.Y - (float) Main.rand.Next(-30, 20) - num13 * 0.05f;
float num15 = Main.player[this.target].position.X - vector2_5.X - (float) Main.rand.Next(-20, 20);
float num16 = 7f / (float) Math.Sqrt((double) num15 * (double) num15 + (double) num14 * (double) num14);
float SpeedX = num15 * num16;
float SpeedY = num14 * num16;
this.localAI[0] = 65f;
Projectile.NewProjectile(vector2_5.X, vector2_5.Y, SpeedX, SpeedY, 176, 13, 0.0f, Main.myPlayer);
}
}
}
}
if (this.type == 377 || this.type == 446)
{
if ((double) this.localAI[2] < 90.0)
++this.localAI[2];
else
this.friendly = false;
}
if (this.type == 59)
{
Lighting.AddLight((int) (((double) this.position.X + (double) (this.width / 2)) / 16.0), (int) (((double) this.position.Y + (double) (this.height / 2)) / 16.0), 1f, 0.3f, 0.1f);
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 1.7f);
Main.dust[index].noGravity = true;
}
if ((double) this.ai[2] > 1.0)
--this.ai[2];
if (this.wet)
{
if (this.collideY)
this.velocity.Y = -2f;
if ((double) this.velocity.Y < 0.0 && (double) this.ai[3] == (double) this.position.X)
{
this.direction *= -1;
this.ai[2] = 200f;
}
if ((double) this.velocity.Y > 0.0)
this.ai[3] = this.position.X;
if (this.type == 59)
{
if ((double) this.velocity.Y > 2.0)
this.velocity.Y *= 0.9f;
else if (this.directionY < 0)
this.velocity.Y -= 0.8f;
this.velocity.Y -= 0.5f;
if ((double) this.velocity.Y < -10.0)
this.velocity.Y = -10f;
}
else
{
if ((double) this.velocity.Y > 2.0)
this.velocity.Y *= 0.9f;
this.velocity.Y -= 0.5f;
if ((double) this.velocity.Y < -4.0)
this.velocity.Y = -4f;
}
if ((double) this.ai[2] == 1.0 & flag)
this.TargetClosest();
}
this.aiAction = 0;
if ((double) this.ai[2] == 0.0)
{
this.ai[0] = -100f;
this.ai[2] = 1f;
this.TargetClosest();
}
if ((double) this.velocity.Y == 0.0)
{
if (this.collideY && (double) this.oldVelocity.Y != 0.0 && Collision.SolidCollision(this.position, this.width, this.height))
this.position.X -= this.velocity.X + (float) this.direction;
if ((double) this.ai[3] == (double) this.position.X)
{
this.direction *= -1;
this.ai[2] = 200f;
}
this.ai[3] = 0.0f;
this.velocity.X *= 0.8f;
if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1)
this.velocity.X = 0.0f;
if (flag)
++this.ai[0];
++this.ai[0];
if (this.type == 59)
this.ai[0] += 2f;
if (this.type == 71)
this.ai[0] += 3f;
if (this.type == 138)
this.ai[0] += 2f;
if (this.type == 183)
++this.ai[0];
if (this.type == 304)
this.ai[0] += (float) ((1 - this.life / this.lifeMax) * 10);
if (this.type == 377 || this.type == 446)
this.ai[0] += 3f;
if (this.type == 81)
{
if ((double) this.scale >= 0.0)
this.ai[0] += 4f;
else
++this.ai[0];
}
int num = 0;
if ((double) this.ai[0] >= 0.0)
num = 1;
if ((double) this.ai[0] >= -1000.0 && (double) this.ai[0] <= -500.0)
num = 2;
if ((double) this.ai[0] >= -2000.0 && (double) this.ai[0] <= -1500.0)
num = 3;
if (num > 0)
{
this.netUpdate = true;
if (flag && (double) this.ai[2] == 1.0)
this.TargetClosest();
if (num == 3)
{
this.velocity.Y = -8f;
if (this.type == 59)
this.velocity.Y -= 2f;
this.velocity.X += (float) (3 * this.direction);
if (this.type == 59)
this.velocity.X += 0.5f * (float) this.direction;
this.ai[0] = -200f;
this.ai[3] = this.position.X;
}
else
{
this.velocity.Y = -6f;
this.velocity.X += (float) (2 * this.direction);
if (this.type == 59)
this.velocity.X += (float) (2 * this.direction);
this.ai[0] = -120f;
if (num == 1)
this.ai[0] -= 1000f;
else
this.ai[0] -= 2000f;
}
if (this.type == 141)
{
this.velocity.Y *= 1.3f;
this.velocity.X *= 1.2f;
}
if (this.type != 377 && this.type != 446)
return;
this.velocity.Y *= 0.9f;
this.velocity.X *= 0.6f;
if (!flag)
return;
this.direction = -this.direction;
this.velocity.X *= -1f;
}
else
{
if ((double) this.ai[0] < -30.0)
return;
this.aiAction = 1;
}
}
else
{
if (this.target >= (int) byte.MaxValue || (this.direction != 1 || (double) this.velocity.X >= 3.0) && (this.direction != -1 || (double) this.velocity.X <= -3.0))
return;
if (this.collideX && (double) Math.Abs(this.velocity.X) == 0.200000002980232)
this.position.X -= 1.4f * (float) this.direction;
if (this.collideY && (double) this.oldVelocity.Y != 0.0 && Collision.SolidCollision(this.position, this.width, this.height))
this.position.X -= this.velocity.X + (float) this.direction;
if (this.direction == -1 && (double) this.velocity.X < 0.01 || this.direction == 1 && (double) this.velocity.X > -0.01)
this.velocity.X += 0.2f * (float) this.direction;
else
this.velocity.X *= 0.93f;
}
}
private void AI_110_Betsy()
{
NPCUtils.TargetClosestBetsy(this, false);
NPCAimedTarget targetData = this.GetTargetData();
int num1 = -1;
float num2 = 1f;
int Damage1 = 35;
int Damage2 = 35;
float num3 = 10f;
float moveSpeed = 0.45f;
float num4 = 7.5f;
float num5 = 30f;
float num6 = 30f;
float num7 = 23f;
float num8 = 600f;
float num9 = 12f;
float num10 = 40f;
float num11 = 80f;
float num12 = num10 + num11;
float num13 = 1500f;
float num14 = 60f;
float num15 = 13f;
float amount = 0.03333334f;
float num16 = 12f;
int num17 = 10;
int num18 = 6 * num17;
float num19 = 60f;
float num20 = num14 + (float) num18 + num19;
float num21 = 60f;
float num22 = (float) (6.28318548202515 * (1.0 / (double) num21));
float num23 = 0.1f;
float num24 = 32f;
float num25 = 90f;
float num26 = 20f;
double num27 = (double) this.ai[0];
if ((double) this.ai[0] == 0.0)
{
if ((double) ++this.ai[1] >= (double) num3)
{
this.ai[1] = 0.0f;
this.ai[0] = 1f;
this.ai[2] = 0.0f;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 1.0)
{
if ((double) this.ai[2] == 0.0)
this.ai[2] = (double) this.Center.X < (double) targetData.Center.X ? 1f : -1f;
this.SimpleFlyMovement(this.DirectionTo(targetData.Center + new Vector2((float) (-(double) this.ai[2] * 300.0), -200f)) * num4, moveSpeed);
this.direction = this.spriteDirection = (double) this.Center.X < (double) targetData.Center.X ? 1 : -1;
if ((double) ++this.ai[1] >= (double) num5)
{
int num28 = 1;
if ((double) this.ai[3] == 5.0 && Main.rand.Next(3) == 0)
++this.ai[3];
switch ((int) this.ai[3])
{
case 0:
case 1:
case 3:
num28 = 2;
break;
case 2:
num28 = 3;
break;
case 4:
num28 = 4;
break;
case 5:
num28 = 5;
break;
case 6:
num28 = 3;
break;
case 7:
num28 = 6;
break;
}
this.ai[0] = (float) num28;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
++this.ai[3];
this.netUpdate = true;
if ((double) this.ai[3] >= 8.0)
this.ai[3] = 0.0f;
switch (num28)
{
case 2:
Vector2 v1 = this.DirectionTo(targetData.Center);
this.spriteDirection = (double) v1.X > 0.0 ? 1 : -1;
this.rotation = v1.ToRotation();
if (this.spriteDirection == -1)
this.rotation += 3.141593f;
this.velocity = v1 * num7;
break;
case 3:
Vector2 vector2 = new Vector2((double) targetData.Center.X > (double) this.Center.X ? 1f : -1f, 0.0f);
this.spriteDirection = (double) vector2.X > 0.0 ? 1 : -1;
this.velocity = vector2 * -2f;
break;
case 5:
Vector2 v2 = this.DirectionTo(targetData.Center);
this.spriteDirection = (double) v2.X > 0.0 ? 1 : -1;
this.rotation = v2.ToRotation();
if (this.spriteDirection == -1)
this.rotation += 3.141593f;
this.velocity = v2 * num24;
break;
}
}
}
else if ((double) this.ai[0] == 2.0)
{
if ((double) this.ai[1] == 0.0)
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_BetsyWindAttack, this.Center);
if ((double) ++this.ai[1] >= (double) num6)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
}
}
else if ((double) this.ai[0] == 3.0)
{
ActiveSound activeSound = Main.GetActiveSound(SlotId.FromFloat(this.localAI[2]));
if (activeSound != null)
activeSound.Position = this.Center;
++this.ai[1];
int num29 = (double) this.Center.X < (double) targetData.Center.X ? 1 : -1;
this.ai[2] = (float) num29;
if ((double) this.ai[1] < (double) num10)
{
Vector2 vector2_1 = targetData.Center + new Vector2((float) num29 * -num8, -250f);
Vector2 vector2_2 = this.DirectionTo(vector2_1) * num9;
if ((double) this.Distance(vector2_1) < (double) num9)
this.Center = vector2_1;
else
this.position = this.position + vector2_2;
if ((double) Vector2.Distance(vector2_1, this.Center) < 16.0)
this.ai[1] = num10 - 1f;
num2 = 1.5f;
}
if ((double) this.ai[1] == (double) num10)
{
int num30 = (double) targetData.Center.X > (double) this.Center.X ? 1 : -1;
this.velocity = new Vector2((float) num30, 0.0f) * 10f;
this.direction = this.spriteDirection = num30;
if (Main.netMode != 1)
Projectile.NewProjectile(this.Center, this.velocity, 687, Damage1, 0.0f, Main.myPlayer, ai1: ((float) this.whoAmI));
float[] localAi = this.localAI;
SlotId slotId = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_BetsyFlameBreath, this.Center);
double num31 = (double) ((SlotId) ref slotId).ToFloat();
localAi[2] = (float) num31;
}
if ((double) this.ai[1] >= (double) num10)
{
num2 = 1.5f;
if ((double) Math.Abs(targetData.Center.X - this.Center.X) > 550.0 && (double) Math.Abs(this.velocity.X) < 20.0)
this.velocity.X += (float) Math.Sign(this.velocity.X) * 0.5f;
}
if ((double) this.ai[1] >= (double) num12)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
}
}
else if ((double) this.ai[0] == 4.0)
{
int num32 = (double) this.Center.X < (double) targetData.Center.X ? 1 : -1;
this.ai[2] = (float) num32;
if ((double) this.ai[1] < (double) num14)
{
Vector2 Destination = targetData.Center + new Vector2((float) num32 * -num13, -350f);
this.velocity = Vector2.Lerp(this.velocity, this.DirectionTo(Destination) * num15, amount);
this.direction = this.spriteDirection = (double) this.Center.X < (double) targetData.Center.X ? 1 : -1;
if ((double) Vector2.Distance(Destination, this.Center) < 16.0)
this.ai[1] = num14 - 1f;
num2 = 1.5f;
}
else if ((double) this.ai[1] == (double) num14)
{
Vector2 v = this.DirectionTo(targetData.Center);
v.Y *= 0.25f;
v = v.SafeNormalize(Vector2.UnitX * (float) this.direction);
this.spriteDirection = (double) v.X > 0.0 ? 1 : -1;
this.rotation = v.ToRotation();
if (this.spriteDirection == -1)
this.rotation += 3.141593f;
this.velocity = v * num16;
}
else
{
this.position.X += this.DirectionTo(targetData.Center).X * 7f;
this.position.Y += this.DirectionTo(targetData.Center + new Vector2(0.0f, -400f)).Y * 6f;
if ((double) this.ai[1] <= (double) num20 - (double) num19)
num2 = 1.5f;
Vector2 position = this.Center + new Vector2((110f + 30f) * (float) this.direction, 20f).RotatedBy((double) this.rotation);
int num33 = (int) ((double) this.ai[1] - (double) num14 + 1.0);
if (num33 <= num18 && num33 % num17 == 0 && Main.netMode != 1)
Projectile.NewProjectile(position, this.velocity, 686, Damage2, 0.0f, Main.myPlayer);
}
if ((double) this.ai[1] > (double) num20 - (double) num19)
this.velocity.Y -= 0.1f;
++this.ai[1];
if ((double) this.ai[1] >= (double) num20)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
}
}
else if ((double) this.ai[0] == 5.0)
{
this.velocity = this.velocity.RotatedBy(-(double) num22 * (double) this.direction);
this.position.Y -= num23;
this.position = this.position + this.DirectionTo(targetData.Center) * 10f;
this.rotation -= num22 * (float) this.direction;
num2 *= 0.7f;
if ((double) this.ai[1] == 1.0)
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_BetsyFlyingCircleAttack, this.Center);
if ((double) ++this.ai[1] >= (double) num21)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.velocity = this.velocity / 2f;
}
}
else if ((double) this.ai[0] == 6.0)
{
if ((double) this.ai[1] == 0.0)
{
this.SimpleFlyMovement(this.DirectionTo(targetData.Center + new Vector2(0.0f, -200f)) * num4 * 2f, moveSpeed * 2f);
this.direction = this.spriteDirection = (double) this.Center.X < (double) targetData.Center.X ? 1 : -1;
++this.ai[2];
if ((double) this.Distance(targetData.Center) < 350.0 || (double) this.ai[2] >= 180.0)
{
this.ai[1] = 1f;
this.netUpdate = true;
}
}
else
{
if ((double) this.ai[1] == 1.0)
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_BetsyScream);
if ((double) this.ai[1] < (double) num26)
this.velocity = this.velocity * 0.95f;
else
this.velocity = this.velocity * 0.98f;
if ((double) this.ai[1] == (double) num26)
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y /= 3f;
this.velocity.Y -= 3f;
}
num2 *= 0.85f;
if (((double) this.ai[1] == 20.0 || (double) this.ai[1] == 25.0 ? 1 : ((double) this.ai[1] == 30.0 ? 1 : 0)) != 0)
{
Point tileCoordinates = this.Center.ToTileCoordinates();
int num34 = 30;
int num35 = 35;
int num36 = 4;
for (int i = tileCoordinates.X - num34; i <= tileCoordinates.X + num34; ++i)
{
bool flag1 = false;
for (int j = tileCoordinates.Y - num35 / 3; j < tileCoordinates.Y + num35; ++j)
{
Tile tileSafely = Framing.GetTileSafely(i, j);
bool flag2 = tileSafely.active() && Main.tileSolid[(int) tileSafely.type] && !Main.tileFrameImportant[(int) tileSafely.type];
if (flag1 & flag2)
{
int tileDustAmount = WorldGen.KillTile_GetTileDustAmount(true, tileSafely);
for (int index = 0; index < tileDustAmount; ++index)
{
Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(i, j, tileSafely)];
dust.velocity.Y -= (float) (3.0 + (double) num36 * 1.5);
dust.velocity.Y *= Main.rand.NextFloat();
dust.scale += (float) num36 * 0.03f;
}
for (int index = 0; index < tileDustAmount - 1; ++index)
{
Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(i, j, tileSafely)];
dust.velocity.Y -= 1f + (float) num36;
dust.velocity.Y *= Main.rand.NextFloat();
}
if (tileDustAmount > 0 && Main.rand.Next(3) != 0)
{
float num37 = (float) (Math.Abs(tileCoordinates.X - i) / (num34 / 2));
Gore gore = Gore.NewGoreDirect(this.position, Vector2.Zero, 61 + Main.rand.Next(3), (float) (1.0 - (double) num36 * 0.150000005960464 + (double) num37 * 0.5));
gore.velocity.Y -= (float) (0.100000001490116 + (double) num36 * 0.5 + (double) num37 * (double) num36 * 1.0);
gore.velocity.Y *= Main.rand.NextFloat();
gore.position = new Vector2((float) (i * 16 + 20), (float) (j * 16 + 20));
}
}
flag1 = !flag2;
}
}
}
bool flag = (double) this.ai[1] == 20.0 || (double) this.ai[1] == 45.0 || (double) this.ai[1] == 70.0;
if (NPC.CountNPCS(560) > 4)
flag = false;
if (flag && Main.netMode != 1)
{
for (int index = 0; index < 1; ++index)
{
Vector2 vector2 = this.Center + (6.283185f * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 300f * (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.400000005960464);
if ((double) Vector2.Distance(vector2, targetData.Center) > 100.0)
{
Point point = vector2.ToPoint();
NPC.NewNPC(point.X, point.Y, 560, this.whoAmI);
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_BetsySummon, vector2);
}
}
List<NPC> npcList = new List<NPC>();
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.active && npc.type == 549)
npcList.Add(npc);
}
if (npcList.Count > 0)
{
for (int index = 0; index < 3; ++index)
{
NPC npc = npcList[Main.rand.Next(npcList.Count)];
Point point = npc.Center.ToPoint();
NPC.NewNPC(point.X, point.Y, 560);
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_BetsySummon, npc.Center);
}
}
}
++this.ai[1];
}
if ((double) this.ai[1] >= (double) num25)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
}
}
this.localAI[0] += num2;
if ((double) this.localAI[0] >= 36.0)
this.localAI[0] = 0.0f;
if (num1 != -1)
this.localAI[0] = (float) (num1 * 4);
if ((double) ++this.localAI[1] >= 60.0)
this.localAI[1] = 0.0f;
float targetAngle = this.DirectionTo(targetData.Center).ToRotation();
float maxChange = 0.04f;
switch (this.ai[0])
{
case 2f:
case 5f:
maxChange = 0.0f;
break;
case 3f:
maxChange = 0.01f;
targetAngle = 0.0f;
if (this.spriteDirection == -1)
targetAngle -= 3.141593f;
if ((double) this.ai[1] >= (double) num10)
{
targetAngle += (float) ((double) this.spriteDirection * 3.14159274101257 / 12.0);
maxChange = 0.05f;
break;
}
break;
case 4f:
maxChange = 0.01f;
targetAngle = 3.141593f;
if (this.spriteDirection == 1)
{
targetAngle += 3.141593f;
break;
}
break;
case 6f:
maxChange = 0.02f;
targetAngle = 0.0f;
if (this.spriteDirection == -1)
{
targetAngle -= 3.141593f;
break;
}
break;
}
if (this.spriteDirection == -1)
targetAngle += 3.141593f;
if ((double) maxChange != 0.0)
this.rotation = this.rotation.AngleTowards(targetAngle, maxChange);
if (Main.GetActiveSound(SlotId.FromFloat(this.localAI[2])) != null)
return;
float[] localAi1 = this.localAI;
SlotId invalid = (SlotId) SlotId.Invalid;
double num38 = (double) ((SlotId) ref invalid).ToFloat();
localAi1[2] = (float) num38;
}
private void AI_026_Unicorns()
{
int num1 = 30;
int num2 = 10;
bool flag1 = false;
bool flag2 = false;
bool flag3 = false;
if ((double) this.velocity.Y == 0.0 && ((double) this.velocity.X > 0.0 && this.direction < 0 || (double) this.velocity.X < 0.0 && this.direction > 0))
{
flag2 = true;
++this.ai[3];
}
if (this.type == 546)
{
num2 = 4;
bool flag4 = (double) this.velocity.Y == 0.0;
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && Main.npc[index].type == this.type && (double) Math.Abs(this.position.X - Main.npc[index].position.X) + (double) Math.Abs(this.position.Y - Main.npc[index].position.Y) < (double) this.width)
{
if ((double) this.position.X < (double) Main.npc[index].position.X)
this.velocity.X -= 0.05f;
else
this.velocity.X += 0.05f;
if ((double) this.position.Y < (double) Main.npc[index].position.Y)
this.velocity.Y -= 0.05f;
else
this.velocity.Y += 0.05f;
}
}
if (flag4)
this.velocity.Y = 0.0f;
}
if ((((double) this.position.X == (double) this.oldPosition.X ? 1 : ((double) this.ai[3] >= (double) num1 ? 1 : 0)) | (flag2 ? 1 : 0)) != 0)
{
++this.ai[3];
flag3 = true;
}
else if ((double) this.ai[3] > 0.0)
--this.ai[3];
if ((double) this.ai[3] > (double) (num1 * num2))
this.ai[3] = 0.0f;
if (this.justHit)
this.ai[3] = 0.0f;
if ((double) this.ai[3] == (double) num1)
this.netUpdate = true;
Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
double num3 = (double) Main.player[this.target].position.X + (double) Main.player[this.target].width * 0.5 - (double) vector2_1.X;
float num4 = Main.player[this.target].position.Y - vector2_1.Y;
float num5 = (float) Math.Sqrt(num3 * num3 + (double) num4 * (double) num4);
if ((double) num5 < 200.0 && !flag3)
this.ai[3] = 0.0f;
if (this.type == 410)
{
++this.ai[1];
bool flag5 = (double) this.ai[1] >= 240.0;
if (!flag5 && (double) this.velocity.Y == 0.0)
{
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && !Main.player[index].dead && (double) Main.player[index].Distance(this.Center) < 800.0 && (double) Main.player[index].Center.Y < (double) this.Center.Y && (double) Math.Abs(Main.player[index].Center.X - this.Center.X) < 20.0)
{
flag5 = true;
break;
}
}
}
if (flag5 && Main.netMode != 1)
{
for (int index = 0; index < 3; ++index)
Projectile.NewProjectile(this.Center.X, this.Center.Y, (float) (((double) Main.rand.NextFloat() - 0.5) * 2.0), (float) (-4.0 - 10.0 * (double) Main.rand.NextFloat()), 538, 50, 0.0f, Main.myPlayer);
this.HitEffect(9999);
this.active = false;
return;
}
}
else if (this.type == 423)
{
if ((double) this.ai[2] == 1.0)
{
++this.ai[1];
this.velocity.X *= 0.7f;
if ((double) this.ai[1] < 30.0)
{
Vector2 Position = this.Center + Vector2.UnitX * (float) this.spriteDirection * -20f;
Dust dust = Main.dust[Dust.NewDust(Position, 0, 0, 242)];
Vector2 vector2_2 = Vector2.UnitY.RotatedByRandom(6.28318548202515);
dust.position = Position + vector2_2 * 20f;
dust.velocity = -vector2_2 * 2f;
dust.scale = (float) (0.5 + (double) vector2_2.X * (double) -this.spriteDirection);
dust.fadeIn = 1f;
dust.noGravity = true;
}
else if ((double) this.ai[1] == 30.0)
{
for (int index = 0; index < 20; ++index)
{
Vector2 Position = this.Center + Vector2.UnitX * (float) this.spriteDirection * -20f;
Dust dust = Main.dust[Dust.NewDust(Position, 0, 0, 242)];
Vector2 vector2_3 = Vector2.UnitY.RotatedByRandom(6.28318548202515);
dust.position = Position + vector2_3 * 4f;
dust.velocity = vector2_3 * 4f + Vector2.UnitX * Main.rand.NextFloat() * (float) this.spriteDirection * -5f;
dust.scale = (float) (0.5 + (double) vector2_3.X * (double) -this.spriteDirection);
dust.fadeIn = 1f;
dust.noGravity = true;
}
}
if ((double) this.velocity.X > -0.5 && (double) this.velocity.X < 0.5)
this.velocity.X = 0.0f;
if ((double) this.ai[1] == 30.0 && Main.netMode != 1)
Projectile.NewProjectile(this.Center.X + (float) (this.spriteDirection * -20), this.Center.Y, (float) (this.spriteDirection * -7), 0.0f, 575, Main.expertMode ? 35 : 50, 0.0f, Main.myPlayer, (float) this.target);
if ((double) this.ai[1] >= 60.0)
{
this.ai[1] = (float) -Main.rand.Next(320, 601);
this.ai[2] = 0.0f;
}
}
else
{
++this.ai[1];
if ((double) this.ai[1] >= 180.0 && (double) num5 < 500.0 && (double) this.velocity.Y == 0.0)
{
flag1 = true;
this.ai[1] = 0.0f;
this.ai[2] = 1f;
this.netUpdate = true;
}
else if ((double) this.velocity.Y == 0.0 && (double) num5 < 100.0 && (double) Math.Abs(this.velocity.X) > 3.0 && ((double) this.Center.X < (double) Main.player[this.target].Center.X && (double) this.velocity.X > 0.0 || (double) this.Center.X > (double) Main.player[this.target].Center.X && (double) this.velocity.X < 0.0))
this.velocity.Y -= 4f;
}
}
else if (this.type == 155 || this.type == 329)
{
if ((double) this.velocity.Y == 0.0 && (double) num5 < 100.0 && (double) Math.Abs(this.velocity.X) > 3.0 && ((double) this.position.X + (double) (this.width / 2) < (double) Main.player[this.target].position.X + (double) (Main.player[this.target].width / 2) && (double) this.velocity.X > 0.0 || (double) this.position.X + (double) (this.width / 2) > (double) Main.player[this.target].position.X + (double) (Main.player[this.target].width / 2) && (double) this.velocity.X < 0.0))
this.velocity.Y -= 4f;
}
else if (this.type == 546 && (double) this.velocity.Y == 0.0 && (double) Math.Abs(this.velocity.X) > 3.0 && ((double) this.Center.X < (double) Main.player[this.target].Center.X && (double) this.velocity.X > 0.0 || (double) this.Center.X > (double) Main.player[this.target].Center.X && (double) this.velocity.X < 0.0))
{
this.velocity.Y -= 4f;
Main.PlaySound(3, this.Center, 11);
}
if ((double) this.ai[3] < (double) num1)
{
if ((this.type == 329 || this.type == 315) && !Main.pumpkinMoon)
{
if (this.timeLeft > 10)
this.timeLeft = 10;
}
else
this.TargetClosest();
}
else
{
if ((double) this.velocity.X == 0.0)
{
if ((double) this.velocity.Y == 0.0)
{
++this.ai[0];
if ((double) this.ai[0] >= 2.0)
{
this.direction *= -1;
this.spriteDirection = this.direction;
this.ai[0] = 0.0f;
}
}
}
else
this.ai[0] = 0.0f;
this.directionY = -1;
if (this.direction == 0)
this.direction = 1;
}
float num6 = 6f;
float num7 = 0.07f;
if (!flag1 && ((double) this.velocity.Y == 0.0 || this.wet || (double) this.velocity.X <= 0.0 && this.direction < 0 || (double) this.velocity.X >= 0.0 && this.direction > 0))
{
if (this.type == 155)
{
if ((double) this.velocity.X > 0.0 && this.direction < 0)
this.velocity.X *= 0.95f;
if ((double) this.velocity.X < 0.0 && this.direction > 0)
this.velocity.X *= 0.95f;
}
else if (this.type == 329)
{
if ((double) this.velocity.X > 0.0 && this.direction < 0)
this.velocity.X *= 0.9f;
if ((double) this.velocity.X < 0.0 && this.direction > 0)
this.velocity.X *= 0.9f;
if (this.direction > 0 && (double) this.velocity.X < 3.0)
this.velocity.X += 0.1f;
if (this.direction < 0 && (double) this.velocity.X > -3.0)
this.velocity.X -= 0.1f;
}
else if (this.type == 315)
{
if ((double) this.velocity.X > 0.0 && this.direction < 0)
this.velocity.X *= 0.95f;
if ((double) this.velocity.X < 0.0 && this.direction > 0)
this.velocity.X *= 0.95f;
if ((double) this.velocity.X < -(double) num6 || (double) this.velocity.X > (double) num6)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num6 && this.direction == 1)
{
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num6)
this.velocity.X = num6;
}
else if ((double) this.velocity.X > -(double) num6 && this.direction == -1)
{
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num6)
this.velocity.X = -num6;
}
}
else if (this.type == 410)
{
if (Math.Sign(this.velocity.X) != this.direction)
this.velocity.X *= 0.9f;
num6 = 6f;
num7 = 0.2f;
}
else if (this.type == 423)
{
if (Math.Sign(this.velocity.X) != this.direction)
this.velocity.X *= 0.85f;
num6 = 10f;
num7 = 0.2f;
}
else if (this.type == 546)
{
if (Math.Sign(this.velocity.X) != this.direction)
this.velocity.X *= 0.92f;
float num8 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float) Math.Sign(Main.windSpeedSet);
if (!Main.player[this.target].ZoneSandstorm)
num8 = 0.0f;
num6 = (float) (5.0 + (double) num8 * (double) this.direction * 4.0);
num7 = 0.2f;
}
if ((double) this.velocity.X < -(double) num6 || (double) this.velocity.X > (double) num6)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num6 && this.direction == 1)
{
this.velocity.X += num7;
if ((double) this.velocity.X > (double) num6)
this.velocity.X = num6;
}
else if ((double) this.velocity.X > -(double) num6 && this.direction == -1)
{
this.velocity.X -= num7;
if ((double) this.velocity.X < -(double) num6)
this.velocity.X = -num6;
}
}
if ((double) this.velocity.Y >= 0.0)
{
int num9 = 0;
if ((double) this.velocity.X < 0.0)
num9 = -1;
if ((double) this.velocity.X > 0.0)
num9 = 1;
Vector2 position = this.position;
position.X += this.velocity.X;
int index1 = (int) (((double) position.X + (double) (this.width / 2) + (double) ((this.width / 2 + 1) * num9)) / 16.0);
int index2 = (int) (((double) position.Y + (double) this.height - 1.0) / 16.0);
if (Main.tile[index1, index2] == null)
Main.tile[index1, index2] = new Tile();
if (Main.tile[index1, index2 - 1] == null)
Main.tile[index1, index2 - 1] = new Tile();
if (Main.tile[index1, index2 - 2] == null)
Main.tile[index1, index2 - 2] = new Tile();
if (Main.tile[index1, index2 - 3] == null)
Main.tile[index1, index2 - 3] = new Tile();
if (Main.tile[index1, index2 + 1] == null)
Main.tile[index1, index2 + 1] = new Tile();
if ((double) (index1 * 16) < (double) position.X + (double) this.width && (double) (index1 * 16 + 16) > (double) position.X && (Main.tile[index1, index2].nactive() && !Main.tile[index1, index2].topSlope() && !Main.tile[index1, index2 - 1].topSlope() && Main.tileSolid[(int) Main.tile[index1, index2].type] && !Main.tileSolidTop[(int) Main.tile[index1, index2].type] || Main.tile[index1, index2 - 1].halfBrick() && Main.tile[index1, index2 - 1].nactive()) && (!Main.tile[index1, index2 - 1].nactive() || !Main.tileSolid[(int) Main.tile[index1, index2 - 1].type] || Main.tileSolidTop[(int) Main.tile[index1, index2 - 1].type] || Main.tile[index1, index2 - 1].halfBrick() && (!Main.tile[index1, index2 - 4].nactive() || !Main.tileSolid[(int) Main.tile[index1, index2 - 4].type] || Main.tileSolidTop[(int) Main.tile[index1, index2 - 4].type])) && (!Main.tile[index1, index2 - 2].nactive() || !Main.tileSolid[(int) Main.tile[index1, index2 - 2].type] || Main.tileSolidTop[(int) Main.tile[index1, index2 - 2].type]) && (!Main.tile[index1, index2 - 3].nactive() || !Main.tileSolid[(int) Main.tile[index1, index2 - 3].type] || Main.tileSolidTop[(int) Main.tile[index1, index2 - 3].type]) && (!Main.tile[index1 - num9, index2 - 3].nactive() || !Main.tileSolid[(int) Main.tile[index1 - num9, index2 - 3].type]))
{
float num10 = (float) (index2 * 16);
if (Main.tile[index1, index2].halfBrick())
num10 += 8f;
if (Main.tile[index1, index2 - 1].halfBrick())
num10 -= 8f;
if ((double) num10 < (double) position.Y + (double) this.height)
{
float num11 = position.Y + (float) this.height - num10;
if ((double) num11 <= 16.1)
{
this.gfxOffY += this.position.Y + (float) this.height - num10;
this.position.Y = num10 - (float) this.height;
this.stepSpeed = (double) num11 >= 9.0 ? 2f : 1f;
}
}
}
}
if ((double) this.velocity.Y == 0.0)
{
int index3 = (int) (((double) this.position.X + (double) (this.width / 2) + (double) ((this.width / 2 + 2) * this.direction) + (double) this.velocity.X * 5.0) / 16.0);
int index4 = (int) (((double) this.position.Y + (double) this.height - 15.0) / 16.0);
if (Main.tile[index3, index4] == null)
Main.tile[index3, index4] = new Tile();
if (Main.tile[index3, index4 - 1] == null)
Main.tile[index3, index4 - 1] = new Tile();
if (Main.tile[index3, index4 - 2] == null)
Main.tile[index3, index4 - 2] = new Tile();
if (Main.tile[index3, index4 - 3] == null)
Main.tile[index3, index4 - 3] = new Tile();
if (Main.tile[index3, index4 + 1] == null)
Main.tile[index3, index4 + 1] = new Tile();
if (Main.tile[index3 + this.direction, index4 - 1] == null)
Main.tile[index3 + this.direction, index4 - 1] = new Tile();
if (Main.tile[index3 + this.direction, index4 + 1] == null)
Main.tile[index3 + this.direction, index4 + 1] = new Tile();
if (Main.tile[index3 - this.direction, index4 + 1] == null)
Main.tile[index3 - this.direction, index4 + 1] = new Tile();
int spriteDirection = this.spriteDirection;
if (this.type == 423 || this.type == 410 || this.type == 546)
spriteDirection *= -1;
if ((double) this.velocity.X < 0.0 && spriteDirection == -1 || (double) this.velocity.X > 0.0 && spriteDirection == 1)
{
bool flag6 = this.type == 410 || this.type == 423;
float num12 = 3f;
if (Main.tile[index3, index4 - 2].nactive() && Main.tileSolid[(int) Main.tile[index3, index4 - 2].type])
{
if (Main.tile[index3, index4 - 3].nactive() && Main.tileSolid[(int) Main.tile[index3, index4 - 3].type])
{
this.velocity.Y = -8.5f;
this.netUpdate = true;
}
else
{
this.velocity.Y = -7.5f;
this.netUpdate = true;
}
}
else if (Main.tile[index3, index4 - 1].nactive() && !Main.tile[index3, index4 - 1].topSlope() && Main.tileSolid[(int) Main.tile[index3, index4 - 1].type])
{
this.velocity.Y = -7f;
this.netUpdate = true;
}
else if ((double) this.position.Y + (double) this.height - (double) (index4 * 16) > 20.0 && Main.tile[index3, index4].nactive() && !Main.tile[index3, index4].topSlope() && Main.tileSolid[(int) Main.tile[index3, index4].type])
{
this.velocity.Y = -6f;
this.netUpdate = true;
}
else if ((this.directionY < 0 || (double) Math.Abs(this.velocity.X) > (double) num12) && (!flag6 || !Main.tile[index3, index4 + 1].nactive() || !Main.tileSolid[(int) Main.tile[index3, index4 + 1].type]) && (!Main.tile[index3, index4 + 2].nactive() || !Main.tileSolid[(int) Main.tile[index3, index4 + 2].type]) && (!Main.tile[index3 + this.direction, index4 + 3].nactive() || !Main.tileSolid[(int) Main.tile[index3 + this.direction, index4 + 3].type]))
{
this.velocity.Y = -8f;
this.netUpdate = true;
}
}
}
if (this.type == 423 && (double) Math.Abs(this.velocity.X) >= (double) num6 * 0.949999988079071)
{
Microsoft.Xna.Framework.Rectangle hitbox = this.Hitbox;
for (int index = 0; index < 2; ++index)
{
if (Main.rand.Next(3) == 0)
{
Dust dust = Main.dust[Dust.NewDust(hitbox.TopLeft(), hitbox.Width, hitbox.Height, 242)];
dust.velocity = Vector2.Zero;
dust.noGravity = true;
dust.fadeIn = 1f;
dust.scale = 0.5f + Main.rand.NextFloat();
}
}
}
if (this.type != 546)
return;
this.rotation += this.velocity.X * 0.05f;
this.spriteDirection = -this.direction;
}
private void AI_107_ImprovedWalkers()
{
bool flag1 = (double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0 && !this.justHit;
bool flag2 = false;
bool flag3 = false;
bool flag4 = false;
int num1 = 32;
int num2 = 15;
float num3 = 9f;
bool flag5 = false;
float num4 = 40f;
int num5 = 30;
int num6 = 0;
bool flag6 = false;
bool flag7 = true;
float num7 = 0.9f;
bool flag8 = false;
bool flag9 = false;
bool flag10 = false;
bool flag11 = false;
bool flag12 = false;
bool flag13 = false;
bool flag14 = false;
bool flag15 = true;
int num8 = 70;
int num9 = num8 / 2;
float num10 = 11f;
Vector2 vector2_1 = Vector2.Zero;
int Damage = 1;
int Type = 81;
float num11 = 700f;
float num12 = 0.0f;
float num13 = 0.1f;
Vector2? nullable = new Vector2?();
float max1 = 0.5f;
int num14 = 1;
float num15 = 1f;
bool flag16 = false;
bool flag17 = true;
bool flag18 = false;
int num16 = 30;
bool flag19 = false;
bool flag20 = false;
bool flag21 = false;
bool flag22 = false;
LegacySoundStyle legacySoundStyle = (LegacySoundStyle) null;
int maxValue1 = 0;
bool flag23 = false;
float max2 = 1f;
float num17 = 0.07f;
float num18 = 0.8f;
float num19 = (float) (this.width / 2 + 6);
bool flag24 = this.directionY < 0;
bool flag25 = false;
int num20 = 1;
bool flag26 = false;
float num21 = 0.025f;
NPCAimedTarget targetData = this.GetTargetData();
if (targetData.Type == NPCTargetType.NPC && Main.npc[this.TranslatedTargetIndex].type == 548 && Main.npc[this.TranslatedTargetIndex].dontTakeDamageFromHostiles)
{
NPCUtils.TargetClosestOldOnesInvasion(this);
targetData = this.GetTargetData();
}
if (!targetData.Invalid)
flag2 = !Collision.CanHit(this.Center, 0, 0, targetData.Center, 0, 0) && (this.direction == Math.Sign(targetData.Center.X - this.Center.X) || this.noGravity && (double) this.Distance(targetData.Center) > 50.0 && (double) this.Center.Y > (double) targetData.Center.Y);
bool flag27 = flag2 & (double) this.ai[0] <= 0.0;
if (flag27)
{
if ((double) this.velocity.Y == 0.0 || (double) Math.Abs(targetData.Center.Y - this.Center.Y) > 800.0)
{
this.noGravity = true;
this.noTileCollide = true;
}
}
else
{
this.noGravity = false;
this.noTileCollide = false;
}
bool flag28 = NPCID.Sets.FighterUsesDD2PortalAppearEffect[this.type];
bool flag29 = true;
Vector2 size;
switch (this.type)
{
case 552:
case 553:
case 554:
legacySoundStyle = SoundID.DD2_GoblinScream;
maxValue1 = 1000;
flag5 = true;
flag20 = DD2Event.EnemiesShouldChasePlayers;
if (this.type == 553)
{
num17 += 0.01f;
max2 += 0.2f;
}
if (this.type == 554)
{
num17 += 0.02f;
max2 += 0.4f;
}
if ((double) this.localAI[3] < 60.0)
{
num17 = (float) (0.00999999977648258 + (double) this.localAI[3] / 60.0 * 0.0500000007450581);
break;
}
break;
case 555:
case 556:
case 557:
maxValue1 = 800;
legacySoundStyle = SoundID.DD2_GoblinBomberScream;
int num22 = (double) this.localAI[3] >= 60.0 ? 1 : 0;
flag20 = DD2Event.EnemiesShouldChasePlayers;
flag23 = true;
flag12 = true;
flag15 = (double) this.ai[1] > 18.0;
num8 = 42;
num9 = 18;
Type = 681;
Damage = 10;
vector2_1.Y -= 14f;
num13 = 0.4f;
max1 = 0.5f;
num11 = 280f;
num10 = 6f;
if (num22 == 0)
{
num11 = 1f;
num17 = (float) (0.00999999977648258 + (double) this.localAI[3] / 60.0 * 0.0500000007450581);
}
if (this.type == 555)
{
max2 = 0.88f;
max1 = 0.6f;
Damage = Main.expertMode ? 15 : 20;
}
if (this.type == 555)
{
max2 = 0.88f;
max1 = 0.6f;
Damage = Main.expertMode ? 25 : 30;
}
if (this.type == 557)
{
max2 = 1.12f;
max1 = 0.4f;
Damage = Main.expertMode ? 35 : 40;
}
if ((double) this.ai[1] == (double) num9)
{
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_GoblinBomberThrow, this.Center);
break;
}
break;
case 561:
case 562:
case 563:
int num23 = (double) this.localAI[3] >= 60.0 ? 1 : 0;
if ((double) this.ai[1] == 82.0)
{
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_JavelinThrowersAttack, this.Center);
maxValue1 = 7;
legacySoundStyle = SoundID.DD2_JavelinThrowersTaunt;
}
flag20 = DD2Event.EnemiesShouldChasePlayers;
flag23 = true;
flag12 = true;
flag15 = (double) this.ai[1] > 82.0;
num8 = 90;
num9 = 82;
Type = 662;
if (this.type == 563)
Type = 685;
vector2_1.Y -= 14f;
num13 = 0.0f;
max1 = 0.5f;
num11 = 600f;
num10 = 13f;
if (num23 == 0)
{
num11 = 1f;
num17 = (float) (0.00999999977648258 + (double) this.localAI[3] / 60.0 * 0.0500000007450581);
}
if (this.type == 561)
{
max2 = 0.88f;
max1 = 0.6f;
Damage = Main.expertMode ? 10 : 15;
num10 = 11.5f;
num11 -= 100f;
}
if (this.type == 562)
{
max2 = 0.94f;
max1 = 0.5f;
Damage = Main.expertMode ? 20 : 30;
num10 = 12.2f;
num11 -= 50f;
}
if (this.type == 563)
{
max2 = 1f;
max1 = 0.4f;
Damage = Main.expertMode ? 30 : 45;
break;
}
break;
case 566:
case 567:
DelegateMethods.v3_1 = new Vector3(0.3f, 0.05f, 0.45f) * 1.5f;
Utils.PlotTileLine(this.Top, this.Bottom, (float) this.width, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
flag20 = DD2Event.EnemiesShouldChasePlayers;
int num24 = (double) this.localAI[3] >= 120.0 ? 1 : 0;
if (num24 == 0)
num17 = 0.0f;
if (num24 != 0)
{
this.dontTakeDamage = false;
break;
}
this.dontTakeDamage = true;
this.velocity.X = 0.0f;
flag23 = true;
flag19 = true;
this.ai[3] = 0.0f;
if ((double) this.localAI[3] == 0.0)
this.alpha = (int) byte.MaxValue;
++this.localAI[3];
float num25 = this.localAI[3];
if ((double) num25 >= 110.0)
{
this.alpha -= 26;
if (this.alpha < 0)
this.alpha = 0;
}
if ((double) num25 >= 100.0)
{
int num26 = (int) this.localAI[3] / 20;
size = this.Size;
float num27 = size.Length() / 2f / 20f;
int maxValue2 = 5;
for (int index = 0; index < num26 * 2; ++index)
{
if (Main.rand.Next(maxValue2) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 236, this.velocity.X * 1f);
dust.scale = 1f;
dust.fadeIn = 0.3f;
dust.velocity = new Vector2(Main.rand.NextFloatDirection() * 1f, -dust.velocity.Length()) * 1.25f * num27;
}
}
}
else
{
int num28 = (int) this.localAI[3] / 10;
size = this.Size;
float num29 = size.Length() / 2f / 20f;
int maxValue3 = 5;
for (int index = 0; (double) index < (double) num28 * 1.29999995231628; ++index)
{
if (Main.rand.Next(maxValue3) == 0)
{
Dust dust = Dust.NewDustDirect(this.position + new Vector2((float) (-this.width / 2), 8f), this.width + this.width, this.height, 27, this.velocity.X * 1f, Alpha: 100);
dust.scale = 1.1f;
dust.fadeIn = 0.1f;
dust.velocity = new Vector2(Main.rand.NextFloatDirection() * 0.1f, -dust.velocity.Length()) * 1.05f * num29 * Main.rand.NextFloat();
dust.velocity.Y *= Utils.InverseLerp((float) this.width * 0.75f, 0.0f, Math.Abs(dust.position.X - this.Center.X), true);
}
}
}
if ((double) num25 > 100.0 && (int) num25 % 4 == 0)
{
Gore.NewGoreDirect(this.Left, new Vector2(0.0f, -3f), Utils.SelectRandom<int>(Main.rand, 971, 972), 0.85f).velocity.X *= 0.8f;
break;
}
break;
case 568:
case 569:
num5 = 110;
num17 = 0.16f;
num18 = 0.7f;
max2 = 1.4f;
flag5 = true;
num4 = 600f;
flag20 = DD2Event.EnemiesShouldChasePlayers;
if ((double) this.localAI[3] < 60.0)
num17 = (float) (0.00999999977648258 + (double) this.localAI[3] / 60.0 * 0.0500000007450581);
SlotId slotId1;
if ((double) this.ai[0] == 0.0)
{
float[] localAi = this.localAI;
slotId1 = (SlotId) SlotId.Invalid;
double num30 = (double) ((SlotId) ref slotId1).ToFloat();
localAi[1] = (float) num30;
}
if ((double) this.ai[0] == 1.0)
{
this.HitSound = SoundID.DD2_WitherBeastCrystalImpact;
++this.ai[0];
if (Main.rand.Next(10) == 0)
{
Dust dust = Dust.NewDustDirect(this.TopLeft, this.width, this.height, 271, SpeedY: -3f, newColor: Color.Transparent, Scale: 0.6f);
dust.velocity.X /= 2f;
dust.noGravity = true;
dust.fadeIn = 1.5f;
dust.position.Y += 4f;
}
ActiveSound activeSound = Main.GetActiveSound(SlotId.FromFloat(this.localAI[1]));
if (activeSound == null)
{
float[] localAi = this.localAI;
slotId1 = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_WitherBeastAuraPulse, this.Center);
double num31 = (double) ((SlotId) ref slotId1).ToFloat();
localAi[1] = (float) num31;
}
else
activeSound.Position = this.Center;
++this.localAI[0];
if ((double) this.localAI[0] > 60.0 && Main.rand.Next(10) == 0)
{
Vector2 vector2_2 = this.Center + (Main.rand.NextFloat() * 6.283185f).ToRotationVector2() * 400f * (float) (0.300000011920929 + 0.699999988079071 * (double) Main.rand.NextFloat());
Point tileCoordinates = vector2_2.ToTileCoordinates();
if (!WorldGen.SolidTile(tileCoordinates.X, tileCoordinates.Y))
{
Dust dust = Dust.NewDustPerfect(vector2_2, 27, new Vector2?(new Vector2(0.0f, -3f)), newColor: new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue), Scale: 1.5f);
dust.velocity = this.DirectionTo(dust.position) * dust.velocity.Length();
dust.fadeIn = 1.5f;
}
}
if (Main.netMode != 2)
{
Player player = Main.player[Main.myPlayer];
if (!player.dead && player.active && (double) (player.Center - this.Center).Length() < 400.0)
player.AddBuff(195, 3, false);
}
if ((double) this.ai[1] > 0.0)
--this.ai[1];
if ((double) this.ai[1] <= 0.0)
{
this.ai[1] = 60f;
if (Main.netMode != 1)
{
int healAmount = this.lifeMax / 20;
if (healAmount > this.lifeMax - this.life)
healAmount = this.lifeMax - this.life;
if (healAmount > 0)
{
this.life += healAmount;
this.HealEffect(healAmount);
this.netUpdate = true;
break;
}
break;
}
break;
}
break;
}
break;
case 570:
case 571:
flag20 = DD2Event.EnemiesShouldChasePlayers;
flag23 = true;
flag12 = true;
flag15 = (double) this.ai[1] > 40.0;
num8 = 60;
num9 = 40;
if (this.type == 571 && (double) this.ai[1] > 10.0 && (double) this.ai[1] <= 40.0 && (int) this.ai[1] % 6 == 0)
num9 = (int) this.ai[1] - 1;
if (this.type == 570 && (double) this.ai[1] > 10.0 && (double) this.ai[1] <= 40.0 && (int) this.ai[1] % 9 == 0)
num9 = (int) this.ai[1] - 1;
Type = 671;
vector2_1.X += (float) (22 * this.direction);
num13 = 0.15f;
max1 = 1.5f;
num11 = 600f;
num10 = 13f;
num14 = 1;
num15 = 0.0f;
if (this.type == 570)
max1 = 2.5f;
Damage = Main.expertMode ? 25 : 35;
if (this.type == 571)
Damage = Main.expertMode ? 45 : 60;
max2 = 0.77f;
if ((double) this.ai[0] > 0.0)
{
if ((double) this.ai[1] == 40.0)
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_DrakinShot, this.Center);
else if ((double) this.ai[1] == 60.0)
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_DrakinBreathIn, this.Center);
}
if ((double) this.localAI[3] < 60.0)
{
num11 = 1f;
num17 = (float) (0.00999999977648258 + (double) this.localAI[3] / 60.0 * 0.0500000007450581);
break;
}
break;
case 572:
case 573:
SlotId slotId2;
if ((double) this.localAI[3] == 0.0)
{
float[] localAi1 = this.localAI;
SlotId invalid = (SlotId) SlotId.Invalid;
double num32 = (double) ((SlotId) ref invalid).ToFloat();
localAi1[0] = (float) num32;
float[] localAi2 = this.localAI;
slotId2 = (SlotId) SlotId.Invalid;
double num33 = (double) ((SlotId) ref slotId2).ToFloat();
localAi2[1] = (float) num33;
}
flag20 = DD2Event.EnemiesShouldChasePlayers;
if ((double) this.ai[1] == 2.0)
{
Main.GetActiveSound(SlotId.FromFloat(this.localAI[0]))?.Stop();
Main.GetActiveSound(SlotId.FromFloat(this.localAI[1]))?.Stop();
this.position = this.Center;
this.width = this.height = 192;
this.Center = this.position;
this.velocity = Vector2.Zero;
this.damage = (int) (80.0 * (double) Main.damageMultiplier);
this.alpha = (int) byte.MaxValue;
for (int index1 = 0; index1 < 4; ++index1)
{
int index2 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
Main.dust[index2].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
}
for (int index3 = 0; index3 < 20; ++index3)
{
int index4 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 200, Scale: 3.7f);
Main.dust[index4].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
Main.dust[index4].noGravity = true;
Main.dust[index4].velocity *= 3f;
int index5 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
Main.dust[index5].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 4f;
Main.dust[index5].velocity *= 2f;
Main.dust[index5].noGravity = true;
Main.dust[index5].fadeIn = 2.5f;
}
for (int index6 = 0; index6 < 6; ++index6)
{
int index7 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Scale: 2.7f);
Main.dust[index7].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
Main.dust[index7].noGravity = true;
Main.dust[index7].velocity *= 3f;
}
for (int index8 = 0; index8 < 12; ++index8)
{
int index9 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Scale: 1.5f);
Main.dust[index9].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
Main.dust[index9].noGravity = true;
Main.dust[index9].velocity *= 3f;
}
for (int index10 = 0; index10 < 5; ++index10)
{
int index11 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
Main.gore[index11].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
Main.gore[index11].velocity *= 0.3f;
Main.gore[index11].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
Main.gore[index11].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
}
++this.ai[0];
if ((double) this.ai[0] < 3.0)
return;
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldExplosion, this.Center);
this.life = 0;
this.HitEffect();
this.active = false;
return;
}
if ((double) this.ai[0] > 0.0 && (double) this.ai[1] == 0.0 && this.life > 0)
{
SlotId slotId3 = SlotId.FromFloat(this.localAI[0]);
if (!((SlotId) ref slotId3).IsValid)
{
float[] localAi = this.localAI;
slotId2 = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldIgnite, this.Center);
double num34 = (double) ((SlotId) ref slotId2).ToFloat();
localAi[0] = (float) num34;
}
++this.localAI[2];
if ((double) this.localAI[2] == 30.0)
{
float[] localAi3 = this.localAI;
slotId2 = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldIgniteLoop, this.Center);
double num35 = (double) ((SlotId) ref slotId2).ToFloat();
localAi3[0] = (float) num35;
float[] localAi4 = this.localAI;
slotId2 = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldScreamChargeLoop, this.Center);
double num36 = (double) ((SlotId) ref slotId2).ToFloat();
localAi4[1] = (float) num36;
}
}
if ((double) this.ai[0] > 0.0 && (double) this.ai[1] == 1.0)
{
this.ai[0] = 0.0f;
this.ai[1] = 2f;
this.netUpdate = true;
return;
}
max2 = 0.88f;
if ((double) this.ai[0] == 1.0)
this.ai[1] = 1f;
if ((double) this.ai[0] == 0.0 && (double) this.ai[1] == 1.0)
{
ActiveSound activeSound1 = Main.GetActiveSound(SlotId.FromFloat(this.localAI[0]));
if (activeSound1 == null)
{
float[] localAi = this.localAI;
slotId2 = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldIgniteLoop, this.Center);
double num37 = (double) ((SlotId) ref slotId2).ToFloat();
localAi[0] = (float) num37;
}
else
activeSound1.Position = this.Center;
ActiveSound activeSound2 = Main.GetActiveSound(SlotId.FromFloat(this.localAI[1]));
if (activeSound2 == null)
{
float[] localAi = this.localAI;
slotId2 = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldScreamChargeLoop, this.Center);
double num38 = (double) ((SlotId) ref slotId2).ToFloat();
localAi[1] = (float) num38;
}
else
activeSound2.Position = this.Center;
}
if ((double) this.ai[1] > 0.0 && (double) this.ai[0] == 0.0)
{
flag5 = true;
num5 = 40;
num4 = 64f;
num17 = 0.3f;
max2 = 4f;
Vector2 Position = this.Center + new Vector2((float) (this.spriteDirection * 12), 0.0f);
if (Main.rand.Next(6) == 0)
{
Dust dust = Dust.NewDustDirect(Position, 1, 1, 213, (float) Main.rand.Next(-2, 3), (float) Main.rand.Next(-2, 3), 100, new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0));
dust.noGravity = true;
dust.fadeIn = (float) ((double) dust.scale + 1.0 + 0.00999999977648258 * (double) Main.rand.Next(0, 51));
dust.velocity *= 0.3f;
dust.velocity.X += (float) -this.spriteDirection * 1.2f;
dust.velocity.Y += -3.5f;
dust.velocity.X += this.velocity.X;
}
if (Main.rand.Next(12) == 0)
{
Dust dust = Dust.NewDustPerfect(Position, 6, new Vector2?(this.velocity), 100);
dust.noGravity = true;
dust.velocity.Y -= 1f + Main.rand.NextFloat();
dust.scale = 1.1f;
dust.fadeIn = 0.5f;
dust.customData = (object) this;
}
}
else
{
flag5 = true;
num5 = 40;
num4 = 700f;
}
if ((double) this.localAI[3] < 60.0)
{
num17 = (float) (0.00999999977648258 + (double) this.localAI[3] / 60.0 * 0.0500000007450581);
break;
}
break;
case 576:
case 577:
maxValue1 = 700;
legacySoundStyle = SoundID.DD2_OgreRoar;
num19 -= 32f;
flag5 = true;
num6 = 60;
num4 = 130f;
num5 = 44;
flag20 = DD2Event.EnemiesShouldChasePlayers;
num7 = 0.7f;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
if ((double) this.ai[0] <= 0.0)
{
float num39 = this.ai[1];
float num40 = this.Distance(targetData.Center);
if ((double) this.localAI[3] >= 60.0)
{
if ((double) num40 <= (double) num4 + 300.0 && (double) this.localAI[0] <= 0.0)
this.ai[1] = 2f;
else if ((double) num40 > (double) num4 + 30.0)
this.ai[1] = 1f;
else if ((double) num40 <= (double) num4)
{
this.ai[1] = 0.0f;
if ((double) num39 == 1.0)
this.ai[0] = 0.0f;
}
}
if ((double) num39 != (double) this.ai[1])
this.netUpdate = true;
}
else if ((double) this.ai[1] == 2.0)
this.localAI[0] = 300f;
switch ((int) this.ai[1])
{
case 0:
num5 = 44;
if ((double) this.ai[0] == 40.0)
{
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_OgreAttack, this.Center);
break;
}
break;
case 1:
flag3 = true;
num5 = 90;
num4 = 1000f;
num6 = 240;
Damage = this.type != 576 ? (Main.expertMode ? 30 : 40) : (Main.expertMode ? 30 : 40);
flag15 = false;
vector2_1 = new Vector2((float) (this.direction * 30), -70f);
Type = 676;
if ((double) this.ai[0] == 80.0)
{
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_OgreSpit, this.Center);
break;
}
break;
case 2:
num5 = 90;
num4 = 250f;
flag4 = true;
Damage = this.type != 576 ? (Main.expertMode ? 40 : 60) : (Main.expertMode ? 40 : 60);
num9 = 36;
num1 = 56;
num2 = 41;
num3 = 13f;
flag3 = true;
Type = 683;
flag15 = false;
vector2_1 = new Vector2((float) (-this.direction * 20), (float) (this.height / 2 - 1));
if ((double) this.ai[0] == 40.0)
{
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_OgreGroundPound, this.Center);
break;
}
break;
}
if ((double) this.ai[0] < (double) -num6)
{
this.ai[0] = (float) -num6;
break;
}
break;
}
if (flag26)
{
bool flag30 = (double) this.velocity.Y == 0.0;
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && Main.npc[index].type == this.type && (double) Math.Abs(this.position.X - Main.npc[index].position.X) + (double) Math.Abs(this.position.Y - Main.npc[index].position.Y) < (double) this.width)
{
if ((double) this.position.X < (double) Main.npc[index].position.X)
this.velocity.X -= num21;
else
this.velocity.X += num21;
if ((double) this.position.Y < (double) Main.npc[index].position.Y)
this.velocity.Y -= num21;
else
this.velocity.Y += num21;
}
}
if (flag30)
this.velocity.Y = 0.0f;
}
if (flag28)
{
if ((double) this.localAI[3] == 0.0)
this.alpha = (int) byte.MaxValue;
if ((double) this.localAI[3] == 30.0)
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_EtherianPortalSpawnEnemy, this.Center);
if ((double) this.localAI[3] < 60.0)
{
++this.localAI[3];
this.alpha -= 5;
if (this.alpha < 0)
this.alpha = 0;
int num41 = (int) this.localAI[3] / 10;
size = this.Size;
float num42 = size.Length() / 2f / 20f;
int maxValue4 = 5;
if (this.type == 576 || this.type == 577)
maxValue4 = 1;
for (int index = 0; index < num41; ++index)
{
if (Main.rand.Next(maxValue4) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 27, this.velocity.X * 1f, Alpha: 100);
dust.scale = 0.55f;
dust.fadeIn = 0.7f;
dust.velocity *= 0.1f * num42;
dust.velocity += this.velocity;
}
}
}
}
bool flag31 = false;
if (flag12 | flag5 && (double) this.ai[0] > 0.0)
flag17 = false;
if (flag12 && (double) this.ai[1] > 0.0)
flag21 = true;
if (flag5 && (double) this.ai[0] > 0.0)
flag21 = true;
if (flag5)
{
if ((double) this.ai[0] < 0.0)
{
++this.ai[0];
flag1 = false;
}
if ((double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 | flag6 && targetData.Type != NPCTargetType.None && (Collision.CanHit(this.position, this.width, this.height, targetData.Position, targetData.Width, targetData.Height) ? 1 : (Collision.CanHitLine(this.position, this.width, this.height, targetData.Position, targetData.Width, targetData.Height) ? 1 : 0)) != 0 && (double) (targetData.Center - this.Center).Length() < (double) num4)
{
this.ai[0] = (float) num5;
this.netUpdate = true;
}
if ((double) this.ai[0] > 0.0)
{
this.spriteDirection = this.direction * num20;
if (flag7)
{
this.velocity.X *= num7;
flag23 = true;
flag19 = true;
this.ai[3] = 0.0f;
}
--this.ai[0];
if ((double) this.ai[0] == 0.0)
this.ai[0] = (float) -num6;
}
}
if (flag3 && (double) this.ai[0] > 0.0)
{
if (flag15)
{
NPCUtils.TargetClosestOldOnesInvasion(this);
targetData = this.GetTargetData();
}
if ((double) this.ai[0] == (double) num9)
{
Vector2 vector2_3 = this.Center + vector2_1;
Vector2 v = targetData.Center - vector2_3;
v.Y -= Math.Abs(v.X) * num13;
Vector2 vector2_4 = v.SafeNormalize(-Vector2.UnitY) * num10;
for (int index = 0; index < num14; ++index)
{
Vector2 vector2_5 = vector2_4;
Vector2 vector2_6 = vector2_3;
Vector2 velocity = !nullable.HasValue ? vector2_5 + Utils.RandomVector2(Main.rand, -max1, max1) : vector2_5 + nullable.Value;
Vector2 position = vector2_6 + vector2_4 * num15;
if (Main.netMode != 1)
Projectile.NewProjectile(position, velocity, Type, Damage, 0.0f, Main.myPlayer);
}
}
}
if (flag4 && (double) this.ai[0] > 0.0)
{
if ((double) this.velocity.Y != 0.0 && (double) this.ai[0] < (double) num2)
this.ai[0] = (float) num2;
if ((double) this.ai[0] == (double) num1)
this.velocity.Y = -num3;
}
if (!flag16 & flag17)
{
if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X * (double) this.direction < 0.0)
flag18 = true;
if ((((double) this.position.X == (double) this.oldPosition.X ? 1 : ((double) this.ai[3] >= (double) num16 ? 1 : 0)) | (flag18 ? 1 : 0)) != 0)
++this.ai[3];
else if ((double) Math.Abs(this.velocity.X) > 0.899999976158142 && (double) this.ai[3] > 0.0)
--this.ai[3];
if ((double) this.ai[3] > (double) (num16 * 10))
this.ai[3] = 0.0f;
if (this.justHit && !flag29)
this.ai[3] = 0.0f;
if ((double) this.ai[3] == (double) num16)
{
this.netUpdate = true;
if (flag29)
{
this.noGravity = true;
this.noTileCollide = true;
this.position.X += (float) (this.direction * this.width * 2);
int num43 = 20;
size = this.Size;
float num44 = size.Length() / 2f / 20f;
int maxValue5 = 5;
if (this.type == 576 || this.type == 577)
maxValue5 = 1;
for (int index = 0; index < num43; ++index)
{
if (Main.rand.Next(maxValue5) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 27, this.velocity.X * 1f, Alpha: 100);
dust.scale = 0.55f;
dust.fadeIn = 0.7f;
dust.velocity *= 3f * num44;
dust.noGravity = true;
dust.fadeIn = 1.5f;
dust.velocity *= 3f;
}
}
return;
}
}
}
if (!flag19)
{
if ((double) this.ai[3] < (double) num16 & flag20)
{
if (maxValue1 > 0 && Main.rand.Next(maxValue1) == 0)
Main.PlayTrackedSound((SoundStyle) legacySoundStyle, this.Center);
NPCUtils.TargetClosestOldOnesInvasion(this);
targetData = this.GetTargetData();
}
else if (!flag21)
{
if (flag22 && this.timeLeft > 10)
this.timeLeft = 10;
if ((double) this.velocity.X == 0.0)
{
if ((double) this.velocity.Y == 0.0)
{
++this.ai[2];
if ((double) this.ai[2] >= 2.0)
{
this.direction *= -1;
this.spriteDirection = this.direction * num20;
this.ai[2] = 0.0f;
}
}
}
else
this.ai[2] = 0.0f;
if (this.direction == 0)
this.direction = 1;
}
}
if (!flag23)
{
if ((double) this.velocity.X < -(double) max2 || (double) this.velocity.X > (double) max2)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * num18;
}
else if ((double) this.velocity.X < (double) max2 && this.direction == 1 || (double) this.velocity.X > -(double) max2 && this.direction == -1)
this.velocity.X = MathHelper.Clamp(this.velocity.X + num17 * (float) this.direction, -max2, max2);
}
if (flag12)
{
if (this.confused)
{
this.ai[0] = 0.0f;
}
else
{
if ((double) this.ai[1] > 0.0)
--this.ai[1];
if (this.justHit)
{
this.ai[1] = 30f;
this.ai[0] = 0.0f;
}
if ((double) this.ai[0] > 0.0)
{
if (flag15)
{
NPCUtils.TargetClosestOldOnesInvasion(this);
targetData = this.GetTargetData();
}
if ((double) this.ai[1] == (double) num9)
{
Vector2 vector2_7 = this.Center + vector2_1;
Vector2 v = targetData.Center - vector2_7;
v.Y -= Math.Abs(v.X) * num13;
Vector2 vector2_8 = v.SafeNormalize(-Vector2.UnitY) * num10;
for (int index = 0; index < num14; ++index)
{
Vector2 vector2_9 = vector2_7;
Vector2 vector2_10 = vector2_8;
Vector2 velocity = !nullable.HasValue ? vector2_10 + Utils.RandomVector2(Main.rand, -max1, max1) : vector2_10 + nullable.Value;
Vector2 position = vector2_9 + velocity * num15;
if (Main.netMode != 1)
Projectile.NewProjectile(position, velocity, Type, Damage, 0.0f, Main.myPlayer);
}
this.ai[0] = (double) Math.Abs(vector2_8.Y) <= (double) Math.Abs(vector2_8.X) * 2.0 ? ((double) Math.Abs(vector2_8.X) <= (double) Math.Abs(vector2_8.Y) * 2.0 ? ((double) vector2_8.Y > 0.0 ? 2f : 4f) : 3f) : ((double) vector2_8.Y > 0.0 ? 1f : 5f);
}
if ((double) this.velocity.Y != 0.0 && !flag14 || (double) this.ai[1] <= 0.0)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
}
else if (!flag13)
{
this.velocity.X *= 0.9f;
this.spriteDirection = this.direction * num20;
}
}
if ((double) this.ai[0] <= 0.0 | flag13 && (double) this.velocity.Y == 0.0 | flag14 && (double) this.ai[1] <= 0.0 && targetData.Type != NPCTargetType.None && Collision.CanHit(this.position, this.width, this.height, targetData.Position, targetData.Width, targetData.Height))
{
Vector2 vector2_11 = targetData.Center - this.Center;
if ((double) vector2_11.Length() < (double) num11)
{
this.netUpdate = true;
this.velocity.X *= 0.5f;
this.ai[0] = 3f;
this.ai[1] = (float) num8;
this.ai[0] = (double) Math.Abs(vector2_11.Y) <= (double) Math.Abs(vector2_11.X) * 2.0 ? ((double) Math.Abs(vector2_11.X) <= (double) Math.Abs(vector2_11.Y) * 2.0 ? ((double) vector2_11.Y > 0.0 ? 2f : 4f) : 3f) : ((double) vector2_11.Y > 0.0 ? 1f : 5f);
}
}
if ((double) this.ai[0] <= 0.0 | flag13)
{
bool flag32 = (double) this.Distance(targetData.Center) < (double) num12;
if (flag32 && Collision.CanHitLine(this.position, this.width, this.height, targetData.Position, targetData.Width, targetData.Height))
this.ai[3] = 0.0f;
if ((((double) this.velocity.X < -(double) max2 ? 1 : ((double) this.velocity.X > (double) max2 ? 1 : 0)) | (flag32 ? 1 : 0)) != 0)
{
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= num18;
}
else if ((double) this.velocity.X < (double) max2 && this.direction == 1 || (double) this.velocity.X > -(double) max2 && this.direction == -1)
this.velocity.X = MathHelper.Clamp(this.velocity.X + num17 * (float) this.direction, -max2, max2);
}
}
}
if ((double) this.velocity.Y == 0.0)
{
int index12 = (int) ((double) this.Bottom.Y + 7.0) / 16;
int num45 = (int) this.Left.X / 16;
int num46 = (int) this.Right.X / 16;
int index13;
for (int index14 = num45; index14 <= num46; index14 = index13 + 1)
{
index13 = Utils.Clamp<int>(index14, 0, Main.maxTilesX);
index12 = Utils.Clamp<int>(index12, 0, Main.maxTilesY);
Tile tile = Main.tile[index13, index12];
if (tile == null)
return;
if (tile.nactive() && Main.tileSolid[(int) tile.type])
{
flag31 = true;
break;
}
}
}
Point tileCoordinates1 = this.Center.ToTileCoordinates();
if (WorldGen.InWorld(tileCoordinates1.X, tileCoordinates1.Y, 5) && !this.noGravity)
{
Vector2 cPosition;
int cWidth;
int cHeight;
this.GetTileCollisionParameters(out cPosition, out cWidth, out cHeight);
Vector2 vector2_12 = this.position - cPosition;
Collision.StepUp(ref cPosition, ref this.velocity, cWidth, cHeight, ref this.stepSpeed, ref this.gfxOffY);
this.position = cPosition + vector2_12;
}
if (flag31)
{
int index = (int) ((double) this.Center.X + (double) num19 * (double) this.direction) / 16;
int j = ((int) this.Bottom.Y - 15) / 16;
bool flag33 = (double) this.position.Y + (double) this.height - (double) (j * 16) > 20.0;
Tile tileSafely1 = Framing.GetTileSafely(index + this.direction, j + 1);
Tile tileSafely2 = Framing.GetTileSafely(index, j + 1);
Tile tileSafely3 = Framing.GetTileSafely(index, j);
Tile tileSafely4 = Framing.GetTileSafely(index, j - 1);
Tile tileSafely5 = Framing.GetTileSafely(index, j - 2);
Tile tileSafely6 = Framing.GetTileSafely(index, j - 3);
if (flag8 && tileSafely4.nactive() && (tileSafely4.type == (ushort) 10 || tileSafely4.type == (ushort) 388))
{
++this.ai[0];
this.ai[3] = 0.0f;
if ((double) this.ai[0] >= 60.0)
{
if (flag9)
this.ai[1] = 0.0f;
int num47 = 5;
if (Main.tile[index, j - 1].type == (ushort) 388)
num47 = 2;
this.velocity.X = 0.5f * (float) -this.direction;
this.ai[1] += (float) num47;
bool flag34 = false;
if ((double) this.ai[1] >= 10.0)
{
flag34 = true;
this.ai[1] = 10f;
}
if (flag10)
flag34 = true;
WorldGen.KillTile(index, j - 1, true);
if (Main.netMode != 1 & flag34)
{
if (flag11)
{
WorldGen.KillTile(index, j - 1);
if (Main.netMode == 2)
NetMessage.SendData(17, number2: ((float) index), number3: ((float) (j - 1)));
}
else
{
if (tileSafely4.type == (ushort) 10)
{
bool flag35 = WorldGen.OpenDoor(index, j - 1, this.direction);
if (!flag35)
{
this.ai[3] = (float) num16;
this.netUpdate = true;
}
if (Main.netMode == 2 & flag35)
NetMessage.SendData(19, number2: ((float) index), number3: ((float) (j - 1)), number4: ((float) this.direction));
}
if (tileSafely4.type == (ushort) 388)
{
bool flag36 = WorldGen.ShiftTallGate(index, j - 1, false);
if (!flag36)
{
this.ai[3] = (float) num16;
this.netUpdate = true;
}
if (Main.netMode == 2 & flag36)
NetMessage.SendData(19, number: 4, number2: ((float) index), number3: ((float) (j - 1)), number4: ((float) this.direction));
}
}
}
}
}
else
{
if ((double) this.velocity.X * (double) (this.spriteDirection * num20) > 0.0)
{
if (this.height >= 32 && tileSafely5.nactive() && Main.tileSolid[(int) tileSafely5.type])
{
this.netUpdate = true;
this.velocity.Y = -7f;
if (tileSafely6.nactive() && Main.tileSolid[(int) tileSafely6.type])
this.velocity.Y = -8f;
}
else if (tileSafely4.nactive() && Main.tileSolid[(int) tileSafely4.type])
{
this.velocity.Y = -6f;
this.netUpdate = true;
}
else if (flag33 && tileSafely3.nactive() && !tileSafely3.topSlope() && Main.tileSolid[(int) tileSafely3.type])
{
this.velocity.Y = -5f;
this.netUpdate = true;
}
else if (flag24 && (!tileSafely2.nactive() || !Main.tileSolid[(int) tileSafely2.type]) && (!tileSafely1.nactive() || !Main.tileSolid[(int) tileSafely1.type]))
{
this.velocity.X *= 1.5f;
this.velocity.Y = -8f;
this.netUpdate = true;
}
else if (flag8)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
}
if ((double) this.velocity.Y == 0.0 & flag1 && (double) this.ai[3] == 1.0)
{
this.velocity.Y = -5f;
this.netUpdate = true;
}
}
if (flag25 && (double) this.velocity.Y == 0.0 && (double) Math.Abs(targetData.Center.X - this.Center.X) < 100.0 && (double) Math.Abs(targetData.Center.Y - this.Center.Y) < 50.0 && (double) Math.Abs(this.velocity.X) >= 1.0 && (double) this.velocity.X * (double) this.direction > 0.0)
{
this.velocity.X = MathHelper.Clamp(this.velocity.X * 2f, -3f, 3f);
this.velocity.Y = -4f;
this.netAlways = true;
}
}
}
else if (flag8)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
}
if (!flag27 || !this.noTileCollide)
return;
if (flag28)
{
if (this.alpha < 60)
this.alpha += 20;
this.localAI[3] = 40f;
}
int num48 = (double) this.velocity.Y == 0.0 ? 1 : 0;
if ((double) Math.Abs(this.Center.X - targetData.Center.X) > 200.0)
{
this.spriteDirection = this.direction = (double) targetData.Center.X > (double) this.Center.X ? 1 : -1;
this.velocity.X = MathHelper.Lerp(this.velocity.X, (float) this.direction, 0.05f);
}
int Width = 80;
int height = this.height;
Vector2 Position1 = new Vector2(this.Center.X - (float) (Width / 2), this.position.Y + (float) this.height - (float) height);
bool flag37 = false;
if ((double) this.position.Y + (double) this.height < (double) targetData.Position.Y + (double) targetData.Height - 16.0)
flag37 = true;
if (flag37)
this.velocity.Y += 0.5f;
else if (Collision.SolidCollision(Position1, Width, height) || (double) targetData.Center.Y - (double) this.Center.Y < -100.0)
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y = 0.0f;
if ((double) this.velocity.Y > -0.2)
this.velocity.Y -= 0.025f;
else
this.velocity.Y -= 0.2f;
if ((double) this.velocity.Y < -4.0)
this.velocity.Y = -4f;
}
else
{
if ((double) this.velocity.Y < 0.0)
this.velocity.Y = 0.0f;
if ((double) this.velocity.Y < 0.1)
this.velocity.Y += 0.025f;
else
this.velocity.Y += 0.5f;
}
if ((double) this.velocity.Y > 10.0)
this.velocity.Y = 10f;
if (num48 == 0)
return;
this.velocity.Y = 0.0f;
}
private void AI_084_LunaticCultist()
{
if ((double) this.ai[0] != -1.0 && Main.rand.Next(1000) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(88, 92));
bool expertMode = Main.expertMode;
bool flag1 = this.life <= this.lifeMax / 2;
int num1 = 120;
int Damage1 = 35;
if (expertMode)
{
num1 = 90;
Damage1 = 25;
}
int num2 = 18;
int num3 = 3;
int Damage2 = 30;
if (expertMode)
{
num2 = 12;
num3 = 4;
Damage2 = 20;
}
int num4 = 80;
int Damage3 = 45;
if (expertMode)
{
num4 = 40;
Damage3 = 30;
}
int num5 = 20;
int num6 = 2;
if (expertMode)
{
num5 = 30;
num6 = 2;
}
int num7 = 20;
int num8 = 3;
bool flag2 = this.type == 439;
bool flag3 = false;
bool flag4 = false;
if (flag1)
this.defense = (int) ((double) this.defDefense * 0.649999976158142);
if (!flag2)
{
if (((double) this.ai[3] < 0.0 || !Main.npc[(int) this.ai[3]].active ? 1 : (Main.npc[(int) this.ai[3]].type != 439 ? 1 : 0)) != 0)
{
this.life = 0;
this.HitEffect();
this.active = false;
return;
}
this.ai[0] = Main.npc[(int) this.ai[3]].ai[0];
this.ai[1] = Main.npc[(int) this.ai[3]].ai[1];
if ((double) this.ai[0] == 5.0)
{
if (this.justHit)
{
this.life = 0;
this.HitEffect();
this.active = false;
if (Main.netMode != 1)
NetMessage.SendData(23, number: this.whoAmI);
NPC npc = Main.npc[(int) this.ai[3]];
npc.ai[0] = 6f;
npc.ai[1] = 0.0f;
npc.netUpdate = true;
}
}
else
{
flag3 = true;
flag4 = true;
}
}
else if ((double) this.ai[0] == 5.0 && (double) this.ai[1] >= 120.0 && (double) this.ai[1] < 420.0 && this.justHit)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
++this.ai[3];
this.velocity = Vector2.Zero;
this.netUpdate = true;
List<int> intList = new List<int>();
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 440 && (double) Main.npc[index].ai[3] == (double) this.whoAmI)
intList.Add(index);
}
int num9 = 10;
if (Main.expertMode)
num9 = 3;
foreach (int number in intList)
{
NPC npc = Main.npc[number];
if ((double) npc.localAI[1] == (double) this.localAI[1] && num9 > 0)
{
--num9;
npc.life = 0;
npc.HitEffect();
npc.active = false;
if (Main.netMode != 1)
NetMessage.SendData(23, number: number);
}
else if (num9 > 0)
{
--num9;
npc.life = 0;
npc.HitEffect();
npc.active = false;
}
}
Main.projectile[(int) this.ai[2]].ai[1] = -1f;
Main.projectile[(int) this.ai[2]].netUpdate = true;
}
Vector2 center1 = this.Center;
Player player = Main.player[this.target];
if (this.target < 0 || this.target == (int) byte.MaxValue || player.dead || !player.active)
{
this.TargetClosest(false);
player = Main.player[this.target];
this.netUpdate = true;
}
if (player.dead || (double) Vector2.Distance(player.Center, center1) > 5600.0)
{
this.life = 0;
this.HitEffect();
this.active = false;
if (Main.netMode != 1)
NetMessage.SendData(28, number: this.whoAmI, number2: -1f);
new List<int>() { this.whoAmI };
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 440 && (double) Main.npc[index].ai[3] == (double) this.whoAmI)
{
Main.npc[index].life = 0;
Main.npc[index].HitEffect();
Main.npc[index].active = false;
if (Main.netMode != 1)
NetMessage.SendData(28, number: this.whoAmI, number2: -1f);
}
}
}
float num10 = this.ai[3];
if ((double) this.localAI[0] == 0.0)
{
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 89);
this.localAI[0] = 1f;
this.alpha = (int) byte.MaxValue;
this.rotation = 0.0f;
if (Main.netMode != 1)
{
this.ai[0] = -1f;
this.netUpdate = true;
}
}
if ((double) this.ai[0] == -1.0)
{
this.alpha -= 5;
if (this.alpha < 0)
this.alpha = 0;
++this.ai[1];
if ((double) this.ai[1] >= 420.0)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
else if ((double) this.ai[1] > 360.0)
{
this.velocity = this.velocity * 0.95f;
if ((double) this.localAI[2] != 13.0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 105);
this.localAI[2] = 13f;
}
else if ((double) this.ai[1] > 300.0)
{
this.velocity = -Vector2.UnitY;
this.localAI[2] = 10f;
}
else
this.localAI[2] = (double) this.ai[1] <= 120.0 ? 0.0f : 1f;
flag3 = true;
flag4 = true;
}
if ((double) this.ai[0] == 0.0)
{
if ((double) this.ai[1] == 0.0)
this.TargetClosest(false);
this.localAI[2] = 10f;
int num11 = Math.Sign(player.Center.X - center1.X);
if (num11 != 0)
this.direction = this.spriteDirection = num11;
++this.ai[1];
if ((double) this.ai[1] >= 40.0 & flag2)
{
int num12 = 0;
if (flag1)
{
switch ((int) this.ai[3])
{
case 0:
num12 = 0;
break;
case 1:
num12 = 1;
break;
case 2:
num12 = 0;
break;
case 3:
num12 = 5;
break;
case 4:
num12 = 0;
break;
case 5:
num12 = 3;
break;
case 6:
num12 = 0;
break;
case 7:
num12 = 5;
break;
case 8:
num12 = 0;
break;
case 9:
num12 = 2;
break;
case 10:
num12 = 0;
break;
case 11:
num12 = 3;
break;
case 12:
num12 = 0;
break;
case 13:
num12 = 4;
this.ai[3] = -1f;
break;
default:
this.ai[3] = -1f;
break;
}
}
else
{
switch ((int) this.ai[3])
{
case 0:
num12 = 0;
break;
case 1:
num12 = 1;
break;
case 2:
num12 = 0;
break;
case 3:
num12 = 2;
break;
case 4:
num12 = 0;
break;
case 5:
num12 = 3;
break;
case 6:
num12 = 0;
break;
case 7:
num12 = 1;
break;
case 8:
num12 = 0;
break;
case 9:
num12 = 2;
break;
case 10:
num12 = 0;
break;
case 11:
num12 = 4;
this.ai[3] = -1f;
break;
default:
this.ai[3] = -1f;
break;
}
}
int maxValue = 6;
if (this.life < this.lifeMax / 3)
maxValue = 4;
if (this.life < this.lifeMax / 4)
maxValue = 3;
if (expertMode & flag1 && Main.rand.Next(maxValue) == 0 && num12 != 0 && num12 != 4 && num12 != 5 && NPC.CountNPCS(523) < 10)
num12 = 6;
if (num12 == 0)
{
float num13 = (float) Math.Ceiling((double) (player.Center + new Vector2(0.0f, -100f) - center1).Length() / 50.0);
if ((double) num13 == 0.0)
num13 = 1f;
List<int> intList = new List<int>();
int num14 = 0;
intList.Add(this.whoAmI);
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 440 && (double) Main.npc[index].ai[3] == (double) this.whoAmI)
intList.Add(index);
}
bool flag5 = intList.Count % 2 == 0;
foreach (int index in intList)
{
NPC npc1 = Main.npc[index];
Vector2 center2 = npc1.Center;
float num15 = (float) ((double) ((num14 + flag5.ToInt() + 1) / 2) * 6.28318548202515 * 0.400000005960464) / (float) intList.Count;
if (num14 % 2 == 1)
num15 *= -1f;
if (intList.Count == 1)
num15 = 0.0f;
Vector2 vector2_1 = new Vector2(0.0f, -1f).RotatedBy((double) num15) * new Vector2(300f, 200f);
Vector2 vector2_2 = player.Center + vector2_1 - center2;
npc1.ai[0] = 1f;
npc1.ai[1] = num13 * 2f;
npc1.velocity = vector2_2 / num13;
if (this.whoAmI >= npc1.whoAmI)
{
NPC npc2 = npc1;
npc2.position = npc2.position - npc1.velocity;
}
npc1.netUpdate = true;
++num14;
}
}
if (num12 == 1)
{
this.ai[0] = 3f;
this.ai[1] = 0.0f;
}
else if (num12 == 2)
{
this.ai[0] = 2f;
this.ai[1] = 0.0f;
}
else if (num12 == 3)
{
this.ai[0] = 4f;
this.ai[1] = 0.0f;
}
else if (num12 == 4)
{
this.ai[0] = 5f;
this.ai[1] = 0.0f;
}
if (num12 == 5)
{
this.ai[0] = 7f;
this.ai[1] = 0.0f;
}
if (num12 == 6)
{
this.ai[0] = 8f;
this.ai[1] = 0.0f;
}
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 1.0)
{
flag3 = true;
this.localAI[2] = 10f;
if ((double) (int) this.ai[1] % 2.0 != 0.0 && (double) this.ai[1] != 1.0)
this.position = this.position - this.velocity;
--this.ai[1];
if ((double) this.ai[1] <= 0.0)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
++this.ai[3];
this.velocity = Vector2.Zero;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 2.0)
{
this.localAI[2] = 11f;
Vector2 vec1 = Vector2.Normalize(player.Center - center1);
if (vec1.HasNaNs())
vec1 = new Vector2((float) this.direction, 0.0f);
if ((double) this.ai[1] >= 4.0 & flag2 && (int) ((double) this.ai[1] - 4.0) % num1 == 0)
{
if (Main.netMode != 1)
{
List<int> intList = new List<int>();
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 440 && (double) Main.npc[index].ai[3] == (double) this.whoAmI)
intList.Add(index);
}
foreach (int index1 in intList)
{
NPC npc = Main.npc[index1];
Vector2 center3 = npc.Center;
int num16 = Math.Sign(player.Center.X - center3.X);
if (num16 != 0)
npc.direction = npc.spriteDirection = num16;
if (Main.netMode != 1)
{
Vector2 vec2 = Vector2.Normalize(player.Center - center3 + player.velocity * 20f);
if (vec2.HasNaNs())
vec2 = new Vector2((float) this.direction, 0.0f);
Vector2 vector2_3 = center3 + new Vector2((float) (this.direction * 30), 12f);
for (int index2 = 0; index2 < 1; ++index2)
{
Vector2 vector2_4 = (vec2 * (float) (6.0 + Main.rand.NextDouble() * 4.0)).RotatedByRandom(0.523598790168762);
Projectile.NewProjectile(vector2_3.X, vector2_3.Y, vector2_4.X, vector2_4.Y, 468, 18, 0.0f, Main.myPlayer);
}
}
}
}
if (Main.netMode != 1)
{
Vector2 vec3 = Vector2.Normalize(player.Center - center1 + player.velocity * 20f);
if (vec3.HasNaNs())
vec3 = new Vector2((float) this.direction, 0.0f);
Vector2 vector2_5 = this.Center + new Vector2((float) (this.direction * 30), 12f);
for (int index = 0; index < 1; ++index)
{
Vector2 vector2_6 = vec3 * 4f;
Projectile.NewProjectile(vector2_5.X, vector2_5.Y, vector2_6.X, vector2_6.Y, 464, Damage1, 0.0f, Main.myPlayer, ai1: 1f);
}
}
}
++this.ai[1];
if ((double) this.ai[1] >= (double) (4 + num1))
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
++this.ai[3];
this.velocity = Vector2.Zero;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 3.0)
{
this.localAI[2] = 11f;
Vector2 vec4 = Vector2.Normalize(player.Center - center1);
if (vec4.HasNaNs())
vec4 = new Vector2((float) this.direction, 0.0f);
if ((double) this.ai[1] >= 4.0 & flag2 && (int) ((double) this.ai[1] - 4.0) % num2 == 0)
{
if ((int) ((double) this.ai[1] - 4.0) / num2 == 2)
{
List<int> intList = new List<int>();
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 440 && (double) Main.npc[index].ai[3] == (double) this.whoAmI)
intList.Add(index);
}
if (Main.netMode != 1)
{
foreach (int index3 in intList)
{
NPC npc = Main.npc[index3];
Vector2 center4 = npc.Center;
int num17 = Math.Sign(player.Center.X - center4.X);
if (num17 != 0)
npc.direction = npc.spriteDirection = num17;
if (Main.netMode != 1)
{
Vector2 vec5 = Vector2.Normalize(player.Center - center4 + player.velocity * 20f);
if (vec5.HasNaNs())
vec5 = new Vector2((float) this.direction, 0.0f);
Vector2 vector2_7 = center4 + new Vector2((float) (this.direction * 30), 12f);
for (int index4 = 0; index4 < 1; ++index4)
{
Vector2 vector2_8 = (vec5 * (float) (6.0 + Main.rand.NextDouble() * 4.0)).RotatedByRandom(0.523598790168762);
Projectile.NewProjectile(vector2_7.X, vector2_7.Y, vector2_8.X, vector2_8.Y, 468, 18, 0.0f, Main.myPlayer);
}
}
}
}
}
int num18 = Math.Sign(player.Center.X - center1.X);
if (num18 != 0)
this.direction = this.spriteDirection = num18;
if (Main.netMode != 1)
{
Vector2 vec6 = Vector2.Normalize(player.Center - center1 + player.velocity * 20f);
if (vec6.HasNaNs())
vec6 = new Vector2((float) this.direction, 0.0f);
Vector2 vector2_9 = this.Center + new Vector2((float) (this.direction * 30), 12f);
for (int index = 0; index < 1; ++index)
{
Vector2 vector2_10 = (vec6 * (float) (6.0 + Main.rand.NextDouble() * 4.0)).RotatedByRandom(0.523598790168762);
Projectile.NewProjectile(vector2_9.X, vector2_9.Y, vector2_10.X, vector2_10.Y, 467, Damage2, 0.0f, Main.myPlayer);
}
}
}
++this.ai[1];
if ((double) this.ai[1] >= (double) (4 + num2 * num3))
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
++this.ai[3];
this.velocity = Vector2.Zero;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 4.0)
{
this.localAI[2] = !flag2 ? 11f : 12f;
if ((double) this.ai[1] == 20.0 & flag2 && Main.netMode != 1)
{
List<int> intList = new List<int>();
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 440 && (double) Main.npc[index].ai[3] == (double) this.whoAmI)
intList.Add(index);
}
foreach (int index5 in intList)
{
NPC npc = Main.npc[index5];
Vector2 center5 = npc.Center;
int num19 = Math.Sign(player.Center.X - center5.X);
if (num19 != 0)
npc.direction = npc.spriteDirection = num19;
if (Main.netMode != 1)
{
Vector2 vec = Vector2.Normalize(player.Center - center5 + player.velocity * 20f);
if (vec.HasNaNs())
vec = new Vector2((float) this.direction, 0.0f);
Vector2 vector2_11 = center5 + new Vector2((float) (this.direction * 30), 12f);
for (int index6 = 0; index6 < 1; ++index6)
{
Vector2 vector2_12 = (vec * (float) (6.0 + Main.rand.NextDouble() * 4.0)).RotatedByRandom(0.523598790168762);
Projectile.NewProjectile(vector2_11.X, vector2_11.Y, vector2_12.X, vector2_12.Y, 468, 18, 0.0f, Main.myPlayer);
}
}
}
if ((int) ((double) this.ai[1] - 20.0) % num4 == 0)
Projectile.NewProjectile(this.Center.X, this.Center.Y - 100f, 0.0f, 0.0f, 465, Damage3, 0.0f, Main.myPlayer);
}
++this.ai[1];
if ((double) this.ai[1] >= (double) (20 + num4))
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
++this.ai[3];
this.velocity = Vector2.Zero;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 5.0)
{
this.localAI[2] = 10f;
if (Vector2.Normalize(player.Center - center1).HasNaNs())
{
Vector2 vector2_13 = new Vector2((float) this.direction, 0.0f);
}
if ((double) this.ai[1] >= 0.0 && (double) this.ai[1] < 30.0)
{
flag3 = true;
flag4 = true;
this.alpha = (int) (((double) this.ai[1] - 0.0) / 30.0 * (double) byte.MaxValue);
}
else if ((double) this.ai[1] >= 30.0 && (double) this.ai[1] < 90.0)
{
if ((((double) this.ai[1] != 30.0 ? 0 : (Main.netMode != 1 ? 1 : 0)) & (flag2 ? 1 : 0)) != 0)
{
++this.localAI[1];
Vector2 spinningpoint = new Vector2(180f, 0.0f);
List<int> intList = new List<int>();
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 440 && (double) Main.npc[index].ai[3] == (double) this.whoAmI)
intList.Add(index);
}
int num20 = 6 - intList.Count;
if (num20 > 2)
num20 = 2;
int length = intList.Count + num20 + 1;
float[] numArray = new float[length];
for (int index = 0; index < numArray.Length; ++index)
numArray[index] = Vector2.Distance(this.Center + spinningpoint.RotatedBy((double) index * 6.28318548202515 / (double) length - 1.57079637050629), player.Center);
int index7 = 0;
for (int index8 = 1; index8 < numArray.Length; ++index8)
{
if ((double) numArray[index7] > (double) numArray[index8])
index7 = index8;
}
int num21 = index7 >= length / 2 ? index7 - length / 2 : index7 + length / 2;
int num22 = num20;
for (int index9 = 0; index9 < numArray.Length; ++index9)
{
if (num21 != index9)
{
Vector2 vector2_14 = this.Center + spinningpoint.RotatedBy((double) index9 * 6.28318548202515 / (double) length - 1.57079637050629);
if (num22-- > 0)
{
int index10 = NPC.NewNPC((int) vector2_14.X, (int) vector2_14.Y + this.height / 2, 440, this.whoAmI);
Main.npc[index10].ai[3] = (float) this.whoAmI;
Main.npc[index10].netUpdate = true;
Main.npc[index10].localAI[1] = this.localAI[1];
}
else
{
int number = intList[-num22 - 1];
Main.npc[number].Center = vector2_14;
NetMessage.SendData(23, number: number);
}
}
}
this.ai[2] = (float) Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 490, 0, 0.0f, Main.myPlayer, ai1: ((float) this.whoAmI));
this.Center = this.Center + spinningpoint.RotatedBy((double) num21 * 6.28318548202515 / (double) length - 1.57079637050629);
this.netUpdate = true;
intList.Clear();
}
flag3 = true;
flag4 = true;
this.alpha = (int) byte.MaxValue;
if (flag2)
{
Vector2 vector2_15 = Main.projectile[(int) this.ai[2]].Center - this.Center;
if (vector2_15 == Vector2.Zero)
vector2_15 = -Vector2.UnitY;
vector2_15.Normalize();
this.localAI[2] = (double) Math.Abs(vector2_15.Y) >= 0.769999980926514 ? ((double) vector2_15.Y >= 0.0 ? 10f : 12f) : 11f;
int num23 = Math.Sign(vector2_15.X);
if (num23 != 0)
this.direction = this.spriteDirection = num23;
}
else
{
Vector2 vector2_16 = Main.projectile[(int) Main.npc[(int) this.ai[3]].ai[2]].Center - this.Center;
if (vector2_16 == Vector2.Zero)
vector2_16 = -Vector2.UnitY;
vector2_16.Normalize();
this.localAI[2] = (double) Math.Abs(vector2_16.Y) >= 0.769999980926514 ? ((double) vector2_16.Y >= 0.0 ? 10f : 12f) : 11f;
int num24 = Math.Sign(vector2_16.X);
if (num24 != 0)
this.direction = this.spriteDirection = num24;
}
}
else if ((double) this.ai[1] >= 90.0 && (double) this.ai[1] < 120.0)
{
flag3 = true;
flag4 = true;
this.alpha = (int) byte.MaxValue - (int) (((double) this.ai[1] - 90.0) / 30.0 * (double) byte.MaxValue);
}
else if ((double) this.ai[1] >= 120.0 && (double) this.ai[1] < 420.0)
{
flag4 = true;
this.alpha = 0;
if (flag2)
{
Vector2 vector2_17 = Main.projectile[(int) this.ai[2]].Center - this.Center;
if (vector2_17 == Vector2.Zero)
vector2_17 = -Vector2.UnitY;
vector2_17.Normalize();
this.localAI[2] = (double) Math.Abs(vector2_17.Y) >= 0.769999980926514 ? ((double) vector2_17.Y >= 0.0 ? 10f : 12f) : 11f;
int num25 = Math.Sign(vector2_17.X);
if (num25 != 0)
this.direction = this.spriteDirection = num25;
}
else
{
Vector2 vector2_18 = Main.projectile[(int) Main.npc[(int) this.ai[3]].ai[2]].Center - this.Center;
if (vector2_18 == Vector2.Zero)
vector2_18 = -Vector2.UnitY;
vector2_18.Normalize();
this.localAI[2] = (double) Math.Abs(vector2_18.Y) >= 0.769999980926514 ? ((double) vector2_18.Y >= 0.0 ? 10f : 12f) : 11f;
int num26 = Math.Sign(vector2_18.X);
if (num26 != 0)
this.direction = this.spriteDirection = num26;
}
}
++this.ai[1];
if ((double) this.ai[1] >= 420.0)
{
flag4 = true;
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
++this.ai[3];
this.velocity = Vector2.Zero;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 6.0)
{
this.localAI[2] = 13f;
++this.ai[1];
if ((double) this.ai[1] >= 120.0)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
++this.ai[3];
this.velocity = Vector2.Zero;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 7.0)
{
this.localAI[2] = 11f;
Vector2 vec7 = Vector2.Normalize(player.Center - center1);
if (vec7.HasNaNs())
vec7 = new Vector2((float) this.direction, 0.0f);
if ((double) this.ai[1] >= 4.0 & flag2 && (int) ((double) this.ai[1] - 4.0) % num5 == 0)
{
if ((int) ((double) this.ai[1] - 4.0) / num5 == 2)
{
List<int> intList = new List<int>();
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 440 && (double) Main.npc[index].ai[3] == (double) this.whoAmI)
intList.Add(index);
}
foreach (int index11 in intList)
{
NPC npc = Main.npc[index11];
Vector2 center6 = npc.Center;
int num27 = Math.Sign(player.Center.X - center6.X);
if (num27 != 0)
npc.direction = npc.spriteDirection = num27;
if (Main.netMode != 1)
{
Vector2 vec8 = Vector2.Normalize(player.Center - center6 + player.velocity * 20f);
if (vec8.HasNaNs())
vec8 = new Vector2((float) this.direction, 0.0f);
Vector2 vector2_19 = center6 + new Vector2((float) (this.direction * 30), 12f);
for (int index12 = 0; (double) index12 < 5.0; ++index12)
{
Vector2 vector2_20 = (vec8 * (float) (6.0 + Main.rand.NextDouble() * 4.0)).RotatedByRandom(1.25663709640503);
Projectile.NewProjectile(vector2_19.X, vector2_19.Y, vector2_20.X, vector2_20.Y, 468, 18, 0.0f, Main.myPlayer);
}
}
}
}
int num28 = Math.Sign(player.Center.X - center1.X);
if (num28 != 0)
this.direction = this.spriteDirection = num28;
if (Main.netMode != 1)
{
Vector2 vec9 = Vector2.Normalize(player.Center - center1 + player.velocity * 20f);
if (vec9.HasNaNs())
vec9 = new Vector2((float) this.direction, 0.0f);
Vector2 vector2_21 = this.Center + new Vector2((float) (this.direction * 30), 12f);
float num29 = 8f;
float num30 = 0.2513274f;
for (int index13 = 0; (double) index13 < 5.0; ++index13)
{
Vector2 vector2_22 = (vec9 * num29).RotatedBy((double) num30 * (double) index13 - (1.25663709640503 - (double) num30) / 2.0);
float ai1 = (float) (((double) Main.rand.NextFloat() - 0.5) * 0.300000011920929 * 6.28318548202515 / 60.0);
int index14 = NPC.NewNPC((int) vector2_21.X, (int) vector2_21.Y + 7, 522, ai1: ai1, ai2: vector2_22.X, ai3: vector2_22.Y);
Main.npc[index14].velocity = vector2_22;
}
}
}
++this.ai[1];
if ((double) this.ai[1] >= (double) (4 + num5 * num6))
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
++this.ai[3];
this.velocity = Vector2.Zero;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 8.0)
{
this.localAI[2] = 13f;
if ((double) this.ai[1] >= 4.0 & flag2 && (int) ((double) this.ai[1] - 4.0) % num7 == 0)
{
List<int> intList = new List<int>();
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 440 && (double) Main.npc[index].ai[3] == (double) this.whoAmI)
intList.Add(index);
}
int num31 = intList.Count + 1;
if (num31 > 3)
num31 = 3;
int num32 = Math.Sign(player.Center.X - center1.X);
if (num32 != 0)
this.direction = this.spriteDirection = num32;
if (Main.netMode != 1)
{
for (int index15 = 0; index15 < num31; ++index15)
{
Point tileCoordinates1 = this.Center.ToTileCoordinates();
Point tileCoordinates2 = Main.player[this.target].Center.ToTileCoordinates();
Vector2 vector2 = Main.player[this.target].Center - this.Center;
int num33 = 20;
int num34 = 3;
int num35 = 7;
int num36 = 2;
int num37 = 0;
bool flag6 = false;
if ((double) vector2.Length() > 2000.0)
flag6 = true;
while (!flag6 && num37 < 100)
{
++num37;
int index16 = Main.rand.Next(tileCoordinates2.X - num33, tileCoordinates2.X + num33 + 1);
int index17 = Main.rand.Next(tileCoordinates2.Y - num33, tileCoordinates2.Y + num33 + 1);
if ((index17 < tileCoordinates2.Y - num35 || index17 > tileCoordinates2.Y + num35 || index16 < tileCoordinates2.X - num35 || index16 > tileCoordinates2.X + num35) && (index17 < tileCoordinates1.Y - num34 || index17 > tileCoordinates1.Y + num34 || index16 < tileCoordinates1.X - num34 || index16 > tileCoordinates1.X + num34) && !Main.tile[index16, index17].nactive())
{
bool flag7 = true;
if (flag7 && Collision.SolidTiles(index16 - num36, index16 + num36, index17 - num36, index17 + num36))
flag7 = false;
if (flag7)
{
NPC.NewNPC(index16 * 16 + 8, index17 * 16 + 8, 523, ai0: ((float) this.whoAmI));
break;
}
}
}
}
}
}
++this.ai[1];
if ((double) this.ai[1] >= (double) (4 + num7 * num8))
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
++this.ai[3];
this.velocity = Vector2.Zero;
this.netUpdate = true;
}
}
if (!flag2)
this.ai[3] = num10;
this.dontTakeDamage = flag3;
this.chaseable = !flag4;
}
private void AI_108_DivingFlyer()
{
this.rotation = this.velocity.ToRotation();
float num1 = 0.4f;
float num2 = 10f;
float num3 = 200f;
float num4 = 750f;
float num5 = 30f;
float num6 = 30f;
float num7 = 0.95f;
int num8 = 50;
float num9 = 14f;
float num10 = 30f;
float num11 = 100f;
float num12 = 20f;
float num13 = 0.0f;
float num14 = 7f;
bool flag1 = true;
bool flag2 = true;
int num15 = 120;
bool flag3 = false;
bool flag4 = false;
float num16 = 0.05f;
float num17 = 0.0f;
bool flag5 = false;
switch (this.type)
{
case 558:
case 559:
case 560:
flag4 = true;
num1 = 0.7f;
if (this.type == 559)
num1 = 0.5f;
if (this.type == 560)
num1 = 0.2f;
num2 = 3f;
num3 = 400f;
num4 = 500f;
num5 = 90f;
num6 = 20f;
num7 = 0.95f;
num8 = 0;
num9 = 8f;
num10 = 30f;
num11 = 150f;
num12 = 60f;
num13 = 0.05f;
num14 = 6f;
flag2 = false;
flag5 = true;
break;
case 574:
case 575:
flag4 = true;
num1 = 0.6f;
if (this.type == 575)
num1 = 0.4f;
num2 = 4f;
num3 = 400f;
num4 = 500f;
num5 = 90f;
num6 = 30f;
num7 = 0.95f;
num8 = 3;
num9 = 8f;
num10 = 30f;
num11 = 150f;
num12 = 10f;
num13 = 0.05f;
num14 = 0.0f;
num17 = -0.1f;
flag3 = true;
flag5 = true;
break;
}
NPCUtils.TargetClosestOldOnesInvasion(this);
NPCAimedTarget targetData = this.GetTargetData();
if (flag5)
{
if ((double) this.localAI[0] == 0.0)
this.alpha = (int) byte.MaxValue;
if ((double) this.localAI[0] == 30.0)
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_EtherianPortalSpawnEnemy, this.Center);
if ((double) this.localAI[0] < 60.0)
{
++this.localAI[0];
this.alpha -= 5;
if (this.alpha < 0)
this.alpha = 0;
int num18 = (int) this.localAI[0] / 10;
float num19 = this.Size.Length() / 2f / 20f;
int maxValue = 5;
if (this.type == 576 || this.type == 577)
maxValue = 1;
for (int index = 0; index < num18; ++index)
{
if (Main.rand.Next(maxValue) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 27, this.velocity.X * 1f, Alpha: 100);
dust.scale = 0.55f;
dust.fadeIn = 0.7f;
dust.velocity *= 0.1f * num19;
dust.velocity += this.velocity;
}
}
}
}
if (flag4)
{
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && Main.npc[index].type == this.type && (double) Math.Abs(this.position.X - Main.npc[index].position.X) + (double) Math.Abs(this.position.Y - Main.npc[index].position.Y) < (double) this.width)
{
if ((double) this.position.X < (double) Main.npc[index].position.X)
this.velocity.X -= num16;
else
this.velocity.X += num16;
if ((double) this.position.Y < (double) Main.npc[index].position.Y)
this.velocity.Y -= num16;
else
this.velocity.Y += num16;
}
}
}
if (Math.Sign(this.velocity.X) != 0)
this.spriteDirection = -Math.Sign(this.velocity.X);
if ((double) this.rotation < -1.57079637050629)
this.rotation += 3.141593f;
if ((double) this.rotation > 1.57079637050629)
this.rotation -= 3.141593f;
float num20 = num13 * num12;
if (Main.expertMode)
num1 *= Main.expertKnockBack;
SlotId slotId;
if ((double) this.ai[0] == 0.0)
{
this.knockBackResist = num1;
float num21 = num2;
Vector2 center = this.Center;
Vector2 vector2_1 = targetData.Center - center;
Vector2 vector2_2 = vector2_1 - Vector2.UnitY * num3;
double num22 = (double) vector2_1.Length();
Vector2 v = Vector2.Normalize(vector2_1) * num21;
Vector2 vector2_3 = Vector2.Normalize(vector2_2) * num21;
bool flag6 = Collision.CanHit(this.Center, 1, 1, targetData.Center, 1, 1);
if ((double) this.ai[3] >= (double) num15)
flag6 = true;
float num23 = 8f;
bool flag7 = flag6 && (double) v.ToRotation() > 3.14159274101257 / (double) num23 && (double) v.ToRotation() < 3.14159274101257 - 3.14159274101257 / (double) num23;
double num24 = (double) num4;
if (num22 > num24 || !flag7)
{
this.velocity.X = (this.velocity.X * (num5 - 1f) + vector2_3.X) / num5;
this.velocity.Y = (this.velocity.Y * (num5 - 1f) + vector2_3.Y) / num5;
if (!flag7)
{
++this.ai[3];
if ((double) this.ai[3] == (double) num15)
this.netUpdate = true;
}
else
this.ai[3] = 0.0f;
}
else
{
this.ai[0] = 1f;
this.ai[2] = v.X;
this.ai[3] = v.Y;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 1.0)
{
this.knockBackResist = 0.0f;
this.velocity = this.velocity * num7;
this.velocity.Y += num17;
++this.ai[1];
if ((double) this.ai[1] == (double) num6)
{
if (this.type == 558 || this.type == 559 || this.type == 560)
{
float[] localAi1 = this.localAI;
slotId = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_WyvernDiveDown, this.Center);
double num25 = (double) ((SlotId) ref slotId).ToFloat();
localAi1[1] = (float) num25;
if (Main.rand.Next(5) == 0)
{
float[] localAi2 = this.localAI;
slotId = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_WyvernScream, this.Center);
double num26 = (double) ((SlotId) ref slotId).ToFloat();
localAi2[2] = (float) num26;
}
}
else if (this.type == 574 || this.type == 575)
{
float[] localAi = this.localAI;
slotId = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldFlyerChargeScream, this.Center);
double num27 = (double) ((SlotId) ref slotId).ToFloat();
localAi[1] = (float) num27;
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldIgnite, this.Center);
}
}
if ((double) this.ai[1] >= (double) num6)
{
this.ai[0] = 2f;
this.ai[1] = 0.0f;
this.netUpdate = true;
Vector2 vector2 = new Vector2(this.ai[2], this.ai[3]) + new Vector2((float) Main.rand.Next(-num8, num8 + 1), (float) Main.rand.Next(-num8, num8 + 1)) * 0.04f;
vector2.Normalize();
this.velocity = vector2 * num9;
}
}
else if ((double) this.ai[0] == 2.0)
{
if ((double) this.ai[1] >= 20.0 && (this.type == 574 || this.type == 575))
{
ActiveSound activeSound = Main.GetActiveSound(SlotId.FromFloat(this.localAI[2]));
if (activeSound == null)
{
float[] localAi = this.localAI;
slotId = Main.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldIgniteLoop, this.Center);
double num28 = (double) ((SlotId) ref slotId).ToFloat();
localAi[2] = (float) num28;
}
else
activeSound.Position = this.Center;
}
this.knockBackResist = 0.0f;
float num29 = num10;
++this.ai[1];
bool flag8 = (double) Vector2.Distance(this.Center, targetData.Center) > (double) num11 && (double) this.Center.Y > (double) targetData.Center.Y;
if (flag3)
flag8 = false;
if ((double) this.ai[1] >= (double) num29 & flag8 || (double) this.velocity.Length() < (double) num14)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.ai[3] = 0.0f;
this.velocity = this.velocity / 2f;
this.netUpdate = true;
if (flag1)
{
this.ai[1] = 45f;
this.ai[0] = 4f;
}
}
else
{
Vector2 center = this.Center;
Vector2 vec = targetData.Center - center;
vec.Normalize();
if (vec.HasNaNs())
vec = new Vector2((float) this.direction, 0.0f);
this.velocity = (this.velocity * (num12 - 1f) + vec * (this.velocity.Length() + num20)) / num12;
}
if (flag2 && Collision.SolidCollision(this.position, this.width, this.height))
{
this.ai[0] = 3f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.ai[3] = 0.0f;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 4.0)
{
this.ai[1] -= 3f;
if ((double) this.ai[1] <= 0.0)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
this.velocity = this.velocity * 0.95f;
}
ActiveSound activeSound1 = Main.GetActiveSound(SlotId.FromFloat(this.localAI[1]));
if (activeSound1 != null)
{
activeSound1.Position = this.Center;
}
else
{
float[] localAi = this.localAI;
slotId = (SlotId) SlotId.Invalid;
double num30 = (double) ((SlotId) ref slotId).ToFloat();
localAi[1] = (float) num30;
}
if (this.type == 558 || this.type == 559 || this.type == 560)
{
ActiveSound activeSound2 = Main.GetActiveSound(SlotId.FromFloat(this.localAI[2]));
if (activeSound2 != null)
{
activeSound2.Position = this.Center;
}
else
{
float[] localAi = this.localAI;
slotId = (SlotId) SlotId.Invalid;
double num31 = (double) ((SlotId) ref slotId).ToFloat();
localAi[2] = (float) num31;
}
}
if (flag2 && (double) this.ai[0] != 3.0 && (double) Vector2.Distance(this.Center, targetData.Center) < 64.0)
{
this.ai[0] = 3f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.ai[3] = 0.0f;
this.netUpdate = true;
}
if ((double) this.ai[0] != 3.0)
return;
this.position = this.Center;
this.width = this.height = 192;
this.position.X -= (float) (this.width / 2);
this.position.Y -= (float) (this.height / 2);
this.velocity = Vector2.Zero;
this.damage = (int) (80.0 * (double) Main.damageMultiplier);
this.alpha = (int) byte.MaxValue;
if ((double) this.ai[1] == 0.0 && (this.type == 574 || this.type == 575))
{
for (int index1 = 0; index1 < 4; ++index1)
{
int index2 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
Main.dust[index2].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
}
for (int index3 = 0; index3 < 20; ++index3)
{
int index4 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 200, Scale: 3.7f);
Main.dust[index4].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
Main.dust[index4].noGravity = true;
Main.dust[index4].velocity *= 3f;
int index5 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 1.5f);
Main.dust[index5].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 4f;
Main.dust[index5].velocity *= 2f;
Main.dust[index5].noGravity = true;
Main.dust[index5].fadeIn = 2.5f;
}
for (int index6 = 0; index6 < 6; ++index6)
{
int index7 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Scale: 2.7f);
Main.dust[index7].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
Main.dust[index7].noGravity = true;
Main.dust[index7].velocity *= 3f;
}
for (int index8 = 0; index8 < 12; ++index8)
{
int index9 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Scale: 1.5f);
Main.dust[index9].position = this.Center + Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) this.velocity.ToRotation()) * (float) this.width / 2f;
Main.dust[index9].noGravity = true;
Main.dust[index9].velocity *= 3f;
}
for (int index10 = 0; index10 < 5; ++index10)
{
int index11 = Gore.NewGore(this.position + new Vector2((float) (this.width * Main.rand.Next(100)) / 100f, (float) (this.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64));
Main.gore[index11].position = this.Center + Vector2.UnitY.RotatedByRandom(3.14159274101257) * (float) Main.rand.NextDouble() * (float) this.width / 2f;
Main.gore[index11].velocity *= 0.3f;
Main.gore[index11].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
Main.gore[index11].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
}
}
++this.ai[1];
if ((double) this.ai[1] < 3.0)
return;
Main.PlaySound(SoundID.Item14, this.position);
this.life = 0;
this.HitEffect();
this.active = false;
}
private void AI_109_DarkMage()
{
bool flag1 = false;
bool flag2 = false;
bool flag3 = true;
bool flag4 = false;
int num1 = 4;
int num2 = 3;
int num3 = 0;
float num4 = 0.2f;
float num5 = 2f;
float num6 = -0.2f;
float num7 = -4f;
bool flag5 = true;
float num8 = 2f;
float num9 = 0.1f;
float num10 = 1f;
float num11 = 0.04f;
bool flag6 = false;
float num12 = 0.96f;
bool flag7 = true;
NPCAimedTarget targetData = this.GetTargetData();
if (this.type == 564 || this.type == 565)
{
flag5 = false;
this.rotation = this.velocity.X * 0.04f;
this.spriteDirection = this.direction > 0 ? 1 : -1;
num3 = 2;
num6 = -0.05f;
num7 = -0.4f;
num4 = 0.05f;
num5 = 0.2f;
num10 = 0.5f;
num11 = 0.02f;
num8 = 0.5f;
num9 = 0.1f;
this.localAI[2] = 0.0f;
DelegateMethods.v3_1 = new Vector3(0.3f, 0.05f, 0.45f) * 1.5f;
Utils.PlotTileLine(this.Top, this.Bottom, (float) this.width, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
if ((double) this.ai[0] < 0.0)
this.ai[0] = MathHelper.Min(this.ai[0] + 1f, 0.0f);
if ((double) this.ai[0] > 0.0)
{
flag7 = false;
flag6 = true;
num12 = 0.9f;
--this.ai[0];
if ((double) this.ai[0] == 80.0 && (double) this.ai[1] == 2.0)
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_DarkMageSummonSkeleton, this.Center);
if ((double) this.ai[1] == 2.0 && (double) this.ai[0] == 64.0 && Main.netMode != 1)
{
Projectile.NewProjectile(this.Center + new Vector2((float) (this.direction * 24), -40f), Vector2.Zero, 673, 0, 0.0f, Main.myPlayer);
DD2Event.RaiseGoblins(this.Center);
}
if ((double) this.ai[1] == 0.0 && (double) this.ai[0] == 32.0)
{
Vector2 velocity = (targetData.Center - (this.Center + new Vector2((float) (this.direction * 10), -16f))).SafeNormalize(Vector2.UnitY) * 14f;
this.direction = (double) velocity.X > 0.0 ? 1 : -1;
if (Main.netMode != 1)
Projectile.NewProjectile(this.Center + new Vector2((float) (this.direction * 10), -16f), velocity, 675, 40, 0.0f, Main.myPlayer);
}
if ((double) this.ai[0] == 126.0 && (double) this.ai[1] == 1.0)
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_DarkMageCastHeal, this.Center);
if ((double) this.ai[1] == 1.0 && Main.netMode != 1 && ((double) this.ai[0] == 40.0 || (double) this.ai[0] == 48.0 || (double) this.ai[0] == 56.0))
{
Point result;
if (WorldUtils.Find(new Vector2(this.Center.X + (float) (this.direction * 240), this.Center.Y).ToTileCoordinates(), Searches.Chain((GenSearch) new Searches.Down(50), (GenCondition) new Conditions.IsSolid()), out result))
Projectile.NewProjectile(result.ToWorldCoordinates(autoAddY: 0.0f), Vector2.Zero, 674, 0, 0.0f, Main.myPlayer);
}
if ((double) this.ai[0] <= 0.0)
{
double num13 = (double) this.ai[1];
++this.ai[1];
if ((double) this.ai[1] >= 3.0)
this.ai[1] = 0.0f;
this.ai[0] = -120f;
if (num13 == 0.0)
this.ai[0] = -20f;
this.netUpdate = true;
}
}
if ((double) this.ai[0] == 0.0 && (double) this.localAI[3] >= 60.0)
{
bool flag8 = false;
Vector2 minimum = this.Center + new Vector2(-600f, -200f);
Vector2 maximum = this.Center + new Vector2(600f, 200f);
int num14 = 0;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.active && npc.lifeMax != npc.life && npc.Center.Between(minimum, maximum) && ++num14 >= 2)
{
flag8 = true;
break;
}
}
if (!flag8)
this.ai[1] = 2f;
if ((double) this.ai[1] == 2.0 && !DD2Event.CanRaiseGoblinsHere(this.Center))
this.ai[1] = 0.0f;
bool flag9 = true;
if ((double) this.ai[1] == 0.0 && ((double) this.Distance(targetData.Center) >= 1000.0 || !Collision.CanHitLine(this.Center, 0, 0, targetData.Center, 0, 0)))
flag9 = false;
if (flag9)
{
switch ((int) this.ai[1])
{
case 0:
this.ai[0] = 97f;
break;
case 1:
this.ai[0] = (float) sbyte.MaxValue;
break;
case 2:
this.ai[0] = 183f;
break;
}
this.netUpdate = true;
flag6 = true;
}
}
if ((double) this.localAI[3] == 0.0)
this.alpha = (int) byte.MaxValue;
if ((double) this.localAI[3] == 30.0)
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_EtherianPortalSpawnEnemy, this.Center);
if ((double) this.localAI[3] < 60.0)
{
++this.localAI[3];
this.alpha -= 5;
if (this.alpha < 0)
this.alpha = 0;
int num15 = (int) this.localAI[3] / 10;
float num16 = this.Size.Length() / 2f / 20f;
int maxValue = 5;
if (this.type == 576 || this.type == 577)
maxValue = 1;
for (int index = 0; index < num15; ++index)
{
if (Main.rand.Next(maxValue) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 27, this.velocity.X * 1f, Alpha: 100);
dust.scale = 0.55f;
dust.fadeIn = 0.7f;
dust.velocity *= 0.1f * num16;
dust.velocity += this.velocity;
}
}
}
}
if (this.justHit)
this.localAI[2] = 0.0f;
if (!flag2)
{
if ((double) this.localAI[2] >= 0.0)
{
float num17 = 16f;
bool flag10 = false;
bool flag11 = false;
if ((double) this.position.X > (double) this.localAI[0] - (double) num17 && (double) this.position.X < (double) this.localAI[0] + (double) num17)
flag10 = true;
else if ((double) this.velocity.X < 0.0 && this.direction > 0 || (double) this.velocity.X > 0.0 && this.direction < 0)
{
flag10 = true;
num17 += 24f;
}
if ((double) this.position.Y > (double) this.localAI[1] - (double) num17 && (double) this.position.Y < (double) this.localAI[1] + (double) num17)
flag11 = true;
if (flag10 & flag11)
{
++this.localAI[2];
if ((double) this.localAI[2] >= 30.0 && (double) num17 == 16.0)
flag1 = true;
if ((double) this.localAI[2] >= 60.0)
{
this.localAI[2] = -180f;
this.direction *= -1;
this.velocity.X *= -1f;
this.collideX = false;
}
}
else
{
this.localAI[0] = this.position.X;
this.localAI[1] = this.position.Y;
this.localAI[2] = 0.0f;
}
if (flag7)
NPCUtils.TargetClosestOldOnesInvasion(this);
}
else
{
++this.localAI[2];
this.direction = (double) targetData.Center.X > (double) this.Center.X ? 1 : -1;
}
}
int index1 = (int) (((double) this.position.X + (double) (this.width / 2)) / 16.0) + this.direction * 2;
int num18 = (int) (((double) this.position.Y + (double) this.height) / 16.0);
int num19 = (int) this.Bottom.Y / 16;
int index2 = (int) this.Bottom.X / 16;
if (flag6)
{
this.velocity = this.velocity * num12;
}
else
{
for (int index3 = num18; index3 < num18 + num1; ++index3)
{
if (Main.tile[index1, index3] == null)
Main.tile[index1, index3] = new Tile();
if (Main.tile[index1, index3].nactive() && Main.tileSolid[(int) Main.tile[index1, index3].type] || Main.tile[index1, index3].liquid > (byte) 0)
{
if (index3 <= num18 + 1)
flag4 = true;
flag3 = false;
break;
}
}
for (int index4 = num19; index4 < num19 + num3; ++index4)
{
if (Main.tile[index2, index4] == null)
Main.tile[index2, index4] = new Tile();
if (Main.tile[index2, index4].nactive() && Main.tileSolid[(int) Main.tile[index2, index4].type] || Main.tile[index2, index4].liquid > (byte) 0)
{
flag4 = true;
flag3 = false;
break;
}
}
if (flag5)
{
for (int index5 = num18 - num2; index5 < num18; ++index5)
{
if (Main.tile[index1, index5] == null)
Main.tile[index1, index5] = new Tile();
if (Main.tile[index1, index5].nactive() && Main.tileSolid[(int) Main.tile[index1, index5].type] || Main.tile[index1, index5].liquid > (byte) 0)
{
flag4 = false;
flag1 = true;
break;
}
}
}
if (flag1)
{
flag4 = false;
flag3 = true;
}
if (flag3)
{
this.velocity.Y += num4;
if ((double) this.velocity.Y > (double) num5)
this.velocity.Y = num5;
}
else
{
if (((this.directionY >= 0 ? 0 : ((double) this.velocity.Y > 0.0 ? 1 : 0)) | (flag4 ? 1 : 0)) != 0)
this.velocity.Y += num6;
if ((double) this.velocity.Y < (double) num7)
this.velocity.Y = num7;
}
if (this.collideX)
{
this.velocity.X = this.oldVelocity.X * -0.4f;
if (this.direction == -1 && (double) this.velocity.X > 0.0 && (double) this.velocity.X < 1.0)
this.velocity.X = 1f;
if (this.direction == 1 && (double) this.velocity.X < 0.0 && (double) this.velocity.X > -1.0)
this.velocity.X = -1f;
}
if (this.collideY)
{
this.velocity.Y = this.oldVelocity.Y * -0.25f;
if ((double) this.velocity.Y > 0.0 && (double) this.velocity.Y < 1.0)
this.velocity.Y = 1f;
if ((double) this.velocity.Y < 0.0 && (double) this.velocity.Y > -1.0)
this.velocity.Y = -1f;
}
if (this.direction == -1 && (double) this.velocity.X > -(double) num8)
{
this.velocity.X -= num9;
if ((double) this.velocity.X > (double) num8)
this.velocity.X -= num9;
else if ((double) this.velocity.X > 0.0)
this.velocity.X += num9 / 2f;
if ((double) this.velocity.X < -(double) num8)
this.velocity.X = -num8;
}
else if (this.direction == 1 && (double) this.velocity.X < (double) num8)
{
this.velocity.X += num9;
if ((double) this.velocity.X < -(double) num8)
this.velocity.X += num9;
else if ((double) this.velocity.X < 0.0)
this.velocity.X -= num9 / 2f;
if ((double) this.velocity.X > (double) num8)
this.velocity.X = num8;
}
if (this.directionY == -1 && (double) this.velocity.Y > -(double) num10)
{
this.velocity.Y -= num11;
if ((double) this.velocity.Y > (double) num10)
this.velocity.Y -= num11 * 1.25f;
else if ((double) this.velocity.Y > 0.0)
this.velocity.Y += num11 * 0.75f;
if ((double) this.velocity.Y >= -(double) num10)
return;
this.velocity.Y = -num8;
}
else
{
if (this.directionY != 1 || (double) this.velocity.Y >= (double) num10)
return;
this.velocity.Y += num11;
if ((double) this.velocity.Y < -(double) num10)
this.velocity.Y += num11 * 1.25f;
else if ((double) this.velocity.Y < 0.0)
this.velocity.Y -= num11 * 0.75f;
if ((double) this.velocity.Y <= (double) num10)
return;
this.velocity.Y = num10;
}
}
}
private void AI_111_DD2LightningBug()
{
bool flag1 = true;
float num1 = 7f;
float num2 = 60f;
float num3 = 60f;
float num4 = 1f;
float num5 = 0.96f;
int num6 = 30;
int num7 = 20;
float num8 = 200f;
int Damage = 40;
int Type = 438;
float num9 = 10f;
float num10 = 100f;
bool flag2 = false;
float num11 = 0.05f;
Vector2 center = this.Center;
NPCUtils.TargetClosestOldOnesInvasion(this);
NPCAimedTarget targetData = this.GetTargetData();
bool flag3 = false;
if (this.type == 578)
{
num1 = 4f;
num2 = 20f;
num3 = 20f;
flag3 = true;
flag2 = true;
num11 = 0.1f;
Type = 682;
Damage = 10;
num9 = 10f;
num10 = 50f;
num6 = 5;
num7 = 30;
center += new Vector2((float) (-this.spriteDirection * 20), 10f);
if (Main.rand.Next(15) == 0)
{
Vector2 position = this.position;
if (this.direction == -1)
position.X += (float) (this.width / 2);
Dust dust = Dust.NewDustDirect(position, this.width / 2, this.height, 272);
dust.scale = 0.65f;
dust.velocity.Y -= 0.8f;
if ((double) dust.velocity.X * (double) this.direction > 0.0)
dust.velocity.X *= -1f;
if ((double) dust.velocity.Y > 0.0)
dust.velocity *= -0.5f;
}
if (Main.rand.Next(80) == 0)
{
Vector2 rotationVector2 = (Main.rand.NextFloat() * 6.283185f).ToRotationVector2();
Dust dust1 = Dust.NewDustPerfect(this.Center, 272, new Vector2?(rotationVector2));
dust1.velocity *= 1.1f;
dust1.noGravity = true;
dust1.customData = (object) this;
Dust dust2 = Dust.NewDustPerfect(this.Center, 272, new Vector2?(rotationVector2));
dust2.velocity *= 1.5f;
dust2.noGravity = true;
dust2.customData = (object) this;
}
}
if (flag3)
{
if ((double) this.localAI[1] == 0.0)
this.alpha = (int) byte.MaxValue;
if ((double) this.localAI[1] == 30.0)
Main.PlayTrackedSound((SoundStyle) SoundID.DD2_EtherianPortalSpawnEnemy, this.Center);
if ((double) this.localAI[1] < 60.0)
{
++this.localAI[1];
this.alpha -= 5;
if (this.alpha < 0)
this.alpha = 0;
int num12 = (int) this.localAI[1] / 10;
float num13 = this.Size.Length() / 2f / 20f;
int maxValue = 5;
if (this.type == 576 || this.type == 577)
maxValue = 1;
for (int index = 0; index < num12; ++index)
{
if (Main.rand.Next(maxValue) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 27, this.velocity.X * 1f, Alpha: 100);
dust.scale = 0.55f;
dust.fadeIn = 0.7f;
dust.velocity *= 0.1f * num13;
dust.velocity += this.velocity;
}
}
}
}
if (flag2)
{
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && Main.npc[index].type == this.type && (double) Math.Abs(this.position.X - Main.npc[index].position.X) + (double) Math.Abs(this.position.Y - Main.npc[index].position.Y) < (double) this.width)
{
if ((double) this.position.X < (double) Main.npc[index].position.X)
this.velocity.X -= num11;
else
this.velocity.X += num11;
if ((double) this.position.Y < (double) Main.npc[index].position.Y)
this.velocity.Y -= num11;
else
this.velocity.Y += num11;
}
}
}
this.rotation = (float) ((double) Math.Abs(this.velocity.X) * (double) this.direction * 0.100000001490116);
this.spriteDirection = this.direction;
Vector2 position1 = center;
Vector2 v = targetData.Center - position1;
Vector2 vector2_1 = v.SafeNormalize(Vector2.UnitY) * num1;
bool flag4 = Collision.CanHit(this.Center, 1, 1, targetData.Center, 1, 1);
if ((double) this.localAI[0] < 0.0)
++this.localAI[0];
if (!flag1)
{
this.velocity = (this.velocity * (num2 - 1f) + vector2_1) / num2;
if (this.timeLeft <= 10)
return;
this.timeLeft = 10;
}
else if ((double) v.Length() > (double) num8 || !flag4)
this.velocity = (this.velocity * (num3 - 1f) + vector2_1) / num3;
else if ((double) v.Y < (double) num10)
{
this.velocity.Y -= 0.03f;
}
else
{
if ((double) this.localAI[0] < 0.0)
return;
this.velocity = this.velocity * num5;
if ((double) this.velocity.Length() >= (double) num4 || Main.netMode == 1)
return;
++this.localAI[0];
if ((double) this.localAI[0] < (double) num6)
return;
this.localAI[0] = (float) -num7;
this.direction = this.spriteDirection = (double) vector2_1.X > 0.0 ? 1 : -1;
Vector2 vector2_2 = v + Utils.RandomVector2(Main.rand, -25f, 25f);
vector2_2.X *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00499999988824129);
vector2_2.Y *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00499999988824129);
vector2_2 = vector2_2.SafeNormalize(Vector2.UnitY) * num9;
vector2_2.X *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * (1.0 / 160.0));
vector2_2.Y *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * (1.0 / 160.0));
Projectile.NewProjectile(position1, vector2_2, Type, Damage, 0.0f, Main.myPlayer);
}
}
public void ReflectProjectiles(Microsoft.Xna.Framework.Rectangle myRect)
{
for (int i = 0; i < 1000; ++i)
{
if (Main.projectile[i].active && Main.projectile[i].CanReflect())
{
Microsoft.Xna.Framework.Rectangle hitbox = Main.projectile[i].Hitbox;
if (myRect.Intersects(hitbox))
this.ReflectProjectile(i);
}
}
}
public void ReflectProjectile(int i)
{
if (this.HitSound != null)
Main.PlaySound(this.HitSound, Main.projectile[i].position);
for (int index1 = 0; index1 < 3; ++index1)
{
int index2 = Dust.NewDust(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, 31);
Main.dust[index2].velocity *= 0.3f;
}
Main.projectile[i].hostile = true;
Main.projectile[i].friendly = false;
Vector2 vector2_1 = Main.player[Main.projectile[i].owner].Center - Main.projectile[i].Center;
vector2_1.Normalize();
Vector2 vector2_2 = vector2_1 * Main.projectile[i].oldVelocity.Length();
Main.projectile[i].velocity = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
Main.projectile[i].velocity.Normalize();
Projectile projectile1 = Main.projectile[i];
projectile1.velocity = projectile1.velocity * vector2_2.Length();
Projectile projectile2 = Main.projectile[i];
projectile2.velocity = projectile2.velocity + vector2_2 * 20f;
Main.projectile[i].velocity.Normalize();
Projectile projectile3 = Main.projectile[i];
projectile3.velocity = projectile3.velocity * vector2_2.Length();
Main.projectile[i].damage /= 2;
Main.projectile[i].penetrate = 1;
}
public int GetShootingFrame(float circleY)
{
int num = -4;
if ((double) circleY < -0.300000011920929)
num = 1;
if ((double) circleY < -0.100000001490116)
num = 0;
if ((double) circleY > 0.100000001490116)
num = 2;
if ((double) circleY > 0.300000011920929)
num = 3;
if (this.type == 228 || this.type == 229 || this.type == 209 || this.type == 22 || this.type == 368)
{
if (num == -4)
num = 1;
if ((double) circleY >= -0.100000001490116)
++num;
}
return num;
}
public Tuple<Vector2, float> GetSwingStats(
int swingMax,
int swingCurrent,
int aimDir,
int itemWidth,
int itemHeight)
{
Vector2 zero = Vector2.Zero;
if ((double) swingCurrent < (double) swingMax * 0.333)
{
float num = 10f;
if (itemWidth > 32)
num = 14f;
if (itemWidth >= 52)
num = 24f;
if (itemWidth >= 64)
num = 28f;
if (itemWidth >= 92)
num = 38f;
zero.X = this.Center.X + ((float) itemWidth * 0.5f - num) * (float) aimDir;
zero.Y = this.position.Y + 24f;
}
else if ((double) swingCurrent < (double) swingMax * 0.666)
{
float num1 = 10f;
if (itemWidth > 32)
num1 = 18f;
if (itemWidth >= 52)
num1 = 24f;
if (itemWidth >= 64)
num1 = 28f;
if (itemWidth >= 92)
num1 = 38f;
zero.X = this.Center.X + ((float) itemWidth * 0.5f - num1) * (float) aimDir;
float num2 = 10f;
if (itemHeight > 32)
num2 = 8f;
if (itemHeight > 52)
num2 = 12f;
if (itemHeight > 64)
num2 = 14f;
zero.Y = this.position.Y + num2;
}
else
{
float num3 = 6f;
if (itemWidth > 32)
num3 = 14f;
if (itemWidth >= 48)
num3 = 18f;
if (itemWidth >= 52)
num3 = 24f;
if (itemWidth >= 64)
num3 = 28f;
if (itemWidth >= 92)
num3 = 38f;
zero.X = this.Center.X - ((float) itemWidth * 0.5f - num3) * (float) aimDir;
float num4 = 10f;
if (itemHeight > 32)
num4 = 10f;
if (itemHeight > 52)
num4 = 12f;
if (itemHeight > 64)
num4 = 14f;
zero.Y = this.position.Y + num4;
}
float num5 = (float) (((double) swingCurrent / (double) swingMax - 0.5) * (double) -aimDir * 3.5 - (double) aimDir * 0.300000011920929);
return Tuple.Create<Vector2, float>(zero, num5);
}
public void TweakSwingStats(
int swingMax,
int swingCurrent,
int aimDir,
ref Microsoft.Xna.Framework.Rectangle itemRectangle)
{
if ((double) swingCurrent < (double) swingMax * 0.333)
{
if (aimDir == -1)
itemRectangle.X -= (int) ((double) itemRectangle.Width * 1.4 - (double) itemRectangle.Width);
itemRectangle.Width = (int) ((double) itemRectangle.Width * 1.4);
itemRectangle.Y += (int) ((double) itemRectangle.Height * 0.5);
itemRectangle.Height = (int) ((double) itemRectangle.Height * 1.1);
}
else
{
if ((double) swingCurrent < (double) swingMax * 0.666)
return;
if (aimDir == 1)
itemRectangle.X -= (int) ((double) itemRectangle.Width * 1.2);
itemRectangle.Width *= 2;
itemRectangle.Y -= (int) ((double) itemRectangle.Height * 1.4 - (double) itemRectangle.Height);
itemRectangle.Height = (int) ((double) itemRectangle.Height * 1.4);
}
}
public bool UsesPartyHat() => this.frame.Height > 0 && this.townNPC && BirthdayParty.PartyIsUp && this.type != 441 && this.type != 37;
public PartyHatColor GetPartyHatColor()
{
if (!this.UsesPartyHat() || string.IsNullOrEmpty(this.GivenOrTypeName))
return PartyHatColor.None;
int num1 = this.GivenOrTypeName.Length + (int) this.GivenOrTypeName[0];
int moonPhase = Main.moonPhase;
if (Main.dayTime)
--moonPhase;
int num2 = num1 + this.whoAmI + moonPhase * (this.whoAmI % 2 == 0).ToDirectionInt();
if (num2 < 0)
num2 += 5;
return (PartyHatColor) (num2 % 5);
}
public void FindFrame()
{
int num1 = 1;
if (!Main.dedServ)
{
if (!Main.NPCLoaded[this.type] || Main.npcTexture[this.type] == null)
return;
num1 = Main.npcTexture[this.type].Height / Main.npcFrameCount[this.type];
}
int num2 = 0;
if (this.aiAction == 0)
num2 = (double) this.velocity.Y >= 0.0 ? ((double) this.velocity.Y <= 0.0 ? ((double) this.velocity.X == 0.0 ? 0 : 1) : 3) : 2;
else if (this.aiAction == 1)
num2 = 4;
if (this.type == 568 || this.type == 569)
{
if ((double) this.ai[0] > 0.0)
{
int num3 = this.frame.Y / this.frame.Height;
this.spriteDirection = this.direction;
if (num3 < 5 || num3 > 16)
this.frameCounter = 0.0;
int num4 = 7;
++this.frameCounter;
int num5 = 0;
int num6;
if (this.frameCounter >= (double) (5 * (num6 = num5 + 1)))
num4 = 8;
int num7;
if (this.frameCounter >= (double) (5 * (num7 = num6 + 1)))
num4 = 9;
int num8;
if (this.frameCounter >= (double) (5 * (num8 = num7 + 1)))
num4 = 10;
int num9;
if (this.frameCounter >= (double) (5 * (num9 = num8 + 1)))
num4 = 7;
int num10;
if (this.frameCounter >= (double) (5 * (num10 = num9 + 1)))
num4 = 8;
int num11;
if (this.frameCounter >= (double) (5 * (num11 = num10 + 1)))
num4 = 9;
int num12;
if (this.frameCounter >= (double) (5 * (num12 = num11 + 1)))
num4 = 10;
int num13;
if (this.frameCounter >= (double) (5 * (num13 = num12 + 1)))
num4 = 7;
int num14;
if (this.frameCounter >= (double) (5 * (num14 = num13 + 1)))
num4 = 8;
int num15;
if (this.frameCounter >= (double) (5 * (num15 = num14 + 1)))
num4 = 9;
int num16;
if (this.frameCounter >= (double) (5 * (num16 = num15 + 1)))
num4 = 10;
int num17;
if (this.frameCounter >= (double) (5 * (num17 = num16 + 1)))
num4 = 7;
int num18;
if (this.frameCounter >= (double) (5 * (num18 = num17 + 1)))
num4 = 8;
int num19;
if (this.frameCounter >= (double) (5 * (num19 = num18 + 1)))
num4 = 9;
int num20;
if (this.frameCounter >= (double) (5 * (num20 = num19 + 1)))
num4 = 10;
int num21;
if (this.frameCounter >= (double) (5 * (num21 = num20 + 1)))
num4 = 7;
int num22;
if (this.frameCounter >= (double) (5 * (num22 = num21 + 1)))
num4 = 8;
int num23;
if (this.frameCounter >= (double) (5 * (num23 = num22 + 1)))
num4 = 9;
int num24;
if (this.frameCounter >= (double) (5 * (num24 = num23 + 1)))
num4 = 10;
int num25;
if (this.frameCounter >= (double) (5 * (num25 = num24 + 1)))
num4 = 7;
int num26;
if (this.frameCounter >= (double) (5 * (num26 = num25 + 1)))
num4 = 8;
int num27;
if (this.frameCounter >= (double) (5 * (num27 = num26 + 1)))
num4 = 9;
int num28;
if (this.frameCounter >= (double) (5 * (num28 = num27 + 1)))
num4 = 10;
int num29;
if (this.frameCounter >= (double) (5 * (num29 = num28 + 1)))
num4 = 11;
int num30;
if (this.frameCounter >= (double) (5 * (num30 = num29 + 1)))
num4 = 12;
int num31;
if (this.frameCounter >= (double) (5 * (num31 = num30 + 1)))
num4 = 13;
int num32;
if (this.frameCounter >= (double) (5 * (num32 = num31 + 1)))
num4 = 14;
if (this.frameCounter >= 270.0)
{
num4 = 14;
this.frameCounter -= 10.0;
}
this.frame.Y = num1 * num4;
}
else
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 4;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 6;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 56.0 || this.frameCounter < 0.0)
this.frameCounter = 0.0;
this.frame.Y = num1 * (int) (this.frameCounter / 8.0);
}
}
}
else if (this.type == 551)
{
int num33 = this.frame.Y / num1;
int num34;
if ((double) this.ai[0] == 4.0)
{
float num35 = 60f;
int num36 = 6 * 10;
if (num33 < 5)
this.frameCounter = 0.0;
num34 = 5;
this.frameCounter = (double) (int) this.ai[1];
int num37 = 0;
int num38;
if (this.frameCounter >= (double) (5 * (num38 = num37 + 1)))
num34 = 6;
num38 = 0;
if (this.frameCounter >= (double) num35 - 6.0)
num34 = 7;
if (this.frameCounter >= (double) num35 - 3.0)
num34 = 8;
if (this.frameCounter >= (double) num35)
num34 = 9 + (int) this.frameCounter / 3 % 2;
int num39 = 0;
if (this.frameCounter >= (double) num35 + (double) num36 + 3.0)
num34 = 8;
int num40;
if (this.frameCounter >= (double) num35 + (double) num36 + 3.0 + (double) (5 * (num40 = num39 + 1)))
num34 = 7;
if (this.frameCounter >= (double) num35 + (double) num36 + 3.0 + (double) (5 * (num38 = num40 + 1)))
num34 = 0;
}
else if ((double) this.ai[0] == 3.0)
{
float num41 = 40f;
float num42 = 80f;
float num43 = num41 + num42;
float num44 = 25f;
if (num33 < 5)
this.frameCounter = 0.0;
num34 = 5;
this.frameCounter = (double) (int) this.ai[1];
int num45 = 0;
int num46;
if (this.frameCounter >= (double) (5 * (num46 = num45 + 1)))
num34 = 6;
num46 = 0;
if (this.frameCounter >= (double) num41 - 6.0)
num34 = 7;
if (this.frameCounter >= (double) num41 - 3.0)
num34 = 8;
if (this.frameCounter >= (double) num41)
num34 = 9 + (int) this.frameCounter / 3 % 2;
int num47 = 0;
if (this.frameCounter >= (double) num43 - (double) num44 + 3.0)
num34 = 8;
int num48;
if (this.frameCounter >= (double) num43 - (double) num44 + 3.0 + (double) (5 * (num48 = num47 + 1)))
num34 = 7;
if (this.frameCounter >= (double) num43 - (double) num44 + 3.0 + (double) (5 * (num46 = num48 + 1)))
num34 = 0;
}
else if ((double) this.ai[0] == 5.0)
num34 = 3;
else if ((double) this.ai[0] == 6.0)
{
if (num33 > 4)
this.frameCounter = 0.0;
num34 = 1;
this.frameCounter = (double) (int) this.ai[1];
int num49 = 0;
int num50;
if (this.frameCounter >= (double) (8 * (num50 = num49 + 1)))
num34 = 2;
int num51;
if (this.frameCounter >= (double) (8 * (num51 = num50 + 1)))
num34 = 3;
int num52;
if (this.frameCounter >= (double) (8 * (num52 = num51 + 1)))
num34 = 4;
int num53;
if (this.frameCounter >= (double) (8 * (num53 = num52 + 1)))
num34 = 3;
int num54;
if (this.frameCounter >= (double) (8 * (num54 = num53 + 1)))
num34 = 4;
int num55;
if (this.frameCounter >= (double) (8 * (num55 = num54 + 1)))
num34 = 3;
int num56;
if (this.frameCounter >= (double) (8 * (num56 = num55 + 1)))
num34 = 2;
int num57;
if (this.frameCounter >= (double) (8 * (num57 = num56 + 1)))
num34 = 1;
int num58;
if (this.frameCounter >= (double) (8 * (num58 = num57 + 1)))
num34 = 0;
}
else
num34 = 0;
this.frame.Y = num1 * num34;
}
if (this.type == 552 || this.type == 553 || this.type == 554)
{
if ((double) this.ai[0] > 0.0)
{
this.spriteDirection = this.direction;
if (this.frame.Y < num1 * 10 || this.frame.Y > num1 * 13 || (double) this.ai[1] == 29.0)
{
this.frame.Y = num1 * 10;
this.frameCounter = 0.0;
}
if (++this.frameCounter >= 6.0 && this.frame.Y < num1 * 13)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
}
else
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 8;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 9;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 64.0 || this.frameCounter < 0.0)
this.frameCounter = 0.0;
this.frame.Y = num1 * (int) (this.frameCounter / 8.0);
}
}
}
if (this.type == 572 || this.type == 573)
{
if ((double) this.ai[0] > 0.0 && (double) this.ai[1] == 0.0)
{
this.spriteDirection = this.direction;
if (this.frame.Y != num1 * 8 || this.frameCounter > 2.0)
{
this.frame.Y = num1 * 8;
this.frameCounter = 0.0;
}
if (this.frameCounter == 0.0)
{
this.frameCounter = 1.0;
EmoteBubble.NewBubble(3, new WorldUIAnchor((Entity) this), 60);
}
}
else if ((double) this.ai[1] == 1.0)
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 17;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 8;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 64.0 || this.frameCounter < 0.0)
this.frameCounter = 0.0;
this.frame.Y = num1 * ((int) (this.frameCounter / 8.0) + 8);
}
}
else
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 16;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 64.0 || this.frameCounter < 0.0)
this.frameCounter = 0.0;
this.frame.Y = num1 * (int) (this.frameCounter / 8.0);
}
}
}
if (this.type == 566 || this.type == 567)
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 8;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 64.0 || this.frameCounter < 0.0)
this.frameCounter = 0.0;
this.frame.Y = num1 * (int) (this.frameCounter / 8.0);
}
}
if (this.type == 576 || this.type == 577)
{
int num59 = this.frame.Y;
this.frame.Width = 80;
if ((double) this.ai[0] > 0.0 && (double) this.ai[1] == 0.0)
{
this.spriteDirection = this.direction;
if (num59 < 11 || num59 > 20)
{
num59 = 11;
this.frameCounter = 0.0;
}
int num60 = 4;
if (num59 == 13 || num59 == 19)
num60 = 8;
if (num59 == 14 || num59 == 18)
num60 = 2;
if (++this.frameCounter >= (double) num60 && num59 < 20)
{
this.frameCounter = 0.0;
++num59;
}
}
else if ((double) this.ai[0] > 0.0 && (double) this.ai[1] == 2.0)
{
this.spriteDirection = this.direction;
if (num59 < 37 || num59 > 47)
{
num59 = 39;
this.frameCounter = 0.0;
}
int num61 = 5;
if (num59 == 42)
num61 = 6;
if (num59 == 45)
num61 = 8;
if (num59 == 46)
num61 = 4;
if (num59 == 47)
num61 = 26;
if (num59 == 37 || num59 == 38)
num61 = 7;
bool flag = true;
if (num59 == 46 && (double) this.velocity.Y != 0.0)
flag = false;
if (num59 == 38)
flag = false;
if (flag)
++this.frameCounter;
if (this.frameCounter >= (double) num61)
{
if (num59 < 47)
{
this.frameCounter = 0.0;
++num59;
}
else
{
num59 = 37;
this.frameCounter = 0.0;
}
}
}
else if ((double) this.ai[0] > 0.0 && (double) this.ai[1] == 1.0)
{
this.spriteDirection = this.direction;
if (num59 < 21 || num59 > 38)
{
num59 = 21;
this.frameCounter = 0.0;
}
if (++this.frameCounter >= 5.0 && num59 < 38)
{
this.frameCounter = 0.0;
++num59;
}
}
else
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0)
{
this.frameCounter = 0.0;
num59 = 43;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
num59 = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 60.0 || this.frameCounter < 0.0)
this.frameCounter = 0.0;
num59 = 1 + (int) (this.frameCounter / 6.0);
}
}
this.frame.Y = num59;
}
if (this.type == 570 || this.type == 571)
{
if ((double) this.ai[1] > 0.0 && (double) this.ai[0] > 0.0)
{
this.spriteDirection = this.direction;
if (this.frame.Y < num1 * 10 || this.frame.Y > num1 * 15 || (double) this.ai[1] == 59.0)
{
this.frame.Y = num1 * 10;
this.frameCounter = 0.0;
}
int num62 = 5;
if (this.frame.Y == num1 * 14)
num62 = 35;
if (++this.frameCounter >= (double) num62 && this.frame.Y < num1 * 15)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
}
else
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 9;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 64.0 || this.frameCounter < 0.0)
this.frameCounter = 0.0;
this.frame.Y = num1 * (int) (this.frameCounter / 8.0 + 2.0);
}
}
}
if (this.type == 561 || this.type == 562 || this.type == 563)
{
if (this.justHit)
this.justHit = this.justHit;
if ((double) this.ai[1] > 0.0 && (double) this.ai[0] > 0.0)
{
this.spriteDirection = this.direction;
if (this.frame.Y < num1 * 10 || this.frame.Y > num1 * 13 || (double) this.ai[1] == 89.0)
{
this.frame.Y = num1 * 10;
this.frameCounter = 0.0;
}
if (++this.frameCounter >= 6.0 && this.frame.Y < num1 * 13)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
}
else
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 8;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 9;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 64.0 || this.frameCounter < 0.0)
this.frameCounter = 0.0;
this.frame.Y = num1 * (int) (this.frameCounter / 8.0);
}
}
}
if (this.type == 555 || this.type == 556 || this.type == 557)
{
if ((double) this.ai[1] > 0.0 && (double) this.ai[0] > 0.0)
{
this.spriteDirection = this.direction;
if (this.frame.Y < num1 * 10 || this.frame.Y > num1 * 16 || (double) this.ai[1] == 41.0)
{
this.frame.Y = num1 * 10;
this.frameCounter = 0.0;
}
if (++this.frameCounter >= 6.0 && this.frame.Y < num1 * 16)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
}
else
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 64.0 || this.frameCounter < 0.0)
this.frameCounter = 0.0;
this.frame.Y = num1 * ((int) (this.frameCounter / 8.0) + 2);
}
}
}
if (this.type == 558 || this.type == 559 || this.type == 560)
{
if ((double) this.velocity.X > 0.0)
this.spriteDirection = 1;
if ((double) this.velocity.X < 0.0)
this.spriteDirection = -1;
float num63 = this.velocity.ToRotation();
if ((double) this.velocity.X < 0.0)
num63 += 3.141593f;
if ((double) this.ai[0] != 2.0)
num63 = this.velocity.X * 0.1f;
this.rotation = num63;
if ((double) this.ai[0] == 2.0)
this.frame.Y = num1 * 4;
else if (++this.frameCounter >= 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
if (this.frame.Y >= num1 * 4)
this.frame.Y = 0;
}
}
if (this.type == 578)
{
this.rotation = this.velocity.X * 0.1f;
if (++this.frameCounter >= 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
if (this.frame.Y >= num1 * 4)
this.frame.Y = 0;
}
}
if (this.type == 574 || this.type == 575)
{
if ((double) this.velocity.X > 0.0)
this.spriteDirection = 1;
if ((double) this.velocity.X < 0.0)
this.spriteDirection = -1;
float rotation = this.velocity.ToRotation();
if ((double) this.velocity.X < 0.0)
rotation += 3.141593f;
this.rotation = this.rotation.AngleTowards(rotation, 0.02f);
if ((double) this.ai[0] != 0.0)
{
if (this.frame.Y < num1 * 2)
{
this.frame.Y = num1 * 2;
this.frameCounter = 0.0;
}
int num64 = 4;
if (this.frame.Y >= num1 * 5)
num64 = 8;
Vector2 Position = this.Center + new Vector2((float) (56 * this.spriteDirection), -30f).RotatedBy((double) this.rotation);
if (++this.frameCounter >= (double) num64 && this.frame.Y < num1 * 9)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y == num1 * 9)
{
for (int index = 0; index < 8; ++index)
{
Dust dust = Dust.NewDustDirect(Position, 0, 0, 6, Alpha: 100);
dust.velocity *= 3f;
dust.scale = 0.6f;
dust.fadeIn = 1.2f;
dust.noGravity = true;
dust.noLight = true;
}
}
}
if (this.frame.Y >= num1 * 9 && (double) this.ai[0] < 3.0)
{
Vector2 vector2_1 = Position;
Vector2 vector2_2 = Position + (this.oldPos[3] - this.position);
int maxValue = 5;
if (this.frameCounter > 60.0)
maxValue = 4;
if (this.frameCounter > 180.0)
maxValue = 3;
if (this.frameCounter > 300.0)
maxValue = 2;
if (this.frameCounter > 600.0)
maxValue = 1;
for (int index = 0; index < 2; ++index)
{
if (Main.rand.Next(maxValue) == 0)
{
Dust dust = Dust.NewDustDirect(Vector2.Lerp(vector2_2, vector2_1, (float) ((double) index / 10.0 + 0.100000001490116)), 0, 0, 6, Alpha: 50);
dust.scale = 0.3f;
dust.fadeIn = 1.5f;
dust.noGravity = true;
dust.noLight = true;
}
}
}
}
else if (++this.frameCounter >= 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
if (this.frame.Y >= num1 * 2)
this.frame.Y = 0;
}
}
if (this.type == 549)
{
this.spriteDirection = 1;
this.rotation = 0.0f;
if (++this.frameCounter >= 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
if (this.type == 564 || this.type == 565)
{
int y = this.frame.Y;
this.frame.Width = 80;
this.frame.Height = 80;
int num65;
if ((double) this.ai[0] > 0.0 && (double) this.ai[1] == 0.0)
{
this.spriteDirection = this.direction;
if (y < 5 || y > 13)
this.frameCounter = 0.0;
num65 = 5;
++this.frameCounter;
int num66 = 0;
int num67;
if (this.frameCounter >= (double) (7 * (num67 = num66 + 1)))
num65 = 6;
int num68;
if (this.frameCounter >= (double) (7 * (num68 = num67 + 1)))
num65 = 7;
int num69;
if (this.frameCounter >= (double) (7 * (num69 = num68 + 1)))
num65 = 5;
int num70;
if (this.frameCounter >= (double) (7 * (num70 = num69 + 1)))
num65 = 6;
int num71;
if (this.frameCounter >= (double) (7 * (num71 = num70 + 1)))
num65 = 7;
int num72;
if (this.frameCounter >= (double) (7 * (num72 = num71 + 1)))
num65 = 5;
int num73;
if (this.frameCounter >= (double) (7 * (num73 = num72 + 1)))
num65 = 6;
int num74;
if (this.frameCounter >= (double) (7 * (num74 = num73 + 1)))
num65 = 7;
int num75;
if (this.frameCounter >= (double) (7 * (num75 = num74 + 1)))
num65 = 8;
int num76;
if (this.frameCounter >= (double) (7 * (num76 = num75 + 1)))
num65 = 9;
int num77;
if (this.frameCounter >= (double) (7 * (num77 = num76 + 1)))
num65 = 10;
int num78;
if (this.frameCounter >= (double) (7 * (num78 = num77 + 1)))
num65 = 11;
int num79;
if (this.frameCounter >= (double) (7 * (num79 = num78 + 1)))
num65 = 12;
int num80;
if (this.frameCounter >= (double) (7 * (num80 = num79 + 1)))
{
num65 = 5;
this.frameCounter = 0.0;
}
}
else if ((double) this.ai[0] > 0.0 && (double) this.ai[1] == 1.0)
{
this.spriteDirection = this.direction;
if (y < 13 || y > 25)
this.frameCounter = 0.0;
num65 = 13;
++this.frameCounter;
int num81 = 0;
int num82;
if (this.frameCounter >= (double) (8 * (num82 = num81 + 1)))
num65 = 14;
int num83;
if (this.frameCounter >= (double) (8 * (num83 = num82 + 1)))
num65 = 15;
int num84;
if (this.frameCounter >= (double) (8 * (num84 = num83 + 1)))
num65 = 16;
int num85;
if (this.frameCounter >= (double) (8 * (num85 = num84 + 1)))
num65 = 17;
int num86;
if (this.frameCounter >= (double) (8 * (num86 = num85 + 1)))
num65 = 18;
int num87;
if (this.frameCounter >= (double) (8 * (num87 = num86 + 1)))
num65 = 19;
int num88;
if (this.frameCounter >= (double) (8 * (num88 = num87 + 1)))
num65 = 20;
int num89;
if (this.frameCounter >= (double) (8 * (num89 = num88 + 1)))
num65 = 18;
int num90;
if (this.frameCounter >= (double) (8 * (num90 = num89 + 1)))
num65 = 19;
int num91;
if (this.frameCounter >= (double) (8 * (num91 = num90 + 1)))
num65 = 20;
int num92;
if (this.frameCounter >= (double) (8 * (num92 = num91 + 1)))
num65 = 21;
int num93;
if (this.frameCounter >= (double) (8 * (num93 = num92 + 1)))
num65 = 22;
int num94;
if (this.frameCounter >= (double) (8 * (num94 = num93 + 1)))
num65 = 23;
int num95;
if (this.frameCounter >= (double) (8 * (num95 = num94 + 1)))
num65 = 24;
int num96;
if (this.frameCounter >= (double) (8 * (num96 = num95 + 1)))
num65 = 25;
int num97;
if (this.frameCounter >= (double) (8 * (num97 = num96 + 1)))
{
num65 = 14;
this.frameCounter = 0.0;
}
}
else if ((double) this.ai[0] > 0.0 && (double) this.ai[1] == 2.0)
{
this.spriteDirection = this.direction;
if (y < 26 || y > 40)
this.frameCounter = 0.0;
num65 = 26;
++this.frameCounter;
int num98 = 0;
int num99;
if (this.frameCounter >= (double) (8 * (num99 = num98 + 1)))
num65 = 27;
int num100;
if (this.frameCounter >= (double) (8 * (num100 = num99 + 1)))
num65 = 28;
int num101;
if (this.frameCounter >= (double) (8 * (num101 = num100 + 1)))
num65 = 29;
int num102;
if (this.frameCounter >= (double) (8 * (num102 = num101 + 1)))
num65 = 26;
int num103;
if (this.frameCounter >= (double) (8 * (num103 = num102 + 1)))
num65 = 27;
int num104;
if (this.frameCounter >= (double) (8 * (num104 = num103 + 1)))
num65 = 28;
int num105;
if (this.frameCounter >= (double) (8 * (num105 = num104 + 1)))
num65 = 29;
int num106;
if (this.frameCounter >= (double) (8 * (num106 = num105 + 1)))
num65 = 26;
int num107;
if (this.frameCounter >= (double) (8 * (num107 = num106 + 1)))
num65 = 27;
int num108;
if (this.frameCounter >= (double) (8 * (num108 = num107 + 1)))
num65 = 28;
int num109;
if (this.frameCounter >= (double) (8 * (num109 = num108 + 1)))
num65 = 29;
int num110;
if (this.frameCounter >= (double) (8 * (num110 = num109 + 1)))
num65 = 30;
int num111;
if (this.frameCounter >= (double) (8 * (num111 = num110 + 1)))
num65 = 31;
int num112;
if (this.frameCounter >= (double) (8 * (num112 = num111 + 1)))
num65 = 32;
int num113;
if (this.frameCounter >= (double) (8 * (num113 = num112 + 1)))
num65 = 33;
int num114;
if (this.frameCounter >= (double) (8 * (num114 = num113 + 1)))
num65 = 34;
int num115;
if (this.frameCounter >= (double) (8 * (num115 = num114 + 1)))
num65 = 35;
int num116;
if (this.frameCounter >= (double) (8 * (num116 = num115 + 1)))
num65 = 36;
int num117;
if (this.frameCounter >= (double) (8 * (num117 = num116 + 1)))
num65 = 37;
int num118;
if (this.frameCounter >= (double) (8 * (num118 = num117 + 1)))
num65 = 38;
int num119;
if (this.frameCounter >= (double) (8 * (num119 = num118 + 1)))
num65 = 39;
int num120;
if (this.frameCounter >= (double) (8 * (num120 = num119 + 1)))
num65 = 40;
int num121;
if (this.frameCounter >= (double) (8 * (num121 = num120 + 1)))
{
num65 = 26;
this.frameCounter = 0.0;
}
}
else
{
this.frameCounter = this.frameCounter + (double) this.velocity.Length() * 0.100000001490116 + 1.0;
if (this.frameCounter >= 40.0 || this.frameCounter < 0.0)
this.frameCounter = 0.0;
num65 = (int) (this.frameCounter / 8.0);
}
this.frame.Y = num65;
}
if (this.type == 338 || this.type == 339 || this.type == 340 || this.type == 17 || this.type == 18 || this.type == 19 || this.type == 20 || this.type == 22 || this.type == 142 || this.type == 353 || this.type == 178 || this.type == 38 || this.type == 26 || this.type == 27 || this.type == 28 || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 21 || this.type == 44 || this.type == 54 || this.type == 37 || this.type == 73 || this.type == 77 || this.type == 78 || this.type == 79 || this.type == 80 || this.type == 104 || this.type == 107 || this.type == 108 || this.type == 120 || this.type == 124 || this.type == 140 || this.type == 159 || this.type == 160 || this.type == 167 || this.type == 181 || this.type == 185 || this.type == 196 || this.type == 197 || this.type == 198 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 207 || this.type == 208 || this.type == 209 || this.type == 212 || this.type == 213 || this.type == 227 || this.type == 228 || this.type == 229 || this.type == 287 || this.type >= 310 && this.type <= 314 || this.type >= 322 && this.type <= 324 || this.type == 326 || this.type == 368 || this.type == 369 || this.type == 453 || this.type == 460 || this.type == 462 || this.type == 463 || this.type == 489 || this.type == 441 || this.type == 534 || this.type == 550)
{
int num122 = this.townNPC || this.type == 453 ? NPCID.Sets.ExtraFramesCount[this.type] : 0;
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
int num123 = Main.npcFrameCount[this.type] - NPCID.Sets.AttackFrameCount[this.type];
if ((double) this.ai[0] == 2.0)
{
++this.frameCounter;
if (this.frame.Y / num1 == num123 - 1 && this.frameCounter >= 5.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else if (this.frame.Y / num1 == 0 && this.frameCounter >= 40.0)
{
this.frame.Y = num1 * (num123 - 1);
this.frameCounter = 0.0;
}
else if (this.frame.Y != 0 && this.frame.Y != num1 * (num123 - 1))
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
}
else if ((double) this.ai[0] == 11.0)
{
++this.frameCounter;
if (this.frame.Y / num1 == num123 - 1 && this.frameCounter >= 20.0)
{
if (this.frameCounter == 20.0)
{
int num124 = Main.rand.Next(4);
for (int index1 = 0; index1 < 3 + num124; ++index1)
{
int index2 = Dust.NewDust(this.Center + Vector2.UnitX * (float) -this.direction * 8f - Vector2.One * 5f + Vector2.UnitY * 8f, 3, 6, 216, (float) -this.direction, 1f);
Main.dust[index2].velocity /= 2f;
Main.dust[index2].scale = 0.8f;
}
if (Main.rand.Next(30) == 0)
{
int index = Gore.NewGore(this.Center + Vector2.UnitX * (float) -this.direction * 8f, Vector2.Zero, Main.rand.Next(580, 583));
Main.gore[index].velocity /= 2f;
Main.gore[index].velocity.Y = Math.Abs(Main.gore[index].velocity.Y);
Main.gore[index].velocity.X = -Math.Abs(Main.gore[index].velocity.X) * (float) this.direction;
}
}
if (this.frameCounter >= 40.0 && Main.rand.Next(20) == 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
}
else if (this.frame.Y / num1 == 0 && this.frameCounter >= 20.0)
{
this.frame.Y = num1 * (num123 - 1);
this.frameCounter = 0.0;
if (Main.netMode != 1)
EmoteBubble.NewBubble(89, new WorldUIAnchor((Entity) this), 30);
}
else if (this.frame.Y != 0 && this.frame.Y != num1 * (num123 - 1))
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
}
else if ((double) this.ai[0] == 5.0)
{
this.frame.Y = num1 * (num123 - 3);
this.frameCounter = 0.0;
}
else if ((double) this.ai[0] == 6.0)
{
++this.frameCounter;
int num125 = this.frame.Y / num1;
switch (num123 - num125)
{
case 1:
case 2:
case 4:
case 5:
int num126 = this.frameCounter >= 10.0 ? (this.frameCounter >= 16.0 ? (this.frameCounter >= 46.0 ? (this.frameCounter >= 60.0 ? (this.frameCounter >= 66.0 ? (this.frameCounter >= 72.0 ? (this.frameCounter >= 102.0 ? (this.frameCounter >= 108.0 ? (this.frameCounter >= 114.0 ? (this.frameCounter >= 120.0 ? (this.frameCounter >= 150.0 ? (this.frameCounter >= 156.0 ? (this.frameCounter >= 162.0 ? (this.frameCounter >= 168.0 ? (this.frameCounter >= 198.0 ? (this.frameCounter >= 204.0 ? (this.frameCounter >= 210.0 ? (this.frameCounter >= 216.0 ? (this.frameCounter >= 246.0 ? (this.frameCounter >= 252.0 ? (this.frameCounter >= 258.0 ? (this.frameCounter >= 264.0 ? (this.frameCounter >= 294.0 ? (this.frameCounter >= 300.0 ? 0 : num123 - 5) : num123 - 4) : num123 - 5) : 0) : num123 - 5) : num123 - 4) : num123 - 5) : 0) : num123 - 5) : num123 - 4) : num123 - 5) : 0) : num123 - 5) : num123 - 4) : num123 - 5) : 0) : num123 - 5) : num123 - 4) : num123 - 5) : 0) : num123 - 5) : num123 - 4) : num123 - 5) : 0;
if (num126 == num123 - 4 && num125 == num123 - 5)
{
Vector2 Position = this.Center + new Vector2((float) (10 * this.direction), -4f);
for (int index3 = 0; index3 < 8; ++index3)
{
int Type = Main.rand.Next(139, 143);
int index4 = Dust.NewDust(Position, 0, 0, Type, this.velocity.X + (float) this.direction, this.velocity.Y - 2.5f, Scale: 1.2f);
Main.dust[index4].velocity.X += (float) this.direction * 1.5f;
Main.dust[index4].position -= new Vector2(4f);
Main.dust[index4].velocity *= 2f;
Main.dust[index4].scale = (float) (0.699999988079071 + (double) Main.rand.NextFloat() * 0.300000011920929);
}
}
this.frame.Y = num1 * num126;
if (this.frameCounter >= 300.0)
{
this.frameCounter = 0.0;
break;
}
break;
default:
if (num125 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
goto case 1;
}
else
goto case 1;
}
}
else if ((double) this.ai[0] == 7.0)
{
++this.frameCounter;
int num127 = this.frame.Y / num1;
switch (num123 - num127)
{
case 1:
case 2:
case 4:
case 5:
int num128 = 0;
if (this.frameCounter < 16.0)
num128 = 0;
else if (this.frameCounter == 16.0 && Main.netMode != 1)
EmoteBubble.NewBubbleNPC(new WorldUIAnchor((Entity) this), 112);
else if (this.frameCounter < 128.0)
num128 = this.frameCounter % 16.0 < 8.0 ? num123 - 2 : 0;
else if (this.frameCounter < 160.0)
num128 = 0;
else if (this.frameCounter == 160.0 && Main.netMode != 1)
EmoteBubble.NewBubbleNPC(new WorldUIAnchor((Entity) this), 60);
else
num128 = this.frameCounter >= 220.0 ? 0 : (this.frameCounter % 12.0 < 6.0 ? num123 - 2 : 0);
this.frame.Y = num1 * num128;
if (this.frameCounter >= 220.0)
{
this.frameCounter = 0.0;
break;
}
break;
default:
if (num127 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
goto case 1;
}
else
goto case 1;
}
}
else if ((double) this.ai[0] == 9.0)
{
++this.frameCounter;
int num129 = this.frame.Y / num1;
switch (num123 - num129)
{
case 1:
case 2:
case 4:
case 5:
int num130 = this.frameCounter >= 10.0 ? (this.frameCounter >= 16.0 ? num123 - 4 : num123 - 5) : 0;
if ((double) this.ai[1] < 16.0)
num130 = num123 - 5;
if ((double) this.ai[1] < 10.0)
num130 = 0;
this.frame.Y = num1 * num130;
break;
default:
if (num129 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
goto case 1;
}
else
goto case 1;
}
}
else if ((double) this.ai[0] == 18.0)
{
++this.frameCounter;
int num131 = this.frame.Y / num1;
switch (num123 - num131)
{
case 1:
case 2:
case 4:
case 5:
int num132 = 0;
num132 = this.frameCounter >= 10.0 ? (this.frameCounter >= 16.0 ? num123 - 2 : num123 - 1) : 0;
if ((double) this.ai[1] < 16.0)
num132 = num123 - 1;
if ((double) this.ai[1] < 10.0)
num132 = 0;
int num133 = Main.npcFrameCount[this.type] - 2;
this.frame.Y = num1 * num133;
break;
default:
if (num131 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
goto case 1;
}
else
goto case 1;
}
}
else if ((double) this.ai[0] == 10.0 || (double) this.ai[0] == 13.0)
{
++this.frameCounter;
int num134 = this.frame.Y / num1;
if ((uint) (num134 - num123) > 3U && num134 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
int num135 = 10;
int num136 = 6;
int num137 = this.frameCounter >= (double) num135 ? (this.frameCounter >= (double) (num135 + num136) ? (this.frameCounter >= (double) (num135 + num136 * 2) ? (this.frameCounter >= (double) (num135 + num136 * 3) ? (this.frameCounter >= (double) (num135 + num136 * 4) ? 0 : num123 + 3) : num123 + 2) : num123 + 1) : num123) : 0;
this.frame.Y = num1 * num137;
}
else if ((double) this.ai[0] == 15.0)
{
++this.frameCounter;
int num138 = this.frame.Y / num1;
if ((uint) (num138 - num123) > 3U && num138 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
float num139 = this.ai[1] / (float) NPCID.Sets.AttackTime[this.type];
int num140 = (double) num139 <= 0.649999976158142 ? ((double) num139 <= 0.5 ? ((double) num139 <= 0.349999994039536 ? ((double) num139 <= 0.0 ? 0 : num123 + 3) : num123 + 2) : num123 + 1) : num123;
this.frame.Y = num1 * num140;
}
else if ((double) this.ai[0] == 12.0)
{
++this.frameCounter;
int num141 = this.frame.Y / num1;
if ((uint) (num141 - num123) > 4U && num141 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
int num142 = num123 + this.GetShootingFrame(this.ai[2]);
this.frame.Y = num1 * num142;
}
else if ((double) this.ai[0] == 14.0)
{
++this.frameCounter;
int num143 = this.frame.Y / num1;
if ((uint) (num143 - num123) > 1U && num143 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
int num144 = 12;
int num145 = this.frameCounter % (double) num144 * 2.0 < (double) num144 ? num123 : num123 + 1;
this.frame.Y = num1 * num145;
}
else if ((double) this.ai[0] == 3.0 || (double) this.ai[0] == 4.0)
{
++this.frameCounter;
int num146 = this.frame.Y / num1;
switch (num123 - num146)
{
case 1:
case 2:
case 4:
case 5:
bool flag = (double) this.ai[0] == 3.0;
int num147 = 0;
int num148 = 0;
int time1 = -1;
int time2 = -1;
if (this.frameCounter < 10.0)
num147 = 0;
else if (this.frameCounter < 16.0)
num147 = num123 - 5;
else if (this.frameCounter < 46.0)
num147 = num123 - 4;
else if (this.frameCounter < 60.0)
num147 = num123 - 5;
else if (this.frameCounter < 216.0)
num147 = 0;
else if (this.frameCounter == 216.0 && Main.netMode != 1)
time1 = 70;
else if (this.frameCounter < 286.0)
num147 = this.frameCounter % 12.0 < 6.0 ? num123 - 2 : 0;
else if (this.frameCounter < 320.0)
num147 = 0;
else if (this.frameCounter == 320.0 && Main.netMode != 1)
time1 = 100;
else
num147 = this.frameCounter >= 420.0 ? 0 : (this.frameCounter % 16.0 < 8.0 ? num123 - 2 : 0);
if (this.frameCounter < 70.0)
num148 = 0;
else if (this.frameCounter == 70.0 && Main.netMode != 1)
time2 = 90;
else
num148 = this.frameCounter >= 160.0 ? (this.frameCounter >= 166.0 ? (this.frameCounter >= 186.0 ? (this.frameCounter >= 200.0 ? (this.frameCounter >= 320.0 ? (this.frameCounter >= 326.0 ? 0 : num123 - 1) : 0) : num123 - 5) : num123 - 4) : num123 - 5) : (this.frameCounter % 16.0 < 8.0 ? num123 - 2 : 0);
if (flag)
{
if (time1 != -1)
EmoteBubble.NewBubbleNPC(new WorldUIAnchor((Entity) this), time1, new WorldUIAnchor((Entity) Main.npc[(int) this.ai[2]]));
if (time2 != -1)
EmoteBubble.NewBubbleNPC(new WorldUIAnchor((Entity) Main.npc[(int) this.ai[2]]), time2, new WorldUIAnchor((Entity) this));
}
this.frame.Y = num1 * (flag ? num147 : num148);
if (this.frameCounter >= 420.0)
{
this.frameCounter = 0.0;
break;
}
break;
default:
if (num146 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
goto case 1;
}
else
goto case 1;
}
}
else if ((double) this.ai[0] == 16.0 || (double) this.ai[0] == 17.0)
{
++this.frameCounter;
int num149 = this.frame.Y / num1;
switch (num123 - num149)
{
case 1:
case 2:
case 4:
case 5:
bool flag = (double) this.ai[0] == 16.0;
int num150 = 0;
int time = -1;
if (this.frameCounter < 10.0)
num150 = 0;
else if (this.frameCounter < 16.0)
num150 = num123 - 5;
else if (this.frameCounter < 22.0)
num150 = num123 - 4;
else if (this.frameCounter < 28.0)
num150 = num123 - 5;
else if (this.frameCounter < 34.0)
num150 = num123 - 4;
else if (this.frameCounter < 40.0)
num150 = num123 - 5;
else if (this.frameCounter == 40.0 && Main.netMode != 1)
time = 45;
else if (this.frameCounter < 70.0)
num150 = num123 - 4;
else if (this.frameCounter < 76.0)
num150 = num123 - 5;
else if (this.frameCounter < 82.0)
num150 = num123 - 4;
else if (this.frameCounter < 88.0)
num150 = num123 - 5;
else if (this.frameCounter < 94.0)
num150 = num123 - 4;
else if (this.frameCounter < 100.0)
num150 = num123 - 5;
else if (this.frameCounter == 100.0 && Main.netMode != 1)
time = 45;
else if (this.frameCounter < 130.0)
num150 = num123 - 4;
else if (this.frameCounter < 136.0)
num150 = num123 - 5;
else if (this.frameCounter < 142.0)
num150 = num123 - 4;
else if (this.frameCounter < 148.0)
num150 = num123 - 5;
else if (this.frameCounter < 154.0)
num150 = num123 - 4;
else if (this.frameCounter < 160.0)
num150 = num123 - 5;
else if (this.frameCounter == 160.0 && Main.netMode != 1)
time = 75;
else
num150 = this.frameCounter >= 220.0 ? (this.frameCounter >= 226.0 ? 0 : num123 - 5) : num123 - 4;
if (flag && time != -1)
{
int num151 = (int) this.localAI[2];
int num152 = (int) this.localAI[3];
int num153 = (int) Main.npc[(int) this.ai[2]].localAI[3];
int num154 = (int) Main.npc[(int) this.ai[2]].localAI[2];
int num155 = 3 - num151 - num152;
int num156 = 0;
if (this.frameCounter == 40.0)
num156 = 1;
if (this.frameCounter == 100.0)
num156 = 2;
if (this.frameCounter == 160.0)
num156 = 3;
int num157 = 3 - num156;
int num158 = -1;
int num159 = 0;
while (num158 < 0 && ++num159 < 100)
{
num158 = Main.rand.Next(2);
if (num158 == 0 && num154 >= num152)
num158 = -1;
if (num158 == 1 && num153 >= num151)
num158 = -1;
if (num158 == -1 && num157 <= num155)
num158 = 2;
}
if (num158 == 0)
{
++Main.npc[(int) this.ai[2]].localAI[3];
++num153;
}
if (num158 == 1)
{
++Main.npc[(int) this.ai[2]].localAI[2];
++num154;
}
int emoticon1 = Utils.SelectRandom<int>(Main.rand, 38, 37, 36);
int emoticon2 = emoticon1;
if (num158 == 0)
{
switch (emoticon1)
{
case 36:
emoticon2 = 38;
break;
case 37:
emoticon2 = 36;
break;
case 38:
emoticon2 = 37;
break;
}
}
else if (num158 == 1)
{
switch (emoticon1)
{
case 36:
emoticon2 = 37;
break;
case 37:
emoticon2 = 38;
break;
case 38:
emoticon2 = 36;
break;
}
}
if (num157 == 0)
{
if (num153 >= 2)
emoticon1 -= 3;
if (num154 >= 2)
emoticon2 -= 3;
}
EmoteBubble.NewBubble(emoticon1, new WorldUIAnchor((Entity) this), time);
EmoteBubble.NewBubble(emoticon2, new WorldUIAnchor((Entity) Main.npc[(int) this.ai[2]]), time);
}
this.frame.Y = num1 * (flag ? num150 : num150);
if (this.frameCounter >= 420.0)
{
this.frameCounter = 0.0;
break;
}
break;
default:
if (num149 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
goto case 1;
}
else
goto case 1;
}
}
else if ((double) this.velocity.X == 0.0)
{
if (this.type == 140 || this.type == 287 || this.type == 489)
{
this.frame.Y = num1;
this.frameCounter = 0.0;
}
else
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
}
else
{
int num160 = 6;
if (this.type == 534)
num160 = 12;
if (this.type == 489)
{
num160 = 8;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
this.frameCounter += 0.5;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
++this.frameCounter;
}
if (this.type == 462)
num160 = 9;
if (this.frameCounter > (double) num160)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type] - num122)
this.frame.Y = num1 * 2;
}
}
else if (this.type == 462)
{
this.frameCounter = 0.0;
this.frame.Y = (double) this.velocity.Y >= 0.0 ? num1 * 2 : num1;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
if (this.type == 489 || this.type == 21 || this.type == 31 || this.type == 294 || this.type == 326 || this.type == 295 || this.type == 296 || this.type == 44 || this.type == 77 || this.type == 78 || this.type == 79 || this.type == 80 || this.type == 120 || this.type == 140 || this.type == 159 || this.type == 167 || this.type == 197 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 287 || this.type >= 322 && this.type <= 324)
this.frame.Y = 0;
if (this.type == 181)
this.frame.Y = num1 * 14;
}
}
if (this.type >= 494 && this.type <= 495)
{
if ((double) this.ai[2] > 0.0)
{
if ((double) this.ai[2] < 7.0)
this.frame.Y = num1 * 5;
else if ((double) this.ai[2] < 14.0)
this.frame.Y = num1 * 6;
else if ((double) this.ai[2] < 20.0)
this.frame.Y = num1 * 7;
}
else
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
}
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = (double) this.velocity.Y >= 0.0 ? num1 * 3 : num1 * 2;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
this.frame.Y = 0;
else if (this.frameCounter < 16.0)
this.frame.Y = num1;
else if (this.frameCounter < 24.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 32.0)
this.frame.Y = num1 * 3;
else if (this.frameCounter < 39.0)
{
this.frame.Y = num1 * 4;
}
else
{
this.frame.Y = num1 * 4;
this.frameCounter = 0.0;
}
}
}
}
if (this.type == 541)
{
if ((double) this.ai[0] > 0.0)
{
float num161 = this.ai[0];
this.frame.Y = (double) num161 >= 6.0 ? ((double) num161 >= 105.0 ? ((double) num161 >= 114.0 ? ((double) num161 >= 135.0 ? num1 : num1 * (int) (((double) num161 - 99.0 - 15.0) / 7.0 + 10.0)) : num1 * 9) : num1 * (int) ((double) num161 / 8.0 % 4.0 + 5.0)) : num1 * 4;
}
else
{
this.frameCounter = this.frameCounter + (double) this.velocity.Length() * 0.100000001490116 + 1.0;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * 4)
this.frame.Y = 0;
}
}
if (this.type >= 498 && this.type <= 506)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] > 0.0)
{
this.spriteDirection = this.direction;
this.frame.Y = (double) this.ai[1] >= 12.0 ? ((double) this.ai[1] >= 34.0 ? num1 * 8 : num1 * 9) : num1 * 8;
this.frameCounter = 0.0;
}
else if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
if (this.frameCounter > 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 7)
this.frame.Y = 0;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 10;
}
}
else if (this.type >= 524 && this.type <= 527)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction != 0)
this.spriteDirection = this.direction;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
++this.frameCounter;
if (this.frameCounter > 9.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = num1 * 2;
}
}
else
{
this.frame.Y = num1;
this.frameCounter = 0.0;
}
}
else if (this.type >= 528 && this.type <= 529)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction != 0)
this.spriteDirection = this.direction;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
++this.frameCounter;
if (this.frameCounter > 9.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type] - 1)
this.frame.Y = num1;
}
}
else
{
this.frame.Y = num1 * (Main.npcFrameCount[this.type] - 1);
this.frameCounter = 0.0;
}
}
else if (this.type == 533)
{
if ((double) this.velocity.Y == 0.0 && this.direction != 0)
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 48.0)
this.frameCounter = 0.0;
this.frame.Y = (int) (this.frameCounter / 6.0) * num1;
if ((double) this.ai[1] > 0.0)
this.frame.Y += num1 * 8;
}
if (this.type >= 496 && this.type <= 497)
{
if ((double) this.ai[0] == 0.0)
{
this.rotation = 0.0f;
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
else if ((double) this.velocity.Y < 0.0)
this.frameCounter = 0.0;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.10000002384186;
if (this.frameCounter < 6.0)
this.frame.Y = 0;
else if (this.frameCounter < 12.0)
this.frame.Y = num1;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 24.0)
this.frame.Y = num1 * 3;
else
this.frameCounter = 0.0;
}
else if ((double) this.ai[0] == 1.0)
{
this.frameCounter = 0.0;
this.frame.Y = (double) this.ai[1] >= 10.0 ? ((double) this.ai[1] >= 20.0 ? num1 * 6 : num1 * 5) : num1 * 4;
}
else if ((double) this.ai[0] == 5.0)
{
this.frameCounter = 0.0;
this.frame.Y = (double) this.ai[1] >= 10.0 ? ((double) this.ai[1] >= 20.0 ? num1 * 3 : num1 * 11) : num1 * 10;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 7;
}
}
else if (this.aiStyle == 39 && this.type != 417)
{
if ((double) this.ai[0] == 0.0)
{
this.rotation = 0.0f;
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
else if ((double) this.velocity.Y < 0.0)
this.frameCounter = 0.0;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.10000002384186;
if (this.frameCounter < 6.0)
this.frame.Y = 0;
else if (this.frameCounter < 12.0)
this.frame.Y = num1;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 24.0)
this.frame.Y = num1 * 3;
else if (this.frameCounter < 32.0)
this.frame.Y = num1 * 4;
else
this.frameCounter = 0.0;
}
else if ((double) this.ai[0] == 1.0)
{
this.frameCounter = 0.0;
this.frame.Y = (double) this.ai[1] >= 10.0 ? ((double) this.ai[1] >= 20.0 ? num1 * 7 : num1 * 6) : num1 * 5;
}
else if ((double) this.ai[0] == 5.0)
{
this.frameCounter = 0.0;
this.frame.Y = (double) this.ai[1] >= 10.0 ? ((double) this.ai[1] >= 20.0 ? num1 * 5 : num1 * 6) : num1 * 7;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 7;
}
}
else if (this.type == 508 || this.type == 532)
{
if ((double) this.velocity.Y != 0.0)
this.frame.Y = num1;
else if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
}
else
{
if (this.direction < 0 && (double) this.velocity.X < 0.0)
this.spriteDirection = -1;
if (this.direction > 0 && (double) this.velocity.X > 0.0)
this.spriteDirection = 1;
if (this.frame.Y / num1 < 2)
this.frame.Y = num1 * 2;
this.frameCounter += 1.0 + (double) Math.Abs(this.velocity.X) / 2.0;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = num1 * 2;
}
}
else if (this.type == 509)
{
if ((double) this.velocity.X > 0.0 && this.direction > 0 || (double) this.velocity.X < 0.0 && this.direction < 0)
this.spriteDirection = this.direction;
if (++this.frameCounter >= 3.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
if (this.type == 415)
{
if ((double) this.ai[2] < 0.0)
{
if (this.frame.Y / num1 != 8 && this.frame.Y / num1 != 9 && this.frame.Y / num1 != 0)
this.frameCounter = 0.0;
++this.frameCounter;
int num162 = 0;
int num163 = 18;
int num164 = 4;
if (this.frameCounter > (double) (num163 - num164 * 2))
num162 = 8 + (int) this.frameCounter / 4 % 2;
if (this.frameCounter > (double) (num163 + num164 * 6))
{
num162 = 0;
this.frameCounter = 0.0;
}
this.frame.Y = num1 * num162;
}
else if ((double) this.velocity.Y == 0.0)
{
if (this.direction != 0)
this.spriteDirection = this.direction;
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 0.5;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type] - 2)
this.frame.Y = num1 * 2;
if ((double) this.velocity.X == 0.0)
this.frame.Y = 0;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
if (this.type == 416)
{
int index = (int) this.ai[0];
if (Main.npc[index].active && Main.npc[index].type == 415 && Main.npcTexture[415] != null)
this.frame.Y = Main.npc[index].frame.Y / (Main.npcTexture[415].Height / Main.npcFrameCount[415]) * num1;
}
else if (this.type == 417)
{
if ((double) this.ai[0] == 0.0)
{
this.rotation = 0.0f;
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
else if ((double) this.velocity.Y < 0.0)
this.frameCounter = 0.0;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.10000002384186;
this.frame.Y = (int) (this.frameCounter / 6.0) * num1;
if (this.frameCounter >= 48.0)
this.frameCounter = 0.0;
}
else if ((double) this.ai[0] == 1.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * (9 + (int) ((double) this.ai[1] / 6.0));
}
else if ((double) this.ai[0] == 5.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * (13 - (int) ((double) this.ai[1] / 6.0));
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 14;
}
}
else if (this.type == 518)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction != 0)
this.spriteDirection = this.direction;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = num1 * 2;
}
}
else
{
this.frame.Y = num1;
this.frameCounter = 0.0;
}
}
else if (this.type == 419)
{
if ((double) this.ai[2] < 0.0)
{
int num165 = 1;
if (this.direction != 0)
this.spriteDirection = this.direction;
if (this.frame.Y / num1 >= 9)
{
this.frame.Y = num1 * 2;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < 2)
{
this.frame.Y = num1 * 2;
this.frameCounter = 0.0;
}
++this.frameCounter;
if (this.frameCounter >= (double) (num165 * 4 + 6))
this.frameCounter = 8.0;
this.frame.Y = this.frameCounter >= 6.0 ? num1 * (int) (4.0 + (this.frameCounter - 6.0) / (double) num165) : num1 * (int) (2.0 + this.frameCounter / 3.0);
}
else if ((double) this.velocity.Y == 0.0)
{
if (this.direction != 0)
this.spriteDirection = this.direction;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = num1 * 9;
if (this.frame.Y / num1 < 9)
this.frame.Y = num1 * 9;
}
}
else
{
this.frame.Y = num1;
this.frameCounter = 0.0;
}
}
else if (this.type == 425)
{
if (this.direction != 0)
this.spriteDirection = -this.direction;
if ((double) this.ai[2] == 1.0)
{
++this.frameCounter;
if (this.frameCounter >= 3.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 12 || this.frame.Y < num1 * 10)
this.frame.Y = num1 * 10;
}
else if ((double) this.velocity.Y != 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 9 || this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
}
}
else if (this.type == 427)
{
if (this.direction != 0)
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0)
{
++this.frameCounter;
if (this.frameCounter >= 2.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * 9 || this.frame.Y < num1 * 6)
this.frame.Y = num1 * 6;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 5 || this.frame.Y < num1)
this.frame.Y = num1;
}
}
else if (this.type == 426)
{
if (this.direction != 0)
this.spriteDirection = this.direction;
if ((double) this.ai[1] >= 45.0)
{
if ((double) this.velocity.Y == 0.0)
{
this.frame.Y = num1 * 8;
}
else
{
++this.frameCounter;
if (this.frameCounter >= 2.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * 15 || this.frame.Y < num1 * 12)
this.frame.Y = num1 * 12;
}
}
else if ((double) this.velocity.Y != 0.0)
{
++this.frameCounter;
if (this.frameCounter >= 2.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * 12 || this.frame.Y < num1 * 9)
this.frame.Y = num1 * 9;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 10.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 7 || this.frame.Y < num1)
this.frame.Y = num1;
}
}
else if (this.type == 429)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction != 0)
this.spriteDirection = this.direction;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = num1 * 2;
}
}
else
{
this.frame.Y = num1;
this.frameCounter = 0.0;
}
}
else if (this.type == 428)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction != 0)
this.spriteDirection = this.direction;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
if (++this.frameCounter > 10.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type] - 1)
this.frame.Y = 0;
}
}
else if (this.frame.Y / num1 != 4)
{
if (this.frameCounter > 0.0)
this.frameCounter = 0.0;
if (--this.frameCounter < -10.0 || (double) this.velocity.Y > 0.600000023841858)
{
this.frame.Y = num1 * 4;
this.frameCounter = 0.0;
}
}
}
else if (this.type == 423)
{
if ((double) this.ai[2] == 1.0)
{
int num166 = 2;
if ((double) this.ai[1] >= 30.0 && (double) this.ai[1] < 45.0)
num166 = 3;
this.frame.Y = num166 * num1;
}
else if ((double) this.velocity.Y != 0.0)
this.frame.Y = num1;
else if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
}
else
{
if ((double) this.velocity.X != 0.0)
this.spriteDirection = Math.Sign(-this.velocity.X);
if (this.frame.Y / num1 < 4)
this.frame.Y = num1 * 4;
this.frameCounter += 1.0 + (double) Math.Abs(this.velocity.X) / 2.0;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = num1 * 4;
}
}
else if (this.type == 421)
{
if ((double) this.ai[0] == 5.0)
++this.frameCounter;
if (++this.frameCounter >= 5.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
if (this.type == 424)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction != 0)
this.spriteDirection = -this.direction;
if ((double) this.ai[2] > 0.0)
{
this.frame.Y = num1 * ((double) this.ai[1] > 90.0 ? Main.npcFrameCount[this.type] - 2 : Main.npcFrameCount[this.type] - 1);
this.frameCounter = 0.0;
}
else if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
}
else
{
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
this.frameCounter += (double) this.velocity.X * 1.29999995231628;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type] - 2)
this.frame.Y = num1 * 2;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
else if (this.type == 420 && ++this.frameCounter >= 5.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
if (this.type == 411)
{
if ((double) this.ai[1] >= 90.0 && (double) this.ai[1] < 180.0)
{
this.spriteDirection = -this.direction;
this.frame.Y = num1 * (Main.npcFrameCount[this.type] - 1);
this.frameCounter = 0.0;
}
else if ((double) this.velocity.Y == 0.0)
{
if (this.direction != 0)
this.spriteDirection = -this.direction;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type] - 1)
this.frame.Y = num1 * 2;
}
}
else
{
this.frame.Y = num1;
this.frameCounter = 0.0;
}
}
else if (this.type == 409)
{
if ((double) this.velocity.Y == 0.0 && (double) this.ai[1] <= 30.0 && (double) this.ai[1] > 0.0)
{
this.frame.Y = num1 * (Main.npcFrameCount[this.type] - 1);
this.frameCounter = 0.0;
}
else
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if (++this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type] - 2)
this.frame.Y = 0;
}
}
}
else if (this.type == 410)
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 10.0)
{
this.frameCounter -= 10.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
else if (this.type == 407)
{
if (++this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
else if ((this.type == 405 || this.type == 406) && ++this.frameCounter >= 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
if (this.type == 516)
{
if ((double) this.localAI[1] == 0.0)
{
this.localAI[1] = 1f;
this.frame.Y = num1 * Main.rand.Next(3);
this.frameCounter += (double) Main.rand.Next(3);
}
++this.frameCounter;
if (this.frameCounter > 3.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y > num1 * 3)
this.frame.Y = 0;
}
}
if (this.type == 418)
{
if ((double) this.ai[0] == 0.0 || (double) this.ai[0] == 1.0 || (double) this.ai[0] == -1.0)
{
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 4)
this.frame.Y = 0;
}
else if ((double) this.ai[0] == 2.0)
this.frame.Y = (double) this.ai[1] >= 10.0 ? ((double) this.ai[1] >= 20.0 ? num1 * 7 : num1 * 6) : num1 * 5;
else if ((double) this.ai[0] == -2.0)
{
++this.frameCounter;
if (this.frameCounter > 12.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 7)
this.frame.Y = num1 * 5;
}
}
if (this.type == 1 || this.type == 537 || this.type == 16 || this.type == 59 || this.type == 71 || this.type == 81 || this.type == 138 || this.type == 147 || this.type == 183 || this.type == 184 || this.type == 204 || this.type == 225 || this.type == 302 || this.type == 304 || this.type >= 333 && this.type <= 336 || this.type == 535)
{
if (this.type == 302 || this.type == 304)
this.spriteDirection = this.direction;
++this.frameCounter;
if (num2 > 0)
++this.frameCounter;
if (num2 == 4)
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
if (this.type == 488)
{
int num167 = (int) this.localAI[1];
if (Framing.GetTileSafely((int) this.ai[0], (int) this.ai[1]).frameX >= (short) 36)
num167 *= -1;
if ((double) this.localAI[0] > 24.0)
this.localAI[0] = 24f;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
if ((double) this.localAI[0] < 0.0)
this.localAI[0] = 0.0f;
int num168 = num167 == -1 ? 4 : 6;
int num169 = (int) this.localAI[0] / num168;
if ((double) this.localAI[0] % (double) num168 != 0.0)
++num169;
if (num169 != 0 && num167 == 1)
num169 += 5;
this.frame.Y = num169 * num1;
}
if (this.type >= 430 && this.type <= 436)
{
if ((double) this.ai[2] > 0.0)
{
this.frame.Y = (double) this.ai[2] >= 5.0 ? ((double) this.ai[2] >= 10.0 ? ((double) this.ai[2] >= 15.0 ? num1 * 6 : num1 * 5) : num1 * 4) : num1 * 3;
}
else
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
}
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 2;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
this.frame.Y = 0;
else if (this.frameCounter < 16.0)
this.frame.Y = num1;
else if (this.frameCounter < 24.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 32.0)
this.frame.Y = num1;
else
this.frameCounter = 0.0;
}
}
}
if (this.type == 454)
{
int num170 = (int) (this.frameCounter / 2.0);
this.frame.Y = num1 * num170;
}
if (this.type == 377 || this.type == 446)
{
this.frame.Y = (double) this.velocity.Y == 0.0 ? 0 : num1;
this.spriteDirection = this.direction;
}
if (this.type == 378)
{
if ((double) this.velocity.Y != 0.0 && this.frame.Y < num1 * 2)
this.frame.Y += num1 * 2;
if ((double) this.velocity.Y == 0.0 && this.frame.Y > num1 * 2)
this.frame.Y -= num1 * 2;
++this.frameCounter;
if (this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if ((double) this.velocity.Y != 0.0 && this.frame.Y >= num1 * 4)
this.frame.Y = num1 * 2;
if ((double) this.velocity.Y == 0.0 && this.frame.Y >= num1 * 2)
this.frame.Y = 0;
}
}
if (this.type == 376)
{
++this.frameCounter;
if (this.frameCounter > 30.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y >= num1 * 2)
this.frame.Y = 0;
}
}
if (this.type == 375)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y >= num1 * 4)
this.frame.Y = 0;
}
}
if (this.type == 374)
{
this.localAI[0] = -2f;
if ((double) this.velocity.Y == 0.0)
{
this.rotation = 0.0f;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y >= num1 * 4)
this.frame.Y = num1;
}
}
}
else
{
this.rotation += (float) this.direction * 0.1f;
++this.frameCounter;
if (this.frameCounter > 3.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y >= num1 * 4)
this.frame.Y = num1;
}
}
}
if (this.type == 492)
this.frame.Y = num1 * (int) this.ai[2];
if (this.type == 473 || this.type == 474 || this.type == 475 || this.type == 476)
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.ai[0] == 0.0 || (double) this.ai[0] == 7.0)
{
this.rotation = 0.0f;
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else if ((double) this.ai[0] == 1.0)
{
this.rotation = 0.0f;
this.frameCounter = 0.0;
int num171 = 6;
this.frame.Y = (double) this.ai[1] >= (double) num171 ? ((double) this.ai[1] >= (double) (num171 * 2) ? ((double) this.ai[1] >= (double) (num171 * 3) ? ((double) this.ai[1] >= (double) (num171 * 4) ? ((double) this.ai[1] >= (double) (num171 * 5) ? num1 * 6 : num1 * 5) : num1 * 4) : num1 * 3) : num1 * 2) : num1;
}
else if ((double) this.ai[0] == 2.0 || (double) this.ai[0] == 6.0)
{
this.rotation = 0.0f;
if ((double) this.velocity.Y == 0.0)
{
int num172 = 6;
++this.frameCounter;
if (this.frame.Y < num1 * 7)
this.frame.Y = num1 * 12;
if (this.frame.Y < num1 * 10)
{
if (this.frameCounter > 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
if (this.frame.Y == num1 * 10)
this.frameCounter = (double) (num172 * 2);
}
}
else if (this.frameCounter < (double) num172)
this.frame.Y = num1 * 12;
else if (this.frameCounter < (double) (num172 * 2))
this.frame.Y = num1 * 11;
else if (this.frameCounter < (double) (num172 * 3))
{
this.frame.Y = num1 * 10;
}
else
{
this.frame.Y = num1 * 11;
if (this.frameCounter >= (double) (num172 * 4 - 1))
this.frameCounter = 0.0;
}
}
else
{
this.frame.Y = num1 * 13;
this.frameCounter = 0.0;
}
}
else if ((double) this.ai[0] == 3.0)
{
this.rotation = 0.0f;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
if (this.frame.Y > num1 * 7)
this.frame.Y -= num1;
}
}
else if ((double) this.ai[0] == 4.0 || (double) this.ai[0] == 5.0)
{
if ((double) this.ai[0] == 4.0 && (double) this.ai[2] == 1.0)
this.rotation = 0.0f;
this.frame.Y = num1 * 13;
this.frameCounter = 0.0;
}
else if ((double) this.ai[0] == 4.09999990463257)
{
this.rotation = 0.0f;
if (this.frame.Y > num1 * 6)
this.frameCounter = 0.0;
++this.frameCounter;
int num173 = 4;
if (this.frameCounter < (double) num173)
this.frame.Y = num1 * 6;
else if (this.frameCounter < (double) (num173 * 2))
this.frame.Y = num1 * 5;
else if (this.frameCounter < (double) (num173 * 3))
this.frame.Y = num1 * 4;
else if (this.frameCounter < (double) (num173 * 4))
this.frame.Y = num1 * 3;
else if (this.frameCounter < (double) (num173 * 5))
{
this.frame.Y = num1 * 4;
}
else
{
this.frame.Y = num1 * 5;
if (this.frameCounter >= (double) (num173 * 6 - 1))
this.frameCounter = 0.0;
}
}
}
if (this.type == 477)
{
this.frameCounter += (double) this.velocity.Length() / 4.0;
++this.frameCounter;
if (this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y / num1 > 5)
this.frame.Y = 0;
}
if (this.type == 479)
{
++this.frameCounter;
int num174 = 4;
if (this.frameCounter < (double) num174)
this.frame.Y = 0;
else if (this.frameCounter < (double) (num174 * 2))
this.frame.Y = num1;
else if (this.frameCounter < (double) (num174 * 3))
this.frame.Y = num1 * 2;
else if (this.frameCounter < (double) (num174 * 4 - 1))
this.frame.Y = num1;
else
this.frameCounter = 0.0;
}
if (this.type == 472)
{
if ((double) this.velocity.X < 0.0)
this.direction = -1;
else
this.direction = 1;
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y * (double) this.direction, (double) this.velocity.X * (double) this.direction);
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= 6)
this.frame.Y = 0;
}
if (this.type >= 449 && this.type <= 452)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] > 0.0)
{
this.spriteDirection = this.direction;
int num175 = 0;
if ((double) this.ai[1] < 22.0)
num175 = -14;
else if ((double) this.ai[1] < 28.0)
num175 = 3;
else if ((double) this.ai[1] < 34.0)
num175 = 2;
else if ((double) this.ai[1] < 40.0)
num175 = 1;
this.frame.Y = num1 * (15 + num175);
this.frameCounter = 0.0;
}
else if ((double) this.velocity.X == 0.0)
{
this.frame.Y = num1;
}
else
{
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= 15)
this.frame.Y = num1 * 2;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
}
if (this.type == 481)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] > 0.0)
{
this.spriteDirection = this.direction;
int num176 = 0;
if ((double) this.ai[1] < 22.0)
num176 = -14;
else if ((double) this.ai[1] < 28.0)
num176 = 3;
else if ((double) this.ai[1] < 34.0)
num176 = 2;
else if ((double) this.ai[1] < 40.0)
num176 = 1;
this.frame.Y = num1 * (15 + num176);
this.frameCounter = 0.0;
}
else if ((double) this.velocity.X == 0.0)
{
this.frame.Y = num1;
}
else
{
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= 15)
this.frame.Y = num1 * 2;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
}
if (this.type == 468)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] > 0.0)
{
this.spriteDirection = this.direction;
int num177 = 0;
if ((double) this.ai[1] < 22.0)
num177 = -15;
else if ((double) this.ai[1] < 28.0)
num177 = 3;
else if ((double) this.ai[1] < 34.0)
num177 = 2;
else if ((double) this.ai[1] < 40.0)
num177 = 1;
this.frame.Y = num1 * (15 + num177);
this.frameCounter = 0.0;
}
else if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
}
else
{
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= 15)
this.frame.Y = num1 * 2;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
if (this.type == 379 || this.type == 380)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] > 0.0)
{
this.spriteDirection = this.direction;
this.frame.Y = num1 * ((int) this.ai[2] - 1 + 2);
this.frameCounter = 0.0;
}
else if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
}
else
{
if (this.frame.Y < num1 * 7)
this.frame.Y = num1 * 7;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = num1 * 7;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
if (this.type == 381 || this.type == 382 || this.type == 383 || this.type == 385 || this.type == 389)
{
if ((double) this.velocity.Y == 0.0)
{
this.spriteDirection = this.direction;
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
if (this.type == 389 || this.type == 385)
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.2;
else
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = num1 * 2;
if ((double) this.velocity.X == 0.0)
this.frame.Y = 0;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
if (this.type == 387)
{
if ((double) this.ai[0] > 0.0)
{
++this.frameCounter;
if ((double) this.ai[0] >= 20.0)
++this.frameCounter;
if ((double) this.ai[0] >= 40.0)
++this.frameCounter;
if (this.frameCounter >= 10.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y >= num1 * 2)
this.frame.Y = 0;
}
}
else
{
++this.frameCounter;
if (this.frameCounter >= 15.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y >= num1 * 2)
this.frame.Y = 0;
}
}
}
if (this.type == 386)
{
if ((double) this.ai[2] > 0.0)
{
int num178 = (int) this.ai[2] / 12;
this.frame.Y = num1 * (9 + num178 % 2);
}
else if ((double) this.velocity.Y == 0.0)
{
this.spriteDirection = this.direction;
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= 9)
this.frame.Y = num1 * 2;
if ((double) this.velocity.X == 0.0)
this.frame.Y = 0;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
if (this.type == 388)
{
++this.frameCounter;
if (this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y >= num1 * 2)
this.frame.Y = 0;
}
}
if (this.type == 391)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = -1;
if (this.direction == -1)
this.spriteDirection = 1;
if (this.frame.Y < num1)
this.frame.Y = num1;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 0.5;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = num1;
if ((double) this.velocity.X == 0.0)
this.frame.Y = 0;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
}
if (this.type == 390)
{
if (this.direction != 0)
this.spriteDirection = -this.direction;
this.frame.Y = (double) this.ai[2] <= 0.0 ? num1 * 2 : num1 * ((int) this.ai[2] - 1);
}
if (this.type == 393)
{
Vector2 rotationVector2 = this.ai[2].ToRotationVector2();
int num179 = (double) rotationVector2.Y <= (double) Math.Abs(rotationVector2.X) * 2.0 ? ((double) rotationVector2.Y <= (double) Math.Abs(rotationVector2.X) * 1.5 ? ((double) Math.Abs(rotationVector2.X) <= (double) rotationVector2.Y * 2.0 ? ((double) Math.Abs(rotationVector2.X) <= (double) rotationVector2.Y * 1.5 ? ((double) rotationVector2.X > 0.0 ? 6 : 2) : ((double) rotationVector2.X > 0.0 ? 7 : 1)) : ((double) rotationVector2.X > 0.0 ? 8 : 0)) : ((double) rotationVector2.X > 0.0 ? 5 : 3)) : 4;
this.frame.Y = num1 * num179;
float num180 = 280f;
float num181 = 140f;
if (((double) this.ai[3] < (double) num180 ? 0 : ((double) this.ai[3] < (double) num180 + (double) num181 ? 1 : 0)) != 0 && (int) this.ai[3] % 6 <= 2)
this.frame.Y += num1 * 9;
}
if (this.type == 394)
{
int num182 = (int) this.ai[3] - 300;
if (num182 >= 120)
{
int num183 = num182 - 120;
this.frame.Y = num183 < 160 ? (num183 < 20 ? num1 * (4 + num183 / 5) : num1 * (num183 / 4 % 4)) : num1 * (7 - (num183 - 160) / 5);
}
else
this.frame.Y = num1 * 4;
}
if (this.type == 395)
{
float num184 = 20f;
float num185 = 240f;
int num186 = (double) this.ai[3] < (double) num184 ? 0 : ((double) this.ai[3] < (double) num184 + (double) num185 ? 1 : 0);
++this.frameCounter;
if (this.frameCounter >= 66.0)
this.frameCounter = 0.0;
if (num186 != 0)
{
++this.frameCounter;
if (this.frameCounter >= 54.0 || this.frameCounter < 36.0)
this.frameCounter = 36.0;
}
int num187 = (int) this.frameCounter % 66 / 6;
this.frame.Y = num1 * num187;
}
if (this.type == 392)
{
float num188 = 20f;
float num189 = 240f;
int num190 = (double) this.ai[3] < (double) num188 ? 0 : ((double) this.ai[3] < (double) num188 + (double) num189 ? 1 : 0);
++this.frameCounter;
if (num190 != 0)
++this.frameCounter;
if (this.frameCounter >= 12.0)
this.frameCounter = 0.0;
int num191 = (int) this.frameCounter % 12 / 3;
this.frame.Y = num1 * num191;
}
if (this.type == 399)
{
this.frameCounter = (this.frameCounter + 0.25) % 4.0 + ((double) this.ai[0] == 0.0 ? 0.0 : 4.0);
this.frame.Y = num1 * (int) this.frameCounter;
}
else if (this.type == 520)
{
if ((double) this.velocity.Y == 0.0)
{
this.spriteDirection = this.direction;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
if (this.frameCounter > 6.0)
{
if ((double) Math.Abs(this.velocity.X) < 0.200000002980232)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = num1;
if ((double) this.velocity.X == 0.0)
this.frame.Y = 0;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
if (this.type == 398)
{
if ((double) this.ai[0] <= 0.0)
{
this.frame.Y = 0;
}
else
{
if (this.frame.Y == 0)
{
Gore.NewGore(this.position + new Vector2(-10f, -15f), this.velocity, 619);
Gore.NewGore(this.position + new Vector2(10f, -15f), this.velocity, 620);
Gore.NewGore(this.position + new Vector2(-10f, 15f), this.velocity, 621);
Gore.NewGore(this.position + new Vector2(10f, 15f), this.velocity, 622);
for (int index = 0; index < 50; ++index)
{
this.frame.Y = num1;
Dust.NewDust(this.position, this.width, this.height, 209);
}
}
++this.frameCounter;
if (this.frameCounter >= 30.0)
this.frameCounter = 6.0;
int num192 = (int) this.frameCounter % 30 / 6;
this.frame.Y = num1 * num192;
}
}
if (this.type == 397)
{
int num193 = (int) this.frameCounter / 7;
this.frame.Y = num1 * num193;
}
if (this.type == 400)
{
++this.frameCounter;
if ((double) this.ai[0] == 0.0 || (double) this.ai[0] == 3.0)
++this.frameCounter;
if (this.frameCounter >= 16.0)
this.frameCounter = 0.0;
int num194 = (int) this.frameCounter % 16 / 4;
this.frame.Y = num1 * num194;
}
if (this.type == 437)
{
++this.frameCounter;
if (this.frameCounter >= 20.0)
this.frameCounter = 0.0;
int num195 = (int) this.frameCounter % 20 / 5;
this.frame.Y = num1 * num195;
}
if (this.type == 438)
{
++this.frameCounter;
if ((double) this.ai[1] == 1.0)
++this.frameCounter;
if (this.frameCounter >= 49.0)
this.frameCounter = 0.0;
int num196 = (int) this.frameCounter % 49 / 7;
if (num196 >= 4)
num196 = 6 - num196;
this.frame.Y = num1 * num196;
}
if (this.type == 439 || this.type == 440)
{
switch ((int) this.localAI[2])
{
case 0:
if (this.frameCounter >= 15.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
if (this.frame.Y != 0)
{
this.frame.Y = ((int) this.frameCounter / 5 + 4) * num1;
break;
}
break;
case 1:
if (this.frameCounter >= 15.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
}
if (this.frame.Y != num1)
{
this.frame.Y = ((int) this.frameCounter / 5 + 10) * num1;
break;
}
break;
case 2:
if (this.frameCounter >= 15.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 2;
break;
}
if (this.frame.Y != num1 * 2)
{
this.frame.Y = ((int) this.frameCounter / 5 + 7) * num1;
break;
}
break;
case 10:
if (this.frameCounter >= 15.0)
this.frameCounter = 0.0;
this.frame.Y = ((int) this.frameCounter / 5 + 4) * num1;
break;
case 11:
if (this.frameCounter >= 15.0)
this.frameCounter = 0.0;
this.frame.Y = ((int) this.frameCounter / 5 + 10) * num1;
break;
case 12:
if (this.frameCounter >= 15.0)
this.frameCounter = 0.0;
this.frame.Y = ((int) this.frameCounter / 5 + 7) * num1;
break;
case 13:
if (this.frameCounter >= 15.0)
this.frameCounter = 0.0;
this.frame.Y = ((int) this.frameCounter / 5 + 13) * num1;
break;
}
++this.frameCounter;
}
if (this.type == 521)
{
if ((double) this.velocity.X < 0.0)
this.direction = -1;
else
this.direction = 1;
if (this.direction != 0)
this.spriteDirection = this.direction;
this.rotation = (float) Math.Atan2((double) this.velocity.Y * (double) this.spriteDirection, (double) this.velocity.X * (double) this.spriteDirection) + this.velocity.X * 0.1f;
if (++this.frameCounter >= 5.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
if (this.type == 523 && ++this.frameCounter >= 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
if (this.type == 371 || this.type == 372 || this.type == 373)
this.frame.Y = num1;
if (this.type == 370)
{
if ((double) this.ai[0] == 0.0 || (double) this.ai[0] == 5.0)
{
int num197 = 5;
if ((double) this.ai[0] == 5.0)
num197 = 4;
++this.frameCounter;
if (this.frameCounter > (double) num197)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y >= num1 * 6)
this.frame.Y = 0;
}
if ((double) this.ai[0] == 1.0 || (double) this.ai[0] == 6.0)
this.frame.Y = (double) this.ai[2] >= 10.0 ? num1 * 7 : num1 * 6;
if ((double) this.ai[0] == 2.0 || (double) this.ai[0] == 7.0)
this.frame.Y = (double) this.ai[2] >= 10.0 ? num1 * 7 : num1 * 6;
if ((double) this.ai[0] == 3.0 || (double) this.ai[0] == 8.0 || (double) this.ai[0] == -1.0)
{
int num198 = 90;
if ((double) this.ai[2] < (double) (num198 - 30) || (double) this.ai[2] > (double) (num198 - 10))
{
++this.frameCounter;
if (this.frameCounter > 5.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y >= num1 * 6)
this.frame.Y = 0;
}
else
{
this.frame.Y = num1 * 6;
if ((double) this.ai[2] > (double) (num198 - 20) && (double) this.ai[2] < (double) (num198 - 15))
this.frame.Y = num1 * 7;
}
}
if ((double) this.ai[0] == 4.0 || (double) this.ai[0] == 9.0)
{
int num199 = 180;
if ((double) this.ai[2] < (double) (num199 - 60) || (double) this.ai[2] > (double) (num199 - 20))
{
++this.frameCounter;
if (this.frameCounter > 5.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y >= num1 * 6)
this.frame.Y = 0;
}
else
{
this.frame.Y = num1 * 6;
if ((double) this.ai[2] > (double) (num199 - 50) && (double) this.ai[2] < (double) (num199 - 25))
this.frame.Y = num1 * 7;
}
}
}
if (this.type == 359 || this.type == 360)
{
if ((double) this.velocity.Y > 1.0)
{
++this.frameCounter;
int num200 = 6;
if (this.frameCounter < (double) num200)
{
this.frame.Y = num1 * 4;
}
else
{
this.frame.Y = num1 * 5;
if (this.frameCounter >= (double) (num200 * 2 - 1))
this.frameCounter = 0.0;
}
}
else
{
++this.frameCounter;
int num201 = 10;
if (this.frameCounter < (double) num201)
this.frame.Y = 0;
else if (this.frameCounter < (double) (num201 * 2))
this.frame.Y = num1;
else if (this.frameCounter < (double) (num201 * 3))
this.frame.Y = num1 * 2;
else if (this.frameCounter < (double) (num201 * 4))
this.frame.Y = num1 * 3;
else if (this.frameCounter < (double) (num201 * 5))
{
this.frame.Y = num1 * 2;
}
else
{
this.frame.Y = num1;
if (this.frameCounter >= (double) (num201 * 6 - 1))
this.frameCounter = 0.0;
}
}
}
if (this.type == 327)
{
if ((double) this.ai[3] == 0.0)
{
if (this.frame.Y > num1 * 5)
++this.frameCounter;
else if (this.frame.Y > 0)
--this.frameCounter;
}
else if ((double) this.ai[3] == 1.0)
{
if (this.frame.Y > num1 * 10)
++this.frameCounter;
else if (this.frame.Y > num1 * 4)
--this.frameCounter;
else if (this.frame.Y < num1 * 4)
++this.frameCounter;
}
else if ((double) this.ai[3] == 2.0)
{
if (this.frame.Y < num1 * 2)
--this.frameCounter;
else if (this.frame.Y > num1 * 8)
--this.frameCounter;
else if (this.frame.Y < num1 * 8)
++this.frameCounter;
}
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y > num1 * 11)
this.frame.Y = 0;
}
if (this.frameCounter < 0.0)
{
this.frameCounter = 6.0;
this.frame.Y -= num1;
if (this.frame.Y < 0)
this.frame.Y = num1 * 11;
}
}
if (this.type == 347)
{
++this.frameCounter;
if (this.frameCounter > 1.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 3)
this.frame.Y = 0;
}
if (this.type == 346)
{
if ((double) this.ai[0] == 1.0)
{
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter > 2.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 8)
this.frame.Y = num1 * 6;
if (this.frame.Y < num1 * 6)
this.frame.Y = num1 * 6;
}
else if ((double) this.velocity.X == 0.0)
{
ref int local = ref this.frame.Y;
local = local;
this.frameCounter = 0.0;
}
else
{
this.spriteDirection = this.direction;
++this.frameCounter;
this.frameCounter += (double) Math.Abs(this.velocity.X) / 2.0;
if (this.frameCounter > 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 5)
this.frame.Y = num1;
if (this.frame.Y < num1)
this.frame.Y = num1;
}
}
if (this.type == 352)
{
++this.frameCounter;
if (this.frameCounter > 3.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 5)
this.frame.Y = 0;
}
if (this.type == 345)
{
if ((double) this.ai[0] == 0.0)
this.frame.Y = (double) this.ai[3] < 0.0 ? ((double) this.velocity.X >= 0.0 ? num1 * 2 : num1) : 0;
else if ((double) this.ai[0] == 1.0)
{
++this.frameCounter;
if (this.frameCounter > 5.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 4)
this.frame.Y = num1 * 3;
if (this.frame.Y < num1 * 3)
this.frame.Y = num1 * 3;
}
else if ((double) this.ai[0] == 2.0)
this.frame.Y = num1 * 5;
}
if (this.type == 344)
{
if ((double) this.velocity.X == 0.0)
{
++this.frameCounter;
if (this.frameCounter > 2.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 9)
this.frame.Y = 0;
}
else
{
++this.frameCounter;
if (this.frameCounter > 3.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 9)
this.frame.Y = 0;
}
}
if (this.type == 325)
{
if ((double) this.velocity.X == 0.0)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 4)
this.frame.Y = 0;
}
else
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y < num1 * 5)
this.frame.Y = num1 * 5;
if (this.frame.Y > num1 * 9)
this.frame.Y = num1 * 5;
}
}
if (this.type == 490)
{
this.rotation = this.velocity.X * 0.15f;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
else if (this.type == 266)
{
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if ((double) this.ai[0] >= 0.0)
{
if (this.frame.Y > num1 * 3)
this.frame.Y = 0;
}
else
{
if (this.frame.Y < num1 * 4)
this.frame.Y = num1 * 4;
if (this.frame.Y > num1 * 7)
this.frame.Y = num1 * 4;
}
}
else if (this.type == 262)
{
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.life > this.lifeMax / 2)
{
if (this.frame.Y > num1 * 3)
this.frame.Y = 0;
}
else
{
if (this.frame.Y < num1 * 4)
this.frame.Y = num1 * 4;
if (this.frame.Y > num1 * 7)
this.frame.Y = num1 * 4;
}
}
else if (this.type >= 305 && this.type <= 309)
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
this.frame.Y = (double) this.velocity.Y >= -3.0 ? ((double) this.velocity.Y > 0.0 ? ((double) this.velocity.Y >= 2.0 ? num1 : num1 * 3) : 0) : num1 * 5;
this.rotation = this.velocity.X * 0.1f;
}
else if (this.type == 263)
{
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
{
if (this.frame.Y > 0)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y -= num1;
}
}
}
else if (this.frame.Y < 2)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
}
}
else if (this.type == 244)
{
++this.frameCounter;
if (num2 > 0)
++this.frameCounter;
if (num2 == 4)
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
else if (this.type == 289)
{
++this.frameCounter;
if (this.frameCounter < 2.0)
this.frame.Y = 0;
else if (this.frameCounter < 3.0)
{
this.frame.Y = num1;
}
else
{
this.frame.Y = num1 * 2;
this.frameCounter = 0.0;
}
if ((double) this.ai[3] == 1.0)
this.frame.Y += num1 * 3;
}
else if (this.type == 288)
{
++this.frameCounter;
if (this.frameCounter >= 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
else if (this.type == 355 || this.type == 358)
{
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter < 4.0)
{
this.frame.Y = 0;
}
else
{
this.frame.Y = num1;
if (this.frameCounter >= 7.0)
this.frameCounter = 0.0;
}
if ((double) this.localAI[2] <= 0.0)
this.frame.Y += num1 * 2;
}
else if (this.type == 356 || this.type == 444)
{
int num202 = 7;
this.rotation = this.velocity.X * 0.3f;
this.spriteDirection = this.direction;
this.frameCounter = this.frameCounter + 1.0 + ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) / 2.0;
if (this.frameCounter < (double) num202)
this.frame.Y = 0;
else if (this.frameCounter < (double) (num202 * 2))
this.frame.Y = num1;
else if (this.frameCounter < (double) (num202 * 3))
{
this.frame.Y = num1 * 2;
}
else
{
this.frame.Y = num1;
if (this.frameCounter >= (double) (num202 * 4 - 1))
this.frameCounter = 0.0;
}
if (this.type != 444)
this.frame.Y += (int) ((double) (num1 * 3) * ((double) this.ai[2] - 1.0));
}
else if (this.type == 357 || this.type == 448 || this.type == 484)
{
this.localAI[0] = -2f;
if ((double) this.velocity.Y == 0.0)
{
this.rotation = 0.0f;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = num1;
this.frameCounter = 0.0;
}
else
{
++this.frameCounter;
if (this.frameCounter > 12.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y > num1)
this.frame.Y = 0;
}
}
}
else
{
this.rotation += (float) this.direction * 0.1f;
this.frame.Y = num1;
}
int x = (int) this.Center.X / 16;
int y = (int) this.position.Y / 16;
if (WorldGen.InWorld(x, y) && Main.tile[x, y] != null)
{
if (Main.tile[x, y].slope() == (byte) 0)
++y;
if (Main.tile[x, y].slope() == (byte) 1)
{
this.rotation = 0.785f;
this.localAI[0] = 0.0f;
}
else if (Main.tile[x, y].slope() == (byte) 2)
{
this.rotation = -0.785f;
this.localAI[0] = 0.0f;
}
}
}
else if (this.type >= 485 && this.type <= 487)
{
this.spriteDirection = this.direction;
this.localAI[0] = -2f;
if ((double) this.velocity.Y == 0.0)
{
this.rotation = 0.0f;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = num1;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X * 5f);
if (this.frameCounter > 10.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y > num1 * 3)
this.frame.Y = 0;
}
}
}
else
{
this.rotation += (float) this.direction * 0.1f;
this.frame.Y = num1;
}
int index5 = (int) this.Center.X / 16;
int index6 = (int) this.position.Y / 16;
if (Main.tile[index5, index6] != null)
{
if (Main.tile[index5, index6].slope() == (byte) 0)
++index6;
if (Main.tile[index5, index6].slope() == (byte) 1)
{
this.rotation = 0.785f;
this.localAI[0] = 0.0f;
}
else if (Main.tile[index5, index6].slope() == (byte) 2)
{
this.rotation = -0.785f;
this.localAI[0] = 0.0f;
}
}
}
else if (this.type == 250 || this.type == 264 || this.type == 268)
{
++this.frameCounter;
if (this.frameCounter >= 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
else if (this.type == 245)
{
if ((double) this.ai[0] == 0.0)
this.frame.Y = (double) this.ai[1] >= -16.0 ? ((double) this.ai[1] >= -12.0 ? ((double) this.ai[1] >= -8.0 ? ((double) this.ai[1] >= -4.0 ? ((double) this.ai[1] >= 0.0 ? 0 : num1 * 4) : num1 * 3) : num1 * 2) : num1) : 0;
else if ((double) this.ai[0] == 1.0)
this.frame.Y = 1;
}
else if (this.type == 246)
{
if ((double) this.ai[0] == 0.0)
this.frame.Y = (double) this.localAI[0] != 1.0 ? 0 : num1;
else if ((double) this.ai[0] == 1.0)
{
this.frame.Y = (double) this.localAI[0] != 1.0 ? 0 : num1;
if ((double) this.localAI[1] == -1.0)
this.frame.Y += num1 * 4;
if ((double) this.localAI[1] == 1.0)
this.frame.Y += num1 * 2;
}
}
else if (this.type == 249)
this.frame.Y = (double) this.localAI[0] != 1.0 ? 0 : num1;
else if (this.type == 141)
{
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0)
{
this.frame.Y = num1 * 2;
}
else
{
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1)
this.frame.Y = 0;
}
}
else if (this.type == 243)
{
if (this.frameCounter < 0.0)
{
if ((double) this.velocity.Y == 0.0)
{
++this.frameCounter;
if (this.frameCounter < -12.0)
{
if (this.frame.Y > num1 * 9)
this.frame.Y = num1 * 11;
}
else if (this.frameCounter < -6.0)
{
if (this.frame.Y > num1 * 9)
this.frame.Y = num1 * 12;
}
else if (this.frameCounter < 0.0)
{
this.frameCounter = 0.0;
if (this.frame.Y > num1 * 9)
this.frame.Y = num1 * 11;
}
}
else
{
this.frameCounter = -18.0;
this.frame.Y = (double) this.velocity.Y >= 0.0 ? num1 * 13 : num1 * 14;
}
}
else
{
this.spriteDirection = this.direction;
this.frameCounter += (double) Math.Abs(this.velocity.X * 1.1f);
if (this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y > num1 * 9)
this.frame.Y = 0;
}
if ((double) this.velocity.Y < -2.0 || (double) this.velocity.Y > 5.0)
this.frameCounter = -18.0;
}
}
else if (this.type == 222)
{
++this.frameCounter;
if ((double) this.localAI[0] == 1.0)
{
if (this.frameCounter > 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * 4)
this.frame.Y = 0;
}
else
{
if (this.frameCounter > 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y < num1 * 4)
this.frame.Y = num1 * 4;
if (this.frame.Y >= num1 * 12)
this.frame.Y = num1 * 4;
}
}
else if (this.type == 164 || this.type == 239 || this.type == 530)
{
if ((double) this.velocity.Y != 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = (double) this.velocity.Y >= 0.0 ? 0 : num1 * 4;
}
else
{
this.spriteDirection = this.direction;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.10000002384186;
if (this.frameCounter < 6.0)
this.frame.Y = num1;
else if (this.frameCounter < 12.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 3;
else
this.frameCounter = 0.0;
}
}
else if (this.type == 236)
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
else
this.frame.Y = 0;
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 || (double) this.velocity.Y != 0.0)
this.frame.Y = 0;
}
else if (this.type == 165 || this.type == 237 || this.type == 238 || this.type == 240 || this.type == 531)
{
float num203 = 0.5f;
if (this.type == 531)
num203 = 0.4f;
this.frameCounter += ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * (double) num203;
if (this.frameCounter < 6.0)
this.frame.Y = 0;
else if (this.frameCounter < 12.0)
this.frame.Y = num1;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 24.0)
this.frame.Y = num1 * 3;
else
this.frameCounter = 0.0;
}
else if (this.type == 195)
this.frame.Y = (double) this.ai[0] >= 3.0 ? ((double) this.ai[0] >= 6.0 ? ((double) this.ai[0] >= 9.0 ? ((double) this.ai[0] >= 12.0 ? ((double) this.ai[0] >= 15.0 ? num1 * 5 : num1 * 4) : num1 * 3) : num1 * 2) : num1) : 0;
else if (this.type == 174)
this.frame.Y = (double) this.velocity.Y != 0.0 ? ((double) this.velocity.Y >= -1.5 ? ((double) this.velocity.Y <= 1.5 ? num1 * 2 : num1 * 3) : num1) : 0;
else if (this.type == 177)
{
if ((double) this.velocity.Y == 0.0)
{
++this.frameCounter;
if (this.frameCounter >= 10.0)
{
this.frameCounter = 30.0;
this.frame.Y = 0;
}
else
this.frame.Y = num1;
}
else if ((double) this.velocity.Y < 0.0)
{
this.frame.Y = num1 * 2;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 2;
}
}
else if (this.type == 163)
{
if ((double) this.velocity.Y != 0.0)
{
this.frameCounter = -12.0;
this.frame.Y = (double) this.velocity.Y >= 0.0 ? num1 * 6 : num1 * 5;
}
else
{
this.spriteDirection = this.direction;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.10000002384186;
if (this.frameCounter < -6.0)
this.frame.Y = num1 * 6;
else if (this.frameCounter < 0.0)
this.frame.Y = num1 * 7;
else if (this.frameCounter < 6.0)
this.frame.Y = num1;
else if (this.frameCounter < 12.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 3;
else
this.frameCounter = 0.0;
}
}
else if (this.type == 143)
{
if ((double) this.velocity.Y > 0.0)
++this.frameCounter;
else if ((double) this.velocity.Y < 0.0)
--this.frameCounter;
if (this.frameCounter < 6.0)
this.frame.Y = num1;
else if (this.frameCounter < 12.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 3;
if (this.frameCounter < 0.0)
this.frameCounter = 0.0;
if (this.frameCounter > 17.0)
this.frameCounter = 17.0;
}
else if (this.type == 144)
{
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
{
++this.localAI[3];
if ((double) this.localAI[3] < 6.0)
this.frame.Y = 0;
else if ((double) this.localAI[3] < 12.0)
this.frame.Y = num1;
if ((double) this.localAI[3] >= 11.0)
this.localAI[3] = 0.0f;
}
else
{
if ((double) this.velocity.Y > 0.0)
++this.frameCounter;
else if ((double) this.velocity.Y < 0.0)
--this.frameCounter;
if (this.frameCounter < 6.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 12.0)
this.frame.Y = num1 * 3;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 4;
if (this.frameCounter < 0.0)
this.frameCounter = 0.0;
if (this.frameCounter > 17.0)
this.frameCounter = 17.0;
}
}
else if (this.type == 145)
{
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
{
if ((double) this.ai[2] < 4.0)
this.frame.Y = 0;
else if ((double) this.ai[2] < 8.0)
this.frame.Y = num1;
else if ((double) this.ai[2] < 12.0)
this.frame.Y = num1 * 2;
else if ((double) this.ai[2] < 16.0)
this.frame.Y = num1 * 3;
}
else
{
if ((double) this.velocity.Y > 0.0)
++this.frameCounter;
else if ((double) this.velocity.Y < 0.0)
--this.frameCounter;
if (this.frameCounter < 6.0)
this.frame.Y = num1 * 4;
else if (this.frameCounter < 12.0)
this.frame.Y = num1 * 5;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 6;
if (this.frameCounter < 0.0)
this.frameCounter = 0.0;
if (this.frameCounter > 17.0)
this.frameCounter = 17.0;
}
}
else if (this.type == 50)
{
if ((double) this.velocity.Y != 0.0)
{
if (this.frame.Y < num1 * 4)
{
this.frame.Y = num1 * 4;
this.frameCounter = 0.0;
}
if (++this.frameCounter >= 4.0)
this.frame.Y = num1 * 5;
}
else
{
if (this.frame.Y >= num1 * 5)
{
this.frame.Y = num1 * 4;
this.frameCounter = 0.0;
}
++this.frameCounter;
if (num2 > 0)
++this.frameCounter;
if (num2 == 4)
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
if (this.frame.Y >= num1 * 4)
this.frame.Y = 0;
}
}
}
else if (this.type == 170 || this.type == 171 || this.type == 180)
{
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * 14)
this.frame.Y = 0;
}
else if (this.type == 135)
this.frame.Y = (double) this.ai[2] != 0.0 ? num1 : 0;
else if (this.type == 85 || this.type == 341)
{
if ((double) this.ai[0] == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
int num204 = 3;
if ((double) this.velocity.Y == 0.0)
--this.frameCounter;
else
++this.frameCounter;
if (this.frameCounter < 0.0)
this.frameCounter = 0.0;
if (this.frameCounter > (double) (num204 * 4))
this.frameCounter = (double) (num204 * 4);
if (this.frameCounter < (double) num204)
this.frame.Y = num1;
else if (this.frameCounter < (double) (num204 * 2))
this.frame.Y = num1 * 2;
else if (this.frameCounter < (double) (num204 * 3))
this.frame.Y = num1 * 3;
else if (this.frameCounter < (double) (num204 * 4))
this.frame.Y = num1 * 4;
else if (this.frameCounter < (double) (num204 * 5))
this.frame.Y = num1 * 5;
else if (this.frameCounter < (double) (num204 * 6))
this.frame.Y = num1 * 4;
else if (this.frameCounter < (double) (num204 * 7))
{
this.frame.Y = num1 * 3;
}
else
{
this.frame.Y = num1 * 2;
if (this.frameCounter >= (double) (num204 * 8))
this.frameCounter = (double) num204;
}
}
if ((double) this.ai[3] == 2.0)
this.frame.Y += num1 * 6;
else if ((double) this.ai[3] == 3.0)
this.frame.Y += num1 * 12;
else if ((double) this.ai[3] == 4.0)
this.frame.Y += num1 * 18;
}
else if (this.type == 113 || this.type == 114)
{
if ((double) this.ai[2] == 0.0)
{
++this.frameCounter;
if (this.frameCounter >= 12.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
else
{
this.frame.Y = 0;
this.frameCounter = -60.0;
}
}
else if (this.type == 61)
{
this.spriteDirection = this.direction;
this.rotation = this.velocity.X * 0.1f;
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
++this.frameCounter;
if (this.frameCounter < 4.0)
{
this.frame.Y = num1;
}
else
{
this.frame.Y = num1 * 2;
if (this.frameCounter >= 7.0)
this.frameCounter = 0.0;
}
}
}
else if (this.type == 252 || this.type == 301)
{
if (this.type == 301)
{
if ((double) this.velocity.Y == 0.0)
{
this.spriteDirection = -this.direction;
}
else
{
if ((double) this.velocity.X > 0.5)
this.spriteDirection = -1;
if ((double) this.velocity.X < -0.5)
this.spriteDirection = 1;
}
}
else
{
if ((double) this.velocity.X > 0.5)
this.spriteDirection = 1;
if ((double) this.velocity.X < -0.5)
this.spriteDirection = -1;
}
this.rotation = this.velocity.X * 0.1f;
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 4 || this.frame.Y == 0)
this.frame.Y = num1;
}
}
else if (this.type == 122)
{
this.spriteDirection = this.direction;
this.rotation = this.velocity.X * 0.05f;
if ((double) this.ai[3] > 0.0)
{
int num205 = (int) ((double) this.ai[3] / 8.0);
this.frameCounter = 0.0;
this.frame.Y = (num205 + 3) * num1;
}
else
{
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * 3)
this.frame.Y = 0;
}
}
else if (this.type == 74 || this.type == 297 || this.type == 298 || this.type == 442)
{
this.spriteDirection = this.direction;
this.rotation = this.velocity.X * 0.1f;
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
{
this.frame.Y = num1 * 4;
this.frameCounter = 0.0;
}
else
{
++this.frameCounter;
if (this.frameCounter >= 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
else if (this.type == 362 || this.type == 364)
{
this.spriteDirection = this.direction;
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
++this.frameCounter;
if (this.frameCounter >= 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * 10)
this.frame.Y = num1 * 3;
if (this.frame.Y < num1 * 3)
this.frame.Y = num1 * 3;
}
}
else if (this.type == 363 || this.type == 365)
{
this.spriteDirection = this.direction;
if (this.wet)
{
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 2)
this.frame.Y = num1;
if (this.frame.Y < num1)
this.frame.Y = num1;
this.rotation = 0.0f;
}
else if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
{
this.frame.Y = num1;
this.frameCounter = 0.0;
this.rotation = 0.0f;
}
else
{
this.rotation = this.velocity.X * 0.1f;
++this.frameCounter;
if (this.frameCounter >= 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = num1 * 11;
if (this.frame.Y < num1 * 11)
this.frame.Y = num1 * 11;
}
}
else if (this.type == 62 || this.type == 66)
{
this.spriteDirection = this.direction;
this.rotation = this.velocity.X * 0.1f;
++this.frameCounter;
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
}
else
{
this.frame.Y = num1;
if (this.frameCounter >= 11.0)
this.frameCounter = 0.0;
}
}
else if (this.type == 156)
{
this.spriteDirection = this.direction;
this.rotation = this.velocity.X * 0.1f;
++this.frameCounter;
if (this.frameCounter >= 20.0)
this.frameCounter = 0.0;
this.frame.Y = (int) this.frameCounter / 4 * num1;
}
else if (this.type == 63 || this.type == 64 || this.type == 103 || this.type == 242 || this.type == 256)
{
if ((this.type == 63 || this.type == 64 || this.type == 103 || this.type == 242) && (double) this.ai[1] == 1.0)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 6)
this.frame.Y = num1 * 4;
if (this.frame.Y >= num1 * 4)
return;
this.frame.Y = num1 * 4;
return;
}
++this.frameCounter;
if (this.frameCounter < 6.0)
this.frame.Y = 0;
else if (this.frameCounter < 12.0)
this.frame.Y = num1;
else if (this.frameCounter < 18.0)
{
this.frame.Y = num1 * 2;
}
else
{
this.frame.Y = num1 * 3;
if (this.frameCounter >= 23.0)
this.frameCounter = 0.0;
}
}
else if (this.type == 221)
{
if ((double) this.localAI[2] == 1.0)
{
if ((double) this.localAI[0] == 1.0)
{
this.frame.Y = 0;
this.localAI[0] = 0.0f;
}
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = num1 * Main.npcFrameCount[this.type] - num1;
}
else
{
++this.frameCounter;
if (this.frameCounter >= 13.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
else if (this.type == 2 || this.type == 23 || this.type == 121 || this.type == 169 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194 || this.type == 317 || this.type == 318)
{
if (this.type == 2 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194 || this.type == 317 || this.type == 318)
{
if ((double) this.velocity.X > 0.0)
{
this.spriteDirection = 1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X);
}
if ((double) this.velocity.X < 0.0)
{
this.spriteDirection = -1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 3.14f;
}
}
else if (this.type == 2 || this.type == 121)
{
if ((double) this.velocity.X > 0.0)
this.spriteDirection = 1;
if ((double) this.velocity.X < 0.0)
this.spriteDirection = -1;
this.rotation = this.velocity.X * 0.1f;
}
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
else if (this.type == 133)
{
if ((double) this.velocity.X > 0.0)
{
this.spriteDirection = 1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X);
}
if ((double) this.velocity.X < 0.0)
{
this.spriteDirection = -1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 3.14f;
}
++this.frameCounter;
this.frame.Y = this.frameCounter < 8.0 ? 0 : num1;
if (this.frameCounter >= 16.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
if ((double) this.life < (double) this.lifeMax * 0.5)
this.frame.Y += num1 * 2;
}
else if (this.type == 116)
{
if ((double) this.velocity.X > 0.0)
{
this.spriteDirection = 1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X);
}
if ((double) this.velocity.X < 0.0)
{
this.spriteDirection = -1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 3.14f;
}
++this.frameCounter;
if (this.frameCounter >= 5.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
else if (this.type == 75)
{
this.spriteDirection = (double) this.velocity.X <= 0.0 ? -1 : 1;
this.rotation = this.velocity.X * 0.1f;
++this.frameCounter;
if (this.frameCounter >= 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
else if (this.type == 157)
{
this.spriteDirection = this.direction;
++this.frameCounter;
if (!this.wet)
++this.frameCounter;
int num206 = 5;
if (this.frameCounter < (double) num206)
this.frame.Y = 0;
else if (this.frameCounter < (double) (num206 * 2))
this.frame.Y = num1;
else if (this.frameCounter < (double) (num206 * 3))
this.frame.Y = num1 * 2;
else if (this.frameCounter < (double) (num206 * 4))
this.frame.Y = num1;
else if (this.frameCounter < (double) (num206 * 5))
this.frame.Y = num1 * 3;
else if (this.frameCounter < (double) (num206 * 6))
this.frame.Y = num1 * 4;
else if (this.frameCounter < (double) (num206 * 7))
this.frame.Y = num1 * 5;
else if (this.frameCounter < (double) (num206 * 8))
this.frame.Y = num1 * 4;
else
this.frameCounter = 0.0;
}
else if (this.type == 55 || this.type == 57 || this.type == 58 || this.type == 102 || this.type == 241 || this.type == 465)
{
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.wet)
{
if (this.frameCounter < 6.0)
this.frame.Y = 0;
else if (this.frameCounter < 12.0)
this.frame.Y = num1;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 24.0)
this.frame.Y = num1 * 3;
else
this.frameCounter = 0.0;
}
else if (this.frameCounter < 6.0)
this.frame.Y = num1 * 4;
else if (this.frameCounter < 12.0)
this.frame.Y = num1 * 5;
else
this.frameCounter = 0.0;
}
else if (this.type == 69)
{
if ((double) this.ai[0] < 190.0)
{
++this.frameCounter;
if (this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type] - 1)
this.frame.Y = 0;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * (Main.npcFrameCount[this.type] - 1);
}
}
else if (this.type == 155)
{
if ((double) this.velocity.Y > 0.0)
{
this.frame.Y = num1 * 4;
this.frameCounter = 0.0;
}
else if ((double) this.velocity.Y < 0.0)
{
this.frame.Y = num1 * 6;
this.frameCounter = 0.0;
}
else
{
this.spriteDirection = this.direction;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 0.400000005960464;
if (this.direction > 0 && (double) this.velocity.X < 0.0 || this.direction < 0 && (double) this.velocity.X > 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else if (this.frameCounter < 8.0)
this.frame.Y = num1 * 3;
else if (this.frameCounter < 16.0)
this.frame.Y = num1 * 6;
else if (this.frameCounter < 24.0)
this.frame.Y = num1 * 4;
else if (this.frameCounter < 32.0)
this.frame.Y = num1 * 5;
else
this.frameCounter = 0.0;
}
}
else if (this.type == 329)
{
if ((double) this.velocity.Y > 0.0)
{
this.frame.Y = num1 * 3;
this.frameCounter = 0.0;
}
else if ((double) this.velocity.Y < 0.0)
{
this.frame.Y = num1 * 2;
this.frameCounter = 0.0;
}
else
{
this.spriteDirection = this.direction;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 0.400000005960464;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
if (this.frame.Y > num1 * 9)
this.frame.Y = num1 * 2;
}
}
}
else if (this.type == 86)
{
if ((double) this.velocity.Y == 0.0 || this.wet)
this.spriteDirection = (double) this.velocity.X >= -2.0 ? ((double) this.velocity.X <= 2.0 ? this.direction : 1) : -1;
if ((double) this.velocity.Y != 0.0)
{
this.frame.Y = num1 * 15;
this.frameCounter = 0.0;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else if ((double) Math.Abs(this.velocity.X) < 3.0)
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= 9)
this.frame.Y = num1;
if (this.frame.Y / num1 <= 0)
this.frame.Y = num1;
}
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 10.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= 15)
this.frame.Y = num1 * 9;
if (this.frame.Y / num1 <= 8)
this.frame.Y = num1 * 9;
}
}
}
else if (this.type == 315)
{
if ((double) this.velocity.Y == 0.0 || this.wet)
this.spriteDirection = (double) this.velocity.X >= -1.0 ? ((double) this.velocity.X <= 1.0 ? this.direction : 1) : -1;
if ((double) this.velocity.Y != 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 8.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 > 10)
this.frame.Y = num1;
}
}
}
else if (this.type == (int) sbyte.MaxValue)
{
if ((double) this.ai[1] == 0.0)
{
++this.frameCounter;
if (this.frameCounter >= 12.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= 2)
this.frame.Y = 0;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 2;
}
}
else if (this.type == 129)
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 2.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
else if (this.type == 130)
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
else if (this.type == 67 || this.type == 217 || this.type == 218 || this.type == 219)
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
else if (this.type == 220)
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 10.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
else if (this.type == 109)
{
if ((double) this.velocity.Y == 0.0 && ((double) this.velocity.X <= 0.0 && this.direction < 0 || (double) this.velocity.X >= 0.0 && this.direction > 0))
this.spriteDirection = this.direction;
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 7.0)
{
this.frameCounter -= 7.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
else if (this.type == 83 || this.type == 84 || this.type == 179)
{
if ((double) this.ai[0] == 2.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
++this.frameCounter;
if (this.frameCounter >= 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
}
else if (this.type == 72)
{
++this.frameCounter;
if (this.frameCounter >= 3.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
}
else if (this.type == 65)
{
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.wet && this.type == 65)
{
if (this.frameCounter < 6.0)
this.frame.Y = 0;
else if (this.frameCounter < 12.0)
this.frame.Y = num1;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 24.0)
this.frame.Y = num1 * 3;
else
this.frameCounter = 0.0;
}
}
else if (this.type >= 542 && this.type <= 545)
{
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 16.0)
this.frameCounter = 0.0;
this.frame.Y = num1 * (int) (this.frameCounter / 4.0);
}
else if (this.type == 224)
{
if ((double) this.velocity.X > 0.0)
{
this.spriteDirection = 1;
this.rotation = this.velocity.Y * 0.2f;
}
if ((double) this.velocity.X < 0.0)
{
this.spriteDirection = -1;
this.rotation = (float) (-(double) this.velocity.Y * 0.200000002980232);
}
++this.frameCounter;
if (this.frameCounter >= 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * 4)
this.frame.Y = 0;
}
else if (this.type == 150 || this.type == 151 || this.type == 152 || this.type == 158 || this.type == 226)
{
if ((double) this.velocity.X > 0.0)
this.spriteDirection = 1;
if ((double) this.velocity.X < 0.0)
this.spriteDirection = -1;
this.rotation = this.velocity.X * 0.1f;
++this.frameCounter;
if (this.frameCounter >= 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * 4)
this.frame.Y = 0;
}
else if (this.type == 48 || this.type == 49 || this.type == 51 || this.type == 60 || this.type == 82 || this.type == 93 || this.type == 137 || this.type == 182 || this.type == 210 || this.type == 211 || this.type == 253 || this.type == 316)
{
if ((double) this.velocity.X > 0.0)
this.spriteDirection = 1;
if ((double) this.velocity.X < 0.0)
this.spriteDirection = -1;
this.rotation = this.velocity.X * 0.1f;
if (this.type == 210 || this.type == 211)
{
++this.frameCounter;
this.rotation = this.velocity.X * 0.2f;
}
++this.frameCounter;
if (this.frameCounter >= 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
else if (this.type == 330)
{
if ((double) this.velocity.X > 0.0)
this.spriteDirection = 1;
if ((double) this.velocity.X < 0.0)
this.spriteDirection = -1;
this.rotation = this.velocity.X * 0.15f;
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
this.frame.Y = 0;
}
else if (this.type == 42 || this.type >= 231 && this.type <= 235)
{
++this.frameCounter;
if (this.frameCounter < 2.0)
this.frame.Y = 0;
else if (this.frameCounter < 4.0)
this.frame.Y = num1;
else if (this.frameCounter < 6.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 8.0)
this.frame.Y = num1;
else
this.frameCounter = 0.0;
}
else if (this.type == 205)
{
this.frameCounter += 0.5;
if (this.frameCounter < 2.0)
this.frame.Y = 0;
else if (this.frameCounter < 4.0)
this.frame.Y = num1;
else if (this.frameCounter < 6.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 8.0)
this.frame.Y = num1;
else
this.frameCounter = 0.0;
}
else if (this.type == 176)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1)
this.frame.Y = 0;
}
else if (this.type == 43 || this.type == 56 || this.type == 175)
{
++this.frameCounter;
if (this.frameCounter < 6.0)
this.frame.Y = 0;
else if (this.frameCounter < 12.0)
this.frame.Y = num1;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 24.0)
this.frame.Y = num1;
if (this.frameCounter == 23.0)
this.frameCounter = 0.0;
}
else if (this.type == 115)
{
++this.frameCounter;
if (this.frameCounter < 3.0)
this.frame.Y = 0;
else if (this.frameCounter < 6.0)
this.frame.Y = num1;
else if (this.frameCounter < 12.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 15.0)
this.frame.Y = num1;
if (this.frameCounter == 15.0)
this.frameCounter = 0.0;
}
else if (this.type == 101)
{
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1 * 2;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 2)
this.frame.Y = 0;
}
if (this.type == 199)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
}
if (this.frame.Y < num1 * 3)
{
++this.frameCounter;
if (this.frameCounter <= 6.0)
return;
this.frameCounter = 0.0;
this.frame.Y += num1;
}
else
{
if ((double) this.velocity.Y != 0.0)
return;
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter <= 12.0)
return;
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y <= num1 * 7)
return;
this.frame.Y = num1 * 3;
}
}
else if (this.type == 467)
{
if ((double) this.ai[0] == 1.0)
{
++this.frameCounter;
if (this.frameCounter <= 4.0)
return;
this.frameCounter = 0.0;
if (this.frame.Y >= num1 * 6)
return;
this.frame.Y += num1;
this.frameCounter = 0.0;
}
else
{
++this.frameCounter;
if (this.frameCounter <= 4.0)
return;
this.frameCounter = 0.0;
if (this.frame.Y > num1 * 3)
this.frame.Y = num1 * 3;
if (this.frame.Y <= 0)
return;
this.frame.Y -= num1;
this.frameCounter = 0.0;
}
}
else if (this.type == 480)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] < 0.0)
{
++this.frameCounter;
if (this.frameCounter > 3.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= Main.npcFrameCount[this.type] * num1)
{
this.frame.Y = num1 * 21;
}
else
{
if (this.frame.Y >= num1 * 21)
return;
this.frame.Y = num1 * 21;
}
}
else if ((double) this.velocity.X == 0.0)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 <= 7)
return;
this.frame.Y = 0;
}
else
{
this.frameCounter += 1.0 + (double) Math.Abs(this.velocity.X);
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type] - 4)
{
this.frame.Y = num1 * 10;
}
else
{
if (this.frame.Y / num1 >= 10)
return;
this.frame.Y = num1 * 10;
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 8;
}
}
else if (this.type == 483)
{
if ((double) this.ai[0] == -1.0)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 21)
this.frame.Y = num1 * 21;
else if (this.frame.Y < num1 * 13)
this.frame.Y = num1 * 13;
this.rotation += this.velocity.X * 0.2f;
}
else
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 11)
this.frame.Y = 0;
this.rotation = this.velocity.X * 0.1f;
}
}
else if (this.type == 482)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] < 0.0)
{
++this.frameCounter;
if (this.frameCounter > 3.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= Main.npcFrameCount[this.type] * num1)
{
this.frame.Y = num1 * 11;
}
else
{
if (this.frame.Y >= num1 * 11)
return;
this.frame.Y = num1 * 11;
}
}
else if ((double) this.velocity.X == 0.0)
{
++this.frameCounter;
this.frame.Y = 0;
}
else
{
this.frameCounter += 0.200000002980232 + (double) Math.Abs(this.velocity.X);
if (this.frameCounter > 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type] - 10)
{
this.frame.Y = num1 * 2;
}
else
{
if (this.frame.Y / num1 >= 2)
return;
this.frame.Y = num1 * 2;
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
else if (this.type == 461)
{
if (this.wet)
{
if ((double) this.velocity.X < 0.0)
this.direction = -1;
if ((double) this.velocity.X > 0.0)
this.direction = 1;
if (this.spriteDirection != this.direction)
{
this.rotation *= -1f;
this.spriteDirection = this.direction;
}
float num207 = (float) Math.Atan2((double) this.velocity.Y * (double) this.direction, (double) this.velocity.X * (double) this.direction);
if ((double) Math.Abs(this.rotation - num207) >= 3.14)
{
if ((double) num207 < (double) this.rotation)
this.rotation -= 6.28f;
else
this.rotation += 6.28f;
}
this.rotation = (float) (((double) this.rotation * 4.0 + (double) num207) / 5.0);
this.frameCounter += (double) Math.Abs(this.velocity.Length());
++this.frameCounter;
if (this.frameCounter > 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 > 20)
{
this.frame.Y = num1 * 16;
}
else
{
if (this.frame.Y / num1 >= 16)
return;
this.frame.Y = num1 * 19;
}
}
else
{
if ((double) this.rotation > 3.14)
this.rotation -= 6.28f;
if ((double) this.rotation > -0.01 && (double) this.rotation < 0.01)
this.rotation = 0.0f;
else
this.rotation *= 0.9f;
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 <= 15)
return;
this.frame.Y = num1 * 2;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
}
else if (this.type == 466)
{
if ((double) this.ai[2] <= 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] == 0.0)
this.frame.Y = 0;
else if ((double) this.ai[2] < -8.0)
this.frame.Y = num1;
else
this.frame.Y = num1 * 2;
}
else if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = num1 * 2;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
++this.frameCounter;
if (this.frameCounter > 7.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 > 17)
this.frame.Y = num1 * 4;
if (this.frame.Y / num1 >= 4)
return;
this.frame.Y = num1 * 4;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 3;
}
}
else if (this.type == 471)
{
bool flag = false;
if ((double) this.ai[3] < 0.0)
flag = true;
if (flag)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
this.frameCounter += (double) Math.Abs(this.velocity.Length()) * 0.5;
++this.frameCounter;
if (this.frameCounter < 6.0)
this.frame.Y = num1 * 17;
else if (this.frameCounter < 12.0)
this.frame.Y = num1 * 18;
else if (this.frameCounter < 18.0)
this.frame.Y = num1 * 19;
else if (this.frameCounter < 23.0)
{
this.frame.Y = num1 * 18;
}
else
{
this.frame.Y = num1 * 18;
this.frameCounter = 0.0;
}
}
else if ((double) this.ai[3] == 1.0)
{
this.frame.Y = num1 * 16;
this.frameCounter = 0.0;
}
else if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
++this.frameCounter;
if (this.frameCounter > 7.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 > 15)
this.frame.Y = num1 * 2;
if (this.frame.Y / num1 >= 2)
return;
this.frame.Y = num1 * 2;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
else if (this.type == 166)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
this.frameCounter += 2.0;
if (this.frameCounter > 7.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 <= 5)
return;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
++this.frameCounter;
if (this.frameCounter > 9.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 > 12)
this.frame.Y = num1 * 7;
if (this.frame.Y / num1 >= 7)
return;
this.frame.Y = num1 * 7;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 6;
}
}
else if (this.type == 469)
{
if ((double) this.ai[2] == 1.0)
{
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
if ((double) this.velocity.X < 0.0)
this.direction = -1;
if ((double) this.velocity.X > 0.0)
this.direction = 1;
this.spriteDirection = this.direction;
this.frameCounter += (double) Math.Abs(this.velocity.Length());
if (this.frameCounter > 11.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 > 5)
this.frame.Y = num1 * 2;
if (this.frame.Y / num1 >= 2)
return;
this.frame.Y = num1 * 2;
}
else
{
this.rotation = 0.0f;
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
++this.frameCounter;
if (this.frameCounter > 9.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 > 11)
this.frame.Y = num1 * 6;
if (this.frame.Y / num1 >= 6)
return;
this.frame.Y = num1 * 6;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
}
else if (this.type == 351)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
++this.frameCounter;
if (this.frameCounter > 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = num1 * 2;
}
}
else
{
this.frame.Y = (double) this.velocity.Y >= 0.0 ? num1 : num1;
this.frameCounter = 0.0;
}
}
else if (this.type == 343)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = num1 * 2;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = num1 * 2;
}
}
else
{
this.frame.Y = (double) this.velocity.Y >= 0.0 ? num1 : 0;
this.frameCounter = 0.0;
}
}
else if (this.type >= 269 && this.type <= 280)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
if (this.type == 140)
{
this.frame.Y = num1;
this.frameCounter = 0.0;
}
else
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = num1 * 2;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
}
else if (this.type == 230)
{
if ((double) this.velocity.Y == 0.0)
{
this.rotation = 0.0f;
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
++this.frameCounter;
if (this.frameCounter > 10.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = 0;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
if ((double) this.velocity.Y <= 4.0)
return;
this.rotation -= this.velocity.Y * 0.01f;
}
}
else if (this.type == 290)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] > 0.0)
{
if ((double) this.ai[1] < 10.0)
this.frame.Y = num1 * 11;
else if ((double) this.ai[1] < 20.0)
this.frame.Y = num1 * 10;
else
this.frame.Y = num1 * 9;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y <= num1 * 8)
return;
this.frame.Y = num1 * 2;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1;
}
}
else if (this.type == 110 || this.type == 214 || this.type == 215 || this.type == 216 || this.type == 291 || this.type == 292 || this.type == 293)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] > 0.0)
{
this.spriteDirection = this.direction;
this.frame.Y = num1 * (int) this.ai[2];
this.frameCounter = 0.0;
}
else
{
if (this.frame.Y < num1 * 6)
this.frame.Y = num1 * 6;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
this.frameCounter += (double) this.velocity.X;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = num1 * 6;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
}
else if (this.type == 206)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] > 0.0)
{
this.spriteDirection = this.direction;
this.frame.Y = num1 * (int) this.ai[2];
this.frameCounter = 0.0;
}
else
{
if (this.frame.Y < num1 * 6)
this.frame.Y = num1 * 6;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
this.frameCounter += (double) this.velocity.X;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = num1 * 6;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
}
else if (this.type == 350)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] > 0.0)
{
this.spriteDirection = this.direction;
this.frame.Y = num1 * ((int) this.ai[2] - 1);
this.frameCounter = 0.0;
}
else
{
if (this.frame.Y < num1 * 7)
this.frame.Y = num1 * 7;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
this.frameCounter += (double) this.velocity.X * 1.29999995231628;
if (this.frameCounter > 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = num1 * 7;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 5;
}
}
else if (this.type == 111)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.ai[2] > 0.0)
{
this.spriteDirection = this.direction;
this.frame.Y = num1 * ((int) this.ai[2] - 1);
this.frameCounter = 0.0;
}
else
{
if (this.frame.Y < num1 * 7)
this.frame.Y = num1 * 7;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 2.0;
this.frameCounter += (double) this.velocity.X * 1.29999995231628;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = num1 * 7;
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 6;
}
}
else if (this.type == 257)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
}
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 4;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
this.frame.Y = 0;
else if (this.frameCounter < 16.0)
this.frame.Y = num1;
else if (this.frameCounter < 24.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 32.0)
this.frame.Y = num1 * 3;
else
this.frameCounter = 0.0;
}
}
else if (this.type == 258)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
}
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
++this.frameCounter;
if (this.frameCounter > 1.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y <= num1 * 5 && this.frame.Y >= num1 * 3)
return;
this.frame.Y = num1 * 3;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
this.frame.Y = 0;
else if (this.frameCounter < 16.0)
this.frame.Y = num1;
else if (this.frameCounter < 24.0)
this.frame.Y = num1 * 2;
else
this.frameCounter = 0.0;
}
}
else if (this.type == 348)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
}
if ((double) this.velocity.Y != 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 8;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y <= num1 * 7)
return;
this.frame.Y = num1;
}
}
else if (this.type == 349)
{
++this.frameCounter;
if (this.frameCounter > 3.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y <= num1 * 7)
return;
this.frame.Y = 0;
}
else if (this.type == 3 || this.type == 342 || this.type == 331 || this.type == 332 || this.type == 52 || this.type == 53 || this.type == 536 || this.type == 132 || this.type == 161 || this.type == 162 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223 || this.type == 251 || this.type == 254 || this.type == (int) byte.MaxValue || this.type >= 319 && this.type <= 321)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
}
if ((double) this.velocity.Y != 0.0 || this.direction == -1 && (double) this.velocity.X > 0.0 || this.direction == 1 && (double) this.velocity.X < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 2;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
this.frame.Y = 0;
else if (this.frameCounter < 16.0)
this.frame.Y = num1;
else if (this.frameCounter < 24.0)
this.frame.Y = num1 * 2;
else if (this.frameCounter < 32.0)
this.frame.Y = num1;
else
this.frameCounter = 0.0;
}
}
else if (this.type == 148 || this.type == 149 || this.type == 168 || this.type == 470)
{
int num208 = 0;
if ((double) this.localAI[0] == 2.0)
num208 = 3;
if ((double) this.localAI[0] == 3.0)
num208 = 6;
if ((double) this.localAI[0] == 4.0)
num208 = 9;
int num209 = num208 * num1;
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = num209;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
if (this.frameCounter < 6.0)
this.frame.Y = num209;
else if (this.frameCounter < 12.0)
this.frame.Y = num1 + num209;
else if (this.frameCounter < 15.0)
{
this.frame.Y = num1 * 2 + num209;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 2 + num209;
}
}
}
else if ((double) this.velocity.Y < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 2 + num209;
}
else
{
if ((double) this.velocity.Y <= 0.0)
return;
this.frameCounter = 0.0;
this.frame.Y = num1 * 2 + num209;
}
}
else if (this.type == 299 || this.type == 538 || this.type == 539)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 0.5;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type] - 1)
return;
this.frame.Y = num1;
}
}
else if ((double) this.velocity.Y < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 2;
}
else
{
if ((double) this.velocity.Y <= 0.0)
return;
this.frameCounter = 0.0;
this.frame.Y = num1 * 4;
}
}
else if (this.type == 300 || this.type == 447)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
++this.frameCounter;
if (this.frameCounter > 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 <= 1)
return;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 0.5;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = num1 * 2;
}
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 0.5;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = num1 * 2;
}
}
else if (this.type == 361 || this.type == 445)
{
this.spriteDirection = this.direction;
if ((double) this.velocity.Y == 0.0)
{
if ((double) this.velocity.X == 0.0)
{
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y <= num1 * 5)
return;
this.frame.Y = 0;
}
else
{
++this.frameCounter;
int num210 = 6;
if (this.frameCounter < (double) num210)
this.frame.Y = 0;
else if (this.frameCounter < (double) (num210 * 2))
this.frame.Y = num1 * 6;
else if (this.frameCounter < (double) (num210 * 3))
{
this.frame.Y = num1 * 8;
}
else
{
this.frame.Y = num1 * 9;
if (this.frameCounter < (double) (num210 * 4 - 1))
return;
this.frameCounter = 0.0;
}
}
}
else if ((double) this.velocity.Y > 0.0)
this.frame.Y = num1 * 9;
else
this.frame.Y = num1 * 8;
}
else if (this.type == 366 || this.type == 367)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
}
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = 0;
}
}
else if (this.type == 46 || this.type == 47 || this.type == 303 || this.type == 337 || this.type == 443 || this.type == 464 || this.type == 540)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
++this.frameCounter;
if (this.frameCounter > 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 < Main.npcFrameCount[this.type])
return;
this.frame.Y = 0;
}
}
else if ((double) this.velocity.Y < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 4;
}
else
{
if ((double) this.velocity.Y <= 0.0)
return;
this.frameCounter = 0.0;
this.frame.Y = num1 * 6;
}
}
else if (this.type == 4 || this.type == 125 || this.type == 126)
{
++this.frameCounter;
if (this.frameCounter < 7.0)
this.frame.Y = 0;
else if (this.frameCounter < 14.0)
this.frame.Y = num1;
else if (this.frameCounter < 21.0)
{
this.frame.Y = num1 * 2;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
if ((double) this.ai[0] <= 1.0)
return;
this.frame.Y += num1 * 3;
}
else if (this.type == 5)
{
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y < num1 * Main.npcFrameCount[this.type])
return;
this.frame.Y = 0;
}
else if (this.type == 94)
{
++this.frameCounter;
if (this.frameCounter < 6.0)
this.frame.Y = 0;
else if (this.frameCounter < 12.0)
this.frame.Y = num1;
else if (this.frameCounter < 18.0)
{
this.frame.Y = num1 * 2;
}
else
{
this.frame.Y = num1;
if (this.frameCounter < 23.0)
return;
this.frameCounter = 0.0;
}
}
else if (this.type == 6 || this.type == 173)
{
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y < num1 * Main.npcFrameCount[this.type])
return;
this.frame.Y = 0;
}
else if (this.type == 24)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
}
if ((double) this.ai[1] > 0.0)
{
if (this.frame.Y < 4)
this.frameCounter = 0.0;
++this.frameCounter;
if (this.frameCounter <= 4.0)
this.frame.Y = num1 * 4;
else if (this.frameCounter <= 8.0)
this.frame.Y = num1 * 5;
else if (this.frameCounter <= 12.0)
this.frame.Y = num1 * 6;
else if (this.frameCounter <= 16.0)
this.frame.Y = num1 * 7;
else if (this.frameCounter <= 20.0)
{
this.frame.Y = num1 * 8;
}
else
{
this.frame.Y = num1 * 9;
this.frameCounter = 100.0;
}
}
else
{
++this.frameCounter;
if (this.frameCounter <= 4.0)
this.frame.Y = 0;
else if (this.frameCounter <= 8.0)
this.frame.Y = num1;
else if (this.frameCounter <= 12.0)
{
this.frame.Y = num1 * 2;
}
else
{
this.frame.Y = num1 * 3;
if (this.frameCounter < 16.0)
return;
this.frameCounter = 0.0;
}
}
}
else if (this.type == 29 || this.type == 32 || this.type == 45 || this.type == 172 || this.type >= 281 && this.type <= 286)
{
if ((double) this.velocity.Y == 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
}
this.frame.Y = 0;
if ((double) this.velocity.Y != 0.0)
{
this.frame.Y += num1;
}
else
{
if ((double) this.ai[1] <= 0.0)
return;
this.frame.Y += num1 * 2;
}
}
else
{
if (this.type != 34)
return;
++this.frameCounter;
if (this.frameCounter >= 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y < num1 * Main.npcFrameCount[this.type])
return;
this.frame.Y = 0;
}
}
public void SimpleFlyMovement(Vector2 desiredVelocity, float moveSpeed)
{
if ((double) this.velocity.X < (double) desiredVelocity.X)
{
this.velocity.X += moveSpeed;
if ((double) this.velocity.X < 0.0 && (double) desiredVelocity.X > 0.0)
this.velocity.X += moveSpeed;
}
else if ((double) this.velocity.X > (double) desiredVelocity.X)
{
this.velocity.X -= moveSpeed;
if ((double) this.velocity.X > 0.0 && (double) desiredVelocity.X < 0.0)
this.velocity.X -= moveSpeed;
}
if ((double) this.velocity.Y < (double) desiredVelocity.Y)
{
this.velocity.Y += moveSpeed;
if ((double) this.velocity.Y >= 0.0 || (double) desiredVelocity.Y <= 0.0)
return;
this.velocity.Y += moveSpeed;
}
else
{
if ((double) this.velocity.Y <= (double) desiredVelocity.Y)
return;
this.velocity.Y -= moveSpeed;
if ((double) this.velocity.Y <= 0.0 || (double) desiredVelocity.Y >= 0.0)
return;
this.velocity.Y -= moveSpeed;
}
}
public void HealEffect(int healAmount, bool broadcast = true)
{
int index = CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), CombatText.HealLife, healAmount);
if (!broadcast || Main.netMode != 2 || index == 100)
return;
CombatText combatText = Main.combatText[index];
NetMessage.SendData(81, number: ((int) combatText.color.PackedValue), number2: combatText.position.X, number3: combatText.position.Y, number4: ((float) healAmount));
}
public static void HealEffect(Microsoft.Xna.Framework.Rectangle r, int healAmount, bool broadcast = true)
{
int index = CombatText.NewText(r, CombatText.HealLife, healAmount);
if (!broadcast || Main.netMode != 2 || index == 100)
return;
CombatText combatText = Main.combatText[index];
NetMessage.SendData(81, number: ((int) combatText.color.PackedValue), number2: combatText.position.X, number3: combatText.position.Y, number4: ((float) healAmount));
}
public int FindClosestPlayer() => this.FindClosestPlayer(out float _);
public int FindClosestPlayer(out float distanceToPlayer)
{
Vector2 center = this.Center;
float num1 = float.MaxValue;
int num2 = -1;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
Player player = Main.player[index];
if (player.active && !player.dead && !player.ghost)
{
float num3 = Vector2.DistanceSquared(center, player.Center);
if ((double) num3 < (double) num1)
{
num1 = num3;
num2 = index;
}
}
}
if (num2 < 0)
{
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
Player player = Main.player[index];
if (player.active)
{
float num4 = Vector2.DistanceSquared(center, player.Center);
if ((double) num4 < (double) num1)
{
num1 = num4;
num2 = index;
}
}
}
}
distanceToPlayer = (float) Math.Sqrt((double) num1);
return num2;
}
public void BigMimicSpawnSmoke()
{
if (Main.netMode == 2)
{
NetMessage.SendData(51, number: this.whoAmI, number2: 4f);
}
else
{
for (int index1 = 0; index1 < 20; ++index1)
{
int index2 = Dust.NewDust(this.position, this.width, this.height, 54, Alpha: 50, Scale: 1.5f);
Main.dust[index2].velocity *= 2f;
Main.dust[index2].noGravity = true;
}
for (int index3 = 0; index3 < 3; ++index3)
{
for (int index4 = 0; index4 < 2; ++index4)
{
int index5 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width * index3) * 0.449999988079071 - 20.0), (float) ((double) this.position.Y + (double) (this.height * index4) * 0.5 + 10.0)), new Vector2(0.0f, 0.0f), 99, 1.1f);
Main.gore[index5].velocity *= 0.3f;
}
}
}
}
public static bool BigMimicSummonCheck(int x, int y)
{
if (Main.netMode == 1 || !Main.hardMode)
return false;
int chest1 = Chest.FindChest(x, y);
if (chest1 < 0)
return false;
int num1 = 0;
int num2 = 0;
int num3 = 0;
for (int index = 0; index < 40; ++index)
{
ushort type = Main.tile[Main.chest[chest1].x, Main.chest[chest1].y].type;
int num4 = (int) Main.tile[Main.chest[chest1].x, Main.chest[chest1].y].frameX / 36;
if (TileID.Sets.BasicChest[(int) type] && (type != (ushort) 21 || num4 < 5 || num4 > 6) && Main.chest[chest1].item[index] != null && Main.chest[chest1].item[index].type > 0)
{
if (Main.chest[chest1].item[index].type == 3092)
num1 += Main.chest[chest1].item[index].stack;
else if (Main.chest[chest1].item[index].type == 3091)
num2 += Main.chest[chest1].item[index].stack;
else
++num3;
}
}
if (num3 == 0 && num1 + num2 == 1)
{
if (num1 != 1)
;
if (TileID.Sets.BasicChest[(int) Main.tile[x, y].type])
{
if ((int) Main.tile[x, y].frameX % 36 != 0)
--x;
if ((int) Main.tile[x, y].frameY % 36 != 0)
--y;
int chest2 = Chest.FindChest(x, y);
for (int index1 = x; index1 <= x + 1; ++index1)
{
for (int index2 = y; index2 <= y + 1; ++index2)
{
if (TileID.Sets.BasicChest[(int) Main.tile[index1, index2].type])
Main.tile[index1, index2].active(false);
}
}
for (int index = 0; index < 40; ++index)
Main.chest[chest1].item[index] = new Item();
Chest.DestroyChest(x, y);
int number = 1;
if (Main.tile[x, y].type == (ushort) 467)
number = 5;
NetMessage.SendData(34, number: number, number2: ((float) x), number3: ((float) y), number5: chest2);
NetMessage.SendTileSquare(-1, x, y, 3);
}
int Type = 475;
if (num2 == 1)
Type = !WorldGen.crimson ? 473 : 474;
int number1 = NPC.NewNPC(x * 16 + 16, y * 16 + 32, Type);
Main.npc[number1].whoAmI = number1;
NetMessage.SendData(23, number: number1);
Main.npc[number1].BigMimicSpawnSmoke();
}
return false;
}
public bool ShouldFaceTarget(
ref NPCUtils.TargetSearchResults searchResults,
NPCUtils.TargetType? overrideTargetType = null)
{
NPCUtils.TargetType nearestTargetType = searchResults.NearestTargetType;
if (overrideTargetType.HasValue)
nearestTargetType = overrideTargetType.Value;
switch (nearestTargetType)
{
case NPCUtils.TargetType.NPC:
case NPCUtils.TargetType.TankPet:
return true;
case NPCUtils.TargetType.Player:
bool flag = true;
Player nearestTankOwner = searchResults.NearestTankOwner;
if (nearestTankOwner.dead || nearestTankOwner.npcTypeNoAggro[this.type] && this.direction != 0)
flag = false;
if (flag)
{
float num = (float) ((double) (nearestTankOwner.width + nearestTankOwner.height + this.width + this.height) / 4.0 + 800.0);
return nearestTankOwner.itemAnimation != 0 || nearestTankOwner.aggro >= 0 || (double) searchResults.NearestTankDistance <= (double) num || this.oldTarget < 0 || this.oldTarget >= (int) byte.MaxValue;
}
break;
}
return false;
}
public void FaceTarget()
{
this.direction = (double) this.targetRect.Center.X < (double) this.Center.X ? -1 : 1;
this.directionY = (double) this.targetRect.Center.Y < (double) this.Center.Y ? -1 : 1;
}
public void TargetClosestUpgraded(bool faceTarget = true, Vector2? checkPosition = null)
{
int index1 = -1;
int index2 = -1;
int index3 = -1;
Vector2 center = this.Center;
if (checkPosition.HasValue)
center = checkPosition.Value;
bool flag1 = this.direction == 0;
float num1 = 9999999f;
for (int index4 = 0; index4 < (int) byte.MaxValue; ++index4)
{
Player player = Main.player[index4];
if (player.active && !player.dead && !player.ghost)
{
float num2 = Vector2.Distance(center, player.Center) - (float) player.aggro;
bool flag2 = player.npcTypeNoAggro[this.type];
if (flag2 && !flag1)
num2 += 1000f;
if ((double) num2 < (double) num1)
{
index1 = index4;
index2 = -1;
num1 = num2;
}
if (player.tankPet >= 0 && !flag2)
{
float num3 = Vector2.Distance(center, Main.projectile[player.tankPet].Center) - 200f;
if ((double) num3 < (double) num1 && (double) num3 < 200.0 && Collision.CanHit(this.Center, 0, 0, Main.projectile[player.tankPet].Center, 0, 0))
{
index2 = player.tankPet;
num1 = num3;
}
}
}
}
for (int index5 = 0; index5 < 200; ++index5)
{
NPC npc = Main.npc[index5];
if (npc.active && npc.type == 548)
{
float num4 = Vector2.Distance(center, npc.Center);
if ((double) num1 > (double) num4)
{
index3 = index5;
index1 = -1;
index2 = -1;
num1 = num4;
}
}
}
if ((double) num1 == 9999999.0)
return;
if (index3 >= 0)
{
this.target = Main.npc[index3].WhoAmIToTargettingIndex;
this.targetRect = Main.npc[index3].Hitbox;
this.direction = (double) this.targetRect.Center.X < (double) this.Center.X ? -1 : 1;
this.directionY = (double) this.targetRect.Center.Y < (double) this.Center.Y ? -1 : 1;
}
else if (index2 >= 0)
{
this.target = Main.projectile[index2].owner;
this.targetRect = Main.projectile[index2].Hitbox;
this.direction = (double) this.targetRect.Center.X < (double) this.Center.X ? -1 : 1;
this.directionY = (double) this.targetRect.Center.Y < (double) this.Center.Y ? -1 : 1;
}
else
{
if (index1 < 0 || index1 >= (int) byte.MaxValue)
index1 = 0;
Player player = Main.player[index1];
this.targetRect = player.Hitbox;
this.target = index1;
if (player.dead || player.npcTypeNoAggro[this.type] && !flag1)
faceTarget = false;
if (!faceTarget)
return;
float num5 = (float) ((double) (player.width + player.height + this.width + this.height) / 4.0 + 800.0);
float num6 = num1 - (float) player.aggro;
if (player.itemAnimation == 0 && player.aggro < 0 && (double) num6 > (double) num5 && this.oldTarget >= 0 && this.oldTarget < (int) byte.MaxValue)
return;
this.direction = (double) this.targetRect.Center.X < (double) this.Center.X ? -1 : 1;
this.directionY = (double) this.targetRect.Center.Y < (double) this.Center.Y ? -1 : 1;
}
}
public void TargetClosest(bool faceTarget = true)
{
float num1 = 0.0f;
float num2 = 0.0f;
bool flag = false;
int num3 = -1;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && !Main.player[index].dead && !Main.player[index].ghost)
{
float num4 = Math.Abs(Main.player[index].position.X + (float) (Main.player[index].width / 2) - this.position.X + (float) (this.width / 2)) + Math.Abs(Main.player[index].position.Y + (float) (Main.player[index].height / 2) - this.position.Y + (float) (this.height / 2)) - (float) Main.player[index].aggro;
if (Main.player[index].npcTypeNoAggro[this.type] && this.direction != 0)
num4 += 1000f;
if (!flag || (double) num4 < (double) num1)
{
flag = true;
num3 = -1;
num2 = Math.Abs(Main.player[index].position.X + (float) (Main.player[index].width / 2) - this.position.X + (float) (this.width / 2)) + Math.Abs(Main.player[index].position.Y + (float) (Main.player[index].height / 2) - this.position.Y + (float) (this.height / 2));
num1 = num4;
this.target = index;
}
if (Main.player[index].tankPet >= 0 && !Main.player[index].npcTypeNoAggro[this.type])
{
int tankPet = Main.player[index].tankPet;
float num5 = Math.Abs(Main.projectile[tankPet].position.X + (float) (Main.projectile[tankPet].width / 2) - this.position.X + (float) (this.width / 2)) + Math.Abs(Main.projectile[tankPet].position.Y + (float) (Main.projectile[tankPet].height / 2) - this.position.Y + (float) (this.height / 2)) - 200f;
if ((double) num5 < (double) num1 && (double) num5 < 200.0 && Collision.CanHit(this.Center, 1, 1, Main.projectile[tankPet].Center, 1, 1))
num3 = tankPet;
}
}
}
if (num3 >= 0)
{
int index = num3;
this.targetRect = new Microsoft.Xna.Framework.Rectangle((int) Main.projectile[index].position.X, (int) Main.projectile[index].position.Y, Main.projectile[index].width, Main.projectile[index].height);
this.direction = 1;
if ((double) (this.targetRect.X + this.targetRect.Width / 2) < (double) this.position.X + (double) (this.width / 2))
this.direction = -1;
this.directionY = 1;
if ((double) (this.targetRect.Y + this.targetRect.Height / 2) < (double) this.position.Y + (double) (this.height / 2))
this.directionY = -1;
}
else
{
if (this.target < 0 || this.target >= (int) byte.MaxValue)
this.target = 0;
this.targetRect = new Microsoft.Xna.Framework.Rectangle((int) Main.player[this.target].position.X, (int) Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height);
if (Main.player[this.target].dead)
faceTarget = false;
if (Main.player[this.target].npcTypeNoAggro[this.type] && this.direction != 0)
faceTarget = false;
if (faceTarget)
{
float num6 = num2 - (float) Main.player[this.target].aggro;
float num7 = (float) ((Main.player[this.target].height + Main.player[this.target].width + this.height + this.width) / 4 + 750 + 50);
if (Main.player[this.target].itemAnimation != 0 || Main.player[this.target].aggro >= 0 || (double) num6 <= (double) num7 || this.oldTarget < 0 || this.oldTarget > 254)
{
this.direction = 1;
if ((double) (this.targetRect.X + this.targetRect.Width / 2) < (double) this.position.X + (double) (this.width / 2))
this.direction = -1;
this.directionY = 1;
if ((double) (this.targetRect.Y + this.targetRect.Height / 2) < (double) this.position.Y + (double) (this.height / 2))
this.directionY = -1;
}
}
}
if (this.confused)
this.direction *= -1;
if (this.direction == this.oldDirection && this.directionY == this.oldDirectionY && this.target == this.oldTarget || this.collideX || this.collideY)
return;
this.netUpdate = true;
}
public void CheckActive()
{
if (!this.active)
return;
switch (this.type)
{
case 8:
return;
case 9:
return;
case 11:
return;
case 12:
return;
case 14:
return;
case 15:
return;
case 40:
case 41:
return;
case 88:
return;
case 89:
return;
case 90:
return;
case 91:
return;
case 92:
return;
case 96:
return;
case 97:
return;
case 99:
return;
case 100:
return;
case 113:
case 114:
case 115:
return;
case 118:
case 119:
return;
case 134:
case 135:
case 136:
return;
case 139:
if (NPC.npcsFoundForCheckActive[134])
return;
break;
case 246:
case 247:
case 248:
case 249:
return;
case 263:
return;
case 267:
return;
case 328:
return;
case 379:
case 380:
return;
case 396:
case 397:
case 398:
return;
case 400:
return;
case 422:
return;
case 437:
case 438:
case 439:
case 440:
return;
case 488:
return;
case 493:
return;
case 507:
return;
case 517:
return;
case 548:
return;
case 549:
return;
case 551:
return;
case 552:
case 553:
case 554:
case 555:
case 556:
case 557:
case 558:
case 559:
case 560:
case 561:
case 562:
case 563:
case 566:
case 567:
case 568:
case 569:
case 570:
case 571:
case 572:
case 573:
case 574:
case 575:
case 576:
case 577:
case 578:
if (NPC.npcsFoundForCheckActive[548])
return;
break;
case 564:
return;
case 565:
return;
}
if (this.townNPC)
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) ((double) this.position.X + (double) (this.width / 2) - (double) NPC.townRangeX), (int) ((double) this.position.Y + (double) (this.height / 2) - (double) NPC.townRangeY), NPC.townRangeX * 2, NPC.townRangeY * 2);
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && rectangle.Intersects(new Microsoft.Xna.Framework.Rectangle((int) Main.player[index].position.X, (int) Main.player[index].position.Y, Main.player[index].width, Main.player[index].height)))
Main.player[index].townNPCs += this.npcSlots;
}
}
else
{
bool flag = false;
Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) ((double) this.position.X + (double) (this.width / 2) - (double) NPC.activeRangeX), (int) ((double) this.position.Y + (double) (this.height / 2) - (double) NPC.activeRangeY), NPC.activeRangeX * 2, NPC.activeRangeY * 2);
Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) ((double) this.position.X + (double) (this.width / 2) - (double) NPC.sWidth * 0.5 - (double) this.width), (int) ((double) this.position.Y + (double) (this.height / 2) - (double) NPC.sHeight * 0.5 - (double) this.height), NPC.sWidth + this.width * 2, NPC.sHeight + this.height * 2);
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active)
{
if (rectangle1.Intersects(new Microsoft.Xna.Framework.Rectangle((int) Main.player[index].position.X, (int) Main.player[index].position.Y, Main.player[index].width, Main.player[index].height)))
{
flag = true;
if (this.type != 25 && this.type != 30 && this.type != 33 && this.releaseOwner == (short) byte.MaxValue && this.lifeMax > 0)
{
if (Main.slimeRain && Main.slimeRainNPC[this.type])
Main.player[index].activeNPCs += this.npcSlots * Main.slimeRainNPCSlots;
else
Main.player[index].activeNPCs += this.npcSlots;
}
}
if (rectangle2.Intersects(new Microsoft.Xna.Framework.Rectangle((int) Main.player[index].position.X, (int) Main.player[index].position.Y, Main.player[index].width, Main.player[index].height)))
this.timeLeft = NPC.activeTime;
if (this.boss)
flag = true;
switch (this.type)
{
case 7:
case 10:
case 13:
case 35:
case 36:
case 39:
case 87:
case (int) sbyte.MaxValue:
case 128:
case 129:
case 130:
case 131:
case 392:
case 393:
case 394:
case 491:
case 492:
flag = true;
continue;
case 399:
if ((double) this.ai[0] == 2.0 || (double) this.ai[0] == 1.0)
this.timeLeft = NPC.activeTime;
flag = true;
continue;
default:
continue;
}
}
}
--this.timeLeft;
if (this.timeLeft <= 0)
flag = false;
if (flag || Main.netMode == 1)
return;
NPC.noSpawnCycle = true;
this.active = false;
if (Main.netMode == 2)
{
this.netSkip = -1;
this.life = 0;
NetMessage.SendData(23, number: this.whoAmI);
}
if (this.aiStyle != 6)
return;
for (int number = (int) this.ai[0]; number > 0; number = (int) Main.npc[number].ai[0])
{
if (Main.npc[number].active)
{
Main.npc[number].active = false;
if (Main.netMode == 2)
{
Main.npc[number].life = 0;
Main.npc[number].netSkip = -1;
NetMessage.SendData(23, number: number);
}
}
}
}
}
public void checkDead()
{
if (!this.active || this.realLife >= 0 && this.realLife != this.whoAmI || this.life > 0)
return;
if (this.type == 397 || this.type == 396)
{
if ((double) this.ai[0] == -2.0)
return;
this.ai[0] = -2f;
this.life = this.lifeMax;
this.netUpdate = true;
this.dontTakeDamage = true;
if (Main.netMode == 1)
return;
int index = NPC.NewNPC((int) this.Center.X, (int) this.Center.Y, 400);
Main.npc[index].ai[3] = this.ai[3];
Main.npc[index].netUpdate = true;
}
else if (this.type == 398 && (double) this.ai[0] != 2.0)
{
this.ai[0] = 2f;
this.life = this.lifeMax;
this.netUpdate = true;
this.dontTakeDamage = true;
}
else if ((this.type == 517 || this.type == 422 || this.type == 507 || this.type == 493) && (double) this.ai[2] != 1.0)
{
this.ai[2] = 1f;
this.ai[1] = 0.0f;
this.life = this.lifeMax;
this.dontTakeDamage = true;
this.netUpdate = true;
}
else if (this.type == 548 && (double) this.ai[1] != 1.0)
{
this.ai[1] = 1f;
this.ai[0] = 0.0f;
this.life = this.lifeMax;
this.dontTakeDamageFromHostiles = true;
this.netUpdate = true;
}
else
{
NPC.noSpawnCycle = true;
if (this.townNPC && this.type != 37 && this.type != 453)
{
NetworkText fullNetName = this.GetFullNetName();
NetworkText text = NetworkText.FromKey(Lang.misc[this.type == 369 ? 36 : 19].Key, (object) fullNetName);
switch (Main.netMode)
{
case 0:
Main.NewText(text.ToString(), G: (byte) 25, B: (byte) 25);
break;
case 2:
NetMessage.BroadcastChatMessage(text, new Color((int) byte.MaxValue, 25, 25));
break;
}
}
if (Main.netMode != 1 && !Main.dayTime && this.type == 54 && !NPC.AnyNPCs(35))
{
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && !Main.player[index].dead && Main.player[index].killClothier)
{
NPC.SpawnSkeletron();
break;
}
}
}
if (this.townNPC && Main.netMode != 1 && this.homeless && WorldGen.prioritizedTownNPC == this.type)
WorldGen.prioritizedTownNPC = 0;
if (this.DeathSound != null)
Main.PlaySound(this.DeathSound, this.position);
if (this.type == 13 || this.type == 14 || this.type == 15)
{
bool flag = true;
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && (Main.npc[index].type == 13 || Main.npc[index].type == 14 || Main.npc[index].type == 15))
{
flag = false;
break;
}
}
if (flag)
{
this.boss = true;
this.NPCLoot();
}
else
this.NPCLoot();
}
else if (this.type == 134)
{
Vector2 position1 = this.position;
Vector2 center = Main.player[this.target].Center;
float num1 = 1E+08f;
Vector2 position2 = this.position;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && (Main.npc[index].type == 134 || Main.npc[index].type == 135 || Main.npc[index].type == 136))
{
float num2 = Math.Abs(Main.npc[index].Center.X - center.X) + Math.Abs(Main.npc[index].Center.Y - center.Y);
if ((double) num2 < (double) num1)
{
num1 = num2;
position2 = Main.npc[index].position;
}
}
}
this.position = position2;
this.NPCLoot();
this.position = position1;
}
else
this.NPCLoot();
this.active = false;
DD2Event.CheckProgress(this.type);
this.CheckProgressFrostMoon();
this.CheckProgressPumpkinMoon();
int num3 = 0;
switch (this.type)
{
case 26:
case 27:
case 28:
case 29:
case 111:
case 471:
num3 = 1;
break;
case 143:
case 144:
case 145:
num3 = 2;
break;
case 212:
case 213:
case 214:
case 215:
case 216:
case 491:
num3 = 3;
break;
case 381:
case 382:
case 383:
case 385:
case 386:
case 388:
case 389:
case 390:
case 391:
case 395:
num3 = 4;
break;
}
if (num3 == 0 || num3 != Main.invasionType)
return;
int num4 = 1;
switch (this.type)
{
case 216:
num4 = 5;
break;
case 395:
num4 = 10;
break;
case 471:
num4 = 10;
break;
case 491:
num4 = 10;
break;
}
Main.invasionSize -= num4;
if (Main.invasionSize < 0)
Main.invasionSize = 0;
if (Main.netMode != 1)
Main.ReportInvasionProgress(Main.invasionSizeStart - Main.invasionSize, Main.invasionSizeStart, num3 + 3, 0);
if (Main.netMode != 2)
return;
NetMessage.SendData(78, number: Main.invasionProgress, number2: ((float) Main.invasionProgressMax), number3: ((float) Main.invasionProgressIcon));
}
}
private void CheckProgressFrostMoon()
{
if (!Main.snowMoon)
return;
NetworkText text = NetworkText.Empty;
int[] numArray = new int[21]
{
0,
25,
15,
10,
30,
100,
160,
180,
200,
250,
300,
375,
450,
525,
675,
850,
1025,
1325,
1550,
2000,
0
};
int progressMax = numArray[NPC.waveNumber];
switch (NPC.waveNumber)
{
case 1:
text = Lang.GetInvasionWaveText(2, (short) 338, (short) 350);
break;
case 2:
text = Lang.GetInvasionWaveText(3, (short) 338, (short) 350, (short) 342, (short) 348);
break;
case 3:
text = Lang.GetInvasionWaveText(4, (short) 344, (short) 338, (short) 350, (short) 342);
break;
case 4:
text = Lang.GetInvasionWaveText(5, (short) 344, (short) 338, (short) 350, (short) 348);
break;
case 5:
text = Lang.GetInvasionWaveText(6, (short) 344, (short) 350, (short) 348, (short) 347);
break;
case 6:
text = Lang.GetInvasionWaveText(7, (short) 346, (short) 342, (short) 350, (short) 338);
break;
case 7:
text = Lang.GetInvasionWaveText(8, (short) 346, (short) 347, (short) 350, (short) 348, (short) 351);
break;
case 8:
text = Lang.GetInvasionWaveText(9, (short) 346, (short) 344, (short) 348, (short) 347, (short) 342);
break;
case 9:
text = Lang.GetInvasionWaveText(10, (short) 346, (short) 344, (short) 351, (short) 338, (short) 347);
break;
case 10:
text = Lang.GetInvasionWaveText(11, (short) 345, (short) 352, (short) 338, (short) 342);
break;
case 11:
text = Lang.GetInvasionWaveText(12, (short) 345, (short) 344, (short) 342, (short) 343, (short) 338);
break;
case 12:
text = Lang.GetInvasionWaveText(13, (short) 345, (short) 346, (short) 342, (short) 352, (short) 343, (short) 347);
break;
case 13:
text = Lang.GetInvasionWaveText(14, (short) 345, (short) 346, (short) 344, (short) 343, (short) 351);
break;
case 14:
text = Lang.GetInvasionWaveText(15, (short) 345, (short) 346, (short) 344, (short) 343, (short) 347);
break;
case 15:
text = Lang.GetInvasionWaveText(16, (short) 345, (short) 346, (short) 344, (short) 343, (short) 352);
break;
case 16:
text = Lang.GetInvasionWaveText(17, (short) 345, (short) 346, (short) 344, (short) 343, (short) 351, (short) 347);
break;
case 17:
text = Lang.GetInvasionWaveText(18, (short) 345, (short) 346, (short) 344, (short) 343, (short) 348, (short) 351);
break;
case 18:
text = Lang.GetInvasionWaveText(19, (short) 345, (short) 346, (short) 344, (short) 343);
break;
case 19:
text = Lang.GetInvasionWaveText(-1, (short) 345, (short) 346, (short) 344);
break;
}
float num = 0.0f;
switch (this.type)
{
case 338:
case 339:
case 340:
num = 1f;
break;
case 341:
num = 20f;
break;
case 342:
num = 2f;
break;
case 343:
num = 18f;
break;
case 344:
num = 50f;
break;
case 345:
num = 150f;
break;
case 346:
num = 100f;
break;
case 347:
num = 8f;
break;
case 348:
case 349:
num = 4f;
break;
case 350:
num = 3f;
break;
}
if (Main.expertMode)
num *= 2f;
float waveKills = NPC.waveKills;
NPC.waveKills += num;
if ((double) NPC.waveKills >= (double) progressMax && progressMax != 0)
{
NPC.waveKills = 0.0f;
++NPC.waveNumber;
progressMax = numArray[NPC.waveNumber];
if (text != NetworkText.Empty)
{
switch (Main.netMode)
{
case 0:
Main.NewText(text.ToString(), (byte) 175, (byte) 75);
break;
case 2:
NetMessage.BroadcastChatMessage(text, new Color(175, 75, (int) byte.MaxValue));
break;
}
if (NPC.waveNumber == 15)
AchievementsHelper.NotifyProgressionEvent(14);
}
}
if ((double) NPC.waveKills == (double) waveKills || (double) num == 0.0)
return;
if (Main.netMode != 1)
Main.ReportInvasionProgress((int) NPC.waveKills, progressMax, 1, NPC.waveNumber);
if (Main.netMode != 2)
return;
NetMessage.SendData(78, number: Main.invasionProgress, number2: ((float) Main.invasionProgressMax), number3: 1f, number4: ((float) NPC.waveNumber));
}
private void CheckProgressPumpkinMoon()
{
if (!Main.pumpkinMoon)
return;
NetworkText text = NetworkText.Empty;
int[] numArray = new int[16]
{
0,
25,
40,
50,
80,
100,
160,
180,
200,
250,
300,
375,
450,
525,
675,
0
};
int progressMax = numArray[NPC.waveNumber];
switch (NPC.waveNumber)
{
case 1:
text = Lang.GetInvasionWaveText(2, (short) 305, (short) 326);
break;
case 2:
text = Lang.GetInvasionWaveText(3, (short) 305, (short) 326, (short) 329);
break;
case 3:
text = Lang.GetInvasionWaveText(4, (short) 305, (short) 326, (short) 329, (short) 325);
break;
case 4:
text = Lang.GetInvasionWaveText(5, (short) 305, (short) 326, (short) 329, (short) 330, (short) 325);
break;
case 5:
text = Lang.GetInvasionWaveText(6, (short) 326, (short) 329, (short) 330, (short) 325);
break;
case 6:
text = Lang.GetInvasionWaveText(7, (short) 305, (short) 329, (short) 330, (short) 327);
break;
case 7:
text = Lang.GetInvasionWaveText(8, (short) 326, (short) 329, (short) 330, (short) 327);
break;
case 8:
text = Lang.GetInvasionWaveText(9, (short) 305, (short) 315, (short) 325, (short) 327);
break;
case 9:
text = Lang.GetInvasionWaveText(10, (short) 326, (short) 329, (short) 330, (short) 315, (short) 325, (short) 327);
break;
case 10:
text = Lang.GetInvasionWaveText(11, (short) 305, (short) 326, (short) 329, (short) 330, (short) 315, (short) 325, (short) 327);
break;
case 11:
text = Lang.GetInvasionWaveText(12, (short) 326, (short) 329, (short) 330, (short) 315, (short) 325, (short) 327);
break;
case 12:
text = Lang.GetInvasionWaveText(13, (short) 329, (short) 330, (short) 315, (short) 325, (short) 327);
break;
case 13:
text = Lang.GetInvasionWaveText(14, (short) 315, (short) 325, (short) 327);
break;
case 14:
text = Lang.GetInvasionWaveText(-1, (short) 325, (short) 327);
break;
}
float num = 0.0f;
switch (this.type)
{
case 305:
case 306:
case 307:
case 308:
case 309:
case 310:
case 311:
case 312:
case 313:
case 314:
num = 1f;
break;
case 315:
num = 25f;
break;
case 325:
num = 75f;
break;
case 326:
num = 2f;
break;
case 327:
num = 150f;
break;
case 329:
num = 4f;
break;
case 330:
num = 8f;
break;
}
if (Main.expertMode)
num *= 2f;
float waveKills = NPC.waveKills;
NPC.waveKills += num;
if ((double) NPC.waveKills >= (double) progressMax && progressMax != 0)
{
NPC.waveKills = 0.0f;
++NPC.waveNumber;
progressMax = numArray[NPC.waveNumber];
if (text != NetworkText.Empty)
{
switch (Main.netMode)
{
case 0:
Main.NewText(text.ToString(), (byte) 175, (byte) 75);
break;
case 2:
NetMessage.BroadcastChatMessage(text, new Color(175, 75, (int) byte.MaxValue));
break;
}
if (NPC.waveNumber == 15)
AchievementsHelper.NotifyProgressionEvent(15);
}
}
if ((double) NPC.waveKills == (double) waveKills || (double) num == 0.0)
return;
if (Main.netMode != 1)
Main.ReportInvasionProgress((int) NPC.waveKills, progressMax, 2, NPC.waveNumber);
if (Main.netMode != 2)
return;
NetMessage.SendData(78, number: Main.invasionProgress, number2: ((float) Main.invasionProgressMax), number3: 2f, number4: ((float) NPC.waveNumber));
}
public static void ResetKillCount()
{
for (int index = 0; index < 580; ++index)
NPC.killCount[index] = 0;
}
public bool AnyInteractions()
{
if (Main.netMode == 0)
{
if (this.playerInteraction[Main.myPlayer])
return true;
}
else
{
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (this.playerInteraction[index])
return true;
}
}
return false;
}
public void NPCLoot()
{
if (Main.netMode == 1 || this.type >= 580)
return;
bool flag1 = NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3;
switch (this.type)
{
case 13:
case 14:
case 15:
if (this.boss)
{
AchievementsHelper.NotifyNPCKilled(this);
break;
}
break;
case 125:
case 126:
if (!NPC.AnyNPCs(this.type == 126 ? 125 : 126))
{
AchievementsHelper.NotifyNPCKilled(this);
AchievementsHelper.CheckMechaMayhem(this.type);
break;
}
break;
case (int) sbyte.MaxValue:
case 134:
AchievementsHelper.CheckMechaMayhem(this.type);
AchievementsHelper.NotifyNPCKilled(this);
break;
default:
AchievementsHelper.NotifyNPCKilled(this);
break;
}
int index1 = Item.NPCtoBanner(this.BannerID());
if (index1 > 0 && !NPCID.Sets.ExcludedFromDeathTally[this.type])
{
if (this.realLife < 0 ? this.AnyInteractions() : Main.npc[this.realLife].AnyInteractions())
{
++NPC.killCount[index1];
if (Main.netMode == 2)
NetMessage.SendData(83, number: index1);
int num = ItemID.Sets.KillsToBanner[Item.BannerToItem(index1)];
if (NPC.killCount[index1] % num == 0 && index1 > 0)
{
int npc = Item.BannerToNPC(index1);
new NPC().SetDefaults(npc);
int index2 = this.lastInteraction;
if (!Main.player[index2].active || Main.player[index2].dead)
index2 = this.FindClosestPlayer();
NetworkText text = NetworkText.FromKey("Game.EnemiesDefeatedAnnouncement", (object) NPC.killCount[index1], (object) NetworkText.FromKey(Lang.GetNPCName(npc).Key));
if (index2 >= 0 && index2 < (int) byte.MaxValue)
text = NetworkText.FromKey("Game.EnemiesDefeatedByAnnouncement", (object) Main.player[index2].name, (object) NPC.killCount[index1], (object) NetworkText.FromKey(Lang.GetNPCName(npc).Key));
switch (Main.netMode)
{
case 0:
Main.NewText(text.ToString(), (byte) 250, (byte) 250, (byte) 0);
break;
case 2:
NetMessage.BroadcastChatMessage(text, new Color(250, 250, 0));
break;
}
int Type = Item.BannerToItem(index1);
Vector2 position = this.position;
if (index2 >= 0 && index2 < (int) byte.MaxValue)
position = Main.player[index2].position;
Item.NewItem((int) position.X, (int) position.Y, this.width, this.height, Type);
}
}
}
if (this.type == 23 && Main.hardMode || this.SpawnedFromStatue && NPCID.Sets.NoEarlymodeLootWhenSpawnedFromStatue[this.type] && !Main.hardMode || this.SpawnedFromStatue && (double) NPCID.Sets.StatueSpawnedDropRarity[this.type] != -1.0 && ((double) Main.rand.NextFloat() >= (double) NPCID.Sets.StatueSpawnedDropRarity[this.type] || !this.AnyInteractions()))
return;
if ((this.type == 170 || this.type == 180 || this.type == 171) && Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3532);
switch (this.type)
{
case 75:
case 80:
case 84:
case 86:
case 120:
case 122:
case 137:
case 138:
case 171:
case 244:
case 475:
int maxValue1 = Main.expertMode ? 150 : 200;
if (Main.rand.Next(maxValue1) == 0)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3260);
break;
}
break;
}
if (Main.slimeRain && Main.slimeRainNPC[this.type] && !NPC.AnyNPCs(50))
{
int num = 150;
if (NPC.downedSlimeKing)
num /= 2;
++Main.slimeRainKillCount;
if (Main.slimeRainKillCount >= num)
{
NPC.SpawnOnPlayer(this.FindClosestPlayer(), 50);
Main.slimeRainKillCount = -num / 2;
}
}
if (!Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].ZoneDungeon)
{
bool flag2 = false;
if (Main.expertMode && Main.rand.Next(5) == 0)
flag2 = true;
else if (Main.rand.Next(5) == 0)
flag2 = true;
if (this.boss)
flag2 = false;
switch (this.type)
{
case 13:
case 14:
case 15:
flag2 = false;
break;
}
if (((!Main.hardMode || this.lifeMax <= 1 || this.damage <= 0 || this.friendly ? 0 : ((double) this.position.Y > Main.rockLayer * 16.0 ? 1 : 0)) & (flag2 ? 1 : 0)) != 0 && this.type != 121 && (double) this.value > 0.0)
{
if (Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].ZoneCorrupt || Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].ZoneCrimson)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 521);
if (Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].ZoneHoly)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 520);
}
}
if (this.type == 1 && (double) this.ai[1] > 0.0)
{
int Type = (int) this.ai[1];
if (Type > 0 && Type < 3930)
{
int Stack = 1;
switch (Type)
{
case 8:
Stack = Main.rand.Next(5, 11);
break;
case 166:
Stack = Main.rand.Next(2, 7);
break;
case 965:
Stack = Main.rand.Next(20, 46);
break;
default:
if (Type >= 11 && Type <= 14 || Type >= 699 && Type <= 702)
{
Stack = Main.rand.Next(3, 9);
if (Main.rand.Next(2) == 0)
{
Stack += 5;
break;
}
break;
}
switch (Type)
{
case 71:
Stack = Main.rand.Next(50, 100);
break;
case 72:
Stack = Main.rand.Next(20, 100);
break;
case 73:
Stack = Main.rand.Next(1, 3);
break;
}
break;
}
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack);
}
}
if (this.type == 22 && this.GivenOrTypeName == "Andrew")
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 867);
if (this.type == 353 && Main.rand.Next(8) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3352);
if (this.type == 441 && Main.rand.Next(8) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3351);
if (this.type == 227 && Main.rand.Next(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3350);
if (this.type == 550 && Main.rand.Next(6) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3821);
if (this.type == 208 && Main.rand.Next(4) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3548, Main.rand.Next(30, 61));
if (this.type == 207 && Main.rand.Next(8) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3349);
if (Main.hardMode && (double) this.value > 0.0)
{
if (!NPC.downedMechBoss1 && Main.rand.Next(2500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 556);
else if (!NPC.downedMechBoss2 && Main.rand.Next(2500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 544);
else if (!NPC.downedMechBoss3 && Main.rand.Next(2500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 557);
}
if (Main.halloween && (double) this.value > 0.0 && (double) this.value < 500.0 && this.damage < 40 && this.defense < 20)
{
if (Main.rand.Next(2000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1825);
else if (Main.rand.Next(2000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1827);
}
if (Main.hardMode && (double) this.value > 0.0)
{
if (Main.rand.Next(2500) == 0 && Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].ZoneJungle)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1533);
if (Main.rand.Next(2500) == 0 && Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].ZoneCorrupt)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1534);
if (Main.rand.Next(2500) == 0 && Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].ZoneCrimson)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1535);
if (Main.rand.Next(2500) == 0 && Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].ZoneHoly)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1536);
if (Main.rand.Next(2500) == 0 && Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].ZoneSnow)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1537);
}
if (DD2Event.Ongoing)
{
switch (this.type)
{
case 552:
case 553:
case 554:
DD2Event.AnnounceGoblinDeath(this);
if (DD2Event.ShouldDropCrystals())
{
Item.NewItem(this.position, this.Size, 3822);
break;
}
break;
case 555:
case 556:
case 557:
case 561:
case 562:
case 563:
case 570:
case 571:
case 572:
case 573:
if (DD2Event.ShouldDropCrystals())
{
Item.NewItem(this.position, this.Size, 3822);
break;
}
break;
case 558:
case 559:
case 560:
case 568:
case 569:
if (DD2Event.ShouldDropCrystals())
{
Item.NewItem(this.position, this.Size, 3822);
break;
}
break;
case 564:
if (Main.rand.Next(7) == 0)
Item.NewItem(this.position, this.Size, 3864);
if (Main.rand.Next(5) == 0)
{
if (Main.rand.Next(2) == 0)
Item.NewItem(this.position, this.Size, 3815, 4);
else
Item.NewItem(this.position, this.Size, 3814);
}
if (Main.rand.Next(Main.expertMode ? 2 : 3) == 0)
Item.NewItem(this.position, this.Size, (int) Utils.SelectRandom<short>(Main.rand, (short) 3857, (short) 3855));
if (DD2Event.ShouldDropCrystals())
{
Item.NewItem(this.position, this.Size, 3822);
break;
}
break;
case 565:
if (Main.rand.Next(14) == 0)
Item.NewItem(this.position, this.Size, 3864);
if (Main.rand.Next(10) == 0)
{
if (Main.rand.Next(2) == 0)
Item.NewItem(this.position, this.Size, 3815, 4);
else
Item.NewItem(this.position, this.Size, 3814);
}
if (Main.rand.Next(6) == 0)
Item.NewItem(this.position, this.Size, (int) Utils.SelectRandom<short>(Main.rand, (short) 3857, (short) 3855));
if (DD2Event.ShouldDropCrystals())
{
Item.NewItem(this.position, this.Size, 3822);
break;
}
break;
case 574:
case 575:
case 578:
if (DD2Event.ShouldDropCrystals())
{
Item.NewItem(this.position, this.Size, 3822);
break;
}
break;
case 576:
if (Main.rand.Next(7) == 0)
Item.NewItem(this.position, this.Size, 3865);
if (Main.rand.Next(Main.expertMode ? 2 : 3) == 0)
Item.NewItem(this.position, this.Size, (int) Utils.SelectRandom<short>(Main.rand, (short) 3809, (short) 3811, (short) 3810, (short) 3812));
if (Main.rand.Next(Main.expertMode ? 2 : 3) == 0)
Item.NewItem(this.position, this.Size, (int) Utils.SelectRandom<short>(Main.rand, (short) 3852, (short) 3854, (short) 3823, (short) 3835, (short) 3836));
if (Main.rand.Next(Main.expertMode ? 4 : 5) == 0)
Item.NewItem(this.position, this.Size, 3856);
if (DD2Event.ShouldDropCrystals())
{
Item.NewItem(this.position, this.Size, 3822);
break;
}
break;
case 577:
if (Main.rand.Next(14) == 0)
Item.NewItem(this.position, this.Size, 3865);
if (Main.rand.Next(6) == 0)
Item.NewItem(this.position, this.Size, (int) Utils.SelectRandom<short>(Main.rand, (short) 3809, (short) 3811, (short) 3810, (short) 3812));
if (Main.rand.Next(6) == 0)
Item.NewItem(this.position, this.Size, (int) Utils.SelectRandom<short>(Main.rand, (short) 3852, (short) 3854, (short) 3823, (short) 3835, (short) 3836));
if (Main.rand.Next(10) == 0)
Item.NewItem(this.position, this.Size, 3856);
if (DD2Event.ShouldDropCrystals())
{
Item.NewItem(this.position, this.Size, 3822);
break;
}
break;
}
}
if (this.type == 68)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1169);
if (Main.snowMoon)
{
int waveNumber = NPC.waveNumber;
if (Main.expertMode)
waveNumber += 7;
int maxValue2 = (int) ((double) (30 - waveNumber) / 2.5);
if (Main.expertMode)
maxValue2 -= 2;
if (maxValue2 < 1)
maxValue2 = 1;
if (this.type == 344)
NPC.downedChristmasTree = true;
if (this.type == 345)
NPC.downedChristmasIceQueen = true;
if (this.type == 346)
NPC.downedChristmasSantank = true;
if ((this.type == 344 || this.type == 345 || this.type == 346) && Main.rand.Next(maxValue2) == 0 && waveNumber >= 15)
{
int maxValue3 = 4;
if (waveNumber == 16)
maxValue3 = 4;
if (waveNumber == 17)
maxValue3 = 3;
if (waveNumber == 18)
maxValue3 = 3;
if (waveNumber == 19)
maxValue3 = 2;
if (waveNumber >= 20)
maxValue3 = 2;
if (Main.expertMode && Main.rand.Next(3) == 0)
--maxValue3;
if (Main.rand.Next(maxValue3) == 0)
{
if (this.type == 344)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1962);
if (this.type == 345)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1960);
if (this.type == 346)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1961);
}
}
if (Main.rand.Next(maxValue2) == 0)
{
if (this.type == 344)
{
int num = Main.rand.Next(3);
if (Main.rand.Next(15) == 0)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1871, pfix: -1);
}
else
{
if (num == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1916);
if (num == 1)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1928, pfix: -1);
if (num == 2)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1930, pfix: -1);
}
}
if (this.type == 346)
{
int num = Main.rand.Next(2);
if (num == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1910, pfix: -1);
if (num == 1)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1929, pfix: -1);
}
if (this.type == 345)
{
if (NPC.waveNumber >= 15 && Main.rand.Next(30) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1914);
else if (Main.rand.Next(15) == 0)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1959);
}
else
{
int num = Main.rand.Next(3);
if (num == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1931, pfix: -1);
if (num == 1)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1946, pfix: -1);
if (num == 2)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1947, pfix: -1);
}
}
}
}
if (this.type == 341)
{
int num = Main.rand.Next(5, 11);
for (int index3 = 0; index3 < num; ++index3)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (Main.xMas)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1869);
}
if (this.type >= 338 && this.type <= 340 && Main.rand.Next(5) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (this.type >= 338 && this.type <= 340 && Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1943 + Main.rand.Next(3));
if (this.type == 342 && Main.rand.Next(3) != 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (Main.pumpkinMoon)
{
if (this.type == 325)
NPC.downedHalloweenTree = true;
if (this.type == 327)
NPC.downedHalloweenKing = true;
int waveNumber = NPC.waveNumber;
if (Main.expertMode)
waveNumber += 6;
int maxValue4 = (int) ((double) (17 - waveNumber) / 1.25);
if (Main.expertMode)
--maxValue4;
if (maxValue4 < 1)
maxValue4 = 1;
if (waveNumber >= 15)
{
if (this.type == 325)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1855);
if (this.type == 327)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1856);
}
if (Main.rand.Next(maxValue4) == 0)
{
if (this.type == 315 && Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1857);
if (this.type >= 305 && this.type <= 314 && Main.rand.Next(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(1788, 1791));
if (this.type == 325)
{
int num = Main.rand.Next(5);
if (num == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1829);
if (num == 1)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1831);
if (num == 2)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1835, pfix: -1);
if (num == 2)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1836, Main.rand.Next(30, 61));
if (num == 3)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1837);
if (num == 4)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1845, pfix: -1);
}
if (this.type == 327)
{
int num = Main.rand.Next(7);
if (num == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1782, pfix: -1);
if (num == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1783, Main.rand.Next(50, 101));
if (num == 1)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1784, pfix: -1);
if (num == 1)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1785, Main.rand.Next(25, 51));
if (num == 2)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1811);
if (num == 3)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1826, pfix: -1);
if (num == 4)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1801, pfix: -1);
if (num == 5)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1802, pfix: -1);
if (num == 6)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1798);
}
}
}
if (this.type == 325)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1729, Main.rand.Next(30, 51));
if (this.type == 326)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1729, Main.rand.Next(1, 5));
if (this.type >= 305 && this.type <= 314 && Main.rand.Next(4) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (this.type == 326 && Main.rand.Next(6) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (this.type == 329 && Main.rand.Next(4) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (this.type == 330 && Main.rand.Next(4) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (this.type == 315)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (Main.halloween && this.lifeMax > 1 && this.damage > 0 && !this.friendly && this.type != 121 && this.type != 23 && (double) this.value > 0.0 && Main.rand.Next(80) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1774);
if (Main.xMas && this.lifeMax > 1 && this.damage > 0 && !this.friendly && this.type != 121 && (double) this.value > 0.0 && Main.rand.Next(13) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1869);
if (this.lifeMax > 5 && (double) this.value > 0.0 && !this.friendly && Main.hardMode && (double) this.position.Y / 16.0 > (double) (Main.maxTilesY - 200) && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2701, Main.rand.Next(20, 51));
if (this.type == 325 || this.type == 327 || this.type == 344 || this.type == 345 || this.type == 346)
{
int num = Main.rand.Next(6) + 6;
for (int index4 = 0; index4 < num; ++index4)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
}
if (this.type == 156 && Main.rand.Next(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1518);
if (this.type == 243 && Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1519);
if (this.type >= 269 && this.type <= 280 && Main.rand.Next(450) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1517);
if ((this.type == 158 || this.type == 159) && Main.rand.Next(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1520);
if (this.type == 176 && Main.rand.Next(150) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1521);
if (this.type == 48 && Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1516);
if (this.type == 205 && Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1611);
if (this.type == 483 || this.type == 482)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3086, Main.rand.Next(5, 11), pfix: -1);
if (!Main.hardMode && Main.rand.Next(100) == 0 && this.HasPlayerTarget && this.lifeMax > 5 && !this.friendly && Main.rand.Next(4) == 0 && (double) this.position.Y / 16.0 > (double) (Main.maxTilesY - 350) && NPC.downedBoss3)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3282, pfix: -1);
if (Main.hardMode && this.HasPlayerTarget && Main.player[this.target].ZoneSnow && Main.rand.Next(300) == 0 && this.HasPlayerTarget && this.lifeMax > 5 && !this.friendly && (double) this.value > 0.0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3289, pfix: -1);
else if (Main.hardMode && Main.rand.Next(200) == 0 && this.HasPlayerTarget && this.lifeMax > 5 && !this.friendly && (double) this.value > 0.0)
{
if (Main.player[this.target].ZoneJungle && NPC.downedMechBossAny)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3286, pfix: -1);
else if (Main.player[this.target].ZoneDungeon && NPC.downedPlantBoss && Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3291, pfix: -1);
else if ((double) this.position.Y / 16.0 > (Main.rockLayer + (double) Main.maxTilesY) / 2.0 && !Main.player[this.target].ZoneDungeon && Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3290, pfix: -1);
}
int num1 = 1;
if (Main.expertMode && Main.rand.Next(2) == 0)
num1 = 2;
for (int index5 = 0; index5 < num1; ++index5)
{
if (this.type == 461 && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 497, pfix: -1);
if ((this.type == 159 || this.type == 158) && Main.rand.Next(35) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 900, pfix: -1);
if (this.type == 251 && Main.rand.Next(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1311, pfix: -1);
if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3)
{
if (this.type == 477)
{
if (Main.rand.Next(20) == 0 && NPC.downedPlantBoss)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2770, pfix: -1);
++index5;
}
if (Main.rand.Next(4) == 0)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1570, pfix: -1);
++index5;
}
else if (Main.rand.Next(3) == 0 && NPC.downedPlantBoss)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3292, pfix: -1);
++index5;
}
}
if (this.type == 253 && Main.rand.Next(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1327, pfix: -1);
}
if (NPC.downedPlantBoss)
{
if (this.type == 460 && Main.rand.Next(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3098, pfix: -1);
if (this.type == 468 && Main.rand.Next(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3105, pfix: -1);
if (this.type == 466 && Main.rand.Next(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3106, pfix: -1);
if (this.type == 467 && Main.rand.Next(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3249, pfix: -1);
if (this.type == 463 && Main.rand.Next(25) == 0)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3107, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3108, Main.rand.Next(100, 201), pfix: -1);
}
}
}
if (Main.bloodMoon && Main.hardMode && Main.rand.Next(1000) == 0 && (double) this.value > 0.0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1314, pfix: -1);
if (this.type == 77 && Main.rand.Next(150) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 723, pfix: -1);
if (Main.rand.Next(100) == 0 || Main.expertMode && Main.rand.Next(100) == 0)
{
int Type1 = -1;
int Type2 = -1;
switch (this.type)
{
case 34:
case 83:
case 84:
case 179:
Type1 = 891;
break;
case 42:
case 141:
case 176:
case 231:
case 232:
case 233:
case 234:
case 235:
Type1 = 887;
break;
case 75:
Type1 = Main.rand.Next(2) != 0 ? 890 : 889;
if (Main.rand.Next(100) == 0)
{
Type2 = Type1 != 889 ? 889 : 890;
break;
}
break;
case 77:
case 273:
case 274:
case 275:
case 276:
Type1 = 886;
break;
case 78:
case 82:
Type1 = 889;
break;
case 79:
Type1 = Main.rand.Next(2) != 0 ? 890 : 888;
if (Main.rand.Next(100) == 0)
{
Type2 = Type1 != 888 ? 888 : 890;
break;
}
break;
case 80:
case 93:
case 109:
Type1 = 893;
break;
case 81:
Type1 = 888;
break;
case 94:
case 182:
Type1 = 892;
break;
case 102:
case 104:
case 269:
case 270:
case 271:
case 272:
Type1 = 885;
break;
case 103:
Type1 = 890;
break;
case 480:
Type1 = 3781;
break;
}
if (Type1 != -1)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type1, pfix: -1);
if (Type2 != -1)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type2, pfix: -1);
}
int num2 = 1;
if (Main.expertMode && Main.rand.Next(2) == 0)
num2 = 2;
for (int index6 = 0; index6 < num2; ++index6)
{
if (this.type == 290)
{
if (Main.rand.Next(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1513, pfix: -1);
else if (Main.rand.Next(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 938, pfix: -1);
}
if (this.type == 287 && Main.rand.Next(6) == 0)
{
if (Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 963, pfix: -1);
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 977, pfix: -1);
}
if (this.type == 291)
{
if (Main.rand.Next(12) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1300, pfix: -1);
else if (Main.rand.Next(12) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1254, pfix: -1);
}
if (this.type == 292)
{
if (Main.rand.Next(12) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1514, pfix: -1);
else if (Main.rand.Next(12) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 679, pfix: -1);
}
if (this.type == 293 && Main.rand.Next(18) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 759, pfix: -1);
if ((this.type == 281 || this.type == 282) && Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1446, pfix: -1);
if ((this.type == 283 || this.type == 284) && Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1444, pfix: -1);
if ((this.type == 285 || this.type == 286) && Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1445, pfix: -1);
if (this.type >= 269 && this.type <= 280)
{
if (Main.rand.Next(400) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1183, pfix: -1);
else if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1266, pfix: -1);
else if (Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 671, pfix: -1);
}
}
if (this.lifeMax > 100 && this.type != 288 && (double) this.value > 0.0 && this.HasPlayerTarget && Main.hardMode && NPC.downedPlantBoss && Main.player[this.target].ZoneDungeon)
{
int maxValue5 = 13;
if (Main.expertMode)
maxValue5 = 9;
if (Main.rand.Next(maxValue5) == 0 && Main.wallDungeon[(int) Main.tile[(int) this.Center.X / 16, (int) this.Center.Y / 16].wall])
NPC.NewNPC((int) this.Center.X, (int) this.Center.Y, 288);
}
if (this.type == 288)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1508, Main.rand.Next(1, 3), pfix: -1);
if (this.type == 156 && Main.rand.Next(30) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 683, pfix: -1);
if ((this.type == 195 || this.type == 196) && (Main.expertMode || Main.rand.Next(2) == 0))
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3102, pfix: -1);
if (this.type == 245)
{
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2110, pfix: -1);
switch (Main.rand.Next(8))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1258, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1261, Main.rand.Next(60, 100));
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1122, pfix: -1);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 899, pfix: -1);
break;
case 3:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1248, pfix: -1);
break;
case 4:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1294, pfix: -1);
break;
case 5:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1295, pfix: -1);
break;
case 6:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1296, pfix: -1);
break;
case 7:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1297, pfix: -1);
break;
}
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2218, Main.rand.Next(4, 9), pfix: -1);
}
NPC.downedGolemBoss = true;
}
if (this.type == 471 && (Main.expertMode || Main.rand.Next(2) == 0))
{
if (Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3052, pfix: -1);
else if (Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3053, pfix: -1);
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3054, pfix: -1);
}
if (this.type == 268)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1332, Main.rand.Next(2, 6));
if (this.type == 370)
{
NPC.downedFishron = true;
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2588, pfix: -1);
if (Main.rand.Next(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2609, pfix: -1);
switch (Main.rand.Next(5))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2611, pfix: -1);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2624, pfix: -1);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2622, pfix: -1);
break;
case 3:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2621, pfix: -1);
break;
case 4:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2623, pfix: -1);
break;
}
}
}
if (this.type == 109 && !NPC.downedClown)
{
NPC.downedClown = true;
if (Main.netMode == 2)
NetMessage.SendData(7);
}
if (this.type == 153 && Main.rand.Next(17) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1328, pfix: -1);
if (this.type == 120 && Main.rand.Next(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1326, pfix: -1);
if (this.type == 49 && Main.rand.Next(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1325, pfix: -1);
if (this.type == 185 && Main.rand.Next(150) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 951, pfix: -1);
if (this.type == 44 && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1320, pfix: -1);
if (this.type == 44 && Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 88, pfix: -1);
if (this.type == 110 && Main.rand.Next(80) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1321, pfix: -1);
if (this.type == 60 && Main.rand.Next(150) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1322, pfix: -1);
if (this.type == 151 && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1322, pfix: -1);
if (this.type == 24 && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1323, pfix: -1);
if (this.type == 109 && Main.rand.Next(30) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1324, Main.rand.Next(1, 5), pfix: -1);
if (this.type == 163 || this.type == 238)
{
if (Main.rand.Next(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1308, pfix: -1);
if (Main.expertMode)
{
if (Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2607, Main.rand.Next(2, 4));
else if (Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2607, Main.rand.Next(1, 4));
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2607);
}
else if (Main.rand.Next(4) != 0)
{
if (Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2607, Main.rand.Next(1, 4));
else if (Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2607, Main.rand.Next(1, 3));
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2607);
}
}
if (Main.hardMode && (this.type == 197 || this.type == 206 || this.type == 169 || this.type == 154) && Main.rand.Next(180) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1306, pfix: -1);
if (this.type == 244)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 23, Main.rand.Next(1, 6));
if (Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 23, Main.rand.Next(1, 6));
if (Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 23, Main.rand.Next(1, 6));
if (Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 23, Main.rand.Next(1, 6));
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 662, Main.rand.Next(30, 60));
}
if (this.type == 250 && Main.rand.Next(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1244, pfix: -1);
if (this.type == 172)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 754, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 755, pfix: -1);
}
if (this.type == 110 && Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 682, pfix: -1);
if (this.type == 154 && Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1253, pfix: -1);
if ((this.type == 169 || this.type == 206) && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 726, pfix: -1);
if (this.type == 243)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2161, pfix: -1);
if (this.type == 480 && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3269, pfix: -1);
if (this.type == 198 || this.type == 199 || this.type == 226)
{
if (Main.rand.Next(1000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1172, pfix: -1);
if (Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1293, pfix: -1);
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2766, Main.rand.Next(1, 3), pfix: -1);
}
if (this.type == 78 || this.type == 79 || this.type == 80)
{
if (Main.rand.Next(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 870, pfix: -1);
if (Main.rand.Next(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 871, pfix: -1);
if (Main.rand.Next(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 872, pfix: -1);
}
if (this.type == 473)
{
switch (Main.rand.Next(5))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3008, pfix: -1);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3014, pfix: -1);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3012, pfix: -1);
break;
case 3:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3015, pfix: -1);
break;
case 4:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3023, pfix: -1);
break;
}
}
else if (this.type == 474)
{
switch (Main.rand.Next(5))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3006, pfix: -1);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3007, pfix: -1);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3013, pfix: -1);
break;
case 3:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3016, pfix: -1);
break;
case 4:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3020, pfix: -1);
break;
}
}
else if (this.type == 475)
{
switch (Main.rand.Next(4))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3029, pfix: -1);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3030, pfix: -1);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3051, pfix: -1);
break;
case 3:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3022, pfix: -1);
break;
}
}
else
{
int type = this.type;
}
if (this.type == 473 || this.type == 474 || this.type == 475 || this.type == 476)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 499, Main.rand.Next(5, 11), pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 500, Main.rand.Next(5, 16), pfix: -1);
}
if (this.type == 85 && (double) this.value > 0.0)
{
if ((double) this.ai[3] == 4.0)
{
if (Main.rand.Next(20) == 0)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1312, pfix: -1);
}
else
{
switch (Main.rand.Next(3))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 676, pfix: -1);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 725, pfix: -1);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1264, pfix: -1);
break;
}
}
}
else
{
switch (Main.rand.Next(6))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 437, pfix: -1);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 517, pfix: -1);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 535, pfix: -1);
break;
case 3:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 536, pfix: -1);
break;
case 4:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 532, pfix: -1);
break;
default:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 554, pfix: -1);
break;
}
}
}
if (this.type == 87)
{
if (Main.expertMode)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 575, Main.rand.Next(5, 11) * 2);
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 575, Main.rand.Next(5, 11));
}
if (this.type >= 212 && this.type <= 215)
{
if (Main.rand.Next(8000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 905, pfix: -1);
if (Main.rand.Next(4000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 855, pfix: -1);
if (Main.rand.Next(2000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 854, pfix: -1);
if (Main.rand.Next(2000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2584, pfix: -1);
if (Main.rand.Next(1000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3033, pfix: -1);
if (Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 672, pfix: -1);
if (Main.rand.Next(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1277);
if (Main.rand.Next(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1278);
if (Main.rand.Next(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1279);
if (Main.rand.Next(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1280);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1704);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1705);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1710);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1716);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1720);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2379);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2389);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2405);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2843);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3885);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2663);
if (Main.rand.Next(150) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3904, Main.rand.Next(6, 11) * 5);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3910);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2238);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2133);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2137);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2143);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2147);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2151);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2155);
if (Main.rand.Next(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3263);
if (Main.rand.Next(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3264);
if (Main.rand.Next(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3265);
}
else if (this.type == 216)
{
if (Main.rand.Next(2000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 905, pfix: -1);
if (Main.rand.Next(1000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 855, pfix: -1);
if (Main.rand.Next(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 854, pfix: -1);
if (Main.rand.Next(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2584, pfix: -1);
if (Main.rand.Next(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3033, pfix: -1);
if (Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 672, pfix: -1);
}
else if (this.type == 491)
{
if (Main.rand.Next(400) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 905, pfix: -1);
else if (Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 855, pfix: -1);
else if (Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 854, pfix: -1);
else if (Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2584, pfix: -1);
else if (Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3033, pfix: -1);
else if (Main.rand.Next(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 672, pfix: -1);
}
if ((this.type == 161 || this.type == 431) && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 803 + Main.rand.Next(3));
if (this.type == 217)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1115, pfix: -1);
if (this.type == 218)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1116, pfix: -1);
if (this.type == 219)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1117, pfix: -1);
if (this.type == 220)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1118, pfix: -1);
if (this.type == 221)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1119, pfix: -1);
if (this.type == 167 && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 879, pfix: -1);
if (this.type == 143 || this.type == 144 || this.type == 145)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 593, Main.rand.Next(5, 11));
if (this.type == 79)
{
if (Main.rand.Next(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 527);
}
else if (this.type == 80 && Main.rand.Next(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 528);
if (this.type == 524 && Main.rand.Next(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3794, Main.rand.Next(1, 4));
if (this.type == 525)
{
if (Main.rand.Next(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3794);
if (Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 522, Main.rand.Next(1, 4));
if (Main.rand.Next(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 527);
}
if (this.type == 526)
{
if (Main.rand.Next(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3794);
if (Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1332, Main.rand.Next(1, 4));
if (Main.rand.Next(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 527);
}
if (this.type == 527)
{
if (Main.rand.Next(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3794);
if (Main.rand.Next(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 528);
}
if (this.type == 532)
{
if (Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3380);
if (Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3771);
}
if (this.type == 528)
{
if (Main.rand.Next(25) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2802);
if (Main.rand.Next(60) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3784 + Main.rand.Next(3));
}
else if (this.type == 529)
{
if (Main.rand.Next(25) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2801);
if (Main.rand.Next(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3784 + Main.rand.Next(3));
}
if ((this.type == 49 || this.type == 51 || this.type == 150 || this.type == 93) && Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 18, pfix: -1);
if ((this.type == 16 || this.type == 185 || this.type == 167 || this.type == 197) && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 393, pfix: -1);
if (this.type == 58 && Main.rand.Next(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 393, pfix: -1);
if (this.type >= 494 && this.type <= 506)
{
if (Main.rand.Next(80) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 18, pfix: -1);
else if (Main.rand.Next(80) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 393, pfix: -1);
else if (Main.rand.Next(25) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3285, pfix: -1);
}
if (this.type == 21 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 322 || this.type == 323 || this.type == 324 || this.type >= 449 && this.type <= 452)
{
if (Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 954, pfix: -1);
else if (Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 955, pfix: -1);
else if (Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1166, pfix: -1);
else if (Main.rand.Next(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1274, pfix: -1);
}
else if (this.type == 6)
{
if (Main.rand.Next(175) == 0)
{
switch (Main.rand.Next(3))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 956, pfix: -1);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 957, pfix: -1);
break;
default:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 958, pfix: -1);
break;
}
}
}
else if (this.type == 42 || this.type == 43 || this.type >= 231 && this.type <= 235)
{
if (Main.rand.Next(100) == 0)
{
switch (Main.rand.Next(3))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 960, pfix: -1);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 961, pfix: -1);
break;
default:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 962, pfix: -1);
break;
}
}
}
else if (this.type == 31 || this.type == 32 || this.type == 294 || this.type == 295 || this.type == 296)
{
if (Main.rand.Next(450) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 959, pfix: -1);
if (Main.rand.Next(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1307, pfix: -1);
}
if ((this.type == 174 || this.type == 179 || this.type == 182 || this.type == 183) && Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 996);
if (this.type == 101 || this.type == 98)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 522, Main.rand.Next(2, 6));
if (this.type == 86)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 526);
if (Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 856);
}
if (this.type == 186 || this.type == 432)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 40, Main.rand.Next(1, 10));
if (this.type == 225)
{
if (Main.rand.Next(45) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1243);
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 23, Main.rand.Next(2, 7));
}
if (this.type == 537)
{
int Stack = Main.rand.Next(1, 3);
if (Main.expertMode)
{
if (this.netID == -7)
++Stack;
if (this.netID == -8 || this.netID == -9)
Stack += Main.rand.Next(2);
}
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 23, Stack);
int maxValue6 = 8000;
if (Main.expertMode)
maxValue6 = (int) ((double) maxValue6 * 0.7);
if (Main.rand.Next(maxValue6) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1309, pfix: -1);
}
if (this.type >= 333 && this.type <= 336 && Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1906);
if (this.netID == -4)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3111, Main.rand.Next(25, 51));
int maxValue7 = 100;
if (Main.expertMode)
maxValue7 = (int) ((double) maxValue7 * 0.7);
if (Main.rand.Next(maxValue7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1309, pfix: -1);
}
else if (this.type == 1 || this.type == 16 || this.type == 138 || this.type == 141 || this.type == 147 || this.type == 184 || this.type == 187 || this.type == 204 || this.type == 302 || this.type >= 333 && this.type <= 336 || this.type == 535)
{
int Stack = Main.rand.Next(1, 3);
if (Main.expertMode)
{
if (this.netID == -7)
++Stack;
if (this.netID == -8 || this.netID == -9)
Stack += Main.rand.Next(2);
}
int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 23, Stack);
if (this.netID <= 1 && this.netID != -1 && this.netID != -2 && this.netID != -5 && this.netID != -6)
{
Main.item[number].color = this.color;
NetMessage.SendData(88, number: number, number2: 1f);
}
int maxValue8 = 10000;
if (Main.expertMode)
maxValue8 = (int) ((double) maxValue8 * 0.7);
if (Main.rand.Next(maxValue8) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1309, pfix: -1);
}
if (this.type == 75)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 501, Main.rand.Next(1, 4));
if (this.type == 81 || this.type == 183)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 23, Main.rand.Next(2, 5));
if (this.type == 122)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 23, Main.rand.Next(5, 11));
if (this.type == 71)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 327);
if (this.type == 2 || this.type == 317 || this.type == 318 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194 || this.type == 133)
{
if (Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 38);
else if (Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 236);
}
if (this.type == 104 && Main.rand.Next(60) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 485, pfix: -1);
if (this.type == 58)
{
if (Main.rand.Next(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 263);
else if (Main.rand.Next(30) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 118);
}
if (this.type == 102 && Main.rand.Next(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 263);
if (this.type == 3 || this.type == 331 || this.type == 332 || this.type == 132 || this.type == 161 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223 || this.type == 319 || this.type == 320 || this.type == 321 || this.type >= 430 && this.type <= 436)
{
if (Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 216, pfix: -1);
if (Main.rand.Next(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1304, pfix: -1);
}
if ((this.type == 489 || this.type == 490) && (Main.expertMode || Main.rand.Next(2) == 0))
{
if (Main.rand.Next(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3212, pfix: -1);
if (Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3213, pfix: -1);
}
if (this.type == 223 && Main.rand.Next(20) == 0)
{
if (Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1135, pfix: -1);
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1136, pfix: -1);
}
if (this.type == 66)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 267);
if ((this.type == 62 || this.type == 66) && Main.rand.Next(35) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 272, pfix: -1);
if ((double) this.value > 0.0 && Main.hardMode && (double) this.position.Y / 16.0 < Main.worldSurface + 10.0 && ((double) this.Center.X / 16.0 < 380.0 || (double) this.Center.X / 16.0 > (double) (Main.maxTilesX - 380)) && Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1315);
if (this.type == 52)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 251);
if (this.type == 53)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 239);
if (this.type == 536)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3478);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3479);
}
if (this.type == 54)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 260);
if (this.type == 368)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2222);
if ((this.type == 69 || this.type == 509 || this.type == 508) && Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 323, Main.rand.Next(1, 3));
if (this.type == 508 && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3772);
if (this.type == 73)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 362, Main.rand.Next(1, 3));
if ((this.type == 483 || this.type == 482) && Main.rand.Next(30) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3109);
if ((this.type == 6 || this.type == 94) && Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 68);
if ((this.type == 181 || this.type == 173 || this.type == 239 || this.type == 182 || this.type == 240) && Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1330);
if (this.type == 7 || this.type == 8 || this.type == 9)
{
if (Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 68, Main.rand.Next(1, 3));
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 69, Main.rand.Next(3, 9));
}
if ((this.type == 10 || this.type == 11 || this.type == 12 || this.type == 95 || this.type == 96 || this.type == 97) && (Main.rand.Next(50) == 0 || Main.expertMode && Main.rand.Next(50) == 0))
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 215);
if ((this.type == 47 || this.type == 464) && Main.rand.Next(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 243);
if ((this.type == 168 || this.type == 470) && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, (int) Utils.SelectRandom<short>(Main.rand, (short) 3757, (short) 3758, (short) 3759));
if (this.type == 533)
{
if (Main.rand.Next(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3795);
else if (Main.rand.Next(30) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3770);
}
if (this.type == 551)
{
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
switch (Main.rand.Next(4))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3859, pfix: -1);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3827, pfix: -1);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3870, pfix: -1);
break;
default:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3858, pfix: -1);
break;
}
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3863, pfix: -1);
if (Main.rand.Next(4) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3883, pfix: -1);
}
}
if (this.type == 4)
{
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2112, pfix: -1);
if (Main.rand.Next(40) == 0 || Main.expertMode && Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1299);
if (Main.expertMode)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3097, pfix: -1);
int num3 = 1;
if (Main.expertMode)
num3 = 2;
for (int index7 = 0; index7 < num3; ++index7)
{
if (WorldGen.crimson)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 880, Main.rand.Next(20) + 10);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 880, Main.rand.Next(20) + 10);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 880, Main.rand.Next(20) + 10);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2171, Main.rand.Next(3) + 1);
}
else
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 47, Main.rand.Next(30) + 20);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 56, Main.rand.Next(20) + 10);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 56, Main.rand.Next(20) + 10);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 56, Main.rand.Next(20) + 10);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 59, Main.rand.Next(3) + 1);
}
}
}
}
if (this.type == 266)
{
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 880, Main.rand.Next(20, 46));
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 880, Main.rand.Next(20, 46));
if (Main.expertMode)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 880, Main.rand.Next(30, 51));
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 880, Main.rand.Next(30, 51));
}
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2104, pfix: -1);
if (Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3060);
if (Main.expertMode)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3223);
}
}
if (this.type == 267 && NPC.AnyNPCs(266))
{
int Stack1 = Main.rand.Next(2, 6);
if (Main.rand.Next(3) != 0)
{
if (Main.expertMode)
Stack1 += Main.rand.Next(2, 6);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1329, Stack1);
}
if (Main.rand.Next(3) != 0)
{
int Stack2 = Main.rand.Next(5, 13);
if (Main.expertMode)
Stack2 += Main.rand.Next(6, 14);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 880, Stack2);
}
if (Main.rand.Next(2) == 0 && Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].statLife < Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].statLifeMax2)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
}
if (this.type == 13 || this.type == 14 || this.type == 15)
{
int Stack = Main.rand.Next(1, 3);
if (Main.rand.Next(2) == 0)
{
if (Main.expertMode)
++Stack;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 86, Stack);
}
if (Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 56, Main.rand.Next(2, 6));
if (this.boss)
{
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 56, Main.rand.Next(10, 30));
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 56, Main.rand.Next(10, 31));
if (Main.expertMode)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 56, Main.rand.Next(10, 30));
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 56, Main.rand.Next(10, 31));
}
if (Main.expertMode)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3224);
if (Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 994);
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2111, pfix: -1);
}
}
if (Main.rand.Next(4) == 0 && Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].statLife < Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].statLifeMax2)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
}
if (this.type == 222)
{
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2108, pfix: -1);
int Type3 = Main.rand.Next(3);
switch (Type3)
{
case 0:
Type3 = 1121;
break;
case 1:
Type3 = 1123;
break;
case 2:
Type3 = 2888;
break;
}
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type3, pfix: -1);
if (Main.expertMode)
{
int Type4 = Main.rand.Next(3);
switch (Type4)
{
case 0:
Type4 = 1121;
break;
case 1:
Type4 = 1123;
break;
case 2:
Type4 = 2888;
break;
}
while (Type4 == Type3)
{
Type4 = Main.rand.Next(3);
switch (Type4)
{
case 0:
Type4 = 1121;
continue;
case 1:
Type4 = 1123;
continue;
case 2:
Type4 = 2888;
continue;
default:
continue;
}
}
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type4, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1132, pfix: -1);
}
else if (Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1132, pfix: -1);
if (Main.expertMode && Main.rand.Next(15) == 0 || Main.rand.Next(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1170);
if (Main.expertMode && Main.rand.Next(20) == 0 || Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2502);
if (Main.expertMode)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1129);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(842, 845));
}
else if (Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1129);
else if (Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(842, 845));
if (Main.rand.Next(4) != 0 || Main.expertMode)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1130, Main.rand.Next(10, 30));
if (Main.expertMode)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1130, Main.rand.Next(10, 30));
}
if (Main.expertMode)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2431, Main.rand.Next(44, 67));
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2431, Main.rand.Next(16, 27));
}
NPC.downedQueenBee = true;
if (Main.netMode == 2)
NetMessage.SendData(7);
}
if (this.type == 35)
{
if (Main.expertMode)
this.DropBossBags();
else if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1281, pfix: -1);
else if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1273, pfix: -1);
else if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1313, pfix: -1);
}
if (this.type == 113)
{
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2105, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 367, pfix: -1);
if (Main.expertMode)
{
int num4 = Main.rand.Next(4);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, num4 != 3 ? 489 + num4 : 2998, pfix: -1);
switch (Main.rand.Next(3))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 514, pfix: -1);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 426, pfix: -1);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 434, pfix: -1);
break;
}
}
else if (Main.rand.Next(2) == 0)
{
int num5 = Main.rand.Next(4);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, num5 != 3 ? 489 + num5 : 2998, pfix: -1);
}
else
{
switch (Main.rand.Next(3))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 514, pfix: -1);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 426, pfix: -1);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 434, pfix: -1);
break;
}
}
}
if (Main.netMode != 1)
{
int num6 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
int num7 = (int) ((double) this.position.Y + (double) (this.height / 2)) / 16;
int num8 = this.width / 2 / 16 + 1;
for (int index8 = num6 - num8; index8 <= num6 + num8; ++index8)
{
for (int index9 = num7 - num8; index9 <= num7 + num8; ++index9)
{
if ((index8 == num6 - num8 || index8 == num6 + num8 || index9 == num7 - num8 || index9 == num7 + num8) && !Main.tile[index8, index9].active())
{
Main.tile[index8, index9].type = WorldGen.crimson ? (ushort) 347 : (ushort) 140;
Main.tile[index8, index9].active(true);
}
Main.tile[index8, index9].lava(false);
Main.tile[index8, index9].liquid = (byte) 0;
if (Main.netMode == 2)
NetMessage.SendTileSquare(-1, index8, index9, 1);
else
WorldGen.SquareTileFrame(index8, index9);
}
}
}
}
if (this.type == 439)
{
NPC.downedAncientCultist = true;
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3372, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3549, pfix: -1);
WorldGen.TriggerLunarApocalypse();
}
if (this.type == 398)
{
NPC.downedMoonlord = true;
NPC.LunarApocalypseIsUp = false;
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3373, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3384, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3460, Main.rand.Next(70, 91), pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Utils.SelectRandom<int>(Main.rand, 3063, 3389, 3065, 1553, 3546, 3541, 3570, 3571, 3569), pfix: -1);
}
}
switch (this.type)
{
case 402:
case 405:
case 407:
case 409:
case 411:
if ((this.type != 406 || Main.rand.Next(3) == 0) && NPC.ShieldStrengthTowerStardust > 0)
{
Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 629, 0, 0.0f, Main.myPlayer, (float) NPC.FindFirstNPC(493));
break;
}
break;
case 412:
case 413:
case 414:
case 415:
case 416:
case 417:
case 418:
case 419:
case 518:
if (NPC.ShieldStrengthTowerSolar > 0)
{
Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 629, 0, 0.0f, Main.myPlayer, (float) NPC.FindFirstNPC(517));
break;
}
break;
case 420:
case 421:
case 423:
case 424:
if (NPC.ShieldStrengthTowerNebula > 0)
{
Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 629, 0, 0.0f, Main.myPlayer, (float) NPC.FindFirstNPC(507));
break;
}
break;
case 422:
int num9 = Main.rand.Next(25, 41) / 2;
if (Main.expertMode)
num9 = (int) ((double) num9 * 1.5);
for (int index10 = 0; index10 < num9; ++index10)
Item.NewItem((int) this.position.X + Main.rand.Next(this.width), (int) this.position.Y + Main.rand.Next(this.height), 2, 2, 3456, Main.rand.Next(1, 4));
NPC.downedTowerVortex = true;
NPC.TowerActiveVortex = false;
WorldGen.UpdateLunarApocalypse();
WorldGen.MessageLunarApocalypse();
break;
case 425:
case 426:
case 427:
case 429:
if (NPC.ShieldStrengthTowerVortex > 0)
{
Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 629, 0, 0.0f, Main.myPlayer, (float) NPC.FindFirstNPC(422));
break;
}
break;
case 493:
int num10 = Main.rand.Next(25, 41) / 2;
if (Main.expertMode)
num10 = (int) ((double) num10 * 1.5);
for (int index11 = 0; index11 < num10; ++index11)
Item.NewItem((int) this.position.X + Main.rand.Next(this.width), (int) this.position.Y + Main.rand.Next(this.height), 2, 2, 3459, Main.rand.Next(1, 4));
NPC.downedTowerStardust = true;
NPC.TowerActiveStardust = false;
WorldGen.UpdateLunarApocalypse();
WorldGen.MessageLunarApocalypse();
break;
case 507:
int num11 = Main.rand.Next(25, 41) / 2;
if (Main.expertMode)
num11 = (int) ((double) num11 * 1.5);
for (int index12 = 0; index12 < num11; ++index12)
Item.NewItem((int) this.position.X + Main.rand.Next(this.width), (int) this.position.Y + Main.rand.Next(this.height), 2, 2, 3457, Main.rand.Next(1, 4));
NPC.downedTowerNebula = true;
NPC.TowerActiveNebula = false;
WorldGen.UpdateLunarApocalypse();
WorldGen.MessageLunarApocalypse();
break;
case 517:
int num12 = Main.rand.Next(25, 41) / 2;
if (Main.expertMode)
num12 = (int) ((double) num12 * 1.5);
for (int index13 = 0; index13 < num12; ++index13)
Item.NewItem((int) this.position.X + Main.rand.Next(this.width), (int) this.position.Y + Main.rand.Next(this.height), 2, 2, 3458, Main.rand.Next(1, 4));
NPC.downedTowerSolar = true;
NPC.TowerActiveSolar = false;
WorldGen.UpdateLunarApocalypse();
WorldGen.MessageLunarApocalypse();
break;
}
switch (this.type)
{
case 381:
case 382:
case 383:
case 385:
case 386:
case 389:
case 390:
case 520:
if (Main.rand.Next(8) == 0)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2860, Main.rand.Next(8, 21));
break;
}
break;
}
switch (this.type)
{
case 383:
case 386:
case 389:
if (Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2806);
if (Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2807);
if (Main.rand.Next(200) == 0)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2808);
break;
}
break;
}
switch (this.type)
{
case 381:
case 382:
case 385:
case 390:
if (Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2803);
if (Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2804);
if (Main.rand.Next(200) == 0)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2805);
break;
}
break;
}
if (this.type == 395)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Utils.SelectRandom<int>(Main.rand, 2797, 2749, 2795, 2798, 2796, 2882, 2880, 2769, 2800));
if (this.type == 390 && Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2771);
if ((this.type == 116 || this.type == 117 || this.type == 118 || this.type == 119) && (!Main.expertMode || Main.rand.Next(5) == 0))
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (this.type == 139 && Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (this.type == 63 || this.type == 64 || this.type == 103)
{
if (Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1303, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 282, Main.rand.Next(1, 5));
}
if (this.type == 481 && Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3094, Main.rand.Next(40, 81));
if (this.type == 481 && Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3187 + Main.rand.Next(3));
if (this.type == 21 || this.type == 44 || this.type == 167 || this.type == 201 || this.type == 202 || this.type == 481 || this.type == 203 || this.type == 322 || this.type == 323 || this.type == 324 || this.type >= 449 && this.type <= 452)
{
if (Main.rand.Next(25) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 118);
else if (this.type == 44)
{
if (Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(410, 412));
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 166, Main.rand.Next(1, 4));
}
}
if (this.type == 45)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 238);
if (this.type == 50)
{
if (Main.slimeRain)
{
Main.StopSlimeRain();
AchievementsHelper.NotifyProgressionEvent(16);
}
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
if (Main.rand.Next(4) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2430);
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2493, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(256, 259));
Main.rand.Next(2);
if (Main.rand.Next(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2585);
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2610);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 998);
}
NPC.downedSlimeKing = true;
if (Main.netMode == 2)
NetMessage.SendData(7);
}
if (this.type == 23 && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 116);
if (this.type == 24 && Main.rand.Next(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 244);
if (this.type == 31 || this.type == 32 || this.type == 34)
{
if (Main.rand.Next(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 932);
else if (Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3095);
else if (Main.rand.Next(65) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 327);
else if (!Main.expertMode)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 154, Main.rand.Next(1, 4));
if (Main.expertMode)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 154, Main.rand.Next(2, 7));
}
if (this.type == 26 || this.type == 27 || this.type == 28 || this.type == 29 || this.type == 111)
{
if (Main.rand.Next(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 160);
else if (Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 161, Main.rand.Next(1, 6));
}
if (this.type == 175 && Main.rand.Next(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1265, pfix: -1);
if ((this.type == 42 || this.type >= 231 && this.type <= 235) && (Main.expertMode || Main.rand.Next(3) != 0))
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 209);
if (this.type == 204 && (Main.expertMode || Main.rand.Next(2) == 0))
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 209);
if (this.type == 43 && (Main.expertMode || Main.rand.Next(2) == 0))
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 210);
if (this.type == 65)
{
if (Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 268);
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 319);
}
if (this.type == 48 && Main.rand.Next(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 320);
if (this.type == 541)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3783);
if (this.type == 542 && Main.rand.Next(8) == 0)
{
int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 319);
Main.item[number].color = new Color(189, 148, 96, (int) byte.MaxValue);
NetMessage.SendData(88, number: number, number2: 1f);
}
if (this.type == 543 || this.type == 544)
{
if (Main.rand.Next(25) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 527);
if (Main.rand.Next(8) == 0)
{
int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 319);
Main.item[number].color = this.type != 544 ? new Color(112, 85, 89, (int) byte.MaxValue) : new Color(145, 27, 40, (int) byte.MaxValue);
NetMessage.SendData(88, number: number, number2: 1f);
}
}
if (this.type == 545)
{
if (Main.rand.Next(25) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 528);
if (Main.rand.Next(8) == 0)
{
int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 319);
Main.item[number].color = new Color(158, 113, 164, (int) byte.MaxValue);
NetMessage.SendData(88, number: number, number2: 1f);
}
}
if (this.type == 125 || this.type == 126)
{
int Type = 125;
if (this.type == 125)
Type = 126;
if (!NPC.AnyNPCs(Type))
{
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2106, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 549, Main.rand.Next(25, 41));
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1225, Main.rand.Next(15, 31));
}
}
else
{
this.value = 0.0f;
this.boss = false;
}
}
else if (Main.expertMode)
{
if (this.type == (int) sbyte.MaxValue || this.type == 134)
this.DropBossBags();
}
else if (this.type == (int) sbyte.MaxValue)
{
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2107, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 547, Main.rand.Next(25, 41));
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1225, Main.rand.Next(15, 31));
}
else if (this.type == 134)
{
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2113, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 548, Main.rand.Next(25, 41));
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1225, Main.rand.Next(15, 31));
}
if (this.type == 262)
{
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
if (Main.rand.Next(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2109, pfix: -1);
if (Main.expertMode)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1141, Main.rand.Next(2, 4), pfix: -1);
else
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1141, pfix: -1);
if (Main.rand.Next(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1182, pfix: -1);
if (Main.rand.Next(50) == 0 || Main.expertMode && Main.rand.Next(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1305, pfix: -1);
if (Main.rand.Next(4) == 0 || Main.expertMode)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1157, pfix: -1);
if (Main.rand.Next(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3021, pfix: -1);
int num13 = 1;
if (Main.expertMode)
num13 = 2;
int num14 = 0;
for (int index14 = 0; index14 < num13; ++index14)
{
int num15 = Main.rand.Next(7);
if (!NPC.downedPlantBoss)
num15 = 0;
if (index14 == 0)
{
num14 = num15;
}
else
{
while (num14 == num15)
num15 = Main.rand.Next(7);
}
switch (num15)
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 758, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 771, Main.rand.Next(50, 150));
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1255, pfix: -1);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 788, pfix: -1);
break;
case 3:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1178, pfix: -1);
break;
case 4:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1259, pfix: -1);
break;
case 5:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1155, pfix: -1);
break;
case 6:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3018, pfix: -1);
break;
}
}
}
int num16 = NPC.downedPlantBoss ? 1 : 0;
NPC.downedPlantBoss = true;
if (num16 == 0)
{
switch (Main.netMode)
{
case 0:
Main.NewText(Lang.misc[33].Value, (byte) 50, B: (byte) 130);
break;
case 2:
NetMessage.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[33].Key), new Color(50, (int) byte.MaxValue, 130));
break;
}
}
}
if ((this.boss || this.type == 125 || this.type == 126 || this.type == 491 || this.type == 551 || this.type == 576 || this.type == 577 || this.type == 564 || this.type == 565) && Main.rand.Next(10) == 0)
{
if (this.type == 4)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1360);
if (this.type == 13 || this.type == 14 || this.type == 15)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1361);
if (this.type == 266)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1362);
if (this.type == 35)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1363);
if (this.type == 222)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1364);
if (this.type == 113)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1365);
if (this.type == 134)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1366);
if (this.type == (int) sbyte.MaxValue)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1367);
if (this.type == 125)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1368);
if (this.type == 126)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1369);
if (this.type == 262)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1370);
if (this.type == 245)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1371);
if (this.type == 50)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2489);
if (this.type == 370)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2589);
if (this.type == 439)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3357);
if (this.type == 491)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3359);
if (this.type == 395)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3358);
if (this.type == 398)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3595);
if (this.type == 551)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3866);
if (this.type == 564 || this.type == 565)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3867);
if (this.type == 576 || this.type == 577)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3868);
}
if (this.boss)
{
if (this.type == 4)
NPC.downedBoss1 = true;
else if (this.type == 13 || this.type == 14 || this.type == 15)
NPC.downedBoss2 = true;
else if (this.type == 266)
NPC.downedBoss2 = true;
else if (this.type == 35)
NPC.downedBoss3 = true;
if (this.type == (int) sbyte.MaxValue)
{
NPC.downedMechBoss3 = true;
NPC.downedMechBossAny = true;
}
if (this.type == 134)
{
NPC.downedMechBoss1 = true;
NPC.downedMechBossAny = true;
}
string typeName = this.TypeName;
int Stack = Main.rand.Next(5, 16);
int Type = 28;
if (this.type == 113)
Type = 188;
else if (this.type == 222)
Type = 1134;
else if (this.type > 113 && this.type < 222)
Type = 499;
else if (this.type == 245 || this.type == 262)
Type = 499;
else if (this.type == 370)
Type = 499;
else if (this.type == 395)
Type = 499;
else if (this.type == 439)
Type = 499;
else if (this.type == 398)
Type = 499;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack);
int num17 = Main.rand.Next(5) + 5;
for (int index15 = 0; index15 < num17; ++index15)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (this.type == 125 || this.type == 126)
{
NPC.downedMechBoss2 = true;
NPC.downedMechBossAny = true;
switch (Main.netMode)
{
case 0:
Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Plural", (object) Language.GetTextValue("Enemies.TheTwins")), (byte) 175, (byte) 75);
break;
case 2:
NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Plural", (object) NetworkText.FromKey("Enemies.TheTwins")), new Color(175, 75, (int) byte.MaxValue));
break;
}
}
else if (this.type == 398)
{
switch (Main.netMode)
{
case 0:
Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Single", (object) Language.GetTextValue("Enemies.MoonLord")), (byte) 175, (byte) 75);
break;
case 2:
NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Single", (object) NetworkText.FromKey("Enemies.MoonLord")), new Color(175, 75, (int) byte.MaxValue));
break;
}
}
else
{
switch (Main.netMode)
{
case 0:
Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Single", (object) typeName), (byte) 175, (byte) 75);
break;
case 2:
NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Single", (object) this.GetTypeNetName()), new Color(175, 75, (int) byte.MaxValue));
break;
}
}
if (this.type == 113 && Main.netMode != 1)
{
bool hardMode = Main.hardMode;
WorldGen.StartHardmode();
if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 && !hardMode)
{
if (Main.netMode == 0)
Main.NewText(Lang.misc[32].Value, (byte) 50, B: (byte) 130);
else if (Main.netMode == 2)
NetMessage.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[32].Key), new Color(50, (int) byte.MaxValue, 130));
}
}
if (Main.netMode == 2)
NetMessage.SendData(7);
}
if (!flag1 && NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 && Main.hardMode)
{
switch (Main.netMode)
{
case 0:
Main.NewText(Lang.misc[32].Value, (byte) 50, B: (byte) 130);
break;
case 2:
NetMessage.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[32].Key), new Color(50, (int) byte.MaxValue, 130));
break;
}
}
if (this.type != 16 && this.type != 81 && this.type != 121 && Main.rand.Next(6) == 0 && this.lifeMax > 1 && this.damage > 0)
{
int closest = (int) Player.FindClosest(this.position, this.width, this.height);
if (Main.rand.Next(2) == 0 && Main.player[closest].statMana < Main.player[closest].statManaMax2)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 184);
else if (Main.rand.Next(2) == 0 && Main.player[closest].statLife < Main.player[closest].statLifeMax2)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
}
if (this.type != 16 && this.type != 81 && this.type != 121 && Main.rand.Next(2) == 0 && this.lifeMax > 1 && this.damage > 0)
{
int closest = (int) Player.FindClosest(this.position, this.width, this.height);
if (Main.player[closest].statMana < Main.player[closest].statManaMax2)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 184);
}
float num18 = this.value;
if (this.midas)
num18 *= (float) (1.0 + (double) Main.rand.Next(10, 50) * 0.00999999977648258);
float num19 = num18 * (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258);
if (Main.rand.Next(5) == 0)
num19 *= (float) (1.0 + (double) Main.rand.Next(5, 11) * 0.00999999977648258);
if (Main.rand.Next(10) == 0)
num19 *= (float) (1.0 + (double) Main.rand.Next(10, 21) * 0.00999999977648258);
if (Main.rand.Next(15) == 0)
num19 *= (float) (1.0 + (double) Main.rand.Next(15, 31) * 0.00999999977648258);
if (Main.rand.Next(20) == 0)
num19 *= (float) (1.0 + (double) Main.rand.Next(20, 41) * 0.00999999977648258);
float num20 = num19 + this.extraValue;
while ((int) num20 > 0)
{
if ((double) num20 > 1000000.0)
{
int Stack = (int) ((double) num20 / 1000000.0);
if (Stack > 50 && Main.rand.Next(5) == 0)
Stack /= Main.rand.Next(3) + 1;
if (Main.rand.Next(5) == 0)
Stack /= Main.rand.Next(3) + 1;
num20 -= (float) (1000000 * Stack);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 74, Stack);
}
else if ((double) num20 > 10000.0)
{
int Stack = (int) ((double) num20 / 10000.0);
if (Stack > 50 && Main.rand.Next(5) == 0)
Stack /= Main.rand.Next(3) + 1;
if (Main.rand.Next(5) == 0)
Stack /= Main.rand.Next(3) + 1;
num20 -= (float) (10000 * Stack);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 73, Stack);
}
else if ((double) num20 > 100.0)
{
int Stack = (int) ((double) num20 / 100.0);
if (Stack > 50 && Main.rand.Next(5) == 0)
Stack /= Main.rand.Next(3) + 1;
if (Main.rand.Next(5) == 0)
Stack /= Main.rand.Next(3) + 1;
num20 -= (float) (100 * Stack);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 72, Stack);
}
else
{
int Stack = (int) num20;
if (Stack > 50 && Main.rand.Next(5) == 0)
Stack /= Main.rand.Next(3) + 1;
if (Main.rand.Next(5) == 0)
Stack /= Main.rand.Next(4) + 1;
if (Stack < 1)
Stack = 1;
num20 -= (float) Stack;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 71, Stack);
}
}
}
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(70, number: i, number2: ((float) who));
}
else
{
if (Main.npc[i].catchItem <= (short) 0)
return;
if (Main.npc[i].SpawnedFromStatue)
{
Vector2 position = Main.npc[i].Center - new Vector2(20f);
Utils.PoofOfSmoke(position);
Main.npc[i].active = false;
NetMessage.SendData(23, number: i);
NetMessage.SendData(106, number: ((int) position.X), number2: position.Y);
}
else
{
new Item().SetDefaults((int) Main.npc[i].catchItem);
Item.NewItem((int) Main.player[who].Center.X, (int) Main.player[who].Center.Y, 0, 0, (int) Main.npc[i].catchItem, noGrabDelay: true);
Main.npc[i].active = false;
NetMessage.SendData(23, number: i);
}
}
}
public void DropBossBags()
{
int itemType = -1;
if (this.type == 50)
itemType = 3318;
if (this.type == 4)
itemType = 3319;
if (this.type >= 13 && this.type <= 15)
itemType = 3320;
if (this.type == 266)
itemType = 3321;
if (this.type == 222)
itemType = 3322;
if (this.type == 35)
itemType = 3323;
if (this.type == 113)
itemType = 3324;
if (this.type == 134)
itemType = 3325;
if (this.type == 125 || this.type == 126)
itemType = 3326;
if (this.type == (int) sbyte.MaxValue)
itemType = 3327;
if (this.type == 262)
itemType = 3328;
if (this.type == 245)
itemType = 3329;
if (this.type == 370)
itemType = 3330;
if (this.type == 439)
itemType = 3331;
if (this.type == 398)
itemType = 3332;
if (this.type == 551)
itemType = 3860;
this.DropItemInstanced(this.position, this.Size, itemType);
}
public void DropItemInstanced(
Vector2 Position,
Vector2 HitboxSize,
int itemType,
int itemStack = 1,
bool interactionRequired = true)
{
if (itemType <= 0)
return;
switch (Main.netMode)
{
case 0:
Item.NewItem((int) Position.X, (int) Position.Y, (int) HitboxSize.X, (int) HitboxSize.Y, itemType, itemStack);
break;
case 2:
int number = Item.NewItem((int) Position.X, (int) Position.Y, (int) HitboxSize.X, (int) HitboxSize.Y, itemType, itemStack, true);
Main.itemLockoutTime[number] = 54000;
for (int remoteClient = 0; remoteClient < (int) byte.MaxValue; ++remoteClient)
{
if ((this.playerInteraction[remoteClient] || !interactionRequired) && Main.player[remoteClient].active)
NetMessage.SendData(90, remoteClient, number: number);
}
Main.item[number].active = false;
break;
}
this.value = 0.0f;
}
public void PlayerInteraction(int player)
{
if (this.realLife < 0 ? this.playerInteraction[player] : Main.npc[this.realLife].playerInteraction[player])
return;
if (this.type == 13 || this.type == 14 || this.type == 15)
{
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && (Main.npc[index].type == 13 || Main.npc[index].type == 14 || Main.npc[index].type == 15))
Main.npc[index].ApplyInteraction(player);
}
}
if (this.type == 134 || this.type == 135 || this.type == 136)
{
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && (Main.npc[index].type == 134 || Main.npc[index].type == 135 || Main.npc[index].type == 136))
Main.npc[index].ApplyInteraction(player);
}
}
if (this.type == 35 || this.type == 36)
{
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && (Main.npc[index].type == 35 || Main.npc[index].type == 36))
Main.npc[index].ApplyInteraction(player);
}
}
if (this.type == 113 || this.type == 114)
{
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && (Main.npc[index].type == 113 || Main.npc[index].type == 114))
Main.npc[index].ApplyInteraction(player);
}
}
if (this.type >= (int) sbyte.MaxValue && this.type <= 131)
{
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && Main.npc[index].type >= (int) sbyte.MaxValue && Main.npc[index].type <= 131)
Main.npc[index].ApplyInteraction(player);
}
}
if (this.type >= 245 && this.type <= 249)
{
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && Main.npc[index].type >= 245 && Main.npc[index].type <= 249)
Main.npc[index].ApplyInteraction(player);
}
}
if ((this.type == 396 || this.type == 397) && Main.npc[(int) this.ai[3]].active && Main.npc[(int) this.ai[3]].type == 398)
Main.npc[(int) this.ai[3]].ApplyInteraction(player);
if ((this.type == 393 || this.type == 394) && Main.npc[(int) this.ai[0]].active && Main.npc[(int) this.ai[0]].type == 395)
Main.npc[(int) this.ai[0]].ApplyInteraction(player);
if (this.type == 492 && Main.npc[(int) this.ai[0]].active && Main.npc[(int) this.ai[0]].type == 491)
Main.npc[(int) this.ai[0]].ApplyInteraction(player);
this.ApplyInteraction(player);
}
public void ApplyInteraction(int player)
{
if (this.realLife >= 0)
Main.npc[this.realLife].playerInteraction[player] = true;
else
this.playerInteraction[player] = true;
if (player >= (int) byte.MaxValue)
return;
if (this.realLife >= 0)
Main.npc[this.realLife].lastInteraction = player;
else
this.lastInteraction = player;
}
public static bool CanReleaseNPCs(int who)
{
float num1 = 0.7f;
if (Main.netMode != 1)
num1 += 0.05f;
int num2 = 0;
int num3 = 0;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active)
{
++num3;
if ((int) Main.npc[index].releaseOwner == who)
++num2;
}
}
int num4 = 0;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active)
++num4;
}
int num5 = (int) (200.0 * (double) num1 / (double) num4);
return (double) num3 < 200.0 * (double) num1 && num2 < num5;
}
public static void ReleaseNPC(int x, int y, int Type, int Style, int who)
{
if (Main.netMode == 1)
{
NetMessage.SendData(71, number: x, number2: ((float) y), number3: ((float) Type), number4: ((float) Style));
}
else
{
if (Type < 0 || Type >= 580 || !Main.npcCatchable[Type] || !NPC.CanReleaseNPCs(who))
return;
if (Type == 148)
{
int Type1 = Type + Main.rand.Next(2);
int index = NPC.NewNPC(x, y, Type1);
Main.npc[index].releaseOwner = (short) who;
}
else
{
int index = NPC.NewNPC(x, y, Type);
if (Type == 356)
Main.npc[index].ai[2] = (float) Style;
Main.npc[index].releaseOwner = (short) who;
}
}
}
public static void SlimeRainSpawns(int plr)
{
int checkScreenHeight = Main.LogicCheckScreenHeight;
int checkScreenWidth = Main.LogicCheckScreenWidth;
float num1 = 15f;
Player player = Main.player[plr];
if ((double) player.position.Y > Main.worldSurface * 16.0 + (double) (checkScreenHeight / 2) || (double) player.activeNPCs > (double) num1)
return;
int maxValue1 = 45 + (int) (450.0 * (double) (player.activeNPCs / num1));
if (Main.expertMode)
maxValue1 = (int) ((double) maxValue1 * 0.85);
if (Main.rand.Next(maxValue1) != 0)
return;
int minValue1 = (int) ((double) player.Center.X - (double) checkScreenWidth);
int maxValue2 = minValue1 + checkScreenWidth * 2;
int minValue2 = (int) ((double) player.Center.Y - (double) checkScreenHeight * 1.5);
int maxValue3 = (int) ((double) player.Center.Y - (double) checkScreenHeight * 0.75);
int num2 = Main.rand.Next(minValue1, maxValue2);
int num3 = Main.rand.Next(minValue2, maxValue3);
int index1 = num2 / 16;
int index2 = num3 / 16;
if (index1 < 10 || index1 > Main.maxTilesX + 10 || (double) index2 < Main.worldSurface * 0.3 || (double) index2 > Main.worldSurface || Collision.SolidTiles(index1 - 3, index1 + 3, index2 - 5, index2 + 2) || Main.wallHouse[(int) Main.tile[index1, index2].wall])
return;
int index3 = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 1);
if (Main.rand.Next(200) == 0)
Main.npc[index3].SetDefaults(-4);
else if (Main.expertMode)
{
if (Main.rand.Next(7) == 0)
{
Main.npc[index3].SetDefaults(-7);
}
else
{
if (Main.rand.Next(3) != 0)
return;
Main.npc[index3].SetDefaults(-3);
}
}
else if (Main.rand.Next(10) == 0)
{
Main.npc[index3].SetDefaults(-7);
}
else
{
if (Main.rand.Next(5) >= 2)
return;
Main.npc[index3].SetDefaults(-3);
}
}
public static bool Spawning_SandstoneCheck(int x, int y)
{
if (!WorldGen.InWorld(x, y, 10))
return false;
int num = 0;
for (int index1 = 0; index1 < 8; ++index1)
{
Tile tile1 = Main.tile[x, y + index1];
if (tile1.active() && TileID.Sets.Conversion.Sand[(int) tile1.type])
{
++num;
for (int index2 = 1; index2 <= 4; ++index2)
{
Tile tile2 = Main.tile[x + index2, y + index1];
if (tile2.active() && TileID.Sets.Conversion.Sand[(int) tile2.type])
++num;
else
break;
}
for (int index3 = 1; index3 <= 4; ++index3)
{
Tile tile3 = Main.tile[x - index3, y + index1];
if (tile3.active() && TileID.Sets.Conversion.Sand[(int) tile3.type])
++num;
else
break;
}
}
else
break;
}
return num >= 40;
}
public static void SpawnNPC()
{
if (NPC.noSpawnCycle)
{
NPC.noSpawnCycle = false;
}
else
{
bool flag1 = false;
bool flag2 = false;
int index1 = 0;
int y = 0;
int num1 = 0;
int num2 = 0;
for (int index2 = 0; index2 < (int) byte.MaxValue; ++index2)
{
if (Main.player[index2].active)
++num2;
}
for (int plr = 0; plr < (int) byte.MaxValue; ++plr)
{
if (Main.player[plr].active && !Main.player[plr].dead)
{
if (Main.slimeRain)
NPC.SlimeRainSpawns(plr);
bool flag3 = false;
bool flag4 = false;
bool flag5 = false;
bool flag6 = false;
bool flag7 = false;
bool flag8 = false;
bool flag9 = false;
bool flag10 = false;
bool flag11 = false;
bool flag12 = false;
bool flag13 = NPC.downedPlantBoss && Main.hardMode;
if (Main.player[plr].active && Main.invasionType > 0 && Main.invasionDelay == 0 && Main.invasionSize > 0 && (double) Main.player[plr].position.Y < Main.worldSurface * 16.0 + (double) NPC.sHeight)
{
int num3 = 3000;
if ((double) Main.player[plr].position.X > Main.invasionX * 16.0 - (double) num3 && (double) Main.player[plr].position.X < Main.invasionX * 16.0 + (double) num3)
flag5 = true;
else if (Main.invasionX >= (double) (Main.maxTilesX / 2 - 5) && Main.invasionX <= (double) (Main.maxTilesX / 2 + 5))
{
for (int index3 = 0; index3 < 200; ++index3)
{
if (Main.npc[index3].townNPC && (double) Math.Abs(Main.player[plr].position.X - Main.npc[index3].Center.X) < (double) num3)
{
if (Main.rand.Next(3) == 0)
{
flag5 = true;
break;
}
break;
}
}
}
}
if (Main.player[plr].ZoneTowerSolar || Main.player[plr].ZoneTowerNebula || Main.player[plr].ZoneTowerVortex || Main.player[plr].ZoneTowerStardust)
flag5 = true;
bool flag14 = false;
NPC.spawnRate = NPC.defaultSpawnRate;
NPC.maxSpawns = NPC.defaultMaxSpawns;
if (Main.hardMode)
{
NPC.spawnRate = (int) ((double) NPC.defaultSpawnRate * 0.9);
NPC.maxSpawns = NPC.defaultMaxSpawns + 1;
}
if ((double) Main.player[plr].position.Y > (double) ((Main.maxTilesY - 200) * 16))
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 2.0);
else if ((double) Main.player[plr].position.Y > Main.rockLayer * 16.0 + (double) NPC.sHeight)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.4);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.89999997615814);
}
else if ((double) Main.player[plr].position.Y > Main.worldSurface * 16.0 + (double) NPC.sHeight)
{
if (Main.hardMode)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.45);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.79999995231628);
}
else
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.5);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.70000004768372);
}
}
else if (!Main.dayTime)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.6);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.29999995231628);
if (Main.bloodMoon)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.3);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.79999995231628);
}
if ((Main.pumpkinMoon || Main.snowMoon) && (double) Main.player[plr].position.Y < Main.worldSurface * 16.0)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.2);
NPC.maxSpawns *= 2;
}
}
else if (Main.dayTime && Main.eclipse)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.2);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.89999997615814);
}
if (Main.player[plr].ZoneSnow && (double) Main.player[plr].position.Y / 16.0 < Main.worldSurface)
{
NPC.maxSpawns = (int) ((double) NPC.maxSpawns + (double) NPC.maxSpawns * (double) Main.cloudAlpha);
NPC.spawnRate = (int) ((double) NPC.spawnRate * (1.0 - (double) Main.cloudAlpha + 1.0) / 2.0);
}
if (Main.player[plr].ZoneDungeon)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.4);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.70000004768372);
}
else if (Main.player[plr].ZoneSandstorm)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * (Main.hardMode ? 0.400000005960464 : 0.899999976158142));
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * (Main.hardMode ? 1.5 : 1.20000004768372));
}
else if (Main.player[plr].ZoneUndergroundDesert)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * (Main.hardMode ? 0.200000002980232 : 0.300000011920929));
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 2.0);
}
else if (Main.player[plr].ZoneJungle)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.4);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.5);
}
else if (Main.player[plr].ZoneCorrupt || Main.player[plr].ZoneCrimson)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.65);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.29999995231628);
}
else if (Main.player[plr].ZoneMeteor)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.4);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.10000002384186);
}
if (Main.player[plr].ZoneHoly && (double) Main.player[plr].position.Y > Main.rockLayer * 16.0 + (double) NPC.sHeight)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.65);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.29999995231628);
}
if (Main.wof >= 0 && (double) Main.player[plr].position.Y > (double) ((Main.maxTilesY - 200) * 16))
{
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.300000011920929);
NPC.spawnRate *= 3;
}
if ((double) Main.player[plr].activeNPCs < (double) NPC.maxSpawns * 0.2)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.600000023841858);
else if ((double) Main.player[plr].activeNPCs < (double) NPC.maxSpawns * 0.4)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.699999988079071);
else if ((double) Main.player[plr].activeNPCs < (double) NPC.maxSpawns * 0.6)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.800000011920929);
else if ((double) Main.player[plr].activeNPCs < (double) NPC.maxSpawns * 0.8)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.899999976158142);
if ((double) Main.player[plr].position.Y / 16.0 > (Main.worldSurface + Main.rockLayer) / 2.0 || Main.player[plr].ZoneCorrupt || Main.player[plr].ZoneCrimson)
{
if ((double) Main.player[plr].activeNPCs < (double) NPC.maxSpawns * 0.2)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.699999988079071);
else if ((double) Main.player[plr].activeNPCs < (double) NPC.maxSpawns * 0.4)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.899999976158142);
}
if (Main.player[plr].calmed)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.29999995231628);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.699999988079071);
}
if (Main.player[plr].sunflower)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.20000004768372);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.800000011920929);
}
if (Main.player[plr].enemySpawns)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.5);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 2.0);
}
if (Main.player[plr].ZoneWaterCandle || Main.player[plr].inventory[Main.player[plr].selectedItem].type == 148)
{
if (!Main.player[plr].ZonePeaceCandle && Main.player[plr].inventory[Main.player[plr].selectedItem].type != 3117)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.75);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.5);
}
}
else if (Main.player[plr].ZonePeaceCandle || Main.player[plr].inventory[Main.player[plr].selectedItem].type == 3117)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.3);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.699999988079071);
}
if (Main.player[plr].ZoneWaterCandle && (double) Main.player[plr].position.Y / 16.0 < Main.worldSurface * 0.349999994039536)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.5);
if ((double) NPC.spawnRate < (double) NPC.defaultSpawnRate * 0.1)
NPC.spawnRate = (int) ((double) NPC.defaultSpawnRate * 0.1);
if (NPC.maxSpawns > NPC.defaultMaxSpawns * 3)
NPC.maxSpawns = NPC.defaultMaxSpawns * 3;
if ((Main.pumpkinMoon || Main.snowMoon) && (double) Main.player[plr].position.Y < Main.worldSurface * 16.0)
{
NPC.maxSpawns = (int) ((double) NPC.defaultMaxSpawns * (2.0 + 0.3 * (double) num2));
NPC.spawnRate = 20;
}
if (DD2Event.Ongoing && Main.player[plr].ZoneOldOneArmy)
{
NPC.maxSpawns = NPC.defaultMaxSpawns;
NPC.spawnRate = NPC.defaultSpawnRate;
}
if (flag5)
{
NPC.maxSpawns = (int) ((double) NPC.defaultMaxSpawns * (2.0 + 0.3 * (double) num2));
NPC.spawnRate = 20;
}
if (Main.player[plr].ZoneDungeon && !NPC.downedBoss3)
NPC.spawnRate = 10;
if (!flag5 && (!Main.bloodMoon && !Main.pumpkinMoon && !Main.snowMoon || Main.dayTime) && (!Main.eclipse || !Main.dayTime) && !Main.player[plr].ZoneDungeon && !Main.player[plr].ZoneCorrupt && !Main.player[plr].ZoneCrimson && !Main.player[plr].ZoneMeteor && !Main.player[plr].ZoneOldOneArmy)
{
if ((double) Main.player[plr].Center.Y / 16.0 > (double) (Main.maxTilesY - 200))
{
if ((double) Main.player[plr].townNPCs == 1.0)
{
if (Main.rand.Next(2) == 0)
flag4 = true;
if (Main.rand.Next(10) == 0)
{
flag11 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.5);
}
else
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.25);
}
else if ((double) Main.player[plr].townNPCs == 2.0)
{
if (Main.rand.Next(4) != 0)
flag4 = true;
if (Main.rand.Next(5) == 0)
{
flag11 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.5);
}
else
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.5);
}
else if ((double) Main.player[plr].townNPCs >= 3.0)
{
if (Main.rand.Next(10) != 0)
flag4 = true;
if (Main.rand.Next(3) == 0)
{
flag11 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.5);
}
else
NPC.spawnRate = (int) ((double) NPC.spawnRate * 2.0);
}
}
else if ((double) Main.player[plr].townNPCs == 1.0)
{
flag4 = true;
if (Main.rand.Next(3) == 1)
{
flag11 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6);
}
else
NPC.spawnRate = (int) ((double) NPC.spawnRate * 2.0);
}
else if ((double) Main.player[plr].townNPCs == 2.0)
{
flag4 = true;
if (Main.rand.Next(3) != 0)
{
flag11 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6);
}
else
NPC.spawnRate = (int) ((double) NPC.spawnRate * 3.0);
}
else if ((double) Main.player[plr].townNPCs >= 3.0)
{
flag4 = true;
if (!Main.expertMode || Main.rand.Next(30) != 0)
flag11 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6);
}
}
int index4 = (int) ((double) Main.player[plr].position.X + (double) (Main.player[plr].width / 2)) / 16;
int index5 = (int) ((double) Main.player[plr].position.Y + (double) (Main.player[plr].height / 2)) / 16;
if (Main.wallHouse[(int) Main.tile[index4, index5].wall])
flag4 = true;
if (Main.tile[index4, index5].wall == (byte) 87)
flag3 = true;
bool flag15 = false;
if (Main.player[plr].active && !Main.player[plr].dead && (double) Main.player[plr].activeNPCs < (double) NPC.maxSpawns && Main.rand.Next(NPC.spawnRate) == 0)
{
NPC.spawnRangeX = (int) ((double) (NPC.sWidth / 16) * 0.7);
NPC.spawnRangeY = (int) ((double) (NPC.sHeight / 16) * 0.7);
NPC.safeRangeX = (int) ((double) (NPC.sWidth / 16) * 0.52);
NPC.safeRangeY = (int) ((double) (NPC.sHeight / 16) * 0.52);
if (Main.player[plr].inventory[Main.player[plr].selectedItem].type == 1254 || Main.player[plr].inventory[Main.player[plr].selectedItem].type == 1299 || Main.player[plr].scope)
{
float num4 = 1.5f;
if (Main.player[plr].inventory[Main.player[plr].selectedItem].type == 1254 && Main.player[plr].scope)
num4 = 1.25f;
else if (Main.player[plr].inventory[Main.player[plr].selectedItem].type == 1254)
num4 = 1.5f;
else if (Main.player[plr].inventory[Main.player[plr].selectedItem].type == 1299)
num4 = 1.5f;
else if (Main.player[plr].scope)
num4 = 2f;
NPC.spawnRangeX += (int) ((double) (NPC.sWidth / 16) * 0.5 / (double) num4);
NPC.spawnRangeY += (int) ((double) (NPC.sHeight / 16) * 0.5 / (double) num4);
NPC.safeRangeX += (int) ((double) (NPC.sWidth / 16) * 0.5 / (double) num4);
NPC.safeRangeY += (int) ((double) (NPC.sHeight / 16) * 0.5 / (double) num4);
}
int minValue1 = (int) ((double) Main.player[plr].position.X / 16.0) - NPC.spawnRangeX;
int maxValue1 = (int) ((double) Main.player[plr].position.X / 16.0) + NPC.spawnRangeX;
int minValue2 = (int) ((double) Main.player[plr].position.Y / 16.0) - NPC.spawnRangeY;
int maxValue2 = (int) ((double) Main.player[plr].position.Y / 16.0) + NPC.spawnRangeY;
int num5 = (int) ((double) Main.player[plr].position.X / 16.0) - NPC.safeRangeX;
int num6 = (int) ((double) Main.player[plr].position.X / 16.0) + NPC.safeRangeX;
int num7 = (int) ((double) Main.player[plr].position.Y / 16.0) - NPC.safeRangeY;
int num8 = (int) ((double) Main.player[plr].position.Y / 16.0) + NPC.safeRangeY;
if (minValue1 < 0)
minValue1 = 0;
if (maxValue1 > Main.maxTilesX)
maxValue1 = Main.maxTilesX;
if (minValue2 < 0)
minValue2 = 0;
if (maxValue2 > Main.maxTilesY)
maxValue2 = Main.maxTilesY;
for (int index6 = 0; index6 < 50; ++index6)
{
int index7 = Main.rand.Next(minValue1, maxValue1);
int index8 = Main.rand.Next(minValue2, maxValue2);
if (!Main.tile[index7, index8].nactive() || !Main.tileSolid[(int) Main.tile[index7, index8].type])
{
if (!Main.wallHouse[(int) Main.tile[index7, index8].wall])
{
if (!flag5 && (double) index8 < Main.worldSurface * 0.349999994039536 && !flag11 && ((double) index7 < (double) Main.maxTilesX * 0.45 || (double) index7 > (double) Main.maxTilesX * 0.55 || Main.hardMode))
{
num1 = (int) Main.tile[index7, index8].type;
index1 = index7;
y = index8;
flag14 = true;
flag2 = true;
}
else if (!flag5 && (double) index8 < Main.worldSurface * 0.449999988079071 && !flag11 && Main.hardMode && Main.rand.Next(10) == 0)
{
num1 = (int) Main.tile[index7, index8].type;
index1 = index7;
y = index8;
flag14 = true;
flag2 = true;
}
else
{
for (int index9 = index8; index9 < Main.maxTilesY; ++index9)
{
if (Main.tile[index7, index9].nactive() && Main.tileSolid[(int) Main.tile[index7, index9].type])
{
if (index7 < num5 || index7 > num6 || index9 < num7 || index9 > num8)
{
num1 = (int) Main.tile[index7, index9].type;
index1 = index7;
y = index9;
flag14 = true;
break;
}
break;
}
}
}
if (flag14)
{
int num9 = index1 - NPC.spawnSpaceX / 2;
int num10 = index1 + NPC.spawnSpaceX / 2;
int num11 = y - NPC.spawnSpaceY;
int num12 = y;
if (num9 < 0)
flag14 = false;
if (num10 > Main.maxTilesX)
flag14 = false;
if (num11 < 0)
flag14 = false;
if (num12 > Main.maxTilesY)
flag14 = false;
if (flag14)
{
for (int index10 = num9; index10 < num10; ++index10)
{
for (int index11 = num11; index11 < num12; ++index11)
{
if (Main.tile[index10, index11].nactive() && Main.tileSolid[(int) Main.tile[index10, index11].type])
{
flag14 = false;
break;
}
if (Main.tile[index10, index11].lava())
{
flag14 = false;
break;
}
}
}
}
if (index1 >= num5 && index1 <= num6)
flag15 = true;
}
}
else
continue;
}
if (flag14 || flag14)
break;
}
}
if (flag14)
{
Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle(index1 * 16, y * 16, 16, 16);
for (int index12 = 0; index12 < (int) byte.MaxValue; ++index12)
{
if (Main.player[index12].active)
{
Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.player[index12].position.X + (double) (Main.player[index12].width / 2) - (double) (NPC.sWidth / 2) - (double) NPC.safeRangeX), (int) ((double) Main.player[index12].position.Y + (double) (Main.player[index12].height / 2) - (double) (NPC.sHeight / 2) - (double) NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2);
if (rectangle1.Intersects(rectangle2))
flag14 = false;
}
}
}
if (flag14)
{
if (Main.player[plr].ZoneDungeon && (!Main.tileDungeon[(int) Main.tile[index1, y].type] || Main.tile[index1, y - 1].wall == (byte) 0))
flag14 = false;
if (Main.tile[index1, y - 1].liquid > (byte) 0 && Main.tile[index1, y - 2].liquid > (byte) 0 && !Main.tile[index1, y - 1].lava())
{
if (Main.tile[index1, y - 1].honey())
flag7 = true;
else
flag6 = true;
}
int index13 = (int) Main.player[plr].Center.X / 16;
int index14 = (int) ((double) Main.player[plr].Bottom.Y + 8.0) / 16;
if (Main.tile[index1, y].type == (ushort) 367)
flag9 = true;
else if (Main.tile[index1, y].type == (ushort) 368)
flag8 = true;
else if (Main.tile[index13, index14].type == (ushort) 367)
flag9 = true;
else if (Main.tile[index13, index14].type == (ushort) 368)
{
flag8 = true;
}
else
{
int num13 = Main.rand.Next(20, 31);
int num14 = Main.rand.Next(1, 4);
if (index1 - num13 < 0)
num13 = index1;
if (y - num13 < 0)
num13 = y;
if (index1 + num13 >= Main.maxTilesX)
num13 = Main.maxTilesX - index1 - 1;
if (y + num13 >= Main.maxTilesY)
num13 = Main.maxTilesY - y - 1;
for (int index15 = index1 - num13; index15 <= index1 + num13; index15 += num14)
{
int num15 = Main.rand.Next(1, 4);
for (int index16 = y - num13; index16 <= y + num13; index16 += num15)
{
if (Main.tile[index15, index16].type == (ushort) 367)
flag9 = true;
if (Main.tile[index15, index16].type == (ushort) 368)
flag8 = true;
}
}
int num16 = Main.rand.Next(30, 61);
int num17 = Main.rand.Next(3, 7);
if (index13 - num16 < 0)
num16 = index13;
if (index14 - num16 < 0)
num16 = index14;
if (index13 + num16 >= Main.maxTilesX)
num16 = Main.maxTilesX - index13 - 2;
if (index14 + num16 >= Main.maxTilesY)
num16 = Main.maxTilesY - index14 - 2;
for (int index17 = index13 - num16; index17 <= index13 + num16; index17 += num17)
{
int num18 = Main.rand.Next(3, 7);
for (int index18 = index14 - num16; index18 <= index14 + num16; index18 += num18)
{
if (Main.tile[index17, index18].type == (ushort) 367)
flag9 = true;
if (Main.tile[index17, index18].type == (ushort) 368)
flag8 = true;
}
}
}
}
if (flag7)
flag14 = false;
if (flag14)
{
if ((double) y > Main.rockLayer && y < Main.maxTilesY - 200 && !Main.player[plr].ZoneDungeon && !flag5)
{
if (Main.rand.Next(3) == 0)
{
int num19 = Main.rand.Next(5, 15);
if (index1 - num19 >= 0 && index1 + num19 < Main.maxTilesX)
{
for (int index19 = index1 - num19; index19 < index1 + num19; ++index19)
{
for (int index20 = y - num19; index20 < y + num19; ++index20)
{
if (Main.tile[index19, index20].wall == (byte) 62)
flag10 = true;
}
}
}
}
else
{
int index21 = (int) Main.player[plr].position.X / 16;
int index22 = (int) Main.player[plr].position.Y / 16;
if (Main.tile[index21, index22].wall == (byte) 62)
flag10 = true;
}
}
if ((double) y < Main.rockLayer && y > 200 && !Main.player[plr].ZoneDungeon && !flag5)
{
if (Main.rand.Next(3) == 0)
{
int num20 = Main.rand.Next(5, 15);
if (index1 - num20 >= 0 && index1 + num20 < Main.maxTilesX)
{
for (int index23 = index1 - num20; index23 < index1 + num20; ++index23)
{
for (int index24 = y - num20; index24 < y + num20; ++index24)
{
if (WallID.Sets.Conversion.Sandstone[(int) Main.tile[index23, index24].wall] || WallID.Sets.Conversion.HardenedSand[(int) Main.tile[index23, index24].wall])
flag12 = true;
}
}
}
}
else
{
int index25 = (int) Main.player[plr].position.X / 16;
int index26 = (int) Main.player[plr].position.Y / 16;
if (WallID.Sets.Conversion.Sandstone[(int) Main.tile[index25, index26].wall] || WallID.Sets.Conversion.HardenedSand[(int) Main.tile[index25, index26].wall])
flag12 = true;
}
}
flag1 = false;
int type = (int) Main.tile[index1, y].type;
int newNPC = 200;
if (Main.player[plr].ZoneTowerNebula)
{
bool flag16 = true;
int Type = 0;
while (flag16)
{
Type = Utils.SelectRandom<int>(Main.rand, 424, 424, 424, 423, 423, 423, 421, 421, 421, 421, 421, 420);
flag16 = false;
if (Type == 424 && NPC.CountNPCS(Type) >= 2)
flag16 = true;
if (Type == 423 && NPC.CountNPCS(Type) >= 3)
flag16 = true;
if (Type == 420 && NPC.CountNPCS(Type) >= 2)
flag16 = true;
}
if (Type != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Type, 1);
}
else if (Main.player[plr].ZoneTowerVortex)
{
bool flag17 = true;
int Type = 0;
while (flag17)
{
Type = Utils.SelectRandom<int>(Main.rand, 429, 429, 429, 429, 427, 427, 425, 425, 426);
flag17 = false;
if (Type == 425 && NPC.CountNPCS(Type) >= 3)
flag17 = true;
if (Type == 426 && NPC.CountNPCS(Type) >= 3)
flag17 = true;
if (Type == 429 && NPC.CountNPCS(Type) >= 4)
flag17 = true;
}
if (Type != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Type, 1);
}
else if (Main.player[plr].ZoneTowerStardust)
{
int Type = Utils.SelectRandom<int>(Main.rand, 411, 411, 411, 409, 409, 407, 402, 405);
if (Type != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Type, 1);
}
else if (Main.player[plr].ZoneTowerSolar)
{
bool flag18 = true;
int Type = 0;
while (flag18)
{
Type = Utils.SelectRandom<int>(Main.rand, 518, 419, 418, 412, 417, 416, 415);
flag18 = false;
if (Type == 415 && NPC.CountNPCS(Type) >= 2)
flag18 = true;
if (Type == 416 && NPC.CountNPCS(Type) >= 1)
flag18 = true;
if (Type == 518 && NPC.CountNPCS(Type) >= 2)
flag18 = true;
if (Type == 412 && NPC.CountNPCS(Type) >= 1)
flag18 = true;
}
if (Type != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Type, 1);
}
else if (flag2)
{
int maxValue3 = 8;
int maxValue4 = 30;
bool flag19 = (double) Math.Abs(index1 - Main.maxTilesX / 2) / (double) (Main.maxTilesX / 2) > 0.330000013113022 && (Main.wallLight[(int) Main.tile[index4, index5].wall] || Main.tile[index4, index5].wall == (byte) 73);
if (flag19 && NPC.AnyDanger())
flag19 = false;
if (Main.player[plr].ZoneWaterCandle)
{
maxValue3 = 3;
maxValue4 = 10;
}
if (flag5 && Main.invasionType == 4)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 388);
else if (flag19 && Main.hardMode && NPC.downedGolemBoss && (!NPC.downedMartians && Main.rand.Next(maxValue3) == 0 || Main.rand.Next(maxValue4) == 0) && !NPC.AnyNPCs(399))
NPC.NewNPC(index1 * 16 + 8, y * 16, 399);
else if (flag19 && Main.hardMode && NPC.downedGolemBoss && (!NPC.downedMartians && Main.rand.Next(maxValue3) == 0 || Main.rand.Next(maxValue4) == 0) && !NPC.AnyNPCs(399) && (Main.player[plr].inventory[Main.player[plr].selectedItem].type == 148 || Main.player[plr].ZoneWaterCandle))
NPC.NewNPC(index1 * 16 + 8, y * 16, 399);
else if (Main.hardMode && !NPC.AnyNPCs(87) && !flag4 && Main.rand.Next(10) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 87, 1);
else if (Main.hardMode && !NPC.AnyNPCs(87) && !flag4 && Main.rand.Next(10) == 0 && (Main.player[plr].inventory[Main.player[plr].selectedItem].type == 148 || Main.player[plr].ZoneWaterCandle))
NPC.NewNPC(index1 * 16 + 8, y * 16, 87, 1);
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 48);
}
else if (flag5)
{
switch (Main.invasionType)
{
case 1:
if (Main.hardMode && !NPC.AnyNPCs(471) && Main.rand.Next(30) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 471);
break;
}
if (Main.rand.Next(9) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 29);
break;
}
if (Main.rand.Next(5) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 26);
break;
}
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 111);
break;
}
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 27);
break;
}
NPC.NewNPC(index1 * 16 + 8, y * 16, 28);
break;
case 2:
if (Main.rand.Next(7) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 145);
break;
}
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 143);
break;
}
NPC.NewNPC(index1 * 16 + 8, y * 16, 144);
break;
case 3:
if (Main.invasionSize < Main.invasionSizeStart / 2 && Main.rand.Next(20) == 0 && !NPC.AnyNPCs(491) && !Collision.SolidTiles(index1 - 20, index1 + 20, y - 40, y - 10))
{
NPC.NewNPC(index1 * 16 + 8, (y - 10) * 16, 491);
break;
}
if (Main.rand.Next(30) == 0 && !NPC.AnyNPCs(216))
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 216);
break;
}
if (Main.rand.Next(11) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 215);
break;
}
if (Main.rand.Next(9) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 252);
break;
}
if (Main.rand.Next(7) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 214);
break;
}
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 213);
break;
}
NPC.NewNPC(index1 * 16 + 8, y * 16, 212);
break;
case 4:
int Type1 = 0;
int num21 = Main.rand.Next(7);
if (Main.invasionSize <= 100 && Main.rand.Next(10) == 0 && !NPC.AnyNPCs(395))
Type1 = 395;
else if (num21 >= 6)
{
if (Main.rand.Next(10) == 0 && !NPC.AnyNPCs(395))
{
Type1 = 395;
}
else
{
int num22 = Main.rand.Next(2);
if (num22 == 0)
Type1 = 390;
if (num22 == 1)
Type1 = 386;
}
}
else if (num21 >= 4)
{
int num23 = Main.rand.Next(5);
Type1 = num23 >= 2 ? (num23 >= 4 ? 388 : 381) : 382;
}
else
{
int num24 = Main.rand.Next(4);
if (num24 == 3)
{
if (!NPC.AnyNPCs(520))
Type1 = 520;
else
num24 = Main.rand.Next(3);
}
if (num24 == 0)
Type1 = 385;
if (num24 == 1)
Type1 = 389;
if (num24 == 2)
Type1 = 383;
}
if (Type1 != 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Type1, 1);
break;
}
break;
}
}
else if (!NPC.savedBartender && DD2Event.ReadyToFindBartender && !NPC.AnyNPCs(579) && Main.rand.Next(80) == 0 && !flag6)
NPC.NewNPC(index1 * 16 + 8, y * 16, 579);
else if (Main.tile[index1, y].wall == (byte) 62 | flag10)
{
if (Main.tile[index1, y].wall == (byte) 62 && Main.rand.Next(8) == 0 && !flag6 && (double) y >= Main.rockLayer && y < Main.maxTilesY - 210 && !NPC.savedStylist && !NPC.AnyNPCs(354))
NPC.NewNPC(index1 * 16 + 8, y * 16, 354);
else if (Main.hardMode)
NPC.NewNPC(index1 * 16 + 8, y * 16, 163);
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 164);
}
else if (((WallID.Sets.Conversion.HardenedSand[(int) Main.tile[index1, y].wall] ? 1 : (WallID.Sets.Conversion.Sandstone[(int) Main.tile[index1, y].wall] ? 1 : 0)) | (flag12 ? 1 : 0)) != 0 && WorldGen.checkUnderground(index1, y))
{
if (Main.hardMode && Main.rand.Next(33) == 0 && !flag4 && (double) y > Main.worldSurface + 100.0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 510);
else if (Main.rand.Next(22) == 0 && !flag4 && (double) y > Main.worldSurface + 100.0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 513);
else if (Main.hardMode && Main.rand.Next(5) != 0)
{
List<int> intList = new List<int>();
if (Main.player[plr].ZoneCorrupt)
{
intList.Add(525);
intList.Add(525);
}
if (Main.player[plr].ZoneCrimson)
{
intList.Add(526);
intList.Add(526);
}
if (Main.player[plr].ZoneHoly)
{
intList.Add(527);
intList.Add(527);
}
if (intList.Count == 0)
{
intList.Add(524);
intList.Add(524);
}
if (Main.player[plr].ZoneCorrupt || Main.player[plr].ZoneCrimson)
{
intList.Add(533);
intList.Add(529);
}
else
{
intList.Add(530);
intList.Add(528);
}
intList.Add(532);
int Type2 = Utils.SelectRandom<int>(Main.rand, intList.ToArray());
NPC.NewNPC(index1 * 16 + 8, y * 16, Type2);
intList.Clear();
}
else
{
int Type3 = Utils.SelectRandom<int>(Main.rand, 69, 508, 508, 508, 509);
NPC.NewNPC(index1 * 16 + 8, y * 16, Type3);
}
}
else if (Main.hardMode & flag6 && Main.player[plr].ZoneJungle && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 157);
else if (Main.hardMode & flag6 && Main.player[plr].ZoneCrimson && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 242);
else if (Main.hardMode & flag6 && Main.player[plr].ZoneCrimson && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 241);
else if (flag6 && (index1 < 250 || index1 > Main.maxTilesX - 250) && Main.tileSand[type] && (double) y < Main.rockLayer)
{
bool flag20 = false;
if (!NPC.savedAngler && !NPC.AnyNPCs(376))
{
int num25 = -1;
for (int j = y - 1; j > y - 50; --j)
{
if (Main.tile[index1, j].liquid == (byte) 0 && !WorldGen.SolidTile(index1, j) && !WorldGen.SolidTile(index1, j + 1) && !WorldGen.SolidTile(index1, j + 2))
{
num25 = j + 2;
break;
}
}
if (num25 > y)
num25 = y;
if (num25 > 0 && !flag15)
{
NPC.NewNPC(index1 * 16 + 8, num25 * 16, 376);
flag20 = true;
}
}
if (!flag20)
{
if (Main.rand.Next(60) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 220);
else if (Main.rand.Next(25) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 221);
else if (Main.rand.Next(8) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 65);
else if (Main.rand.Next(3) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 67);
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 64);
}
}
else if (!flag6 && !NPC.savedAngler && !NPC.AnyNPCs(376) && (index1 < 340 || index1 > Main.maxTilesX - 340) && Main.tileSand[type] && (double) y < Main.worldSurface)
NPC.NewNPC(index1 * 16 + 8, y * 16, 376);
else if (flag6 && ((double) y > Main.rockLayer && Main.rand.Next(2) == 0 || type == 60))
{
if (Main.hardMode && Main.rand.Next(3) > 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 102);
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 58);
}
else if (flag6 && (double) y > Main.worldSurface && Main.rand.Next(3) == 0)
{
if (Main.hardMode)
NPC.NewNPC(index1 * 16 + 8, y * 16, 103);
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 63);
}
else if (flag6 && Main.rand.Next(4) == 0)
{
if (Main.player[plr].ZoneCorrupt)
NPC.NewNPC(index1 * 16 + 8, y * 16, 57);
else if ((double) y < Main.worldSurface && y > 50 && Main.rand.Next(3) != 0 && Main.dayTime)
{
int num26 = -1;
for (int j = y - 1; j > y - 50; --j)
{
if (Main.tile[index1, j].liquid == (byte) 0 && !WorldGen.SolidTile(index1, j) && !WorldGen.SolidTile(index1, j + 1) && !WorldGen.SolidTile(index1, j + 2))
{
num26 = j + 2;
break;
}
}
if (num26 > y)
num26 = y;
if (num26 > 0 && !flag15)
{
if (Main.rand.Next(2) == 0)
NPC.NewNPC(index1 * 16 + 8, num26 * 16, 362);
else
NPC.NewNPC(index1 * 16 + 8, num26 * 16, 364);
}
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 55);
}
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 55);
}
else if (NPC.downedGoblins && Main.rand.Next(20) == 0 && !flag6 && (double) y >= Main.rockLayer && y < Main.maxTilesY - 210 && !NPC.savedGoblin && !NPC.AnyNPCs(105))
NPC.NewNPC(index1 * 16 + 8, y * 16, 105);
else if (Main.hardMode && Main.rand.Next(20) == 0 && !flag6 && (double) y >= Main.rockLayer && y < Main.maxTilesY - 210 && !NPC.savedWizard && !NPC.AnyNPCs(106))
NPC.NewNPC(index1 * 16 + 8, y * 16, 106);
else if (flag11)
{
if (flag6)
{
if ((double) y < Main.worldSurface && y > 50 && Main.rand.Next(3) != 0 && Main.dayTime)
{
int num27 = -1;
for (int j = y - 1; j > y - 50; --j)
{
if (Main.tile[index1, j].liquid == (byte) 0 && !WorldGen.SolidTile(index1, j) && !WorldGen.SolidTile(index1, j + 1) && !WorldGen.SolidTile(index1, j + 2))
{
num27 = j + 2;
break;
}
}
if (num27 > y)
num27 = y;
if (num27 > 0 && !flag15)
{
if (Main.rand.Next(2) == 0)
NPC.NewNPC(index1 * 16 + 8, num27 * 16, 362);
else
NPC.NewNPC(index1 * 16 + 8, num27 * 16, 364);
}
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 55);
}
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 55);
}
else
{
switch (type)
{
case 2:
case 109:
if (Main.raining)
{
if (Main.rand.Next(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 448);
break;
}
if (Main.rand.Next(3) != 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 357);
break;
}
NPC.NewNPC(index1 * 16 + 8, y * 16, 230);
break;
}
if (!Main.dayTime && Main.rand.Next(NPC.fireFlyFriendly) == 0 && (double) y <= Main.worldSurface)
{
int Type4 = 355;
if (type == 109)
Type4 = 358;
NPC.NewNPC(index1 * 16 + 8, y * 16, Type4);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8 - 16, y * 16, Type4);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8 + 16, y * 16, Type4);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16 - 16, Type4);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16 + 16, Type4);
break;
}
break;
}
if (Main.dayTime && Main.time < 18000.0 && Main.rand.Next(3) != 0 && (double) y <= Main.worldSurface)
{
int num28 = Main.rand.Next(4);
if (Main.rand.Next(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 442);
break;
}
switch (num28)
{
case 0:
NPC.NewNPC(index1 * 16 + 8, y * 16, 297);
break;
case 1:
NPC.NewNPC(index1 * 16 + 8, y * 16, 298);
break;
default:
NPC.NewNPC(index1 * 16 + 8, y * 16, 74);
break;
}
}
else
{
if (Main.dayTime && Main.rand.Next(NPC.butterflyChance) == 0 && (double) y <= Main.worldSurface)
{
if (Main.rand.Next(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 444);
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 356);
if (Main.rand.Next(4) == 0)
NPC.NewNPC(index1 * 16 + 8 - 16, y * 16, 356);
if (Main.rand.Next(4) == 0)
{
NPC.NewNPC(index1 * 16 + 8 + 16, y * 16, 356);
break;
}
break;
}
if (Main.rand.Next(2) == 0 && (double) y <= Main.worldSurface)
{
int num29 = Main.rand.Next(4);
if (Main.rand.Next(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 442);
break;
}
switch (num29)
{
case 0:
NPC.NewNPC(index1 * 16 + 8, y * 16, 297);
break;
case 1:
NPC.NewNPC(index1 * 16 + 8, y * 16, 298);
break;
default:
NPC.NewNPC(index1 * 16 + 8, y * 16, 74);
break;
}
}
else
{
if (type == 53)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(366, 368));
break;
}
if (Main.rand.Next(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 443);
break;
}
if (Main.rand.Next(NPC.goldCritterChance) == 0 && (double) y <= Main.worldSurface)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 539);
break;
}
if (Main.halloween && Main.rand.Next(3) != 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 303);
break;
}
if (Main.xMas && Main.rand.Next(3) != 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 337);
break;
}
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) != 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 540);
break;
}
if (Main.rand.Next(3) == 0 && (double) y <= Main.worldSurface)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, (int) Utils.SelectRandom<short>(Main.rand, (short) 299, (short) 538));
break;
}
NPC.NewNPC(index1 * 16 + 8, y * 16, 46);
break;
}
}
break;
case 60:
if (Main.rand.Next(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 445);
break;
}
NPC.NewNPC(index1 * 16 + 8, y * 16, 361);
break;
case 147:
case 161:
if (Main.rand.Next(2) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 148);
break;
}
NPC.NewNPC(index1 * 16 + 8, y * 16, 149);
break;
default:
if ((double) y <= Main.worldSurface)
return;
goto case 2;
}
}
}
else if (Main.player[plr].ZoneDungeon)
{
int num30 = 0;
if (Main.tile[index1, y].wall == (byte) 94 || Main.tile[index1, y].wall == (byte) 96 || Main.tile[index1, y].wall == (byte) 98)
num30 = 1;
if (Main.tile[index1, y].wall == (byte) 95 || Main.tile[index1, y].wall == (byte) 97 || Main.tile[index1, y].wall == (byte) 99)
num30 = 2;
if (Main.rand.Next(7) == 0)
num30 = Main.rand.Next(3);
if (!NPC.downedBoss3)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 68);
else if (!NPC.savedMech && Main.rand.Next(5) == 0 && !flag6 && !NPC.AnyNPCs(123) && (double) y > Main.rockLayer)
NPC.NewNPC(index1 * 16 + 8, y * 16, 123);
else if (flag13 && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 287);
else if (flag13 && num30 == 0 && Main.rand.Next(15) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 293);
else if (flag13 && num30 == 1 && Main.rand.Next(15) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 291);
else if (flag13 && num30 == 2 && Main.rand.Next(15) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 292);
else if (flag13 && !NPC.AnyNPCs(290) && num30 == 0 && Main.rand.Next(35) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 290);
else if (flag13 && (num30 == 1 || num30 == 2) && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 289);
else if (flag13 && Main.rand.Next(20) == 0)
{
int num31 = 281;
if (num30 == 0)
num31 += 2;
if (num30 == 2)
num31 += 4;
int Type5 = num31 + Main.rand.Next(2);
if (!NPC.AnyNPCs(Type5))
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Type5);
}
else if (flag13 && Main.rand.Next(3) != 0)
{
int num32 = 269;
if (num30 == 0)
num32 += 4;
if (num30 == 2)
num32 += 8;
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, num32 + Main.rand.Next(4));
}
else if (Main.rand.Next(37) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 71);
else if (num30 == 1 && Main.rand.Next(4) == 0 && !NPC.NearSpikeBall(index1, y))
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 70);
else if (num30 == 2 && Main.rand.Next(15) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 72);
else if (num30 == 0 && Main.rand.Next(9) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 34);
else if (Main.rand.Next(7) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 32);
}
else
{
switch (Main.rand.Next(5))
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 294);
break;
case 1:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 295);
break;
case 2:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 296);
break;
default:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 31);
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-14);
break;
}
if (Main.rand.Next(5) == 0)
{
Main.npc[newNPC].SetDefaults(-13);
break;
}
break;
}
}
}
else if (Main.player[plr].ZoneMeteor)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 23);
else if (DD2Event.Ongoing && Main.player[plr].ZoneOldOneArmy)
DD2Event.SpawnNPC(ref newNPC);
else if ((double) y <= Main.worldSurface && !Main.dayTime && Main.snowMoon)
{
int waveNumber = NPC.waveNumber;
if (Main.rand.Next(30) == 0 && NPC.CountNPCS(341) < 4)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 341);
else if (waveNumber >= 20)
{
switch (Main.rand.Next(3))
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 345);
break;
case 1:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 346);
break;
default:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 344);
break;
}
}
else if (waveNumber >= 19)
newNPC = Main.rand.Next(10) != 0 || NPC.CountNPCS(345) >= 4 ? (Main.rand.Next(10) != 0 || NPC.CountNPCS(346) >= 5 ? (Main.rand.Next(10) != 0 || NPC.CountNPCS(344) >= 7 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 343) : NPC.NewNPC(index1 * 16 + 8, y * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 345);
else if (waveNumber >= 18)
newNPC = Main.rand.Next(10) != 0 || NPC.CountNPCS(345) >= 3 ? (Main.rand.Next(10) != 0 || NPC.CountNPCS(346) >= 4 ? (Main.rand.Next(10) != 0 || NPC.CountNPCS(344) >= 6 ? (Main.rand.Next(3) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 343) : NPC.NewNPC(index1 * 16 + 8, y * 16, 351)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 345);
else if (waveNumber >= 17)
newNPC = Main.rand.Next(10) != 0 || NPC.CountNPCS(345) >= 2 ? (Main.rand.Next(10) != 0 || NPC.CountNPCS(346) >= 3 ? (Main.rand.Next(10) != 0 || NPC.CountNPCS(344) >= 5 ? (Main.rand.Next(4) != 0 ? (Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 343) : NPC.NewNPC(index1 * 16 + 8, y * 16, 351)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 345);
else if (waveNumber >= 16)
newNPC = Main.rand.Next(10) != 0 || NPC.CountNPCS(345) >= 2 ? (Main.rand.Next(10) != 0 || NPC.CountNPCS(346) >= 2 ? (Main.rand.Next(10) != 0 || NPC.CountNPCS(344) >= 4 ? (Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 343) : NPC.NewNPC(index1 * 16 + 8, y * 16, 352)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 345);
else if (waveNumber >= 15)
newNPC = Main.rand.Next(10) != 0 || NPC.AnyNPCs(345) ? (Main.rand.Next(10) != 0 || NPC.CountNPCS(346) >= 2 ? (Main.rand.Next(10) != 0 || NPC.CountNPCS(344) >= 3 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 343) : NPC.NewNPC(index1 * 16 + 8, y * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 345);
else if (waveNumber == 14)
{
if (Main.rand.Next(10) == 0 && !NPC.AnyNPCs(345))
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 345);
else if (Main.rand.Next(10) == 0 && !NPC.AnyNPCs(346))
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 346);
else if (Main.rand.Next(10) == 0 && !NPC.AnyNPCs(344))
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 344);
else if (Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 343);
}
else
newNPC = waveNumber != 13 ? (waveNumber != 12 ? (waveNumber != 11 ? (waveNumber != 10 ? (waveNumber != 9 ? (waveNumber != 8 ? (waveNumber != 7 ? (waveNumber != 6 ? (waveNumber != 5 ? (waveNumber != 4 ? (waveNumber != 3 ? (waveNumber != 2 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 342)) : (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 350))) : (Main.rand.Next(8) != 0 ? (Main.rand.Next(4) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 350)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 348))) : (Main.rand.Next(10) != 0 || NPC.AnyNPCs(344) ? (Main.rand.Next(4) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 350)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 344))) : (Main.rand.Next(10) != 0 || NPC.AnyNPCs(344) ? (Main.rand.Next(4) != 0 ? (Main.rand.Next(8) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 350)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 344))) : (Main.rand.Next(10) != 0 || NPC.CountNPCS(344) >= 2 ? (Main.rand.Next(4) != 0 ? (Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 350) : NPC.NewNPC(index1 * 16 + 8, y * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 344))) : (Main.rand.Next(10) != 0 || NPC.AnyNPCs(346) ? (Main.rand.Next(3) != 0 ? (Main.rand.Next(4) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 350)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 346))) : (Main.rand.Next(10) != 0 || NPC.AnyNPCs(346) ? (Main.rand.Next(8) != 0 ? (Main.rand.Next(3) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 350) : NPC.NewNPC(index1 * 16 + 8, y * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 351)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 346))) : (Main.rand.Next(10) != 0 || NPC.AnyNPCs(346) ? (Main.rand.Next(10) != 0 || NPC.AnyNPCs(344) ? (Main.rand.Next(2) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 342) : NPC.NewNPC(index1 * 16 + 8, y * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 346))) : (Main.rand.Next(10) != 0 || NPC.AnyNPCs(346) ? (Main.rand.Next(10) != 0 || NPC.CountNPCS(344) >= 2 ? (Main.rand.Next(6) != 0 ? (Main.rand.Next(3) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 351)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 346))) : (Main.rand.Next(10) != 0 || NPC.AnyNPCs(345) ? (Main.rand.Next(6) != 0 ? (Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 352)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 345))) : (Main.rand.Next(10) != 0 || NPC.AnyNPCs(345) ? (Main.rand.Next(10) != 0 || NPC.AnyNPCs(344) ? (Main.rand.Next(8) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 343)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 345))) : (Main.rand.Next(10) != 0 || NPC.AnyNPCs(345) ? (Main.rand.Next(10) != 0 || NPC.AnyNPCs(346) ? (Main.rand.Next(3) != 0 ? (Main.rand.Next(6) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 347) : NPC.NewNPC(index1 * 16 + 8, y * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 343)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 352)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 345));
}
else if ((double) y <= Main.worldSurface && !Main.dayTime && Main.pumpkinMoon)
{
int waveNumber = NPC.waveNumber;
int num33;
if (NPC.waveNumber >= 15)
{
newNPC = Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 325) : NPC.NewNPC(index1 * 16 + 8, y * 16, 327);
}
else
{
switch (waveNumber)
{
case 2:
newNPC = Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 326);
break;
case 3:
newNPC = Main.rand.Next(6) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 326)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 329);
break;
case 4:
newNPC = Main.rand.Next(10) != 0 || NPC.AnyNPCs(325) ? (Main.rand.Next(10) != 0 ? (Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 326)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 325);
break;
case 5:
newNPC = Main.rand.Next(10) != 0 || NPC.AnyNPCs(325) ? (Main.rand.Next(8) != 0 ? (Main.rand.Next(5) != 0 ? (Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 326)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 325);
break;
case 6:
newNPC = Main.rand.Next(7) != 0 || NPC.CountNPCS(325) >= 2 ? (Main.rand.Next(6) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 326) : NPC.NewNPC(index1 * 16 + 8, y * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 325);
break;
case 7:
newNPC = Main.rand.Next(10) != 0 || NPC.AnyNPCs(327) ? (Main.rand.Next(8) != 0 ? (Main.rand.Next(5) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 327);
break;
case 8:
newNPC = Main.rand.Next(10) != 0 || NPC.AnyNPCs(327) ? (Main.rand.Next(5) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 326) : NPC.NewNPC(index1 * 16 + 8, y * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 327);
break;
case 9:
newNPC = Main.rand.Next(8) != 0 || NPC.AnyNPCs(327) ? (Main.rand.Next(8) != 0 || NPC.AnyNPCs(325) ? (Main.rand.Next(10) != 0 || NPC.AnyNPCs(315) ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 325)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 327);
break;
case 10:
newNPC = Main.rand.Next(10) != 0 || NPC.AnyNPCs(327) ? (Main.rand.Next(10) != 0 || NPC.AnyNPCs(325) ? (Main.rand.Next(10) != 0 || NPC.AnyNPCs(315) ? (Main.rand.Next(8) != 0 ? (Main.rand.Next(5) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 326) : NPC.NewNPC(index1 * 16 + 8, y * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 325)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 327);
break;
case 11:
if (Main.rand.Next(10) == 0 && !NPC.AnyNPCs(327))
num33 = NPC.NewNPC(index1 * 16 + 8, y * 16, 327);
newNPC = Main.rand.Next(7) != 0 || NPC.CountNPCS(325) >= 2 ? (Main.rand.Next(10) != 0 || NPC.AnyNPCs(315) ? (Main.rand.Next(10) != 0 ? (Main.rand.Next(7) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 326)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 325);
break;
case 12:
if (Main.rand.Next(7) == 0 && NPC.CountNPCS(327) < 2)
num33 = NPC.NewNPC(index1 * 16 + 8, y * 16, 327);
newNPC = Main.rand.Next(7) != 0 || NPC.CountNPCS(325) >= 2 ? (Main.rand.Next(7) != 0 || NPC.CountNPCS(315) >= 2 ? (Main.rand.Next(7) != 0 ? (Main.rand.Next(5) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 326) : NPC.NewNPC(index1 * 16 + 8, y * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 325);
break;
case 13:
if (Main.rand.Next(7) == 0 && NPC.CountNPCS(327) < 2)
num33 = NPC.NewNPC(index1 * 16 + 8, y * 16, 327);
newNPC = Main.rand.Next(5) != 0 || NPC.CountNPCS(325) >= 3 ? (Main.rand.Next(5) != 0 || NPC.CountNPCS(315) >= 3 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 329) : NPC.NewNPC(index1 * 16 + 8, y * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 315)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 325);
break;
case 14:
newNPC = Main.rand.Next(5) != 0 || NPC.CountNPCS(327) >= 3 ? (Main.rand.Next(5) != 0 || NPC.CountNPCS(325) >= 3 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 315) : NPC.NewNPC(index1 * 16 + 8, y * 16, 325)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 327);
break;
default:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(305, 315));
break;
}
}
}
else if ((double) y <= Main.worldSurface && Main.dayTime && Main.eclipse)
{
bool flag21 = false;
if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3)
flag21 = true;
newNPC = !flag21 || Main.rand.Next(80) != 0 || NPC.AnyNPCs(477) ? (Main.rand.Next(50) != 0 || NPC.AnyNPCs(251) ? (!NPC.downedPlantBoss || Main.rand.Next(5) != 0 || NPC.AnyNPCs(466) ? (!NPC.downedPlantBoss || Main.rand.Next(20) != 0 || NPC.AnyNPCs(463) ? (!NPC.downedPlantBoss || Main.rand.Next(20) != 0 || NPC.CountNPCS(467) >= 2 ? (Main.rand.Next(15) != 0 ? (!flag21 || Main.rand.Next(13) != 0 ? (Main.rand.Next(8) != 0 ? (!NPC.downedPlantBoss || Main.rand.Next(7) != 0 ? (!NPC.downedPlantBoss || Main.rand.Next(5) != 0 ? (Main.rand.Next(4) != 0 ? (Main.rand.Next(3) != 0 ? (Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 166) : NPC.NewNPC(index1 * 16 + 8, y * 16, 462)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 461)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 162)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 460)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 468)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 469)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 253)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 159)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 467)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 463)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 466)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 251)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 477);
}
else if (((!Main.hardMode ? 0 : (num1 == 70 ? 1 : 0)) & (flag6 ? 1 : 0)) != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 256);
else if (num1 == 70 && (double) y <= Main.worldSurface && Main.rand.Next(3) != 0)
{
if (!Main.hardMode && Main.rand.Next(6) == 0 || Main.rand.Next(12) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 360);
else if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(4) == 0)
{
if (Main.hardMode && Main.rand.Next(3) != 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 260);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) y;
Main.npc[newNPC].netUpdate = true;
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 259);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) y;
Main.npc[newNPC].netUpdate = true;
}
}
else
newNPC = Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 258) : NPC.NewNPC(index1 * 16 + 8, y * 16, 257);
}
else
newNPC = Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, (int) byte.MaxValue) : NPC.NewNPC(index1 * 16 + 8, y * 16, 254);
}
else if (num1 == 70 && Main.hardMode && (double) y >= Main.worldSurface && Main.rand.Next(3) != 0)
{
if (Main.hardMode && Main.rand.Next(5) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 374);
else if (!Main.hardMode && Main.rand.Next(4) == 0 || Main.rand.Next(8) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 360);
else if (Main.rand.Next(4) == 0)
{
if (Main.hardMode && Main.rand.Next(3) != 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 260);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) y;
Main.npc[newNPC].netUpdate = true;
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 259);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) y;
Main.npc[newNPC].netUpdate = true;
}
}
else
newNPC = Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 258) : NPC.NewNPC(index1 * 16 + 8, y * 16, 257);
}
else if (Main.player[plr].ZoneCorrupt && Main.rand.Next(65) == 0 && !flag4)
newNPC = !Main.hardMode || Main.rand.Next(4) == 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 7, 1) : NPC.NewNPC(index1 * 16 + 8, y * 16, 98, 1);
else if (Main.hardMode && (double) y > Main.worldSurface && Main.rand.Next(75) == 0)
newNPC = Main.rand.Next(2) != 0 || !Main.player[plr].ZoneCorrupt || NPC.AnyNPCs(473) ? (Main.rand.Next(2) != 0 || !Main.player[plr].ZoneCrimson || NPC.AnyNPCs(474) ? (Main.rand.Next(2) != 0 || !Main.player[plr].ZoneHoly || NPC.AnyNPCs(475) ? NPC.NewNPC(index1 * 16 + 8, y * 16, 85) : NPC.NewNPC(index1 * 16 + 8, y * 16, 475)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 474)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 473);
else if (Main.hardMode && Main.tile[index1, y - 1].wall == (byte) 2 && Main.rand.Next(20) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 85);
else if (Main.hardMode && (double) y <= Main.worldSurface && !Main.dayTime && (Main.rand.Next(20) == 0 || Main.rand.Next(5) == 0 && Main.moonPhase == 4))
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 82);
else if (Main.hardMode && Main.halloween && (double) y <= Main.worldSurface && !Main.dayTime && Main.rand.Next(10) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 304);
else if (type == 60 && Main.rand.Next(500) == 0 && !Main.dayTime)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 52);
else if (type == 60 && (double) y > Main.worldSurface && Main.rand.Next(60) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 219);
else if ((double) y > Main.worldSurface && y < Main.maxTilesY - 210 && !Main.player[plr].ZoneSnow && !Main.player[plr].ZoneCrimson && !Main.player[plr].ZoneCorrupt && !Main.player[plr].ZoneJungle && !Main.player[plr].ZoneHoly && Main.rand.Next(8) == 0)
{
if (Main.rand.Next(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 448);
else
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 357);
}
else if ((double) y > Main.worldSurface && y < Main.maxTilesY - 210 && !Main.player[plr].ZoneSnow && !Main.player[plr].ZoneCrimson && !Main.player[plr].ZoneCorrupt && !Main.player[plr].ZoneJungle && !Main.player[plr].ZoneHoly && Main.rand.Next(13) == 0)
{
if (Main.rand.Next(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 447);
else
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 300);
}
else if ((double) y > Main.worldSurface && (double) y < (Main.rockLayer + (double) Main.maxTilesY) / 2.0 && !Main.player[plr].ZoneSnow && !Main.player[plr].ZoneCrimson && !Main.player[plr].ZoneCorrupt && !Main.player[plr].ZoneHoly && Main.rand.Next(13) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 359);
else if ((double) y < Main.worldSurface && Main.player[plr].ZoneJungle && Main.rand.Next(9) == 0)
{
if (Main.rand.Next(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 445);
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 361);
}
else if (type == 60 && Main.hardMode && Main.rand.Next(3) != 0)
{
if ((double) y < Main.worldSurface && !Main.dayTime && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 152);
else if ((double) y < Main.worldSurface && Main.dayTime && Main.rand.Next(4) != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 177);
else if ((double) y > Main.worldSurface && Main.rand.Next(100) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 205);
else if ((double) y > Main.worldSurface && Main.rand.Next(5) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 236);
else if ((double) y > Main.worldSurface && Main.rand.Next(4) != 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 176);
if (Main.rand.Next(10) == 0)
Main.npc[newNPC].SetDefaults(-18);
if (Main.rand.Next(10) == 0)
Main.npc[newNPC].SetDefaults(-19);
if (Main.rand.Next(10) == 0)
Main.npc[newNPC].SetDefaults(-20);
if (Main.rand.Next(10) == 0)
Main.npc[newNPC].SetDefaults(-21);
}
else if (Main.rand.Next(3) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 175);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) y;
Main.npc[newNPC].netUpdate = true;
}
else
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 153);
}
else if (type == 226 & flag3)
newNPC = Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 198) : NPC.NewNPC(index1 * 16 + 8, y * 16, 226);
else if (type == 60 && (double) y > (Main.worldSurface + Main.rockLayer) / 2.0)
{
if (Main.rand.Next(4) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 204);
else if (Main.rand.Next(4) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 43);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) y;
Main.npc[newNPC].netUpdate = true;
}
else
{
switch (Main.rand.Next(8))
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 231);
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-56);
break;
}
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-57);
break;
}
break;
case 1:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 232);
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-58);
break;
}
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-59);
break;
}
break;
case 2:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 233);
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-60);
break;
}
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-61);
break;
}
break;
case 3:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 234);
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-62);
break;
}
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-63);
break;
}
break;
case 4:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 235);
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-64);
break;
}
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-65);
break;
}
break;
default:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 42);
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-16);
break;
}
if (Main.rand.Next(4) == 0)
{
Main.npc[newNPC].SetDefaults(-17);
break;
}
break;
}
}
}
else if (type == 60 && Main.rand.Next(4) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 51);
else if (type == 60 && Main.rand.Next(8) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 56);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) y;
Main.npc[newNPC].netUpdate = true;
}
else if (Sandstorm.Happening && Main.player[plr].ZoneSandstorm && TileID.Sets.Conversion.Sand[type] && NPC.Spawning_SandstoneCheck(index1, y))
{
if (!NPC.downedBoss1 && !Main.hardMode)
newNPC = Main.rand.Next(2) != 0 ? (Main.rand.Next(2) != 0 ? (Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 69) : NPC.NewNPC(index1 * 16 + 8, y * 16, 61)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 508)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 546);
else if (Main.hardMode && Main.rand.Next(20) == 0 && !NPC.AnyNPCs(541))
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 541);
else if (Main.hardMode && !flag4 && Main.rand.Next(3) == 0 && NPC.CountNPCS(510) < 4)
newNPC = NPC.NewNPC(index1 * 16 + 8, (y + 10) * 16, 510);
else if (Main.hardMode && !flag4 && Main.rand.Next(2) == 0)
{
int Type6 = 542;
if (TileID.Sets.Corrupt[type])
Type6 = 543;
if (TileID.Sets.Crimson[type])
Type6 = 544;
if (TileID.Sets.Hallow[type])
Type6 = 545;
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Type6);
}
else
newNPC = !Main.hardMode || type != 53 || Main.rand.Next(3) != 0 ? (!Main.hardMode || type != 112 && type != 234 || Main.rand.Next(3) != 0 ? (!Main.hardMode || type != 116 || Main.rand.Next(3) != 0 ? (Main.rand.Next(2) != 0 ? (Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 509) : NPC.NewNPC(index1 * 16 + 8, y * 16, 508)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 546)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 80)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 79)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 78);
}
else if (Main.hardMode && type == 53 && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 78);
else if (Main.hardMode && (type == 112 || type == 234) && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 79);
else if (Main.hardMode && type == 116 && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 80);
else if (Main.hardMode && !flag6 && (double) y < Main.rockLayer && (type == 116 || type == 117 || type == 109 || type == 164))
newNPC = Main.dayTime || Main.rand.Next(2) != 0 ? (Main.rand.Next(10) == 0 || Main.player[plr].ZoneWaterCandle && Main.rand.Next(10) == 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 86) : NPC.NewNPC(index1 * 16 + 8, y * 16, 75)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 122);
else if (!flag4 && Main.hardMode && Main.rand.Next(50) == 0 && !flag6 && (double) y >= Main.rockLayer && (type == 116 || type == 117 || type == 109 || type == 164))
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 84);
else if (type == 204 && Main.player[plr].ZoneCrimson || type == 199 || type == 200 || type == 203 || type == 234)
{
if (Main.hardMode && (double) y >= Main.rockLayer && Main.rand.Next(5) == 0 && !flag4)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 182);
else if (Main.hardMode && (double) y >= Main.rockLayer && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 268);
else if (Main.hardMode && Main.rand.Next(3) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 183);
if (Main.rand.Next(3) == 0)
Main.npc[newNPC].SetDefaults(-24);
else if (Main.rand.Next(3) == 0)
Main.npc[newNPC].SetDefaults(-25);
}
else if (Main.hardMode && (double) y >= Main.rockLayer && Main.rand.Next(40) == 0 && !flag4)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 179);
else if (Main.hardMode && (Main.rand.Next(2) == 0 || (double) y > Main.worldSurface))
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 174);
else if (Main.tile[index1, y].wall > (byte) 0 && Main.rand.Next(4) != 0 || Main.rand.Next(8) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 239);
else if (Main.rand.Next(2) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 181);
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 173);
if (Main.rand.Next(3) == 0)
Main.npc[newNPC].SetDefaults(-22);
else if (Main.rand.Next(3) == 0)
Main.npc[newNPC].SetDefaults(-23);
}
}
else if (type == 22 && Main.player[plr].ZoneCorrupt || type == 23 || type == 25 || type == 112 || type == 163)
{
if (Main.hardMode && (double) y >= Main.rockLayer && Main.rand.Next(3) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 101);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) y;
Main.npc[newNPC].netUpdate = true;
}
else if (Main.hardMode && Main.rand.Next(3) == 0)
newNPC = Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 81) : NPC.NewNPC(index1 * 16 + 8, y * 16, 121);
else if (Main.hardMode && (double) y >= Main.rockLayer && Main.rand.Next(40) == 0 && !flag4)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 83);
else if (Main.hardMode && (Main.rand.Next(2) == 0 || (double) y > Main.rockLayer))
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 94);
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 6);
if (Main.rand.Next(3) == 0)
Main.npc[newNPC].SetDefaults(-11);
else if (Main.rand.Next(3) == 0)
Main.npc[newNPC].SetDefaults(-12);
}
}
else if ((double) y <= Main.worldSurface)
{
bool flag22 = (double) Math.Abs(index1 - Main.maxTilesX / 2) / (double) (Main.maxTilesX / 2) > 0.330000013113022;
if (flag22 && NPC.AnyDanger())
flag22 = false;
if (Main.player[plr].ZoneSnow && Main.hardMode && (double) Main.cloudAlpha > 0.0 && !NPC.AnyNPCs(243) && Main.rand.Next(20) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 243);
else if (Main.player[plr].ZoneHoly && Main.hardMode && (double) Main.cloudAlpha > 0.0 && !NPC.AnyNPCs(244) && Main.rand.Next(20) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 244);
else if (!Main.player[plr].ZoneSnow && Main.hardMode && (double) Main.cloudAlpha > 0.0 && NPC.CountNPCS(250) < 2 && Main.rand.Next(10) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 250);
else if (flag22 && Main.hardMode && NPC.downedGolemBoss && (!NPC.downedMartians && Main.rand.Next(100) == 0 || Main.rand.Next(400) == 0) && !NPC.AnyNPCs(399))
NPC.NewNPC(index1 * 16 + 8, y * 16, 399);
else if (Main.dayTime)
{
int num34 = Math.Abs(index1 - Main.spawnTileX);
if (num34 < Main.maxTilesX / 3 && Main.rand.Next(15) == 0 && (type == 2 || type == 109 || type == 147 || type == 161))
{
if (type == 147 || type == 161)
{
if (Main.rand.Next(2) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 148);
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 149);
}
else if (Main.dayTime && Main.rand.Next(NPC.butterflyChance) == 0 && (double) y <= Main.worldSurface)
{
if (Main.rand.Next(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 444);
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 356);
if (Main.rand.Next(4) == 0)
NPC.NewNPC(index1 * 16 + 8 - 16, y * 16, 356);
if (Main.rand.Next(4) == 0)
NPC.NewNPC(index1 * 16 + 8 + 16, y * 16, 356);
}
else if (Main.rand.Next(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 443);
else if (Main.rand.Next(NPC.goldCritterChance) == 0 && (double) y <= Main.worldSurface)
NPC.NewNPC(index1 * 16 + 8, y * 16, 539);
else if (Main.halloween && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 303);
else if (Main.xMas && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 337);
else if (BirthdayParty.PartyIsUp && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, y * 16, 540);
else if (Main.rand.Next(3) == 0 && (double) y <= Main.worldSurface)
NPC.NewNPC(index1 * 16 + 8, y * 16, (int) Utils.SelectRandom<short>(Main.rand, (short) 299, (short) 538));
else
NPC.NewNPC(index1 * 16 + 8, y * 16, 46);
}
else if (num34 < Main.maxTilesX / 3 && Main.rand.Next(15) == 0 && type == 53)
NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(366, 368));
else if (num34 < Main.maxTilesX / 3 && Main.dayTime && Main.time < 18000.0 && (type == 2 || type == 109) && Main.rand.Next(4) == 0 && (double) y <= Main.worldSurface && NPC.CountNPCS(74) + NPC.CountNPCS(297) + NPC.CountNPCS(298) < 6)
{
int num35 = Main.rand.Next(4);
if (Main.rand.Next(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 442);
}
else
{
switch (num35)
{
case 0:
NPC.NewNPC(index1 * 16 + 8, y * 16, 297);
break;
case 1:
NPC.NewNPC(index1 * 16 + 8, y * 16, 298);
break;
default:
NPC.NewNPC(index1 * 16 + 8, y * 16, 74);
break;
}
}
}
else if (num34 < Main.maxTilesX / 3 && Main.rand.Next(15) == 0 && (type == 2 || type == 109 || type == 147))
{
int num36 = Main.rand.Next(4);
if (Main.rand.Next(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, y * 16, 442);
}
else
{
switch (num36)
{
case 0:
NPC.NewNPC(index1 * 16 + 8, y * 16, 297);
break;
case 1:
NPC.NewNPC(index1 * 16 + 8, y * 16, 298);
break;
default:
NPC.NewNPC(index1 * 16 + 8, y * 16, 74);
break;
}
}
}
else if (num34 > Main.maxTilesX / 3 && type == 2 && Main.rand.Next(300) == 0 && !NPC.AnyNPCs(50))
NPC.SpawnOnPlayer(plr, 50);
else if (type == 53 && Main.rand.Next(5) == 0 && NPC.Spawning_SandstoneCheck(index1, y) && !flag6)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 69);
else if (type == 53 && Main.rand.Next(3) == 0 && !flag6)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 537);
else if (type == 53 && !flag6)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 61);
else if (num34 > Main.maxTilesX / 3 && (Main.rand.Next(15) == 0 || !NPC.downedGoblins && WorldGen.shadowOrbSmashed && Main.rand.Next(7) == 0))
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 73);
else if (Main.raining && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 224);
else if (Main.raining && Main.rand.Next(2) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 225);
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 1);
switch (type)
{
case 60:
Main.npc[newNPC].SetDefaults(-10);
break;
case 147:
case 161:
Main.npc[newNPC].SetDefaults(147);
break;
default:
if (Main.halloween && Main.rand.Next(3) != 0)
{
Main.npc[newNPC].SetDefaults(302);
break;
}
if (Main.xMas && Main.rand.Next(3) != 0)
{
Main.npc[newNPC].SetDefaults(Main.rand.Next(333, 337));
break;
}
if (Main.rand.Next(3) == 0 || num34 < 200 && !Main.expertMode)
{
Main.npc[newNPC].SetDefaults(-3);
break;
}
if (Main.rand.Next(10) == 0 && (num34 > 400 || Main.expertMode))
{
Main.npc[newNPC].SetDefaults(-7);
break;
}
break;
}
}
}
else if ((num1 == 2 || num1 == 109) && Main.rand.Next(NPC.fireFlyChance) == 0 && (double) y <= Main.worldSurface)
{
int Type7 = 355;
if (type == 109)
Type7 = 358;
NPC.NewNPC(index1 * 16 + 8, y * 16, Type7);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8 - 16, y * 16, Type7);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8 + 16, y * 16, Type7);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16 - 16, Type7);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8, y * 16 + 16, Type7);
}
else if (Main.rand.Next(10) == 0 && Main.halloween)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 301);
else if (Main.rand.Next(6) == 0 || Main.moonPhase == 4 && Main.rand.Next(2) == 0)
{
if (Main.hardMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 133);
else if (Main.halloween && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(317, 319));
else if (Main.rand.Next(2) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 2);
if (Main.rand.Next(4) == 0)
Main.npc[newNPC].SetDefaults(-43);
}
else
{
switch (Main.rand.Next(5))
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 190);
if (Main.rand.Next(3) == 0)
{
Main.npc[newNPC].SetDefaults(-38);
break;
}
break;
case 1:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 191);
if (Main.rand.Next(3) == 0)
{
Main.npc[newNPC].SetDefaults(-39);
break;
}
break;
case 2:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 192);
if (Main.rand.Next(3) == 0)
{
Main.npc[newNPC].SetDefaults(-40);
break;
}
break;
case 3:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 193);
if (Main.rand.Next(3) == 0)
{
Main.npc[newNPC].SetDefaults(-41);
break;
}
break;
case 4:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 194);
if (Main.rand.Next(3) == 0)
{
Main.npc[newNPC].SetDefaults(-42);
break;
}
break;
}
}
}
else if (Main.hardMode && Main.rand.Next(50) == 0 && Main.bloodMoon && !NPC.AnyNPCs(109))
NPC.NewNPC(index1 * 16 + 8, y * 16, 109);
else if (Main.rand.Next(250) == 0 && Main.bloodMoon)
NPC.NewNPC(index1 * 16 + 8, y * 16, 53);
else if (Main.rand.Next(250) == 0 && Main.bloodMoon)
NPC.NewNPC(index1 * 16 + 8, y * 16, 536);
else if (Main.moonPhase == 0 && Main.hardMode && Main.rand.Next(3) != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 104);
else if (Main.hardMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 140);
else if (Main.bloodMoon && Main.rand.Next(5) < 2)
newNPC = Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 490) : NPC.NewNPC(index1 * 16 + 8, y * 16, 489);
else if (num1 == 147 || num1 == 161 || num1 == 163 || num1 == 164 || num1 == 162)
newNPC = !Main.hardMode || Main.rand.Next(4) != 0 ? (!Main.hardMode || Main.rand.Next(3) != 0 ? (!Main.expertMode || Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 161) : NPC.NewNPC(index1 * 16 + 8, y * 16, 431)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 155)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 169);
else if (Main.raining && Main.rand.Next(2) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 223);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
Main.npc[newNPC].SetDefaults(-54);
else
Main.npc[newNPC].SetDefaults(-55);
}
}
else
{
int num37 = Main.rand.Next(7);
if (Main.halloween && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(319, 322));
else if (Main.xMas && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(331, 333));
else if (num37 == 0 && Main.expertMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 430);
else if (num37 == 2 && Main.expertMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 432);
else if (num37 == 3 && Main.expertMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 433);
else if (num37 == 4 && Main.expertMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 434);
else if (num37 == 5 && Main.expertMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 435);
else if (num37 == 6 && Main.expertMode && Main.rand.Next(3) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 436);
}
else
{
switch (num37)
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 3);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[newNPC].SetDefaults(-26);
break;
}
Main.npc[newNPC].SetDefaults(-27);
break;
}
break;
case 1:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 132);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[newNPC].SetDefaults(-28);
break;
}
Main.npc[newNPC].SetDefaults(-29);
break;
}
break;
case 2:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 186);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[newNPC].SetDefaults(-30);
break;
}
Main.npc[newNPC].SetDefaults(-31);
break;
}
break;
case 3:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 187);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[newNPC].SetDefaults(-32);
break;
}
Main.npc[newNPC].SetDefaults(-33);
break;
}
break;
case 4:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 188);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[newNPC].SetDefaults(-34);
break;
}
Main.npc[newNPC].SetDefaults(-35);
break;
}
break;
case 5:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 189);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[newNPC].SetDefaults(-36);
break;
}
Main.npc[newNPC].SetDefaults(-37);
break;
}
break;
case 6:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 200);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[newNPC].SetDefaults(-44);
break;
}
Main.npc[newNPC].SetDefaults(-45);
break;
}
break;
}
}
}
}
else if ((double) y <= Main.rockLayer)
{
if (!flag4 && Main.rand.Next(50) == 0 && !Main.player[plr].ZoneSnow)
newNPC = !Main.hardMode ? (!Main.player[plr].ZoneSnow ? NPC.NewNPC(index1 * 16 + 8, y * 16, 10, 1) : NPC.NewNPC(index1 * 16 + 8, y * 16, 185)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 95, 1);
else if (Main.hardMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 140);
else if (Main.hardMode && Main.rand.Next(4) != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 141);
else if (type == 147 || type == 161 || Main.player[plr].ZoneSnow)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 147);
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 1);
if (Main.rand.Next(5) == 0)
Main.npc[newNPC].SetDefaults(-9);
else if (Main.rand.Next(2) == 0)
Main.npc[newNPC].SetDefaults(1);
else
Main.npc[newNPC].SetDefaults(-8);
}
}
else if (y > Main.maxTilesY - 190)
newNPC = !Main.hardMode || NPC.savedTaxCollector || Main.rand.Next(20) != 0 || NPC.AnyNPCs(534) ? (Main.rand.Next(40) != 0 || NPC.AnyNPCs(39) ? (Main.rand.Next(14) != 0 ? (Main.rand.Next(7) != 0 ? (Main.rand.Next(3) != 0 ? (!Main.hardMode || !NPC.downedMechBossAny || Main.rand.Next(5) == 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 60) : NPC.NewNPC(index1 * 16 + 8, y * 16, 151)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 59)) : (Main.rand.Next(7) != 0 ? (!Main.hardMode || !NPC.downedMechBossAny || Main.rand.Next(5) == 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 62) : NPC.NewNPC(index1 * 16 + 8, y * 16, 156)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 66))) : NPC.NewNPC(index1 * 16 + 8, y * 16, 24)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 39, 1)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 534);
else if (Main.rand.Next(60) == 0)
newNPC = !Main.player[plr].ZoneSnow ? NPC.NewNPC(index1 * 16 + 8, y * 16, 217) : NPC.NewNPC(index1 * 16 + 8, y * 16, 218);
else if ((type == 116 || type == 117 || type == 164) && Main.hardMode && !flag4 && Main.rand.Next(8) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 120);
else if ((num1 == 147 || num1 == 161 || num1 == 162 || num1 == 163 || num1 == 164) && !flag4 && Main.hardMode && Main.player[plr].ZoneCorrupt && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 170);
else if ((num1 == 147 || num1 == 161 || num1 == 162 || num1 == 163 || num1 == 164) && !flag4 && Main.hardMode && Main.player[plr].ZoneHoly && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 171);
else if ((num1 == 147 || num1 == 161 || num1 == 162 || num1 == 163 || num1 == 164) && !flag4 && Main.hardMode && Main.player[plr].ZoneCrimson && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 180);
else if (Main.hardMode && Main.player[plr].ZoneSnow && Main.rand.Next(10) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 154);
else if (!flag4 && Main.rand.Next(100) == 0 && !Main.player[plr].ZoneHoly)
newNPC = !Main.hardMode ? (!Main.player[plr].ZoneSnow ? NPC.NewNPC(index1 * 16 + 8, y * 16, 10, 1) : NPC.NewNPC(index1 * 16 + 8, y * 16, 185)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 95, 1);
else if (Main.player[plr].ZoneSnow && Main.rand.Next(20) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 185);
else if (!Main.hardMode && Main.rand.Next(10) == 0)
{
if (Main.player[plr].ZoneSnow)
Main.npc[newNPC].SetDefaults(184);
else
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 16);
}
else if (!Main.hardMode && Main.rand.Next(4) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 1);
if (Main.player[plr].ZoneJungle)
Main.npc[newNPC].SetDefaults(-10);
else if (Main.player[plr].ZoneSnow)
Main.npc[newNPC].SetDefaults(184);
else
Main.npc[newNPC].SetDefaults(-6);
}
else if (Main.rand.Next(2) == 0)
{
if (Main.rand.Next(35) == 0 && NPC.CountNPCS(453) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 453);
else if (!Main.hardMode && Main.rand.Next(80) == 0 || Main.rand.Next(200) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 195);
else if (Main.hardMode && (double) y > (Main.rockLayer + (double) Main.maxTilesY) / 2.0 && Main.rand.Next(300) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 172);
else if ((double) y > (Main.rockLayer + (double) Main.maxTilesY) / 2.0 && (Main.rand.Next(200) == 0 || Main.rand.Next(50) == 0 && Main.player[plr].armor[1].type >= 1282 && Main.player[plr].armor[1].type <= 1287 && Main.player[plr].armor[0].type != 238))
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 45);
else if (flag9 && Main.rand.Next(4) != 0)
newNPC = Main.rand.Next(6) == 0 || NPC.AnyNPCs(480) || !Main.hardMode ? NPC.NewNPC(index1 * 16 + 8, y * 16, 481) : NPC.NewNPC(index1 * 16 + 8, y * 16, 480);
else if (flag8 && Main.rand.Next(5) != 0)
newNPC = Main.rand.Next(6) == 0 || NPC.AnyNPCs(483) ? NPC.NewNPC(index1 * 16 + 8, y * 16, 482) : NPC.NewNPC(index1 * 16 + 8, y * 16, 483);
else if (Main.hardMode && Main.rand.Next(10) != 0)
{
if (Main.rand.Next(2) == 0)
{
if (Main.player[plr].ZoneSnow)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 197);
else if (Main.halloween && Main.rand.Next(5) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 316);
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 77);
if ((double) y > (Main.rockLayer + (double) Main.maxTilesY) / 2.0 && Main.rand.Next(5) == 0)
Main.npc[newNPC].SetDefaults(-15);
}
}
else
newNPC = !Main.player[plr].ZoneSnow ? NPC.NewNPC(index1 * 16 + 8, y * 16, 110) : NPC.NewNPC(index1 * 16 + 8, y * 16, 206);
}
else if (Main.rand.Next(20) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 44);
else if (num1 == 147 || num1 == 161 || num1 == 162)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 167);
else if (Main.player[plr].ZoneSnow)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 185);
else if (Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, NPC.cavernMonsterType[Main.rand.Next(2), Main.rand.Next(3)]);
else if (Main.halloween && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, Main.rand.Next(322, 325));
else if (Main.expertMode && Main.rand.Next(3) == 0)
{
int num38 = Main.rand.Next(4);
newNPC = num38 != 0 ? (num38 != 0 ? (num38 != 0 ? NPC.NewNPC(index1 * 16 + 8, y * 16, 452) : NPC.NewNPC(index1 * 16 + 8, y * 16, 451)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 450)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 449);
}
else
{
switch (Main.rand.Next(4))
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 21);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[newNPC].SetDefaults(-47);
break;
}
Main.npc[newNPC].SetDefaults(-46);
break;
}
break;
case 1:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 201);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[newNPC].SetDefaults(-49);
break;
}
Main.npc[newNPC].SetDefaults(-48);
break;
}
break;
case 2:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 202);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[newNPC].SetDefaults(-51);
break;
}
Main.npc[newNPC].SetDefaults(-50);
break;
}
break;
case 3:
newNPC = NPC.NewNPC(index1 * 16 + 8, y * 16, 203);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[newNPC].SetDefaults(-53);
break;
}
Main.npc[newNPC].SetDefaults(-52);
break;
}
break;
}
}
}
else
newNPC = !Main.hardMode || !(Main.player[plr].ZoneHoly & Main.rand.Next(2) == 0) ? (!Main.player[plr].ZoneJungle ? (!Main.hardMode || !Main.player[plr].ZoneHoly ? (!Main.hardMode || Main.rand.Next(6) <= 0 ? (num1 == 147 || num1 == 161 || num1 == 162 ? (!Main.hardMode ? NPC.NewNPC(index1 * 16 + 8, y * 16, 150) : NPC.NewNPC(index1 * 16 + 8, y * 16, 169)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 49)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 93)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 137)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 51)) : NPC.NewNPC(index1 * 16 + 8, y * 16, 138);
if (Main.npc[newNPC].type == 1 && Main.rand.Next(180) == 0)
Main.npc[newNPC].SetDefaults(-4);
if (Main.netMode != 2 || newNPC >= 200)
break;
NetMessage.SendData(23, number: newNPC);
break;
}
}
}
}
}
public static bool AnyDanger()
{
bool flag = false;
if (NPC.MoonLordCountdown > 0)
flag = true;
if (Main.invasionType > 0)
flag = true;
if (!flag)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && (Main.npc[index].boss || NPCID.Sets.TechnicallyABoss[Main.npc[index].type]))
flag = true;
}
}
return flag;
}
public static bool AnyoneNearCultists()
{
int firstNpc = NPC.FindFirstNPC(437);
if (firstNpc == -1)
return false;
Microsoft.Xna.Framework.Rectangle rectangle = Utils.CenteredRectangle(Main.npc[firstNpc].Center, new Vector2(2500f, 1500f));
Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, 0, 2500, 1500);
Vector2 vector2 = r.Size() / 2f;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active)
{
r.X = (int) Main.player[index].Center.X - (int) vector2.X;
r.Y = (int) Main.player[index].Center.Y - (int) vector2.Y;
if (rectangle.Intersects(r))
return true;
}
}
return false;
}
public static void SpawnWOF(Vector2 pos)
{
if ((double) pos.Y / 16.0 < (double) (Main.maxTilesY - 205) || Main.wof >= 0 || Main.netMode == 1)
return;
int closest = (int) Player.FindClosest(pos, 16, 16);
int num1 = 1;
if ((double) pos.X / 16.0 > (double) (Main.maxTilesX / 2))
num1 = -1;
bool flag = false;
int x = (int) pos.X;
while (!flag)
{
flag = true;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && (double) Main.player[index].position.X > (double) (x - 1200) && (double) Main.player[index].position.X < (double) (x + 1200))
{
x -= num1 * 16;
flag = false;
}
}
if (x / 16 < 20 || x / 16 > Main.maxTilesX - 20)
flag = true;
}
int y = (int) pos.Y;
int i = x / 16;
int num2 = y / 16;
int num3 = 0;
while (true)
{
try
{
if (!WorldGen.SolidTile(i, num2 - num3) && Main.tile[i, num2 - num3].liquid < (byte) 100)
{
num2 -= num3;
break;
}
if (!WorldGen.SolidTile(i, num2 + num3) && Main.tile[i, num2 + num3].liquid < (byte) 100)
{
num2 += num3;
break;
}
++num3;
}
catch
{
break;
}
}
if (num2 < Main.maxTilesY - 180)
num2 = Main.maxTilesY - 180;
int Y = num2 * 16;
int index1 = NPC.NewNPC(x, Y, 113);
if (Main.netMode == 0)
{
Main.NewText(Language.GetTextValue("Announcement.HasAwoken", (object) Main.npc[index1].TypeName), (byte) 175, (byte) 75);
}
else
{
if (Main.netMode != 2)
return;
NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", (object) Main.npc[index1].GetTypeNetName()), new Color(175, 75, (int) byte.MaxValue));
}
}
public static void SpawnSkeletron()
{
bool flag1 = true;
bool flag2 = false;
Vector2 vector2 = Vector2.Zero;
int num1 = 0;
int num2 = 0;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 35)
{
flag1 = false;
break;
}
}
for (int number = 0; number < 200; ++number)
{
if (Main.npc[number].active)
{
if (Main.npc[number].type == 37)
{
flag2 = true;
Main.npc[number].ai[3] = 1f;
vector2 = Main.npc[number].position;
num1 = Main.npc[number].width;
num2 = Main.npc[number].height;
if (Main.netMode == 2)
NetMessage.SendData(23, number: number);
}
else if (Main.npc[number].type == 54)
{
flag2 = true;
vector2 = Main.npc[number].position;
num1 = Main.npc[number].width;
num2 = Main.npc[number].height;
}
}
}
if (!(flag1 & flag2))
return;
int index1 = NPC.NewNPC((int) vector2.X + num1 / 2, (int) vector2.Y + num2 / 2, 35);
Main.npc[index1].netUpdate = true;
string npcNameValue = Lang.GetNPCNameValue(35);
if (Main.netMode == 0)
{
Main.NewText(Language.GetTextValue("Announcement.HasAwoken", (object) npcNameValue), (byte) 175, (byte) 75);
}
else
{
if (Main.netMode != 2)
return;
NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", (object) Lang.GetNPCName(35).ToNetworkText()), new Color(175, 75, (int) byte.MaxValue));
}
}
public static void SpawnOnPlayer(int plr, int Type)
{
if (Main.netMode == 1 || Type == 262 && NPC.AnyNPCs(262))
return;
switch (Type)
{
case 245:
if (NPC.AnyNPCs(245))
break;
try
{
int num1 = (int) Main.player[plr].Center.X / 16;
int num2 = (int) Main.player[plr].Center.Y / 16;
int i = 0;
int num3 = 0;
for (int index1 = num1 - 20; index1 < num1 + 20; ++index1)
{
for (int index2 = num2 - 20; index2 < num2 + 20; ++index2)
{
if (Main.tile[index1, index2].active() && Main.tile[index1, index2].type == (ushort) 237 && Main.tile[index1, index2].frameX == (short) 18 && Main.tile[index1, index2].frameY == (short) 0)
{
i = index1;
num3 = index2;
}
}
}
if (i <= 0 || num3 <= 0)
break;
int num4 = num3 - 15;
int num5 = num3 - 15;
for (int j = num3; j > num3 - 100; --j)
{
if (WorldGen.SolidTile(i, j))
{
num4 = j;
break;
}
}
for (int j = num3; j < num3 + 100; ++j)
{
if (WorldGen.SolidTile(i, j))
{
num5 = j;
break;
}
}
int num6 = (num4 + num4 + num5) / 3;
int index = NPC.NewNPC(i * 16 + 8, num6 * 16, 245, 100);
Main.npc[index].target = plr;
string typeName = Main.npc[index].TypeName;
if (Main.netMode == 0)
{
Main.NewText(Language.GetTextValue("Announcement.HasAwoken", (object) typeName), (byte) 175, (byte) 75);
break;
}
if (Main.netMode != 2)
break;
NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", (object) Main.npc[index].GetTypeNetName()), new Color(175, 75, (int) byte.MaxValue));
break;
}
catch
{
break;
}
case 370:
Player player1 = Main.player[plr];
if (!player1.active || player1.dead)
break;
for (int index3 = 0; index3 < 1000; ++index3)
{
Projectile projectile = Main.projectile[index3];
if (projectile.active && projectile.bobber && projectile.owner == plr)
{
int index4 = NPC.NewNPC((int) projectile.Center.X, (int) projectile.Center.Y + 100, 370);
string typeName = Main.npc[index4].TypeName;
if (Main.netMode == 0)
{
Main.NewText(Language.GetTextValue("Announcement.HasAwoken", (object) typeName), (byte) 175, (byte) 75);
break;
}
if (Main.netMode != 2)
break;
NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", (object) Main.npc[index4].GetTypeNetName()), new Color(175, 75, (int) byte.MaxValue));
break;
}
}
break;
case 398:
if (NPC.AnyNPCs(Type))
break;
Player player2 = Main.player[plr];
NPC.NewNPC((int) player2.Center.X, (int) player2.Center.Y - 150, Type);
if (Main.netMode == 0)
{
Main.NewText(Language.GetTextValue("Announcement.HasAwoken", (object) Language.GetTextValue("Enemies.MoonLord")), (byte) 175, (byte) 75);
break;
}
if (Main.netMode != 2)
break;
NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", (object) NetworkText.FromKey("Enemies.MoonLord")), new Color(175, 75, (int) byte.MaxValue));
break;
default:
bool flag = false;
int num7 = 0;
int num8 = 0;
int minValue1 = (int) ((double) Main.player[plr].position.X / 16.0) - NPC.spawnRangeX * 2;
int maxValue1 = (int) ((double) Main.player[plr].position.X / 16.0) + NPC.spawnRangeX * 2;
int minValue2 = (int) ((double) Main.player[plr].position.Y / 16.0) - NPC.spawnRangeY * 2;
int maxValue2 = (int) ((double) Main.player[plr].position.Y / 16.0) + NPC.spawnRangeY * 2;
int num9 = (int) ((double) Main.player[plr].position.X / 16.0) - NPC.safeRangeX;
int num10 = (int) ((double) Main.player[plr].position.X / 16.0) + NPC.safeRangeX;
int num11 = (int) ((double) Main.player[plr].position.Y / 16.0) - NPC.safeRangeY;
int num12 = (int) ((double) Main.player[plr].position.Y / 16.0) + NPC.safeRangeY;
if (minValue1 < 0)
minValue1 = 0;
if (maxValue1 > Main.maxTilesX)
maxValue1 = Main.maxTilesX;
if (minValue2 < 0)
minValue2 = 0;
if (maxValue2 > Main.maxTilesY)
maxValue2 = Main.maxTilesY;
for (int index5 = 0; index5 < 1000; ++index5)
{
for (int index6 = 0; index6 < 100; ++index6)
{
int index7 = Main.rand.Next(minValue1, maxValue1);
int index8 = Main.rand.Next(minValue2, maxValue2);
if (!Main.tile[index7, index8].nactive() || !Main.tileSolid[(int) Main.tile[index7, index8].type])
{
if ((!Main.wallHouse[(int) Main.tile[index7, index8].wall] || index5 >= 999) && (Type != 50 || index5 >= 500 || Main.tile[index8, index8].wall <= (byte) 0))
{
for (int index9 = index8; index9 < Main.maxTilesY; ++index9)
{
if (Main.tile[index7, index9].nactive() && Main.tileSolid[(int) Main.tile[index7, index9].type])
{
if (index7 < num9 || index7 > num10 || index9 < num11 || index9 > num12 || index5 == 999)
{
int type = (int) Main.tile[index7, index9].type;
num7 = index7;
num8 = index9;
flag = true;
break;
}
break;
}
}
if (flag && Type == 50 && index5 < 900)
{
int num13 = 20;
if (!Collision.CanHit(new Vector2((float) num7, (float) (num8 - 1)) * 16f, 16, 16, new Vector2((float) num7, (float) (num8 - 1 - num13)) * 16f, 16, 16) || !Collision.CanHit(new Vector2((float) num7, (float) (num8 - 1 - num13)) * 16f, 16, 16, Main.player[plr].Center, 0, 0))
{
num7 = 0;
num8 = 0;
flag = false;
}
}
if (flag && index5 < 999)
{
int num14 = num7 - NPC.spawnSpaceX / 2;
int num15 = num7 + NPC.spawnSpaceX / 2;
int num16 = num8 - NPC.spawnSpaceY;
int num17 = num8;
if (num14 < 0)
flag = false;
if (num15 > Main.maxTilesX)
flag = false;
if (num16 < 0)
flag = false;
if (num17 > Main.maxTilesY)
flag = false;
if (flag)
{
for (int index10 = num14; index10 < num15; ++index10)
{
for (int index11 = num16; index11 < num17; ++index11)
{
if (Main.tile[index10, index11].nactive() && Main.tileSolid[(int) Main.tile[index10, index11].type])
{
flag = false;
break;
}
}
}
}
}
}
else
continue;
}
if (flag || flag)
break;
}
if (flag && index5 < 999)
{
Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle(num7 * 16, num8 * 16, 16, 16);
for (int index12 = 0; index12 < (int) byte.MaxValue; ++index12)
{
if (Main.player[index12].active)
{
Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.player[index12].position.X + (double) (Main.player[index12].width / 2) - (double) (NPC.sWidth / 2) - (double) NPC.safeRangeX), (int) ((double) Main.player[index12].position.Y + (double) (Main.player[index12].height / 2) - (double) (NPC.sHeight / 2) - (double) NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2);
if (rectangle1.Intersects(rectangle2))
flag = false;
}
}
}
if (flag)
break;
}
if (!flag)
break;
int number = NPC.NewNPC(num7 * 16 + 8, num8 * 16, Type, 1);
if (number == 200)
break;
Main.npc[number].target = plr;
Main.npc[number].timeLeft *= 20;
string typeName1 = Main.npc[number].TypeName;
if (Main.netMode == 2 && number < 200)
NetMessage.SendData(23, number: number);
if (Type == 134 || Type == (int) sbyte.MaxValue || Type == 126 || Type == 125)
AchievementsHelper.CheckMechaMayhem();
if (Type == 125)
{
if (Main.netMode == 0)
{
Main.NewText(Lang.misc[48].Value, (byte) 175, (byte) 75);
break;
}
if (Main.netMode != 2)
break;
NetMessage.BroadcastChatMessage(Lang.misc[48].ToNetworkText(), new Color(175, 75, (int) byte.MaxValue));
break;
}
if (Type == 82 || Type == 126 || Type == 50 || Type == 398 || Type == 551)
break;
if (Main.netMode == 0)
{
Main.NewText(Language.GetTextValue("Announcement.HasAwoken", (object) typeName1), (byte) 175, (byte) 75);
break;
}
if (Main.netMode != 2)
break;
NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", (object) Main.npc[number].GetTypeNetName()), new Color(175, 75, (int) byte.MaxValue));
break;
}
}
public static int NewNPC(
int X,
int Y,
int Type,
int Start = 0,
float ai0 = 0.0f,
float ai1 = 0.0f,
float ai2 = 0.0f,
float ai3 = 0.0f,
int Target = 255)
{
int index1 = -1;
if (Type == 222)
{
for (int index2 = 199; index2 >= 0; --index2)
{
if (!Main.npc[index2].active)
{
index1 = index2;
break;
}
}
}
else
{
for (int index3 = Start; index3 < 200; ++index3)
{
if (!Main.npc[index3].active)
{
index1 = index3;
break;
}
}
}
if (index1 < 0)
return 200;
Main.npc[index1] = new NPC();
Main.npc[index1].SetDefaults(Type);
if (NPC.TypeToHeadIndex(Type) != -1 || Type == 453)
Main.npc[index1].GivenName = NPC.getNewNPCName(Type);
Main.npc[index1].position.X = (float) (X - Main.npc[index1].width / 2);
Main.npc[index1].position.Y = (float) (Y - Main.npc[index1].height);
Main.npc[index1].active = true;
Main.npc[index1].timeLeft = (int) ((double) NPC.activeTime * 1.25);
Main.npc[index1].wet = Collision.WetCollision(Main.npc[index1].position, Main.npc[index1].width, Main.npc[index1].height);
Main.npc[index1].ai[0] = ai0;
Main.npc[index1].ai[1] = ai1;
Main.npc[index1].ai[2] = ai2;
Main.npc[index1].ai[3] = ai3;
Main.npc[index1].target = Target;
if (Type == 50)
{
switch (Main.netMode)
{
case 0:
Main.NewText(Language.GetTextValue("Announcement.HasAwoken", (object) Main.npc[index1].TypeName), (byte) 175, (byte) 75);
break;
case 2:
NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", (object) Main.npc[index1].GetTypeNetName()), new Color(175, 75, (int) byte.MaxValue));
break;
}
}
return index1;
}
public void TransformVisuals(int oldType, int newType)
{
if (oldType == 158 && newType == 159 || oldType == 159 && newType == 158)
{
Main.PlaySound(SoundID.Item8, this.position);
int index1 = Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), this.velocity, 99, this.scale);
Main.gore[index1].velocity *= 0.3f;
int index2 = Gore.NewGore(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) (this.height / 2) - 10.0)), this.velocity, 99, this.scale);
Main.gore[index2].velocity *= 0.3f;
int index3 = Gore.NewGore(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 10.0)), this.velocity, 99, this.scale);
Main.gore[index3].velocity *= 0.3f;
}
else if (oldType == 478 && newType == 479)
{
for (int index4 = 0; index4 < 30; ++index4)
{
int index5 = Dust.NewDust(this.position, this.width, this.height, 238, SpeedY: -2f);
if (Main.rand.Next(2) == 0)
Main.dust[index5].noGravity = true;
}
Gore.NewGore(this.position, this.velocity, 684, this.scale);
Gore.NewGore(this.position, this.velocity, 685, this.scale);
Gore.NewGore(this.position, this.velocity, 686, this.scale);
Gore.NewGore(this.position, this.velocity, 684 + Main.rand.Next(3), this.scale);
}
else if (oldType == 406 && newType == 405)
{
float num1 = (float) Main.rand.Next(10, 21);
float num2 = 6.283185f * Main.rand.NextFloat();
Vector2 vector2_1 = new Vector2(22f, 22f);
for (float num3 = 0.0f; (double) num3 < (double) num1; ++num3)
{
Dust dust = Main.dust[Dust.NewDust(this.Center, 0, 0, 229)];
Vector2 vector2_2 = Vector2.UnitY.RotatedBy((double) num3 * 6.28318548202515 / (double) num1 + (double) num2);
dust.position = this.Center + vector2_2 * vector2_1 / 2f;
dust.velocity = vector2_2;
dust.noGravity = true;
dust.scale = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 1.79999995231628);
dust.velocity *= dust.scale;
dust.fadeIn = Main.rand.NextFloat() * 2f;
}
}
if (oldType == 428 && newType == 427)
{
for (int index = 0; index < 20; ++index)
{
int Type = Utils.SelectRandom<int>(Main.rand, 229, 240);
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type)];
dust.noGravity = true;
dust.scale = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 1.79999995231628);
dust.fadeIn = 0.25f;
dust.velocity *= dust.scale / 2f;
}
}
if (oldType != 427 || newType != 426)
return;
for (int index = 0; index < 30; ++index)
{
int Type = Utils.SelectRandom<int>(Main.rand, 229, 240, 240);
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type)];
dust.noGravity = true;
dust.scale = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 1.79999995231628);
dust.fadeIn = 0.25f;
dust.velocity *= dust.scale * 0.75f;
}
}
public void Teleport(Vector2 newPos, int Style = 0, int extraInfo = 0)
{
int extraInfo1 = 0;
if (Style == 4)
extraInfo1 = this.lastPortalColorIndex;
float dustCountMult = (double) this.teleportTime > 0.0 ? 0.3f : 1f;
Main.TeleportEffect(this.getRect(), Style, extraInfo1, dustCountMult);
this.position = newPos;
if (Style == 4)
{
this.lastPortalColorIndex = extraInfo;
extraInfo1 = this.lastPortalColorIndex;
}
Main.TeleportEffect(this.getRect(), Style, extraInfo1, dustCountMult);
this.teleportTime = 1f;
this.teleportStyle = Style;
if (Main.netMode != 2 || Style == 4)
return;
NetMessage.SendData(65, number: 1, number2: ((float) this.whoAmI), number3: newPos.X, number4: newPos.Y, number5: Style);
}
public void Transform(int newType)
{
if (Main.netMode == 1)
return;
bool flag = false;
if ((double) this.value == 0.0)
flag = true;
int[] numArray1 = new int[5];
int[] numArray2 = new int[5];
for (int index = 0; index < 5; ++index)
{
numArray1[index] = this.buffType[index];
numArray2[index] = this.buffTime[index];
}
int height = this.height;
int type = this.type;
int life = this.life;
int lifeMax = this.lifeMax;
Vector2 velocity = this.velocity;
this.position.Y += (float) this.height;
int spriteDirection = this.spriteDirection;
bool spawnedFromStatue = this.SpawnedFromStatue;
this.SetDefaults(newType);
this.SpawnedFromStatue = spawnedFromStatue;
this.spriteDirection = spriteDirection;
this.TargetClosest();
this.velocity = velocity;
this.position.Y -= (float) this.height;
if (flag)
this.value = 0.0f;
if (this.lifeMax == lifeMax)
this.life = life;
if (newType == 107 || newType == 108)
{
this.homeTileX = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
this.homeTileY = (int) ((double) this.position.Y + (double) this.height) / 16;
this.homeless = true;
}
for (int index = 0; index < 5; ++index)
{
this.buffType[index] = numArray1[index];
this.buffTime[index] = numArray2[index];
}
if (Main.netMode == 2)
{
this.netUpdate = true;
NetMessage.SendData(23, number: this.whoAmI);
NetMessage.SendData(54, number: this.whoAmI);
}
this.TransformVisuals(type, newType);
if (NPC.TypeToHeadIndex(this.type) != -1)
Main.npc[this.whoAmI].GivenName = NPC.getNewNPCName(this.type);
this.npcNameLookup = (byte) 0;
if (this.townNPC)
this.homeless = true;
this.altTexture = 0;
}
public int checkArmorPenetration(int armorPenetration)
{
if (armorPenetration <= 0)
return 0;
return armorPenetration > this.defense && this.defense >= 0 ? this.defense / 2 : armorPenetration / 2;
}
public double StrikeNPCNoInteraction(
int Damage,
float knockBack,
int hitDirection,
bool crit = false,
bool noEffect = false,
bool fromNet = false)
{
if (Main.netMode == 0)
++NPC.ignorePlayerInteractions;
return this.StrikeNPC(Damage, knockBack, hitDirection, crit, noEffect, fromNet);
}
public double StrikeNPC(
int Damage,
float knockBack,
int hitDirection,
bool crit = false,
bool noEffect = false,
bool fromNet = false)
{
bool flag = Main.netMode == 0;
if (flag && NPC.ignorePlayerInteractions > 0)
{
--NPC.ignorePlayerInteractions;
flag = false;
}
if (!this.active || this.life <= 0)
return 0.0;
double num1 = (double) Damage;
int Defense = this.defense;
if (this.ichor)
Defense -= 20;
if (this.betsysCurse)
Defense -= 40;
if (Defense < 0)
Defense = 0;
double dmg = Main.CalculateDamage((int) num1, Defense);
if (crit)
dmg *= 2.0;
if ((double) this.takenDamageMultiplier > 1.0)
dmg *= (double) this.takenDamageMultiplier;
if (((double) this.takenDamageMultiplier > 1.0 || Damage != 9999) && this.lifeMax > 1)
{
if (this.friendly)
{
CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), crit ? CombatText.DamagedFriendlyCrit : CombatText.DamagedFriendly, (int) dmg, crit);
}
else
{
Color color = crit ? CombatText.DamagedHostileCrit : CombatText.DamagedHostile;
if (fromNet)
color = crit ? CombatText.OthersDamagedHostileCrit : CombatText.OthersDamagedHostile;
CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), color, (int) dmg, crit);
}
}
if (dmg < 1.0)
return 0.0;
if (flag)
this.PlayerInteraction(Main.myPlayer);
this.justHit = true;
if (this.townNPC)
{
if ((this.aiStyle != 7 ? 0 : ((double) this.ai[0] == 3.0 || (double) this.ai[0] == 4.0 || (double) this.ai[0] == 16.0 ? 1 : ((double) this.ai[0] == 17.0 ? 1 : 0))) != 0)
{
NPC npc = Main.npc[(int) this.ai[2]];
if (npc.active)
{
npc.ai[0] = 1f;
npc.ai[1] = (float) (300 + Main.rand.Next(300));
npc.ai[2] = 0.0f;
npc.localAI[3] = 0.0f;
npc.direction = hitDirection;
npc.netUpdate = true;
}
}
this.ai[0] = 1f;
this.ai[1] = (float) (300 + Main.rand.Next(300));
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.direction = hitDirection;
this.netUpdate = true;
}
if (this.aiStyle == 8 && Main.netMode != 1)
{
if (this.type == 172)
this.ai[0] = 450f;
else if (this.type == 283 || this.type == 284)
{
if (Main.rand.Next(2) == 0)
{
this.ai[0] = 390f;
this.netUpdate = true;
}
}
else if (this.type == 533)
{
if (Main.rand.Next(3) != 0)
{
this.ai[0] = 181f;
this.netUpdate = true;
}
}
else
this.ai[0] = 400f;
this.TargetClosest();
}
if (this.aiStyle == 97 && Main.netMode != 1)
{
this.localAI[1] = 1f;
this.TargetClosest();
}
if (this.type == 371)
{
dmg = 0.0;
this.ai[0] = 1f;
this.ai[1] = 4f;
this.dontTakeDamage = true;
}
if (this.type == 346 && (double) this.life >= (double) this.lifeMax * 0.5 && (double) this.life - dmg < (double) this.lifeMax * 0.5)
Gore.NewGore(this.position, this.velocity, 517);
if (this.type == 184)
this.localAI[0] = 60f;
if (this.type == 535)
this.localAI[0] = 60f;
if (this.type == 185)
this.localAI[0] = 1f;
if (!this.immortal)
{
if (this.realLife >= 0)
{
Main.npc[this.realLife].life -= (int) dmg;
this.life = Main.npc[this.realLife].life;
this.lifeMax = Main.npc[this.realLife].lifeMax;
}
else
this.life -= (int) dmg;
}
if ((double) knockBack > 0.0 && (double) this.knockBackResist > 0.0)
{
float num2 = knockBack * this.knockBackResist;
if ((double) num2 > 8.0)
num2 = 8f + (num2 - 8f) * 0.9f;
if ((double) num2 > 10.0)
num2 = 10f + (num2 - 10f) * 0.8f;
if ((double) num2 > 12.0)
num2 = 12f + (num2 - 12f) * 0.7f;
if ((double) num2 > 14.0)
num2 = 14f + (num2 - 14f) * 0.6f;
if ((double) num2 > 16.0)
num2 = 16f;
if (crit)
num2 *= 1.4f;
int num3 = (int) dmg * 10;
if (Main.expertMode)
num3 = (int) dmg * 15;
if (num3 > this.lifeMax)
{
if (hitDirection < 0 && (double) this.velocity.X > -(double) num2)
{
if ((double) this.velocity.X > 0.0)
this.velocity.X -= num2;
this.velocity.X -= num2;
if ((double) this.velocity.X < -(double) num2)
this.velocity.X = -num2;
}
else if (hitDirection > 0 && (double) this.velocity.X < (double) num2)
{
if ((double) this.velocity.X < 0.0)
this.velocity.X += num2;
this.velocity.X += num2;
if ((double) this.velocity.X > (double) num2)
this.velocity.X = num2;
}
if (this.type == 185)
num2 *= 1.5f;
float num4 = this.noGravity ? num2 * -0.5f : num2 * -0.75f;
if ((double) this.velocity.Y > (double) num4)
{
this.velocity.Y += num4;
if ((double) this.velocity.Y < (double) num4)
this.velocity.Y = num4;
}
}
else
{
if (!this.noGravity)
this.velocity.Y = (float) (-(double) num2 * 0.75) * this.knockBackResist;
else
this.velocity.Y = (float) (-(double) num2 * 0.5) * this.knockBackResist;
this.velocity.X = num2 * (float) hitDirection * this.knockBackResist;
}
}
if ((this.type == 113 || this.type == 114) && this.life <= 0)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && (Main.npc[index].type == 113 || Main.npc[index].type == 114))
Main.npc[index].HitEffect(hitDirection, dmg);
}
}
else
this.HitEffect(hitDirection, dmg);
if (this.HitSound != null)
Main.PlaySound(this.HitSound, this.position);
if (this.realLife >= 0)
Main.npc[this.realLife].checkDead();
else
this.checkDead();
return dmg;
}
public void HitEffect(int hitDirection = 0, double dmg = 10.0)
{
// ISSUE: unable to decompile the method.
}
public static int CountNPCS(int Type)
{
int num = 0;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == Type)
++num;
}
return num;
}
public static bool AnyNPCs(int Type)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == Type)
return true;
}
return false;
}
public static int FindFirstNPC(int Type)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == Type)
return index;
}
return -1;
}
public static bool NearSpikeBall(int x, int y)
{
Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle(x * 16 - 300, y * 16 - 300, 600, 600);
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].aiStyle == 20)
{
Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].ai[1], (int) Main.npc[index].ai[2], 20, 20);
if (rectangle1.Intersects(rectangle2))
return true;
}
}
return false;
}
public int FindBuffIndex(int type)
{
if (this.buffImmune[type])
return -1;
for (int index = 0; index < 5; ++index)
{
if (this.buffTime[index] >= 1 && this.buffType[index] == type)
return index;
}
return -1;
}
public void AddBuff(int type, int time, bool quiet = false)
{
if (this.buffImmune[type])
return;
if (!quiet)
{
switch (Main.netMode)
{
case 1:
NetMessage.SendData(53, number: this.whoAmI, number2: ((float) type), number3: ((float) time));
break;
case 2:
NetMessage.SendData(54, number: this.whoAmI);
break;
}
}
int index1 = -1;
for (int index2 = 0; index2 < 5; ++index2)
{
if (this.buffType[index2] == type)
{
if (this.buffTime[index2] >= time)
return;
this.buffTime[index2] = time;
return;
}
}
while (index1 == -1)
{
int b = -1;
for (int index3 = 0; index3 < 5; ++index3)
{
if (!Main.debuff[this.buffType[index3]])
{
b = index3;
break;
}
}
if (b == -1)
return;
for (int index4 = b; index4 < 5; ++index4)
{
if (this.buffType[index4] == 0)
{
index1 = index4;
break;
}
}
if (index1 == -1)
this.DelBuff(b);
}
this.buffType[index1] = type;
this.buffTime[index1] = time;
}
public void DelBuff(int b)
{
this.buffTime[b] = 0;
this.buffType[b] = 0;
for (int index1 = 0; index1 < 4; ++index1)
{
if (this.buffTime[index1] == 0 || this.buffType[index1] == 0)
{
for (int index2 = index1 + 1; index2 < 5; ++index2)
{
this.buffTime[index2 - 1] = this.buffTime[index2];
this.buffType[index2 - 1] = this.buffType[index2];
this.buffTime[index2] = 0;
this.buffType[index2] = 0;
}
}
}
if (Main.netMode != 2)
return;
NetMessage.SendData(54, number: this.whoAmI);
}
public Microsoft.Xna.Framework.Rectangle getRect() => new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height);
public bool CanBeChasedBy(object attacker = null, bool ignoreDontTakeDamage = false) => this.active && this.chaseable && this.lifeMax > 5 && !this.dontTakeDamage | ignoreDontTakeDamage && !this.friendly && !this.immortal;
public void moneyPing(Vector2 pos)
{
Main.PlaySound(38, pos);
int Type = 244;
if ((double) this.extraValue >= 1000000.0)
Type = 247;
else if ((double) this.extraValue >= 10000.0)
Type = 246;
else if ((double) this.extraValue >= 100.0)
Type = 245;
for (int index1 = 0; index1 < 20; ++index1)
{
int index2 = Dust.NewDust(pos - new Vector2(1f, 2f), 10, 14, Type, Alpha: 254, Scale: 0.25f);
Main.dust[index2].velocity *= 0.2f;
}
}
public void IdleSounds()
{
if ((this.type == 239 || this.type == 240) && Main.rand.Next(900) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(24, 26));
else if ((this.type == 62 || this.type == 156) && Main.rand.Next(700) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(26, 30));
else if (this.type == 177 && Main.rand.Next(600) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(30, 32));
else if (this.type == 226 && Main.rand.Next(800) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 32);
else if (this.type == 153 && Main.rand.Next(1000) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 33);
else if (this.wet && (this.type == 63 || this.type == 64 || this.type == 103) && Main.rand.Next(1000) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(34, 36));
else if ((this.type == 198 || this.type == 199) && Main.rand.Next(1000) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(36, 38));
else if ((this.type == 170 || this.type == 180 || this.type == 171) && Main.rand.Next(600) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(38, 41));
else if (this.type == 250 && Main.rand.Next(700) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(41, 44));
else if (this.type == 508 && Main.rand.Next(800) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 44);
else if (this.type == 509 && Main.rand.Next(800) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(44, 47));
else if (this.type == 494 && Main.rand.Next(600) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 47);
else if (this.type == 467 && Main.rand.Next(700) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(48, 50));
else if (this.type == 468 && Main.rand.Next(700) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(50, 53));
else if (this.type == 288 && Main.rand.Next(400) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(53, 55));
else if ((this.type == 524 || this.type == 525 || this.type == 526 || this.type == 527) && Main.rand.Next(700) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(55, 57));
else if ((this.type == 496 || this.type == 497) && Main.rand.Next(600) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(57, 59));
else if (this.type == 389 && Main.rand.Next(800) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(59, 61));
else if (this.type == 471 && Main.rand.Next(600) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(61, 63));
else if (this.type == 482 && Main.rand.Next(600) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(63, 66));
else if (this.type == 388 && Main.rand.Next(700) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(66, 69));
else if (this.type == 520 && Main.rand.Next(800) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(69, 73));
else if (this.type == 477 && Main.rand.Next(600) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 73);
else if (this.type == 258 && Main.rand.Next(700) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(74, 78));
else if (this.type == 252 && Main.rand.Next(700) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, 78);
else if (this.type == 469 && Main.rand.Next(700) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(79, 81));
else if ((this.type == 253 || this.type == 82) && Main.rand.Next(700) == 0)
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(81, 84));
else if (this.type >= 498 && this.type <= 506 && Main.rand.Next(600) == 0)
{
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(84, 86));
}
else
{
if (this.type != 391 || Main.rand.Next(700) != 0)
return;
Main.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(86, 87));
}
}
private void UpdateAltTexture()
{
if (!this.townNPC)
return;
int altTexture = this.altTexture;
this.altTexture = !BirthdayParty.PartyIsUp ? 0 : 1;
if (this.type == 441 || this.type == 453)
this.altTexture = 0;
if (altTexture == 0 && this.altTexture == 1)
{
for (int index = 0; index < 20; ++index)
Dust.NewDust(this.position, this.width, this.height / 4, 139 + Main.rand.Next(4), SpeedY: -2f);
}
if (altTexture != 1 || this.altTexture != 0)
return;
for (int index = 0; index < 4; ++index)
Utils.PoofOfSmoke(this.position);
}
public void UpdateNPC(int i)
{
this.whoAmI = i;
if (!this.active)
return;
this.UpdateAltTexture();
if (this.type == 368)
NPC.travelNPC = true;
this.UpdateNPC_CastLights();
this.UpdateNPC_TeleportVisuals();
this.UpdateNPC_CritterSounds();
if (Main.netMode == 1 && (this.townNPC || this.type == 453) && this.type != 37 && this.npcNameLookup == (byte) 0)
{
this.npcNameLookup = (byte) 1;
int number = -1;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index] == this)
{
number = index;
break;
}
}
NetMessage.SendData(56, number: number);
}
if (Main.netMode == 1)
{
bool flag = false;
int index1 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
int index2 = (int) ((double) this.position.Y + (double) (this.height / 2)) / 16;
try
{
if (index1 >= 4)
{
if (index1 <= Main.maxTilesX - 4)
{
if (index2 >= 4)
{
if (index2 <= Main.maxTilesY - 4)
{
if (Main.tile[index1, index2] == null)
flag = true;
else if (Main.tile[index1 - 3, index2] == null)
flag = true;
else if (Main.tile[index1 + 3, index2] == null)
flag = true;
else if (Main.tile[index1, index2 - 3] == null)
flag = true;
else if (Main.tile[index1, index2 + 3] == null)
flag = true;
}
}
}
}
}
catch
{
flag = true;
}
if (flag)
return;
}
this.UpdateNPC_BuffFlagsReset();
this.UpdateNPC_BuffSetFlags();
this.UpdateNPC_SoulDrainDebuff();
this.UpdateNPC_BuffClearExpiredBuffs();
this.UpdateNPC_BuffApplyDOTs();
this.UpdateNPC_BloodMoonTransformations();
float maxFallSpeed;
this.UpdateNPC_UpdateGravity(out maxFallSpeed);
if (this.soundDelay > 0)
--this.soundDelay;
if (this.life <= 0)
this.active = false;
this.oldTarget = this.target;
this.oldDirection = this.direction;
this.oldDirectionY = this.directionY;
float num1 = (float) (1.0 + (double) Math.Abs(this.velocity.X) / 3.0);
if ((double) this.gfxOffY > 0.0)
{
this.gfxOffY -= num1 * this.stepSpeed;
if ((double) this.gfxOffY < 0.0)
this.gfxOffY = 0.0f;
}
else if ((double) this.gfxOffY < 0.0)
{
this.gfxOffY += num1 * this.stepSpeed;
if ((double) this.gfxOffY > 0.0)
this.gfxOffY = 0.0f;
}
if ((double) this.gfxOffY > 16.0)
this.gfxOffY = 16f;
if ((double) this.gfxOffY < -16.0)
this.gfxOffY = -16f;
this.TryPortalJumping();
this.IdleSounds();
this.AI();
if (Main.netMode != 2 && (double) this.extraValue > 0.0)
{
int Type = 244;
float num2 = 30f;
if ((double) this.extraValue >= 1000000.0)
{
Type = 247;
num2 *= 0.25f;
}
else if ((double) this.extraValue >= 10000.0)
{
Type = 246;
num2 *= 0.5f;
}
else if ((double) this.extraValue >= 100.0)
{
Type = 245;
num2 *= 0.75f;
}
if (Main.rand.Next((int) num2) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, Type, Alpha: 254, Scale: 0.25f);
Main.dust[index].velocity *= 0.1f;
}
}
for (int index = 0; index < 256; ++index)
{
if (this.immune[index] > 0)
--this.immune[index];
}
if (!this.noGravity && !this.noTileCollide)
{
int x = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
int y = (int) ((double) this.position.Y + (double) (this.height / 2)) / 16;
if (WorldGen.InWorld(x, y) && Main.tile[x, y] == null)
{
NPC.gravity = 0.0f;
this.velocity.X = 0.0f;
this.velocity.Y = 0.0f;
}
}
if (!this.noGravity)
{
this.velocity.Y += NPC.gravity;
if ((double) this.velocity.Y > (double) maxFallSpeed)
this.velocity.Y = maxFallSpeed;
}
if ((double) this.velocity.X < 0.005 && (double) this.velocity.X > -0.005)
this.velocity.X = 0.0f;
if (Main.netMode != 1 && this.type != 37 && (this.friendly || this.type == 46 || this.type == 55 || this.type == 74 || this.type == 148 || this.type == 149 || this.type == 230 || this.type == 297 || this.type == 298 || this.type == 299 || this.type == 303 || this.type == 355 || this.type == 356 || this.type == 358 || this.type == 359 || this.type == 360 || this.type == 361 || this.type == 362 || this.type == 363 || this.type == 364 || this.type == 365 || this.type == 366 || this.type == 367 || this.type == 377 || this.type == 357 || this.type == 374 || this.type >= 442 && this.type <= 448 && this.type != 447) || this.type == 538 || this.type == 539 || this.type == 337 || this.type == 540 || this.type >= 484 && this.type <= 487)
{
if (this.townNPC)
this.CheckDrowning();
this.CheckLifeRegen();
this.CheckMeleeCollision();
}
if (!this.noTileCollide)
{
this.UpdateCollision();
}
else
{
this.oldPosition = this.position;
this.oldDirection = this.direction;
this.position = this.position + this.velocity;
if (this.onFire && this.boss && Main.netMode != 1 && Collision.WetCollision(this.position, this.width, this.height))
{
for (int b = 0; b < 5; ++b)
{
if (this.buffType[b] == 24)
this.DelBuff(b);
}
}
}
if (Main.netMode != 1 && !this.noTileCollide && this.lifeMax > 1 && Collision.SwitchTiles(this.position, this.width, this.height, this.oldPosition, 2) && (this.type == 46 || this.type == 148 || this.type == 149 || this.type == 303 || this.type == 361 || this.type == 362 || this.type == 364 || this.type == 366 || this.type == 367 || this.type >= 442 && this.type <= 448))
{
this.ai[0] = 1f;
this.ai[1] = 400f;
this.ai[2] = 0.0f;
}
this.FindFrame();
this.UpdateNPC_UpdateTrails();
if (!this.active)
this.netUpdate = true;
if (Main.netMode == 2)
{
if (Main.npcStreamSpeed > 0 && !this.townNPC && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 1.0)
{
++this.netStream;
if ((int) this.netStream > Main.npcStreamSpeed)
{
for (int remoteClient = 0; remoteClient < (int) byte.MaxValue; ++remoteClient)
{
if (Main.player[remoteClient].active)
{
float num3 = Math.Abs(this.Center.X - Main.player[remoteClient].Center.X) + Math.Abs(this.Center.Y - Main.player[remoteClient].Center.Y);
if ((double) num3 < 250.0)
this.streamPlayer[remoteClient] -= (byte) 8;
else if ((double) num3 < 500.0)
this.streamPlayer[remoteClient] -= (byte) 4;
else if ((double) num3 < 1000.0)
this.streamPlayer[remoteClient] -= (byte) 2;
else if ((double) num3 < 1500.0)
--this.streamPlayer[remoteClient];
if (this.streamPlayer[remoteClient] <= (byte) 0)
{
this.streamPlayer[remoteClient] = (byte) 8;
NetMessage.SendData(23, remoteClient, number: i);
}
}
}
}
}
if (this.townNPC)
this.netSpam = 0;
if (this.netUpdate2)
this.netUpdate = true;
if (!this.active)
this.netSpam = 0;
if (this.netUpdate)
{
if (this.boss)
{
Vector2 vector2 = this.oldPosition - this.position;
if (this.netSpam <= 15)
{
this.netSpam += 5;
NetMessage.SendData(23, number: i);
this.netUpdate2 = false;
}
else
this.netUpdate2 = true;
}
else if (this.netSpam <= 90)
{
this.netSpam += 30;
NetMessage.SendData(23, number: i);
this.netUpdate2 = false;
}
else
this.netUpdate2 = true;
}
if (this.netSpam > 0)
--this.netSpam;
if (this.active && this.townNPC && NPC.TypeToHeadIndex(this.type) != -1)
{
if (this.homeless != this.oldHomeless || this.homeTileX != this.oldHomeTileX || this.homeTileY != this.oldHomeTileY)
{
byte householdStatus = WorldGen.TownManager.GetHouseholdStatus(this);
NetMessage.SendData(60, number: i, number2: ((float) Main.npc[i].homeTileX), number3: ((float) Main.npc[i].homeTileY), number4: ((float) householdStatus));
}
this.oldHomeless = this.homeless;
this.oldHomeTileX = this.homeTileX;
this.oldHomeTileY = this.homeTileY;
}
}
this.CheckActive();
this.netUpdate = false;
this.justHit = false;
}
private void UpdateNPC_UpdateTrails()
{
int num = NPCID.Sets.TrailingMode[this.type];
if (num == 0)
{
if ((double) this.localAI[3] <= 0.0)
{
this.localAI[3] = 2f;
for (int index = this.oldPos.Length - 1; index > 0; --index)
this.oldPos[index] = this.oldPos[index - 1];
this.oldPos[0] = this.position;
}
--this.localAI[3];
}
if (num == 1)
{
for (int index = this.oldPos.Length - 1; index > 0; --index)
this.oldPos[index] = this.oldPos[index - 1];
this.oldPos[0] = this.position;
}
if (num == 2)
{
if ((int) this.ai[0] == 4 || (double) this.ai[0] == 5.0 || (double) this.ai[0] == 6.0)
{
for (int index = this.oldPos.Length - 1; index > 0; --index)
{
this.oldPos[index] = this.oldPos[index - 1];
this.oldRot[index] = this.oldRot[index - 1];
}
this.oldPos[0] = this.position;
this.oldRot[0] = this.rotation;
}
else
{
for (int index = this.oldPos.Length - 1; index >= 0; --index)
{
this.oldPos[index] = this.position;
this.oldRot[index] = this.rotation;
}
}
}
if (num == 3)
{
for (int index = this.oldPos.Length - 1; index > 0; --index)
{
this.oldPos[index] = this.oldPos[index - 1];
this.oldRot[index] = this.oldRot[index - 1];
}
this.oldPos[0] = this.position;
this.oldRot[0] = this.rotation;
}
if (num == 4)
{
for (int index = this.oldPos.Length - 1; index > 0; --index)
{
this.oldPos[index] = this.oldPos[index - 1];
Lighting.AddLight((int) this.position.X / 16, (int) this.position.Y / 16, 0.3f, 0.0f, 0.2f);
}
this.oldPos[0] = this.position;
}
else if (num == 5)
{
for (int index = this.oldPos.Length - 1; index > 0; --index)
this.oldPos[index] = this.oldPos[index - 1];
this.oldPos[0] = this.position;
}
else if (num == 6)
{
for (int index = this.oldPos.Length - 1; index > 0; --index)
this.oldPos[index] = this.oldPos[index - 1];
this.oldPos[0] = this.position;
}
else
{
if (num != 7)
return;
for (int index = this.oldPos.Length - 1; index > 0; --index)
{
this.oldPos[index] = this.oldPos[index - 1];
this.oldRot[index] = this.oldRot[index - 1];
}
this.oldPos[0] = this.position;
this.oldRot[0] = this.rotation;
}
}
private void UpdateNPC_UpdateGravity(out float maxFallSpeed)
{
maxFallSpeed = 10f;
NPC.gravity = 0.3f;
if (this.type == 258)
{
NPC.gravity = 0.1f;
if ((double) this.velocity.Y > 3.0)
this.velocity.Y = 3f;
}
else if (this.type == 425 && (double) this.ai[2] == 1.0)
{
NPC.gravity = 0.1f;
if ((double) this.velocity.Y > 2.0)
this.velocity.Y = 2f;
}
else if ((this.type == 576 || this.type == 577) && (double) this.ai[0] > 0.0 && (double) this.ai[1] == 2.0)
{
NPC.gravity = 0.45f;
if ((double) this.velocity.Y > 32.0)
this.velocity.Y = 32f;
}
else if (this.type == 427 && (double) this.ai[2] == 1.0)
{
NPC.gravity = 0.1f;
if ((double) this.velocity.Y > 4.0)
this.velocity.Y = 4f;
}
else if (this.type == 426)
{
NPC.gravity = 0.1f;
if ((double) this.velocity.Y > 3.0)
this.velocity.Y = 3f;
}
else if (this.type == 541)
NPC.gravity = 0.0f;
float num1 = (float) (Main.maxTilesX / 4200);
float num2 = (float) (((double) this.position.Y / 16.0 - (60.0 + 10.0 * (double) (num1 * num1))) / (Main.worldSurface / 6.0));
if ((double) num2 < 0.25)
num2 = 0.25f;
if ((double) num2 > 1.0)
num2 = 1f;
NPC.gravity *= num2;
if (!this.wet)
return;
if (this.honeyWet)
{
NPC.gravity = 0.1f;
maxFallSpeed = 4f;
}
else
{
NPC.gravity = 0.2f;
maxFallSpeed = 7f;
}
}
private void UpdateNPC_SoulDrainDebuff()
{
if (!this.soulDrain)
return;
int num = 1100;
for (int index1 = 0; index1 < (int) byte.MaxValue; ++index1)
{
if (Main.player[index1].active && !Main.player[index1].dead && (double) (this.Center - Main.player[index1].position).Length() < (double) num && Main.player[index1].inventory[Main.player[index1].selectedItem].type == 3006 && Main.player[index1].itemAnimation > 0)
{
if (index1 == Main.myPlayer)
++Main.player[index1].soulDrain;
if (Main.rand.Next(3) != 0)
{
Vector2 center = this.Center;
center.X += (float) Main.rand.Next(-100, 100) * 0.05f;
center.Y += (float) Main.rand.Next(-100, 100) * 0.05f;
int index2 = Dust.NewDust(center + this.velocity, 1, 1, 235);
Main.dust[index2].velocity *= 0.0f;
Main.dust[index2].scale = (float) Main.rand.Next(70, 85) * 0.01f;
Main.dust[index2].fadeIn = (float) (index1 + 1);
}
}
}
}
private void UpdateNPC_BuffApplyDOTs()
{
if (this.dontTakeDamage)
return;
int amount = this.lifeRegenExpectedLossPerSecond;
if (this.poisoned)
{
if (this.lifeRegen > 0)
this.lifeRegen = 0;
this.lifeRegen -= 4;
}
if (this.onFire)
{
if (this.lifeRegen > 0)
this.lifeRegen = 0;
this.lifeRegen -= 8;
}
if (this.onFrostBurn)
{
if (this.lifeRegen > 0)
this.lifeRegen = 0;
this.lifeRegen -= 16;
if (amount < 2)
amount = 2;
}
if (this.onFire2)
{
if (this.lifeRegen > 0)
this.lifeRegen = 0;
this.lifeRegen -= 12;
}
if (this.venom)
{
if (this.lifeRegen > 0)
this.lifeRegen = 0;
this.lifeRegen -= 12;
if (amount < 2)
amount = 2;
}
if (this.shadowFlame)
{
if (this.lifeRegen > 0)
this.lifeRegen = 0;
this.lifeRegen -= 30;
if (amount < 5)
amount = 5;
}
if (this.oiled)
{
int num1 = (this.onFire ? 2 : 0) + (this.onFrostBurn ? 4 : 0) + (this.onFire2 ? 3 : 0) + (this.shadowFlame ? 8 : 0);
if (num1 > 0)
{
int num2 = num1 * 4 + 12;
this.lifeRegen -= num2;
int num3 = num2 / 6;
if (amount < num3)
amount = num3;
}
}
if (this.javelined)
{
if (this.lifeRegen > 0)
this.lifeRegen = 0;
int num4 = 0;
int num5 = 1;
for (int index = 0; index < 1000; ++index)
{
if (Main.projectile[index].active && Main.projectile[index].type == 598 && (double) Main.projectile[index].ai[0] == 1.0 && (double) Main.projectile[index].ai[1] == (double) this.whoAmI)
++num4;
}
this.lifeRegen -= num4 * 2 * 3;
if (amount < num4 * 3 / num5)
amount = num4 * 3 / num5;
}
if (this.daybreak)
{
if (this.lifeRegen > 0)
this.lifeRegen = 0;
int num6 = 0;
int num7 = 4;
for (int index = 0; index < 1000; ++index)
{
if (Main.projectile[index].active && Main.projectile[index].type == 636 && (double) Main.projectile[index].ai[0] == 1.0 && (double) Main.projectile[index].ai[1] == (double) this.whoAmI)
++num6;
}
if (num6 == 0)
num6 = 1;
this.lifeRegen -= num6 * 2 * 100;
if (amount < num6 * 100 / num7)
amount = num6 * 100 / num7;
}
if (this.celled)
{
if (this.lifeRegen > 0)
this.lifeRegen = 0;
int num = 0;
for (int index = 0; index < 1000; ++index)
{
if (Main.projectile[index].active && Main.projectile[index].type == 614 && (double) Main.projectile[index].ai[0] == 1.0 && (double) Main.projectile[index].ai[1] == (double) this.whoAmI)
++num;
}
this.lifeRegen -= num * 2 * 20;
if (amount < num * 20)
amount = num * 20 / 2;
}
if (this.dryadBane)
{
int num8 = 4;
float num9 = 1f;
if (this.lifeRegen > 0)
this.lifeRegen = 0;
if (NPC.downedBoss1)
num9 += 0.1f;
if (NPC.downedBoss2)
num9 += 0.1f;
if (NPC.downedBoss3)
num9 += 0.1f;
if (NPC.downedQueenBee)
num9 += 0.1f;
if (Main.hardMode)
num9 += 0.4f;
if (NPC.downedMechBoss1)
num9 += 0.15f;
if (NPC.downedMechBoss2)
num9 += 0.15f;
if (NPC.downedMechBoss3)
num9 += 0.15f;
if (NPC.downedPlantBoss)
num9 += 0.15f;
if (NPC.downedGolemBoss)
num9 += 0.15f;
if (NPC.downedAncientCultist)
num9 += 0.15f;
if (Main.expertMode)
num9 *= Main.expertNPCDamage;
int num10 = (int) ((double) num8 * (double) num9);
this.lifeRegen -= 2 * num10;
if (amount < num10)
amount = num10 / 3;
}
if (this.soulDrain && this.realLife == -1)
{
if (this.lifeRegen > 0)
this.lifeRegen = 0;
this.lifeRegen -= 50;
if (amount < 5)
amount = 5;
}
if (this.lifeRegen <= -240 && amount < 2)
amount = 2;
this.lifeRegenCount += this.lifeRegen;
while (this.lifeRegenCount >= 120)
{
this.lifeRegenCount -= 120;
if (!this.immortal)
{
if (this.life < this.lifeMax)
++this.life;
if (this.life > this.lifeMax)
this.life = this.lifeMax;
}
}
if (amount > 0)
{
while (this.lifeRegenCount <= -120 * amount)
{
this.lifeRegenCount += 120 * amount;
int number = this.whoAmI;
if (this.realLife >= 0)
number = this.realLife;
if (!Main.npc[number].immortal)
Main.npc[number].life -= amount;
CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), CombatText.LifeRegenNegative, amount, dot: true);
if (Main.npc[number].life <= 0 && !Main.npc[number].immortal)
{
Main.npc[number].life = 1;
if (Main.netMode != 1)
{
Main.npc[number].StrikeNPCNoInteraction(9999, 0.0f, 0);
if (Main.netMode == 2)
NetMessage.SendData(28, number: number, number2: 9999f);
}
}
}
}
else
{
while (this.lifeRegenCount <= -120)
{
this.lifeRegenCount += 120;
int number = this.whoAmI;
if (this.realLife >= 0)
number = this.realLife;
if (!Main.npc[number].immortal)
--Main.npc[number].life;
CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), CombatText.LifeRegenNegative, 1, dot: true);
if (Main.npc[number].life <= 0 && !Main.npc[number].immortal)
{
Main.npc[number].life = 1;
if (Main.netMode != 1)
{
Main.npc[number].StrikeNPCNoInteraction(9999, 0.0f, 0);
if (Main.netMode == 2)
NetMessage.SendData(28, number: number, number2: 9999f);
}
}
}
}
}
private void UpdateNPC_BuffClearExpiredBuffs()
{
if (Main.netMode == 1)
return;
for (int b = 0; b < 5; ++b)
{
if (this.buffType[b] > 0 && this.buffTime[b] <= 0)
{
this.DelBuff(b);
if (Main.netMode == 2)
NetMessage.SendData(54, number: this.whoAmI);
}
}
}
private void UpdateNPC_BloodMoonTransformations()
{
if (Main.netMode == 1 || !Main.bloodMoon)
return;
bool flag = false;
if ((double) this.value == 0.0)
flag = true;
if (this.type == 46 || this.type == 303 || this.type == 337 || this.type == 443 || this.type == 540)
{
if (WorldGen.crimson)
this.Transform(464);
else
this.Transform(47);
}
else if (this.type == 55 || this.type == 230)
{
if (WorldGen.crimson)
this.Transform(465);
else
this.Transform(57);
}
else if (this.type == 148 || this.type == 149)
{
if (WorldGen.crimson)
this.Transform(470);
else
this.Transform(168);
}
if (!flag)
return;
this.value = 0.0f;
}
private void UpdateNPC_BuffSetFlags()
{
for (int index = 0; index < 5; ++index)
{
if (this.buffType[index] > 0 && this.buffTime[index] > 0)
{
--this.buffTime[index];
if (this.buffType[index] == 20)
this.poisoned = true;
if (this.buffType[index] == 70)
this.venom = true;
if (this.buffType[index] == 24)
this.onFire = true;
if (this.buffType[index] == 72)
this.midas = true;
if (this.buffType[index] == 69)
this.ichor = true;
if (this.buffType[index] == 31)
this.confused = true;
if (this.buffType[index] == 39)
this.onFire2 = true;
if (this.buffType[index] == 44)
this.onFrostBurn = true;
if (this.buffType[index] == 103)
this.dripping = true;
if (this.buffType[index] == 137)
this.drippingSlime = true;
if (this.buffType[index] == 119)
this.loveStruck = true;
if (this.buffType[index] == 120)
this.stinky = true;
if (this.buffType[index] == 151)
this.soulDrain = true;
if (this.buffType[index] == 153)
this.shadowFlame = true;
if (this.buffType[index] == 165)
this.dryadWard = true;
if (this.buffType[index] == 169)
this.javelined = true;
if (this.buffType[index] == 183)
this.celled = true;
if (this.buffType[index] == 186)
this.dryadBane = true;
if (this.buffType[index] == 189)
this.daybreak = true;
if (this.buffType[index] == 203)
this.betsysCurse = true;
if (this.buffType[index] == 204)
this.oiled = true;
}
}
}
private void UpdateNPC_BuffFlagsReset()
{
this.lifeRegen = 0;
this.soulDrain = false;
this.poisoned = false;
this.venom = false;
this.shadowFlame = false;
this.onFire = false;
this.midas = false;
this.ichor = false;
this.onFrostBurn = false;
this.onFire2 = false;
this.confused = false;
this.loveStruck = false;
this.dryadWard = false;
this.stinky = false;
this.dripping = false;
this.drippingSlime = false;
this.daybreak = false;
this.javelined = false;
this.celled = false;
this.dryadBane = false;
this.betsysCurse = false;
this.oiled = false;
this.lifeRegenExpectedLossPerSecond = -1;
}
private void UpdateNPC_TeleportVisuals()
{
if ((double) this.teleportTime <= 0.0)
return;
if (this.teleportStyle == 0)
{
if ((double) Main.rand.Next(100) <= 100.0 * (double) this.teleportTime * 2.0)
{
int index = Dust.NewDust(new Vector2((float) this.getRect().X, (float) this.getRect().Y), this.getRect().Width, this.getRect().Height, 159);
Main.dust[index].scale = this.teleportTime * 1.5f;
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 1.1f;
}
}
else if (this.teleportStyle == 4)
{
this.teleportTime -= 0.02f;
if ((double) Main.rand.Next(100) <= 100.0 * (double) this.teleportTime)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 263)];
dust.color = PortalHelper.GetPortalColor(this.lastPortalColorIndex);
dust.noLight = true;
dust.noGravity = true;
dust.scale = 1.2f;
dust.fadeIn = 0.4f;
}
}
this.teleportTime -= 0.005f;
}
private void UpdateNPC_CritterSounds()
{
if (Main.netMode == 2)
return;
if (this.type >= 362 && this.type <= 365)
{
if (!Main.dayTime || Main.rand.Next(200) != 0)
return;
Main.PlaySound(30, (int) this.position.X, (int) this.position.Y);
}
else if (this.type == 361 || this.type == 445)
{
if ((double) Math.Abs(this.velocity.X) >= 0.5 || Main.dayTime && (double) this.position.Y <= Main.worldSurface * 16.0 || Main.rand.Next(200) != 0)
return;
Main.PlaySound(31, (int) this.position.X, (int) this.position.Y);
}
else if (this.type == 74 || this.type == 297 || this.type == 298 || this.type == 442)
{
if (!Main.dayTime || Main.time >= 18000.0 || Main.rand.Next(400) != 0)
return;
if (this.type == 74)
{
if (Main.rand.Next(3) != 0)
Main.PlaySound(32, (int) this.position.X, (int) this.position.Y, 14);
else
Main.PlaySound(32, (int) this.position.X, (int) this.position.Y, 18);
}
if (this.type == 297)
Main.PlaySound(32, (int) this.position.X, (int) this.position.Y, 16);
if (this.type == 298)
{
if (Main.rand.Next(3) != 0)
Main.PlaySound(32, (int) this.position.X, (int) this.position.Y, 17);
else
Main.PlaySound(32, (int) this.position.X, (int) this.position.Y, 19);
}
if (this.type != 442)
return;
switch (Main.rand.Next(5))
{
case 0:
Main.PlaySound(32, (int) this.position.X, (int) this.position.Y, 16);
break;
case 1:
Main.PlaySound(32, (int) this.position.X, (int) this.position.Y, 17);
break;
case 2:
Main.PlaySound(32, (int) this.position.X, (int) this.position.Y, 19);
break;
case 3:
Main.PlaySound(32, (int) this.position.X, (int) this.position.Y, 14);
break;
default:
Main.PlaySound(32, (int) this.position.X, (int) this.position.Y, 18);
break;
}
}
else
{
if (this.type != 300 && this.type != 447 || Main.rand.Next(1800) != 0)
return;
Main.PlaySound(33, (int) this.position.X, (int) this.position.Y);
}
}
private void UpdateNPC_CastLights()
{
if (this.type >= 442 && this.type <= 448 || this.type == 539)
{
Color color = Lighting.GetColor((int) this.Center.X / 16, (int) this.Center.Y / 16);
if (color.R > (byte) 20 || color.B > (byte) 20 || color.G > (byte) 20)
{
int num1 = (int) color.R;
if ((int) color.G > num1)
num1 = (int) color.G;
if ((int) color.B > num1)
num1 = (int) color.B;
int num2 = num1 / 30;
if (Main.rand.Next(300) < num2)
{
int index = Dust.NewDust(this.position, this.width, this.height, 43, Alpha: 254, newColor: new Color((int) byte.MaxValue, (int) byte.MaxValue, 0), Scale: 0.5f);
Main.dust[index].velocity *= 0.0f;
}
}
}
if (this.type >= 254 && this.type <= 261 || this.type == 160)
{
float num3 = (float) Main.rand.Next(28, 42) * 0.005f + (float) (270 - (int) Main.mouseTextColor) / 500f;
float num4 = 0.1f;
float num5 = (float) (0.300000011920929 + (double) num3 / 2.0);
float num6 = 0.6f + num3;
float num7 = 0.35f;
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, num4 * num7, num5 * num7, num6 * num7);
}
if (this.type == 209)
{
float num8 = (float) Main.rand.Next(28, 42) * 0.005f + (float) (270 - (int) Main.mouseTextColor) / 500f;
float num9 = 0.1f;
float num10 = (float) (0.300000011920929 + (double) num8 / 2.0);
float num11 = (float) (0.400000005960464 + (double) num8 / 2.0);
float num12 = 0.35f;
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, num9 * num12, num10 * num12, num11 * num12);
if ((double) this.ai[0] == 12.0)
Lighting.AddLight(this.Top, 0.3f, 0.1f, 0.1f);
}
if (this.type != 44)
return;
Lighting.AddLight((int) ((double) this.position.X + (double) (this.width / 2)) / 16, (int) ((double) this.position.Y + 4.0) / 16, 0.9f, 0.75f, 0.5f);
}
private void CheckMeleeCollision()
{
if (this.dontTakeDamageFromHostiles)
return;
int specialHitSetter = 1;
if (this.immune[(int) byte.MaxValue] != 0)
return;
int num1 = 30;
if (this.type == 548)
num1 = 20;
Microsoft.Xna.Framework.Rectangle hitbox1 = this.Hitbox;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.active && !npc.friendly && npc.damage > 0)
{
Microsoft.Xna.Framework.Rectangle hitbox2 = npc.Hitbox;
float damageMultiplier = 1f;
NPC.GetMeleeCollisionData(hitbox1, index, ref specialHitSetter, ref damageMultiplier, ref hitbox2);
if (hitbox1.Intersects(hitbox2) && (this.type != 453 || !NPCID.Sets.Skeletons.Contains(npc.netID)))
{
int damage = npc.damage;
int num2 = 6;
int hitDirection1 = 1;
if ((double) npc.position.X + (double) (npc.width / 2) > (double) this.position.X + (double) (this.width / 2))
hitDirection1 = -1;
double num3 = this.StrikeNPCNoInteraction(damage, (float) num2, hitDirection1);
if (Main.netMode != 0)
NetMessage.SendData(28, number: this.whoAmI, number2: ((float) damage), number3: ((float) num2), number4: ((float) hitDirection1));
this.netUpdate = true;
this.immune[(int) byte.MaxValue] = num1;
if (this.dryadWard)
{
int Damage = (int) num3 / 3;
int num4 = 6;
int hitDirection2 = hitDirection1 * -1;
npc.StrikeNPCNoInteraction(Damage, (float) num4, hitDirection2);
if (Main.netMode != 0)
NetMessage.SendData(28, number: index, number2: ((float) Damage), number3: ((float) num4), number4: ((float) hitDirection2));
npc.netUpdate = true;
npc.immune[(int) byte.MaxValue] = num1;
}
}
}
}
}
private void CheckLifeRegen()
{
if (this.life >= this.lifeMax)
return;
++this.friendlyRegen;
if (this.dryadWard)
this.friendlyRegen += 10;
if (this.friendlyRegen <= 180)
return;
this.friendlyRegen = 0;
++this.life;
this.netUpdate = true;
}
private void UpdateCollision()
{
this.Collision_WalkDownSlopes();
this.Collision_WaterCollision(this.Collision_LavaCollision());
if (!this.wet)
{
this.lavaWet = false;
this.honeyWet = false;
}
if (this.wetCount > (byte) 0)
--this.wetCount;
bool fall = this.Collision_DecideFallThroughPlatforms();
this.oldVelocity = this.velocity;
this.collideX = false;
this.collideY = false;
this.FishTransformationDuringRain();
Vector2 cPosition;
int cWidth;
int cHeight;
this.GetTileCollisionParameters(out cPosition, out cWidth, out cHeight);
Vector2 velocity = this.velocity;
this.ApplyTileCollision(fall, cPosition, cWidth, cHeight);
if (this.wet)
{
if (this.honeyWet)
this.Collision_MoveWhileWet(velocity, this.honeyMovementSpeed);
else if (this.lavaWet)
this.Collision_MoveWhileWet(velocity, this.lavaMovementSpeed);
else
this.Collision_MoveWhileWet(velocity, this.waterMovementSpeed);
}
else
this.Collision_MoveWhileDry();
if (this.aiStyle == 67)
{
this.Collision_MoveSnailOnSlopes();
}
else
{
if (this.type == 72 || this.type == 247 || this.type == 248 || this.type >= 542 && this.type <= 545 || NPCID.Sets.BelongsToInvasionOldOnesArmy[this.type] && this.noGravity)
return;
this.Collision_MoveSlopesAndStairFall(fall);
if (!this.townNPC)
return;
Collision.StepConveyorBelt((Entity) this, 1f);
}
}
private void Collision_MoveWhileDry()
{
if (Collision.up)
this.velocity.Y = 0.01f;
if ((double) this.oldVelocity.X != (double) this.velocity.X)
this.collideX = true;
if ((double) this.oldVelocity.Y != (double) this.velocity.Y)
this.collideY = true;
this.oldPosition = this.position;
this.oldDirection = this.direction;
this.position = this.position + this.velocity;
}
private void ApplyTileCollision(bool fall, Vector2 cPosition, int cWidth, int cHeight)
{
if (this.type == 72)
this.Collision_MoveBlazingWheel();
else if (this.type >= 542 && this.type <= 545)
this.Collision_MoveSandshark(fall, cPosition, cWidth, cHeight);
else if (this.type == 405 || this.type == 406)
this.Collision_MoveStardustCell(fall, cPosition, cWidth, cHeight);
else if (this.type == 417)
this.Collision_MoveSolarSroller(fall, cPosition, cWidth, cHeight);
else
this.Collision_MoveNormal(fall, cPosition, cWidth, cHeight);
}
private void Collision_MoveSlopesAndStairFall(bool fall)
{
if (fall)
this.stairFall = true;
if (this.aiStyle == 7)
{
int x = (int) this.Center.X / 16;
int y = (int) this.position.Y / 16;
if (WorldGen.InWorld(x, y))
{
int num = 16;
bool flag = false;
if (Main.tile[x, y] != null && Main.tile[x, y].active() && Main.tileSolid[(int) Main.tile[x, y].type])
flag = true;
if (!Main.dayTime || Main.eclipse)
flag = true;
else if (this.homeTileY - (int) ((double) this.position.Y + (double) this.height) / 16 > num)
flag = true;
if (flag)
this.stairFall = ((double) this.position.Y + (double) this.height - 8.0) / 16.0 < (double) this.homeTileY;
}
}
Vector2 cPosition;
int cWidth;
int cHeight;
this.GetTileCollisionParameters(out cPosition, out cWidth, out cHeight);
Vector2 vector2 = this.position - cPosition;
Vector4 vector4 = Collision.SlopeCollision(cPosition, this.velocity, cWidth, cHeight, NPC.gravity, this.stairFall);
if (Collision.stairFall)
this.stairFall = true;
else if (!fall)
this.stairFall = false;
if (Collision.stair && (double) Math.Abs(vector4.Y - this.position.Y) > 8.0)
{
this.gfxOffY -= vector4.Y - this.position.Y;
this.stepSpeed = 2f;
}
this.position.X = vector4.X;
this.position.Y = vector4.Y;
this.velocity.X = vector4.Z;
this.velocity.Y = vector4.W;
this.position = this.position + vector2;
}
private void Collision_MoveSnailOnSlopes()
{
Vector4 vector4 = Collision.SlopeCollision(this.position, this.velocity, this.width, this.height, NPC.gravity);
if ((double) this.position.X != (double) vector4.X || (double) this.position.Y != (double) vector4.Y)
{
if ((double) this.ai[2] == 0.0 && (double) this.velocity.Y > 0.0 && (this.direction < 0 && (double) this.rotation == 1.57000005245209 && this.spriteDirection == 1 || this.direction > 0 && (double) this.rotation == 4.71000003814697 && this.spriteDirection == -1))
this.direction *= -this.direction;
this.ai[2] = 2f;
this.directionY = 1;
this.rotation = 0.0f;
}
this.position.X = vector4.X;
this.position.Y = vector4.Y;
this.velocity.X = vector4.Z;
this.velocity.Y = vector4.W;
}
private void Collision_MoveNormal(bool fall, Vector2 cPosition, int cWidth, int cHeight) => this.velocity = Collision.TileCollision(cPosition, this.velocity, cWidth, cHeight, fall, fall);
private void Collision_MoveSandshark(bool fall, Vector2 cPosition, int cWidth, int cHeight) => this.velocity = Collision.AdvancedTileCollision(TileID.Sets.ForAdvancedCollision.ForSandshark, cPosition, this.velocity, cWidth, cHeight, fall, fall);
private void Collision_MoveSolarSroller(bool fall, Vector2 cPosition, int cWidth, int cHeight)
{
this.velocity = Collision.TileCollision(cPosition, this.velocity, cWidth, cHeight, fall, fall);
if ((double) this.ai[0] != 6.0 || !(this.velocity != this.oldVelocity))
return;
--this.ai[2];
this.ai[3] = 1f;
if ((double) this.ai[2] <= 0.0)
return;
if ((double) this.velocity.X != 0.0 && (double) this.velocity.X != (double) this.oldVelocity.X)
{
this.velocity.X = (float) (-(double) this.oldVelocity.X * 0.899999976158142);
this.direction *= -1;
}
if ((double) this.velocity.Y == 0.0 || (double) this.velocity.Y == (double) this.oldVelocity.Y)
return;
this.velocity.Y = (float) (-(double) this.oldVelocity.Y * 0.899999976158142);
}
private void Collision_MoveStardustCell(bool fall, Vector2 cPosition, int cWidth, int cHeight)
{
this.velocity = Collision.TileCollision(cPosition, this.velocity, cWidth, cHeight, fall, fall);
if (!(this.velocity != this.oldVelocity))
return;
if ((double) this.velocity.X != 0.0 && (double) this.velocity.X != (double) this.oldVelocity.X)
this.velocity.X = (float) (-(double) this.oldVelocity.X * 0.800000011920929);
if ((double) this.velocity.Y == 0.0 || (double) this.velocity.Y == (double) this.oldVelocity.Y)
return;
this.velocity.Y = (float) (-(double) this.oldVelocity.Y * 0.800000011920929);
}
private void Collision_MoveBlazingWheel()
{
Vector2 Position = new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2));
int Width = 12;
int Height = 12;
Position.X -= (float) (Width / 2);
Position.Y -= (float) (Height / 2);
this.velocity = Collision.noSlopeCollision(Position, this.velocity, Width, Height, true, true);
}
private void Collision_MoveWaterOrLavaOld(
bool fall,
Vector2 cPosition,
int cWidth,
int cHeight)
{
Vector2 velocity = this.velocity;
this.velocity = Collision.TileCollision(cPosition, this.velocity, cWidth, cHeight, fall, fall);
if (Collision.up)
this.velocity.Y = 0.01f;
Vector2 vector2 = this.velocity * 0.5f;
if ((double) this.velocity.X != (double) velocity.X)
{
vector2.X = this.velocity.X;
this.collideX = true;
}
if ((double) this.velocity.Y != (double) velocity.Y)
{
vector2.Y = this.velocity.Y;
this.collideY = true;
}
this.oldPosition = this.position;
this.oldDirection = this.direction;
this.position = this.position + vector2;
}
private void Collision_MoveHoneyOld(bool fall, Vector2 cPosition, int cWidth, int cHeight)
{
Vector2 velocity = this.velocity;
this.velocity = Collision.TileCollision(cPosition, this.velocity, cWidth, cHeight, fall, fall);
if (Collision.up)
this.velocity.Y = 0.01f;
Vector2 vector2 = this.velocity * 0.25f;
if ((double) this.velocity.X != (double) velocity.X)
{
vector2.X = this.velocity.X;
this.collideX = true;
}
if ((double) this.velocity.Y != (double) velocity.Y)
{
vector2.Y = this.velocity.Y;
this.collideY = true;
}
this.oldPosition = this.position;
this.oldDirection = this.direction;
this.position = this.position + vector2;
}
private void Collision_MoveWhileWet(Vector2 oldDryVelocity, float Slowdown = 0.5f)
{
if (Collision.up)
this.velocity.Y = 0.01f;
Vector2 vector2 = this.velocity * Slowdown;
if ((double) this.velocity.X != (double) oldDryVelocity.X)
{
vector2.X = this.velocity.X;
this.collideX = true;
}
if ((double) this.velocity.Y != (double) oldDryVelocity.Y)
{
vector2.Y = this.velocity.Y;
this.collideY = true;
}
this.oldPosition = this.position;
this.oldDirection = this.direction;
this.position = this.position + vector2;
}
private void GetTileCollisionParameters(out Vector2 cPosition, out int cWidth, out int cHeight)
{
cPosition = this.position;
cWidth = this.width;
cHeight = this.height;
if (this.type == 243)
cHeight = 90;
if (this.type == 290)
cHeight = 40;
if (this.type == 351)
cHeight = 40;
if (this.type == 482)
cHeight = 40;
if (this.type == 351 || this.type == 343 || this.type == 348 || this.type == 349)
cHeight = 40;
if (this.type == 391)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 390 && (double) Main.npc[index].ai[0] == (double) this.whoAmI)
{
cHeight = 62;
break;
}
}
}
if (this.type == 415)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 416 && (double) Main.npc[index].ai[0] == (double) this.whoAmI)
{
cHeight = 62;
break;
}
}
}
if (this.type == 576 || this.type == 577)
{
cPosition.X += 32f;
cWidth -= 64;
}
if (cHeight == this.height)
return;
cPosition.Y += (float) (this.height - cHeight);
}
private void FishTransformationDuringRain()
{
if (Main.netMode == 1)
return;
if (this.type == 230 && this.wet)
{
int direction = this.direction;
Vector2 velocity = this.velocity;
this.Transform(55);
this.direction = direction;
this.velocity = velocity;
this.wet = true;
if ((double) this.velocity.Y >= 0.0)
return;
this.velocity.Y = 0.0f;
}
else
{
if (this.type != 55 || this.wet || !Main.raining)
return;
int direction = this.direction;
Vector2 velocity = this.velocity;
this.Transform(230);
this.direction = direction;
this.velocity = velocity;
this.homeTileX = (int) ((double) this.position.X / 16.0) + 10 * this.direction;
}
}
private bool Collision_DecideFallThroughPlatforms()
{
bool flag1 = false;
if (this.type == 2 || this.type == -43 || this.type == 317 || this.type == 318 || this.type == 133)
flag1 = true;
if (this.aiStyle == 10)
flag1 = true;
if (this.aiStyle == 40)
flag1 = true;
if (this.type == 467)
flag1 = true;
if (this.type == 477)
flag1 = true;
if (this.aiStyle == 14)
flag1 = true;
if (this.type == 173)
flag1 = true;
if (this.type == 469 && (double) this.ai[2] == 1.0)
flag1 = true;
if (this.aiStyle == 3 && this.directionY == 1)
flag1 = true;
if (this.type == 210 || this.type == 211)
flag1 = true;
if (this.type == 50 && this.target >= 0 && (double) Main.player[this.target].position.Y > (double) this.position.Y + (double) this.height)
flag1 = true;
if (this.type == 247 || this.type == 248)
flag1 = true;
if (this.type == 245 && this.target >= 0 && (double) Main.player[this.target].position.Y > (double) this.position.Y + (double) this.height)
flag1 = true;
if (this.type >= 542 && this.type <= 545)
flag1 = true;
if (this.aiStyle == 107 && this.directionY == 1)
flag1 = true;
if (this.type == 418)
flag1 = true;
if (this.aiStyle == 87 && (double) Main.player[this.target].position.Y > (double) this.position.Y + (double) this.height)
flag1 = true;
if (this.aiStyle == 7)
{
int num = 16;
bool flag2 = false;
if (!Main.dayTime || Main.invasionType > 0 || Main.eclipse)
flag2 = true;
else if (this.homeTileY - (int) ((double) this.position.Y + (double) this.height) / 16 > num)
flag1 = true;
if (flag2 && ((double) this.position.Y + (double) this.height - 8.0) / 16.0 < (double) (this.homeTileY - 1))
flag1 = true;
}
return flag1;
}
private bool Collision_WaterCollision(bool lava)
{
bool flag;
if (this.type == 72 || this.aiStyle == 21 || this.aiStyle == 67 || this.type == 376 || this.type == 579 || this.type == 541)
{
flag = false;
this.wetCount = (byte) 0;
lava = false;
}
else
{
flag = Collision.WetCollision(this.position, this.width, this.height);
if (Collision.honey)
this.honeyWet = true;
}
if (flag)
{
if (this.onFire && !this.lavaWet && Main.netMode != 1)
{
for (int b = 0; b < 5; ++b)
{
if (this.buffType[b] == 24)
this.DelBuff(b);
}
}
if (!this.wet && this.wetCount == (byte) 0)
{
this.wetCount = (byte) 10;
if (!lava)
{
if (this.honeyWet)
{
for (int index1 = 0; index1 < 10; ++index1)
{
int index2 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, 152);
--Main.dust[index2].velocity.Y;
Main.dust[index2].velocity.X *= 2.5f;
Main.dust[index2].scale = 1.3f;
Main.dust[index2].alpha = 100;
Main.dust[index2].noGravity = true;
}
if (this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 147 && this.type != 59 && this.type != 300 && this.aiStyle != 39 && !this.noGravity)
Main.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
else
{
for (int index3 = 0; index3 < 30; ++index3)
{
int index4 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, Dust.dustWater());
Main.dust[index4].velocity.Y -= 4f;
Main.dust[index4].velocity.X *= 2.5f;
Main.dust[index4].scale *= 0.8f;
Main.dust[index4].alpha = 100;
Main.dust[index4].noGravity = true;
}
if (this.type != 376 && this.type != 579 && this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 147 && this.type != 59 && this.type != 300 && this.aiStyle != 39 && this.aiStyle != 68 && this.type != 362 && this.type != 364 && this.type != 361 && this.type != 445 && !this.noGravity)
Main.PlaySound(19, (int) this.position.X, (int) this.position.Y, 0);
}
}
else
{
for (int index5 = 0; index5 < 10; ++index5)
{
int index6 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, 35);
Main.dust[index6].velocity.Y -= 1.5f;
Main.dust[index6].velocity.X *= 2.5f;
Main.dust[index6].scale = 1.3f;
Main.dust[index6].alpha = 100;
Main.dust[index6].noGravity = true;
}
if (this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 147 && this.type != 59 && this.type != 300 && this.aiStyle != 39 && !this.noGravity)
Main.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
}
this.wet = true;
}
else if (this.wet)
{
this.velocity.X *= 0.5f;
this.wet = false;
if (this.wetCount == (byte) 0)
{
this.wetCount = (byte) 10;
if (!this.lavaWet)
{
if (this.honeyWet)
{
for (int index7 = 0; index7 < 10; ++index7)
{
int index8 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, 152);
--Main.dust[index8].velocity.Y;
Main.dust[index8].velocity.X *= 2.5f;
Main.dust[index8].scale = 1.3f;
Main.dust[index8].alpha = 100;
Main.dust[index8].noGravity = true;
}
if (this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 147 && this.type != 300 && this.type != 59 && this.aiStyle != 39 && !this.noGravity)
Main.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
else
{
for (int index9 = 0; index9 < 30; ++index9)
{
int index10 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, Dust.dustWater());
Main.dust[index10].velocity.Y -= 4f;
Main.dust[index10].velocity.X *= 2.5f;
Main.dust[index10].scale *= 0.8f;
Main.dust[index10].alpha = 100;
Main.dust[index10].noGravity = true;
}
if (this.type != 376 && this.type != 579 && this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 59 && this.type != 300 && this.aiStyle != 39 && this.aiStyle != 68 && this.type != 362 && this.type != 364 && this.type != 361 && this.type != 445 && !this.noGravity)
Main.PlaySound(19, (int) this.position.X, (int) this.position.Y, 0);
}
}
else
{
for (int index11 = 0; index11 < 10; ++index11)
{
int index12 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, 35);
Main.dust[index12].velocity.Y -= 1.5f;
Main.dust[index12].velocity.X *= 2.5f;
Main.dust[index12].scale = 1.3f;
Main.dust[index12].alpha = 100;
Main.dust[index12].noGravity = true;
}
if (this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 59 && this.type != 300 && this.aiStyle != 39 && !this.noGravity)
Main.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
}
}
return lava;
}
private bool Collision_LavaCollision()
{
int num = Collision.LavaCollision(this.position, this.width, this.height) ? 1 : 0;
if (num == 0)
return num != 0;
this.lavaWet = true;
if (this.lavaImmune)
return num != 0;
if (this.dontTakeDamage)
return num != 0;
if (Main.netMode == 1)
return num != 0;
if (this.immune[(int) byte.MaxValue] != 0)
return num != 0;
this.AddBuff(24, 420);
this.immune[(int) byte.MaxValue] = 30;
this.StrikeNPCNoInteraction(50, 0.0f, 0);
if (Main.netMode != 2)
return num != 0;
if (Main.netMode == 0)
return num != 0;
NetMessage.SendData(28, number: this.whoAmI, number2: 50f);
return num != 0;
}
private void Collision_WalkDownSlopes()
{
Vector2 velocity = this.velocity;
Vector4 vector4 = Collision.WalkDownSlope(this.position, this.velocity, this.width, this.height, NPC.gravity);
this.position.X = vector4.X;
this.position.Y = vector4.Y;
this.velocity.X = vector4.Z;
this.velocity.Y = vector4.W;
}
public static void setFireFlyChance()
{
if (Main.rand == null)
Main.rand = new UnifiedRandom((int) DateTime.Now.Ticks);
if (WorldGen.genRand.Next(9) == 0)
{
NPC.fireFlyChance = Main.rand.Next(5, 10);
NPC.fireFlyFriendly = Main.rand.Next(1, 4);
NPC.fireFlyMultiple = Main.rand.Next(3, 8);
}
else if (WorldGen.genRand.Next(3) == 0)
{
NPC.fireFlyChance = 999999;
NPC.fireFlyFriendly = 999999;
NPC.fireFlyMultiple = 999999;
}
else
{
NPC.fireFlyChance = Main.rand.Next(10, 60);
NPC.fireFlyFriendly = Main.rand.Next(2, 15);
NPC.fireFlyMultiple = Main.rand.Next(6, 30);
}
NPC.butterflyChance = Main.rand.Next(1, 25);
if (WorldGen.genRand.Next(3) != 0)
return;
NPC.butterflyChance = 999999;
}
public Color GetAlpha(Color newColor)
{
float num1 = (float) ((int) byte.MaxValue - this.alpha) / (float) byte.MaxValue;
int r1 = (int) ((double) newColor.R * (double) num1);
int g1 = (int) ((double) newColor.G * (double) num1);
int b1 = (int) ((double) newColor.B * (double) num1);
int a = (int) newColor.A - this.alpha;
if (this.type == 402)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
if (this.type == 484)
return new Color(250, 250, 250, 200);
if (this.type >= 542 && this.type <= 545 && r1 + g1 + b1 > 10 && r1 + g1 + b1 >= 60)
{
r1 *= 2;
g1 *= 2;
b1 *= 2;
if (r1 > (int) byte.MaxValue)
r1 = (int) byte.MaxValue;
if (g1 > (int) byte.MaxValue)
g1 = (int) byte.MaxValue;
if (b1 > (int) byte.MaxValue)
b1 = (int) byte.MaxValue;
}
if (this.type >= 454 && this.type <= 459 || this.type == 521)
{
newColor = Color.Lerp(newColor, Color.White, 0.4f);
newColor.A = (byte) 150;
newColor *= (float) a / (float) byte.MaxValue;
return newColor;
}
if (this.type == 440)
{
byte num2 = 180;
if (Main.expertMode)
num2 = (byte) 210;
byte num3 = (byte) ((double) num2 * (double) num1);
return new Color((int) num3, (int) num3, (int) num3, (int) num3);
}
if (this.type == 516)
return new Color(this.alpha, this.alpha, this.alpha, this.alpha);
if (this.type == 522)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
if (this.type == 523)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
if (this.type == 395 || this.type == 519)
{
newColor = Color.Lerp(newColor, Color.White, 0.4f);
return newColor;
}
if (this.type == 370 && (double) this.ai[0] != -1.0 && (double) this.ai[0] < 9.0)
{
float num4 = MathHelper.Lerp(num1, 1f, 0.25f);
if ((double) num4 > 1.0)
num4 = 1f;
b1 = (int) ((double) newColor.B * (double) num4);
}
if (this.type == 30)
return new Color(250, 250, 250, 100);
if (this.type == 25 || this.type == 30 || this.type == 59 || this.type == 60)
return new Color(200, 200, 200, 0);
if (this.type == 360)
{
int r2 = (int) newColor.R;
int g2 = (int) newColor.G;
int b2 = (int) newColor.B;
if (r2 < 75)
r2 = 75;
if (g2 < 175)
g2 = 175;
if (b2 < (int) byte.MaxValue)
b2 = (int) byte.MaxValue;
return new Color(r2, g2, b2, (int) byte.MaxValue);
}
if (this.type == 352)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
if (this.type == 72)
{
r1 = (int) newColor.R;
g1 = (int) newColor.G;
b1 = (int) newColor.B;
}
else
{
if (this.type == 288)
return new Color(200, 200, 200, 0);
if (this.type == 289)
return new Color(250, 250, 250, 50);
if (this.type >= 254 && this.type <= 261)
{
b1 = (int) byte.MaxValue;
if (r1 < 100)
r1 = 100;
if (g1 < 150)
g1 = 150;
}
else if (this.type == 374)
{
b1 = (int) byte.MaxValue;
if (r1 < 100)
r1 = 100;
if (g1 < 150)
g1 = 150;
}
else
{
if (this.type == 549)
{
newColor = Color.Lerp(newColor, Color.White, 0.4f);
newColor *= (float) a / (float) byte.MaxValue;
return newColor;
}
if (this.type == 64 || this.type == 63 || this.type == 75 || this.type == 103 || this.type == 400)
{
r1 = (int) ((double) newColor.R * 1.5);
g1 = (int) ((double) newColor.G * 1.5);
b1 = (int) ((double) newColor.B * 1.5);
if (r1 > (int) byte.MaxValue)
r1 = (int) byte.MaxValue;
if (g1 > (int) byte.MaxValue)
g1 = (int) byte.MaxValue;
if (b1 > (int) byte.MaxValue)
b1 = (int) byte.MaxValue;
}
}
}
if (a < 0)
a = 0;
if (a > (int) byte.MaxValue)
a = (int) byte.MaxValue;
return new Color(r1, g1, b1, a);
}
public Color GetColor(Color newColor)
{
int r = (int) this.color.R - ((int) byte.MaxValue - (int) newColor.R);
int g = (int) this.color.G - ((int) byte.MaxValue - (int) newColor.G);
int b = (int) this.color.B - ((int) byte.MaxValue - (int) newColor.B);
int a = (int) this.color.A - ((int) byte.MaxValue - (int) newColor.A);
if (r < 0)
r = 0;
if (r > (int) byte.MaxValue)
r = (int) byte.MaxValue;
if (g < 0)
g = 0;
if (g > (int) byte.MaxValue)
g = (int) byte.MaxValue;
if (b < 0)
b = 0;
if (b > (int) byte.MaxValue)
b = (int) byte.MaxValue;
if (a < 0)
a = 0;
if (a > (int) byte.MaxValue)
a = (int) byte.MaxValue;
return new Color(r, g, b, a);
}
private string GetBirthdayDialog()
{
switch (this.type)
{
case 17:
return Language.SelectRandom(Lang.CreateDialogFilter("MerchantSpecialText.Party")).Value;
case 18:
return Language.SelectRandom(Lang.CreateDialogFilter("NurseSpecialText.Party")).Value;
case 19:
return Language.SelectRandom(Lang.CreateDialogFilter("ArmsDealerSpecialText.Party")).Value;
case 20:
return Language.SelectRandom(Lang.CreateDialogFilter("DryadSpecialText.Party")).Value;
case 22:
return Language.SelectRandom(Lang.CreateDialogFilter("GuideSpecialText.Party")).Value;
case 38:
return Language.SelectRandom(Lang.CreateDialogFilter("DemolitionistSpecialText.Party")).Value;
case 54:
return Language.SelectRandom(Lang.CreateDialogFilter("ClothierSpecialText.Party")).Value;
case 107:
return Language.SelectRandom(Lang.CreateDialogFilter("GoblinTinkererSpecialText.Party")).Value;
case 108:
return Language.SelectRandom(Lang.CreateDialogFilter("WizardSpecialText.Party")).Value;
case 124:
return Language.SelectRandom(Lang.CreateDialogFilter("MechanicSpecialText.Party")).Value;
case 142:
return Language.SelectRandom(Lang.CreateDialogFilter("SantaClausSpecialText.Party")).Value;
case 160:
return Language.SelectRandom(Lang.CreateDialogFilter("TruffleSpecialText.Party")).Value;
case 178:
return Language.SelectRandom(Lang.CreateDialogFilter("SteampunkerSpecialText.Party")).Value;
case 207:
return Language.SelectRandom(Lang.CreateDialogFilter("DyeTraderSpecialText.Party")).Value;
case 208:
return Language.SelectRandom(Lang.CreateDialogFilter("PartyGirlSpecialText.Party")).Value;
case 209:
return Language.SelectRandom(Lang.CreateDialogFilter("CyborgSpecialText.Party")).Value;
case 227:
return Language.SelectRandom(Lang.CreateDialogFilter("PainterSpecialText.Party")).Value;
case 228:
return Language.SelectRandom(Lang.CreateDialogFilter("WitchDoctorSpecialText.Party")).Value;
case 229:
return Language.SelectRandom(Lang.CreateDialogFilter("PirateSpecialText.Party")).Value;
case 353:
return Language.SelectRandom(Lang.CreateDialogFilter("StylistSpecialText.Party")).Value;
case 368:
return Language.SelectRandom(Lang.CreateDialogFilter("TravellingMerchantSpecialText.Party")).Value;
case 369:
return Language.SelectRandom(Lang.CreateDialogFilter("AnglerSpecialText.Party")).Value;
case 550:
return Language.SelectRandom(Lang.CreateDialogFilter("DD2BartenderSpecialText.Party")).Value;
default:
return "";
}
}
public string GetChat()
{
Recipe.FindRecipes();
bool flag1 = false;
bool flag2 = false;
bool flag3 = false;
bool flag4 = false;
bool flag5 = false;
bool flag6 = false;
bool flag7 = false;
bool flag8 = false;
bool flag9 = false;
bool flag10 = false;
bool flag11 = false;
bool flag12 = false;
bool flag13 = false;
bool flag14 = false;
bool flag15 = false;
bool flag16 = false;
object substitutionObject = Lang.CreateDialogSubstitutionObject(this);
bool flag17 = false;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active)
{
if (Main.npc[index].type == 17)
flag1 = true;
else if (Main.npc[index].type == 18)
flag2 = true;
else if (Main.npc[index].type == 19)
flag3 = true;
else if (Main.npc[index].type == 20)
flag4 = true;
else if (Main.npc[index].type == 37)
flag5 = true;
else if (Main.npc[index].type == 38)
flag6 = true;
else if (Main.npc[index].type == 124)
flag7 = true;
else if (Main.npc[index].type == 107)
flag8 = true;
else if (Main.npc[index].type == 54)
flag9 = true;
else if (Main.npc[index].type == 160)
flag10 = true;
else if (Main.npc[index].type == 178)
flag11 = true;
else if (Main.npc[index].type == 229)
flag12 = true;
else if (Main.npc[index].type == 209)
flag13 = true;
else if (Main.npc[index].type == 208)
flag14 = true;
else if (Main.npc[index].type == 353)
flag15 = true;
else if (Main.npc[index].type == 22)
flag16 = true;
else if (Main.npc[index].type == 2)
{
flag17 = true;
}
else
{
int type = Main.npc[index].type;
}
}
}
string str = "";
if (this.type == 17)
{
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (!NPC.downedBoss1 && Main.rand.Next(3) == 0)
str = Main.player[Main.myPlayer].statLifeMax >= 200 ? (Main.player[Main.myPlayer].statDefense > 10 ? Lang.dialog(3) : Lang.dialog(2)) : Lang.dialog(1);
else if (Main.dayTime)
{
if (Main.time < 16200.0)
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(4);
break;
case 1:
str = Lang.dialog(5);
break;
default:
str = Lang.dialog(6);
break;
}
}
else if (Main.time > 37800.0)
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(7);
break;
case 1:
str = Lang.dialog(8);
break;
default:
str = Lang.dialog(9);
break;
}
}
else
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(10);
break;
case 1:
str = Lang.dialog(11);
break;
default:
str = Lang.dialog(12);
break;
}
}
}
else if (Main.bloodMoon)
{
if (flag2 & flag7 && Main.rand.Next(3) == 0)
{
str = Lang.dialog(13);
}
else
{
switch (Main.rand.Next(4))
{
case 0:
str = Lang.dialog(14);
break;
case 1:
str = Lang.dialog(15);
break;
case 2:
str = Lang.dialog(16);
break;
default:
str = Lang.dialog(17);
break;
}
}
}
else if (Main.time < 9720.0)
str = Main.rand.Next(2) != 0 ? Lang.dialog(19) : Lang.dialog(18);
else if (Main.time > 22680.0)
{
str = Main.rand.Next(2) != 0 ? Lang.dialog(21) : Lang.dialog(20);
}
else
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(22);
break;
case 1:
str = Lang.dialog(23);
break;
default:
str = Lang.dialog(24);
break;
}
}
}
else if (this.type == 18)
{
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (Main.bloodMoon)
{
if ((double) Main.player[Main.myPlayer].statLife < (double) Main.player[Main.myPlayer].statLifeMax2 * 0.66)
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(25);
break;
case 1:
str = Lang.dialog(26);
break;
default:
str = Lang.dialog(27);
break;
}
}
else
{
switch (Main.rand.Next(4))
{
case 0:
str = Lang.dialog(28);
break;
case 1:
str = Lang.dialog(29);
break;
case 2:
str = Lang.dialog(30);
break;
default:
str = Lang.dialog(31);
break;
}
}
}
else if (Main.rand.Next(3) == 0 && !NPC.downedBoss3)
str = Lang.dialog(32);
else if (flag6 && Main.rand.Next(4) == 0)
str = Lang.dialog(33);
else if (flag3 && Main.rand.Next(4) == 0)
str = Lang.dialog(34);
else if (flag17 && Main.rand.Next(4) == 0)
str = Lang.dialog(35);
else if ((double) Main.player[Main.myPlayer].statLife < (double) Main.player[Main.myPlayer].statLifeMax2 * 0.33)
{
switch (Main.rand.Next(5))
{
case 0:
str = Lang.dialog(36);
break;
case 1:
str = Lang.dialog(37);
break;
case 2:
str = Lang.dialog(38);
break;
case 3:
str = Lang.dialog(39);
break;
default:
str = Lang.dialog(40);
break;
}
}
else if ((double) Main.player[Main.myPlayer].statLife < (double) Main.player[Main.myPlayer].statLifeMax2 * 0.66)
{
switch (Main.rand.Next(7))
{
case 0:
str = Lang.dialog(41);
break;
case 1:
str = Lang.dialog(42);
break;
case 2:
str = Lang.dialog(43);
break;
case 3:
str = Lang.dialog(44);
break;
case 4:
str = Lang.dialog(45);
break;
case 5:
str = Lang.dialog(46);
break;
default:
str = Lang.dialog(47);
break;
}
}
else
{
LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("NurseChatter.", substitutionObject));
int num = Main.rand.Next(4 + all.Length);
str = num < 4 ? (num != 0 ? (num != 1 ? (num != 2 ? Lang.dialog(51) : Lang.dialog(50)) : Lang.dialog(49)) : Lang.dialog(48)) : all[num - 4].FormatWith(substitutionObject);
}
}
else if (this.type == 19)
{
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (NPC.downedBoss3 && !Main.hardMode)
str = Lang.dialog(58);
else if (flag2 && Main.rand.Next(5) == 0)
str = Lang.dialog(59);
else if (flag2 && Main.rand.Next(5) == 0)
str = Lang.dialog(60);
else if (flag4 && Main.rand.Next(5) == 0)
str = Lang.dialog(61);
else if (flag6 && Main.rand.Next(5) == 0)
str = Lang.dialog(62);
else if (flag6 && Main.rand.Next(5) == 0)
str = Lang.dialog(63);
else if (Main.bloodMoon)
{
str = Main.rand.Next(2) != 0 ? Lang.dialog(65) : Lang.dialog(64);
}
else
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(66);
break;
case 1:
str = Lang.dialog(67);
break;
default:
str = Lang.dialog(68);
break;
}
}
}
else if (this.type == 20)
{
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (DD2Event.DownedInvasionT1 && Main.rand.Next(6) == 0)
str = !DD2Event.DownedInvasionT2 ? Language.GetTextValueWith("DryadSpecialText.AfterDD2Tier1", substitutionObject) : Language.GetTextValueWith("DryadSpecialText.AfterDD2Tier2", substitutionObject);
else if (!NPC.downedBoss2 && Main.rand.Next(3) == 0)
str = !WorldGen.crimson ? Lang.dialog(69) : Lang.dialog(332);
else if (flag3 && Main.rand.Next(6) == 0)
str = Lang.dialog(70);
else if (flag1 && Main.rand.Next(6) == 0)
str = Lang.dialog(71);
else if (flag5 && Main.rand.Next(6) == 0)
str = Lang.dialog(72);
else if (flag10 && Main.rand.Next(6) == 0)
str = Lang.dialog(238);
else if (Main.bloodMoon)
{
switch (Main.rand.Next(4))
{
case 0:
str = Lang.dialog(73);
break;
case 1:
str = Lang.dialog(74);
break;
case 2:
str = Lang.dialog(75);
break;
default:
str = Lang.dialog(76);
break;
}
}
else
{
switch (Main.rand.Next(5))
{
case 0:
str = !WorldGen.crimson ? Lang.dialog(77) : Lang.dialog(333);
break;
case 1:
str = Lang.dialog(78);
break;
case 2:
str = Lang.dialog(79);
break;
case 3:
str = Lang.dialog(80);
break;
default:
str = Lang.dialog(81);
break;
}
}
}
else if (this.type == 37)
{
if (Main.dayTime)
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(82);
break;
case 1:
str = Lang.dialog(83);
break;
default:
str = Lang.dialog(84);
break;
}
}
else if (Main.player[Main.myPlayer].statLifeMax < 300 || Main.player[Main.myPlayer].statDefense < 10)
{
switch (Main.rand.Next(4))
{
case 0:
str = Lang.dialog(85);
break;
case 1:
str = Lang.dialog(86);
break;
case 2:
str = Lang.dialog(87);
break;
default:
str = Lang.dialog(88);
break;
}
}
else
{
switch (Main.rand.Next(4))
{
case 0:
str = Lang.dialog(89);
break;
case 1:
str = Lang.dialog(90);
break;
case 2:
str = Lang.dialog(91);
break;
default:
str = Lang.dialog(92);
break;
}
}
}
else if (this.type == 38)
{
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (!NPC.downedBoss2 && Main.rand.Next(3) == 0)
str = Lang.dialog(93);
else if (Main.bloodMoon)
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(94);
break;
case 1:
str = Lang.dialog(95);
break;
default:
str = Lang.dialog(96);
break;
}
}
else if ((DD2Event.DownedInvasionT1 || DD2Event.Ongoing) && Main.rand.Next(5) == 0)
str = Language.GetTextValueWith("DemolitionistSpecialText.AfterDD2Start", substitutionObject);
else if (flag3 && Main.rand.Next(5) == 0)
str = Lang.dialog(97);
else if (flag3 && Main.rand.Next(5) == 0)
str = Lang.dialog(98);
else if (flag2 && Main.rand.Next(4) == 0)
str = Lang.dialog(99);
else if (flag4 && Main.rand.Next(4) == 0)
str = Lang.dialog(100);
else if (!Main.dayTime)
{
switch (Main.rand.Next(4))
{
case 0:
str = Lang.dialog(101);
break;
case 1:
str = Lang.dialog(102);
break;
case 2:
str = Lang.dialog(103);
break;
default:
str = Lang.dialog(104);
break;
}
}
else
{
switch (Main.rand.Next(5))
{
case 0:
str = Lang.dialog(105);
break;
case 1:
str = Lang.dialog(106);
break;
case 2:
str = Lang.dialog(107);
break;
case 3:
str = Lang.dialog(108);
break;
default:
str = Lang.dialog(109);
break;
}
}
}
else if (this.type == 54)
{
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (!flag7 && Main.rand.Next(2) == 0)
str = Lang.dialog(110);
else if (flag10 && Main.rand.Next(6) == 0)
str = Lang.dialog(237);
else if (Main.bloodMoon)
str = Lang.dialog(111);
else if (flag2 && Main.rand.Next(4) == 0)
str = Lang.dialog(112);
else if (Main.player[Main.myPlayer].head == 24)
{
str = Lang.dialog(113);
}
else
{
switch (Main.rand.Next(6))
{
case 0:
str = Lang.dialog(114);
break;
case 1:
str = Lang.dialog(115);
break;
case 2:
str = Lang.dialog(116);
break;
case 3:
str = Lang.dialog(117);
break;
case 4:
str = Lang.dialog(118);
break;
default:
str = Lang.dialog(119);
break;
}
}
}
else if (this.type == 105)
str = Lang.dialog(120);
else if (this.type == 107)
{
if (this.homeless)
{
switch (Main.rand.Next(5))
{
case 0:
str = Lang.dialog(121);
break;
case 1:
str = Lang.dialog(122);
break;
case 2:
str = Lang.dialog(123);
break;
case 3:
str = Lang.dialog(124);
break;
default:
str = Lang.dialog(125);
break;
}
}
else if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (flag7 && Main.rand.Next(5) == 0)
str = Lang.dialog(126);
else if (flag15 && Main.rand.Next(5) == 0)
{
str = Lang.dialog(309);
}
else
{
LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("GoblinTinkererChatter.", substitutionObject));
int num = Main.rand.Next(all.Length + 5);
if (num >= 5)
str = all[num - 5].FormatWith(substitutionObject);
else if (!Main.dayTime)
{
switch (num)
{
case 0:
str = Lang.dialog((int) sbyte.MaxValue);
break;
case 1:
str = Lang.dialog(128);
break;
case 2:
str = Lang.dialog(129);
break;
case 3:
str = Lang.dialog(130);
break;
default:
str = Lang.dialog(131);
break;
}
}
else
{
switch (num)
{
case 0:
str = Lang.dialog(132);
break;
case 1:
str = Lang.dialog(133);
break;
case 2:
str = Lang.dialog(134);
break;
case 3:
str = Lang.dialog(135);
break;
default:
str = Lang.dialog(136);
break;
}
}
}
}
else if (this.type == 106)
str = Lang.dialog(137);
else if (this.type == 108)
{
if (this.homeless)
{
int num = Main.rand.Next(3);
if (num == 0)
str = Lang.dialog(138);
else if (num == 1 && !Main.player[Main.myPlayer].Male)
{
str = Lang.dialog(139);
}
else
{
switch (num)
{
case 1:
str = Lang.dialog(140);
break;
case 2:
str = Lang.dialog(141);
break;
}
}
}
else if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (DD2Event.DownedInvasionT1 && Main.rand.Next(6) == 0)
str = Language.GetTextValueWith("WizardSpecialText.AfterDD2Tier1", substitutionObject);
else if (Main.player[Main.myPlayer].Male & flag17 && Main.rand.Next(6) == 0)
str = Lang.dialog(142);
else if (Main.player[Main.myPlayer].Male & flag6 && Main.rand.Next(6) == 0)
str = Lang.dialog(143);
else if (Main.player[Main.myPlayer].Male & flag8 && Main.rand.Next(6) == 0)
str = Lang.dialog(144);
else if (!Main.player[Main.myPlayer].Male & flag2 && Main.rand.Next(6) == 0)
str = Lang.dialog(145);
else if (!Main.player[Main.myPlayer].Male & flag7 && Main.rand.Next(6) == 0)
str = Lang.dialog(146);
else if (!Main.player[Main.myPlayer].Male & flag4 && Main.rand.Next(6) == 0)
str = Lang.dialog(147);
else if (!Main.dayTime)
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(148);
break;
case 1:
str = Lang.dialog(149);
break;
case 2:
str = Lang.dialog(150);
break;
}
}
else
{
switch (Main.rand.Next(5))
{
case 0:
str = Lang.dialog(151);
break;
case 1:
str = Lang.dialog(152);
break;
case 2:
str = Lang.dialog(153);
break;
case 3:
str = Lang.dialog(154);
break;
default:
str = Lang.dialog(155);
break;
}
}
}
else if (this.type == 123)
str = Lang.dialog(156);
else if (this.type == 124)
{
if (this.homeless)
{
switch (Main.rand.Next(4))
{
case 0:
str = Lang.dialog(157);
break;
case 1:
str = Lang.dialog(158);
break;
case 2:
str = Lang.dialog(159);
break;
default:
str = Lang.dialog(160);
break;
}
}
else if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (Main.bloodMoon)
{
switch (Main.rand.Next(4))
{
case 0:
str = Lang.dialog(161);
break;
case 1:
str = Lang.dialog(162);
break;
case 2:
str = Lang.dialog(163);
break;
default:
str = Lang.dialog(164);
break;
}
}
else if (flag8 && Main.rand.Next(6) == 0)
str = Lang.dialog(165);
else if (flag3 && Main.rand.Next(6) == 0)
{
str = Lang.dialog(166);
}
else
{
LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("MechanicChatter.", substitutionObject));
int num = Main.rand.Next(3 + all.Length);
str = num < 3 ? (num != 0 ? (num != 1 ? Lang.dialog(169) : Lang.dialog(168)) : Lang.dialog(167)) : all[num - 3].FormatWith(substitutionObject);
}
}
else if (this.type == 22)
{
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (Main.bloodMoon)
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(170);
break;
case 1:
str = Lang.dialog(171);
break;
default:
str = Lang.dialog(172);
break;
}
}
else if (!Main.dayTime)
{
str = Lang.dialog(173);
}
else
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(174);
break;
case 1:
str = Lang.dialog(175);
break;
default:
str = Lang.dialog(176);
break;
}
}
}
else if (this.type == 142)
{
int num = Main.rand.Next(3);
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
{
str = this.GetBirthdayDialog();
}
else
{
switch (num)
{
case 0:
str = Lang.dialog(224);
break;
case 1:
str = Lang.dialog(225);
break;
case 2:
str = Lang.dialog(226);
break;
}
}
}
else if (this.type == 160)
{
int num = Main.rand.Next(6);
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (flag4 && Main.rand.Next(6) == 0)
str = Lang.dialog(232);
else if (flag9 && Main.rand.Next(6) == 0)
{
str = Lang.dialog(236);
}
else
{
switch (num)
{
case 0:
str = Lang.dialog(231);
break;
case 1:
str = Lang.dialog(233);
break;
case 2:
str = Lang.dialog(234);
break;
case 3:
str = Lang.dialog(235);
break;
case 4:
str = Lang.dialog(240);
break;
case 5:
str = Lang.dialog(241);
break;
}
}
}
else if (this.type == 178)
{
int num = Main.rand.Next(5);
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (Main.bloodMoon && Main.rand.Next(3) == 0)
str = Lang.dialog(245);
else if (flag13 && Main.rand.Next(6) == 0)
str = Lang.dialog(246);
else if (flag12 && Main.rand.Next(6) == 0)
{
str = Lang.dialog(247);
}
else
{
switch (num)
{
case 0:
str = Lang.dialog(242);
break;
case 1:
str = Lang.dialog(243);
break;
case 2:
str = Lang.dialog(244);
break;
case 3:
str = Lang.dialog(248);
break;
case 4:
str = Lang.dialog(249);
break;
}
}
}
else if (this.type == 207)
{
int num = Main.rand.Next(3);
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (flag12 && Main.rand.Next(6) == 0)
{
str = Lang.dialog(260);
}
else
{
switch (num)
{
case 0:
str = Lang.dialog(257);
break;
case 1:
str = Lang.dialog(258);
break;
case 2:
str = Lang.dialog(259);
break;
}
}
}
else if (this.type == 208)
{
int num = Main.rand.Next(7);
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (DD2Event.DownedInvasionT1 && Main.rand.Next(5) == 0)
str = Language.GetTextValueWith("PartyGirlSpecialText.AfterDD2Tier1", substitutionObject);
else if (Main.player[Main.myPlayer].Male && Main.rand.Next(5) == 0)
str = Lang.dialog(268);
else if (flag15 && Main.rand.Next(5) == 0)
{
str = Lang.dialog(310);
}
else
{
switch (num)
{
case 0:
str = Lang.dialog(265);
break;
case 1:
str = Lang.dialog(266);
break;
case 2:
str = Lang.dialog(267);
break;
case 3:
str = Lang.dialog(269);
break;
case 4:
str = Lang.dialog(270);
break;
case 5:
str = Lang.dialog(271);
break;
case 6:
str = Lang.dialog(272);
break;
}
}
}
else if (this.type == 209)
{
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (flag12 && Main.rand.Next(6) == 0)
str = Lang.dialog(284);
else if (flag11 && Main.rand.Next(6) == 0)
{
str = Lang.dialog(283);
}
else
{
LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("CyborgChatter.", substitutionObject));
int num = Main.rand.Next(5 + all.Length);
if (num >= 5)
str = all[num - 5].FormatWith(substitutionObject);
else if (num == 0)
str = Lang.dialog(280);
else if (num == 1)
str = Lang.dialog(281);
else if (num == 2)
str = Lang.dialog(282);
else if (num == 3)
str = Lang.dialog(285);
else if (num == 4)
str = Lang.dialog(286);
}
}
else if (this.type == 227)
{
int num = Main.rand.Next(5);
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (Main.hardMode && Main.rand.Next(7) == 0)
str = Lang.dialog(250);
else if (flag14 && Main.rand.Next(6) == 0)
{
str = Lang.dialog(251);
}
else
{
switch (num)
{
case 0:
str = Lang.dialog(252);
break;
case 1:
str = Lang.dialog(253);
break;
case 2:
str = Lang.dialog(254);
break;
case 3:
str = Lang.dialog((int) byte.MaxValue);
break;
case 4:
str = Lang.dialog(256);
break;
}
}
}
else if (this.type == 228)
{
int num = Main.rand.Next(4);
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (flag2 && Main.rand.Next(6) == 0)
{
str = Lang.dialog(263);
}
else
{
switch (num)
{
case 0:
str = Lang.dialog(261);
break;
case 1:
str = Lang.dialog(262);
break;
case 2:
str = Lang.dialog(264);
break;
case 3:
str = Language.GetTextValueWith("WitchDoctorSpecialText.AfterDD2Tier1", substitutionObject);
break;
}
}
}
else if (this.type == 229)
{
LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("PirateChatter.", substitutionObject));
int num = Main.rand.Next(6 + all.Length);
if (num >= 6)
str = all[num - 6].FormatWith(substitutionObject);
else if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (!Main.player[Main.myPlayer].Male && Main.rand.Next(5) == 0)
{
str = Lang.dialog(276);
}
else
{
switch (num)
{
case 0:
str = Lang.dialog(273);
break;
case 1:
str = Lang.dialog(274);
break;
case 2:
str = Lang.dialog(275);
break;
case 3:
str = Lang.dialog(277);
break;
case 4:
str = Lang.dialog(278);
break;
case 5:
str = Lang.dialog(279);
break;
}
}
}
else if (this.type == 354)
str = Lang.dialog(Main.rand.Next(315, 319));
else if (this.type == 353)
{
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (Main.bloodMoon)
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(304);
break;
case 1:
str = Lang.dialog(305);
break;
case 2:
str = Lang.dialog(306);
break;
}
}
else if (Main.dayTime && Main.time < 16200.0 && Main.rand.Next(3) == 0)
str = Lang.dialog(311);
else if (Main.player[Main.myPlayer].Male && Main.rand.Next(3) == 0)
{
switch (Main.rand.Next(2))
{
case 0:
str = Lang.dialog(293);
break;
case 1:
str = Lang.dialog(300);
break;
}
}
else if (!Main.player[Main.myPlayer].Male && Main.rand.Next(3) == 0)
{
switch (Main.rand.Next(3))
{
case 0:
str = Lang.dialog(291);
break;
case 1:
str = Lang.dialog(292);
break;
case 2:
str = Lang.dialog(312);
break;
}
}
else if (flag14 & flag7 & flag2 & flag3 && Main.rand.Next(5) == 0)
str = Lang.dialog(307);
else if (flag14 && Main.rand.Next(5) == 0)
str = Lang.dialog(302);
else if (flag6 && Main.rand.Next(5) == 0)
str = Lang.dialog(303);
else if (flag13 && Main.rand.Next(5) == 0)
{
str = Lang.dialog(308);
}
else
{
LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("StylistChatter.", substitutionObject));
int num1 = Main.moonPhase < 3 ? 5 : 4;
int num2 = Main.rand.Next(num1 + all.Length);
if (num2 >= num1)
str = all[num2 - num1].FormatWith(substitutionObject);
else if (Main.moonPhase < 3)
{
switch (num2)
{
case 0:
str = Lang.dialog(287);
break;
case 1:
str = Lang.dialog(288);
break;
case 2:
str = Lang.dialog(289);
break;
case 3:
str = Lang.dialog(290);
break;
case 4:
str = Lang.dialog(294);
break;
}
}
else if (Main.moonPhase < 6)
{
switch (num2)
{
case 0:
str = Lang.dialog(295);
break;
case 1:
str = Lang.dialog(296);
break;
case 2:
str = Lang.dialog(297);
break;
case 3:
str = Lang.dialog(298);
break;
}
}
else
{
switch (num2)
{
case 0:
str = Lang.dialog(299);
break;
case 1:
str = Lang.dialog(301);
break;
case 2:
str = Lang.dialog(313);
break;
case 3:
str = Lang.dialog(314);
break;
}
}
}
}
else if (this.type == 368)
str = !BirthdayParty.PartyIsUp || Main.rand.Next(3) != 0 ? (!flag16 || Main.rand.Next(5) != 0 ? (!flag1 || Main.rand.Next(5) != 0 ? (!flag9 || Main.rand.Next(5) != 0 ? Lang.dialog(Main.rand.Next(322, 331)) : Lang.dialog(321)) : Lang.dialog(320)) : Lang.dialog(319)) : this.GetBirthdayDialog();
else if (this.type == 376)
str = Lang.dialog(Main.rand.Next(353, 356));
else if (this.type == 369)
{
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0)
str = this.GetBirthdayDialog();
else if (Main.bloodMoon)
str = Main.anglerQuestFinished ? Lang.dialog(Main.rand.Next(350, 353)) : Lang.dialog(Main.rand.Next(348, 350));
else if (!Main.anglerQuestFinished)
str = Lang.dialog(Main.rand.Next(334, 338));
else if (flag4 && Main.rand.Next(5) == 0)
{
str = Lang.dialog(347);
}
else
{
LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("AnglerChatter.", substitutionObject));
int num = Main.rand.Next(all.Length + 9);
str = num < 9 ? Lang.dialog(338 + num) : all[num - 9].FormatWith(substitutionObject);
}
}
else if (this.type == 453)
str = Lang.dialog(Main.rand.Next(356, 364));
else if (this.type == 441)
str = !(Main.rand.Next(6) == 0 & flag4) ? (!(Main.rand.Next(6) == 0 & flag3) ? (!(Main.rand.Next(6) == 0 & flag6) ? (!(Main.rand.Next(6) == 0 & flag1) ? Lang.dialog(Main.rand.Next(364, 370)) : Lang.dialog(374)) : Lang.dialog(373)) : Lang.dialog(372)) : Lang.dialog(371);
else if (this.type == 579)
str = Language.GetTextValue("BartenderSpecialText.FirstMeeting");
else if (this.type == 550)
str = Lang.BartenderChat(this);
return str;
}
public object Clone() => this.MemberwiseClone();
public void CheckDrowning()
{
bool flag = Collision.DrownCollision(this.position, this.width, this.height, 1f);
if (Main.netMode != 1)
{
if (flag)
{
if (++this.breathCounter >= 7)
{
this.breathCounter = 0;
--this.breath;
if (this.breath <= 0)
{
this.friendlyRegen = 0;
this.breath = 0;
this.life -= 2;
if (this.life % 24 < 2)
this.netUpdate = true;
if (this.life <= 0)
{
this.life = 1;
this.StrikeNPCNoInteraction(2, 0.0f, 0);
if (Main.netMode != 0)
NetMessage.SendData(28, number: this.whoAmI, number2: 2f);
}
}
}
}
else
{
this.breath += 3;
if (this.breath > 200)
this.breath = 200;
this.breathCounter = 0;
}
}
if (!flag || Main.rand.Next(20) != 0 || this.lavaWet || this.honeyWet)
return;
int num1 = 0;
int num2 = 0;
if (this.type == 369)
num2 = 8;
Dust.NewDust(new Vector2(this.position.X + (float) ((10 + num1) * this.direction), (float) ((double) this.position.Y + (double) num2 + 4.0)), this.width - 8, 8, 34, Scale: 1.2f);
}
public void TryPortalJumping()
{
if (!this.townNPC || Main.netMode == 1)
return;
PortalHelper.TryGoingThroughPortals((Entity) this);
}
public static void GetMeleeCollisionData(
Microsoft.Xna.Framework.Rectangle victimHitbox,
int enemyIndex,
ref int specialHitSetter,
ref float damageMultiplier,
ref Microsoft.Xna.Framework.Rectangle npcRect)
{
NPC npc1 = Main.npc[enemyIndex];
if (npc1.type >= 430 && npc1.type <= 436 && (double) npc1.ai[2] > 5.0)
{
int num = 34;
if (npc1.spriteDirection < 0)
{
npcRect.X -= num;
npcRect.Width += num;
}
else
npcRect.Width += num;
damageMultiplier *= 1.25f;
}
else if (npc1.type >= 494 && npc1.type <= 495 && (double) npc1.ai[2] > 5.0)
{
int num = 18;
if (npc1.spriteDirection < 0)
{
npcRect.X -= num;
npcRect.Width += num;
}
else
npcRect.Width += num;
damageMultiplier *= 1.25f;
}
else if (npc1.type == 460)
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 30, 14);
rectangle.X = (int) npc1.Center.X;
if (npc1.direction < 0)
rectangle.X -= rectangle.Width;
rectangle.Y = (int) npc1.position.Y + npc1.height - 20;
if (!victimHitbox.Intersects(rectangle))
return;
npcRect = rectangle;
damageMultiplier *= 1.35f;
}
else if (npc1.type == 417 && (double) npc1.ai[0] == 6.0 && (double) npc1.ai[3] > 0.0 && (double) npc1.ai[3] < 4.0)
{
Microsoft.Xna.Framework.Rectangle rectangle = Utils.CenteredRectangle(npc1.Center, new Vector2(100f));
if (!victimHitbox.Intersects(rectangle))
return;
npcRect = rectangle;
damageMultiplier *= 1.35f;
}
else if (npc1.type == 466)
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 30, 8);
rectangle.X = (int) npc1.Center.X;
if (npc1.direction < 0)
rectangle.X -= rectangle.Width;
rectangle.Y = (int) npc1.position.Y + npc1.height - 32;
if (!victimHitbox.Intersects(rectangle))
return;
npcRect = rectangle;
damageMultiplier *= 1.75f;
}
else if (npc1.type == 576 || npc1.type == 577)
{
NPC npc2 = npc1;
bool flag = true;
int y = npc2.frame.Y;
int num1 = 0;
int num2 = 0;
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 30, 8);
switch (y)
{
case 15:
specialHitSetter = 2;
rectangle.Width = 120;
rectangle.Height = 30;
num2 = 24;
break;
case 16:
specialHitSetter = 2;
rectangle.Width = 120;
rectangle.Height = 60;
num1 = 10;
break;
case 17:
specialHitSetter = 2;
rectangle.Width = 100;
rectangle.Height = 90;
num1 = 50;
break;
case 18:
specialHitSetter = 2;
rectangle.Width = 100;
rectangle.Height = 50;
num1 = 90;
num2 = 10;
break;
default:
flag = false;
break;
}
if (!flag)
return;
rectangle.X = (int) npc2.Center.X - num1 * npc2.direction;
if (npc2.direction < 0)
rectangle.X -= rectangle.Width;
rectangle.Y = (int) npc2.Center.Y - rectangle.Height + num2;
if (!victimHitbox.Intersects(rectangle))
return;
npcRect = rectangle;
damageMultiplier *= 1.75f;
}
else
{
if (npc1.type != 552 && npc1.type != 553 && npc1.type != 554 || (double) npc1.ai[0] <= 0.0 || (double) npc1.ai[0] >= 24.0)
return;
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 34, 14);
rectangle.X = (int) npc1.Center.X;
if (npc1.direction < 0)
rectangle.X -= rectangle.Width;
rectangle.Y = (int) npc1.position.Y + npc1.height - 20;
if (!victimHitbox.Intersects(rectangle))
return;
npcRect = rectangle;
damageMultiplier *= 1.35f;
}
}
public override string ToString() => "name:" + this.TypeName + ", active:" + this.active.ToString() + ", whoAmI:" + (object) this.whoAmI;
}
}