terraria-source-code/NPC.cs
2021-10-26 12:45:26 -04:00

50859 lines
1.8 MiB

// Decompiled with JetBrains decompiler
// Type: Terraria.NPC
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// 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.Chat;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.GameContent;
using Terraria.GameContent.Achievements;
using Terraria.GameContent.Creative;
using Terraria.GameContent.Drawing;
using Terraria.GameContent.Events;
using Terraria.GameContent.ItemDropRules;
using Terraria.GameContent.RGB;
using Terraria.GameContent.UI;
using Terraria.ID;
using Terraria.Localization;
using Terraria.Utilities;
using Terraria.WorldBuilding;
namespace Terraria
{
public class NPC : Entity
{
private const int NPC_TARGETS_START = 300;
public bool IsABestiaryIconDummy;
public bool ForcePartyHatOn;
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 MoonLordFightingDistance = 4500;
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 = 400;
public static int[] killCount = new int[663];
public static float waveKills = 0.0f;
public static int waveNumber = 0;
public const float nameOverIncrement = 0.025f;
public const float nameOverDistance = 350f;
public float nameOver;
public bool SpawnedFromStatue;
public bool dripping;
public bool drippingSlime;
public bool drippingSparkleSlime;
public static readonly int AFKTimeNeededForNoWorms = 300;
public int altTexture;
public int townNpcVariationIndex;
public Vector2 netOffset = 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;
public static bool freeCake = false;
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 bool needsUniqueInfoUpdate = true;
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[323];
public bool midas;
public bool ichor;
public bool onFire;
public bool onFire2;
public bool onFrostBurn;
public bool poisoned;
public bool markedByScytheWhip;
public bool markedByThornWhip;
public bool markedByFireWhip;
public bool markedByRainbowWhip;
public bool markedByBlandWhip;
public bool markedBySwordWhip;
public bool markedByMaceWhip;
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 savedGolfer = false;
public static bool boughtCat = false;
public static bool boughtDog = false;
public static bool boughtBunny = false;
public static bool combatBookWasUsed = 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 bool downedEmpressOfLight = false;
public static bool downedQueenSlime = 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[663];
public static int[] lazyNPCOwnedProjectileSearchArray = new int[200];
private static int spawnRate = NPC.defaultSpawnRate;
private static int maxSpawns = NPC.defaultMaxSpawns;
public int soundDelay;
public static CoinLossRevengeSystem RevengeManager = new CoinLossRevengeSystem();
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 int extraValue;
public bool dontTakeDamage;
public int netID;
public int statsAreScaledForThisManyPlayers;
public float strengthMultiplier = 1f;
public bool townNPC;
public static bool travelNPC = false;
public bool homeless;
public int homeTileX = -1;
public int homeTileY = -1;
public int housingCategory;
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 reflectsProjectiles;
public int lastPortalColorIndex;
public bool despawnEncouraged;
public static int[,] cavernMonsterType = new int[2, 3];
private static bool EoCKilledToday;
private static bool WoFKilledToday;
public static bool fairyLog = false;
private static int ignorePlayerInteractions = 0;
public static int ladyBugGoodLuckTime = 43200;
public static int ladyBugBadLuckTime = -10800;
private static int ladyBugRainTime = 1800;
public static int offSetDelayTime = 60;
public bool CanTalk => this.isLikeATownNPC && this.aiStyle == 7 && (double) this.velocity.Y == 0.0 && !NPCID.Sets.IsTownPet[this.type];
public bool CanBeTalkedTo => this.isLikeATownNPC && 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] = 50;
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] = 50;
numArray[0, 1, 0, 2] = 3;
numArray[0, 1, 1, 2] = 90;
numArray[0, 1, 0, 3] = 0;
numArray[0, 1, 1, 3] = 60;
numArray[0, 1, 0, 4] = 2;
numArray[0, 1, 1, 4] = 330;
numArray[0, 2, 0, 0] = 3;
numArray[0, 2, 1, 0] = 180;
numArray[0, 2, 0, 1] = 0;
numArray[0, 2, 1, 1] = 30;
numArray[0, 2, 0, 2] = 2;
numArray[0, 2, 1, 2] = 435;
numArray[0, 2, 0, 3] = 3;
numArray[0, 2, 1, 3] = 180;
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 string GetFullnameByID(int npcID)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == npcID)
return Main.npc[index].FullName;
}
return Lang.GetNPCNameValue(npcID);
}
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 int GetAttackDamage_ScaledByStrength(float normalDamage) => (int) ((double) normalDamage * (double) Main.GameModeInfo.EnemyDamageMultiplier * (double) this.strengthMultiplier);
public float GetAttackDamage_LerpBetweenFinalValuesFloat(float normalDamage, float expertDamage)
{
float amount = Main.expertMode ? 1f : 0.0f;
if (Main.GameModeInfo.IsJourneyMode)
amount = MathHelper.Clamp(this.strengthMultiplier - 1f, 0.0f, 1f);
return MathHelper.Lerp(normalDamage, expertDamage, amount);
}
public int GetAttackDamage_LerpBetweenFinalValues(float normalDamage, float expertDamage)
{
float amount = Main.expertMode ? 1f : 0.0f;
if (Main.GameModeInfo.IsJourneyMode)
amount = MathHelper.Clamp(this.strengthMultiplier - 1f, 0.0f, 1f);
return (int) MathHelper.Lerp(normalDamage, expertDamage, amount);
}
public int GetAttackDamage_ForProjectiles(float normalDamage, float expertDamage)
{
float amount = Main.expertMode ? 1f : 0.0f;
if (Main.GameModeInfo.IsJourneyMode)
amount = MathHelper.Clamp(this.strengthMultiplier - 1f, 0.0f, 1f);
return (int) MathHelper.Lerp(normalDamage, expertDamage, amount);
}
public int GetAttackDamage_ForProjectiles_MultiLerp(
float normalDamage,
float expertDamage,
float masterDamage)
{
float percent = Main.masterMode ? 1f : (Main.expertMode ? 0.5f : 0.0f);
if (Main.GameModeInfo.IsJourneyMode)
percent = MathHelper.Clamp(this.strengthMultiplier - 1f, 0.0f, 2f) / 2f;
return (int) Utils.MultiLerp(percent, normalDamage, expertDamage, masterDamage);
}
public bool isLikeATownNPC => this.type == 453 || this.townNPC;
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 < 663)
NPC.npcsFoundForCheckActive[npc.type] = true;
}
NPC.UpdateRGBPeriheralProbe();
}
public static void ClearFoundNPCTypesForBestiary()
{
for (int index = 0; index < NPC.npcsFoundForCheckActive.Length; ++index)
NPC.npcsFoundForCheckActive[index] = false;
}
public static void UpdateRGBPeriheralProbe()
{
int num1 = 0;
int num2 = Main.LocalPlayer.ZoneOverworldHeight ? 1 : 0;
if (NPC.npcsFoundForCheckActive[4])
num1 = 4;
if (NPC.npcsFoundForCheckActive[50])
num1 = 50;
if (num2 != 0 && Main.invasionType == 1)
num1 = -1;
if (NPC.npcsFoundForCheckActive[13])
num1 = 13;
if (NPC.npcsFoundForCheckActive[266])
num1 = 266;
if (NPC.npcsFoundForCheckActive[222])
num1 = 222;
if (NPC.npcsFoundForCheckActive[35])
num1 = 35;
if (NPC.npcsFoundForCheckActive[113])
num1 = 113;
if (num2 != 0 && Main.invasionType == 2)
num1 = -2;
if (NPC.npcsFoundForCheckActive[657])
num1 = 657;
if (NPC.npcsFoundForCheckActive[126] || NPC.npcsFoundForCheckActive[125])
num1 = 126;
if (NPC.npcsFoundForCheckActive[134])
num1 = 134;
if (NPC.npcsFoundForCheckActive[(int) sbyte.MaxValue])
num1 = (int) sbyte.MaxValue;
if (num2 != 0 && Main.invasionType == 3)
num1 = -3;
if (NPC.npcsFoundForCheckActive[262])
num1 = 262;
if (NPC.npcsFoundForCheckActive[245])
num1 = 245;
if (NPC.npcsFoundForCheckActive[636])
num1 = 636;
if (DD2Event.Ongoing)
num1 = -6;
if (num2 != 0 && Main.invasionType == 4)
num1 = -4;
if (NPC.npcsFoundForCheckActive[439])
num1 = 439;
if (NPC.npcsFoundForCheckActive[370])
num1 = 370;
if (NPC.npcsFoundForCheckActive[398])
num1 = 398;
CommonConditions.Boss.HighestTierBossOrEvent = num1;
}
public void SpawnWithHigherTime(int timeMult) => this.timeLeft = NPC.activeTime * timeMult;
public void EncourageDespawn(int despawnTime)
{
if (this.timeLeft > despawnTime)
this.timeLeft = despawnTime;
this.despawnEncouraged = true;
}
public void DiscourageDespawn(int despawnTime)
{
if (this.timeLeft < despawnTime)
this.timeLeft = despawnTime;
this.despawnEncouraged = false;
}
public static bool WouldBeEncouragedToDespawn(int aistyle, int type) => aistyle == 4 && Main.dayTime;
public static string getNewNPCName(int npcType) => NPC.getNewNPCNameInner(npcType);
private static string getNewNPCNameInner(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 "Isaac";
case 20:
return "Joseph";
case 21:
return "Kristian";
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(27))
{
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(21))
{
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 "Miles";
case 15:
return "Charles";
case 16:
return "Adam";
case 17:
return "Tyler";
case 18:
return "Jey";
case 19:
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;
case 588:
return Language.RandomFromCategory("GolferNames", WorldGen.genRand).Value;
case 633:
return Language.RandomFromCategory("BestiaryGirlNames", WorldGen.genRand).Value;
case 637:
return Language.RandomFromCategory("CatNames_Siamese", WorldGen.genRand).Value;
case 638:
return Language.RandomFromCategory("DogNames_Labrador", WorldGen.genRand).Value;
case 656:
return Language.RandomFromCategory("BunnyNames_White", WorldGen.genRand).Value;
default:
return "";
}
}
public NetworkText GetTypeNetName() => NetworkText.FromKey(Lang.GetNPCName(this.netID).Key);
public void GetLifeStats(out int statLife, out int statLifeMax)
{
statLife = this.life;
statLifeMax = this.lifeMax;
if (this.realLife == -1)
return;
statLife = Main.npc[this.realLife].life;
statLifeMax = Main.npc[this.realLife].lifeMax;
}
public float GetLifePercent()
{
int statLife;
int statLifeMax;
this.GetLifeStats(out statLife, out statLifeMax);
return (float) statLife / (float) statLifeMax;
}
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);
Main.npc[index].needsUniqueInfoUpdate = true;
}
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)
{
bool flag = false;
if (Main.npc[index].type == type)
{
flag = true;
}
else
{
switch (type)
{
case 46:
case 303:
case 337:
case 540:
if (Main.npc[index].type == 46 || Main.npc[index].type == 540 || Main.npc[index].type == 303 || Main.npc[index].type == 337)
{
flag = true;
goto label_19;
}
else
goto label_19;
case 55:
if (Main.npc[index].type == 230)
{
flag = true;
goto label_19;
}
else
break;
case 362:
case 364:
if (Main.npc[index].type == 362 || Main.npc[index].type == 363 || Main.npc[index].type == 364 || Main.npc[index].type == 365)
{
flag = true;
goto label_19;
}
else
goto label_19;
case 602:
if (Main.npc[index].type == 602 || Main.npc[index].type == 603)
{
flag = true;
goto label_19;
}
else
goto label_19;
case 608:
if (Main.npc[index].type == 608 || Main.npc[index].type == 609)
{
flag = true;
goto label_19;
}
else
goto label_19;
case 616:
case 617:
if (Main.npc[index].type == 616 || Main.npc[index].type == 617)
{
flag = true;
goto label_19;
}
else
goto label_19;
}
if (NPCID.Sets.IsDragonfly[type] && NPCID.Sets.IsDragonfly[Main.npc[index].type])
flag = true;
}
label_19:
if (flag)
{
++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 TypeToDefaultHeadIndex(int type)
{
switch (type)
{
case 0:
return 0;
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;
case 588:
return 25;
case 633:
return 26;
case 637:
return 27;
case 638:
return 33;
case 656:
return 39;
default:
return -1;
}
}
public static int DefaultHeadIndexToType(int headIndex)
{
switch (headIndex)
{
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;
case 25:
return 588;
case 26:
return 633;
case 27:
return 637;
case 33:
return 638;
case 39:
return 656;
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 = 16;
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, NPCSpawnParams spawnparams = default (NPCSpawnParams))
{
bool flag = false;
int Type = NPCID.FromNetId(id);
this.SetDefaults(0);
switch (id)
{
case -65:
this.SetDefaults_ForNetId(Type, spawnparams, 1.21f);
flag = false;
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_ForNetId(Type, spawnparams, 0.87f);
flag = false;
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_ForNetId(Type, spawnparams, 1.16f);
flag = false;
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_ForNetId(Type, spawnparams, 0.78f);
flag = false;
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_ForNetId(Type, spawnparams, 1.1f);
flag = false;
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_ForNetId(Type, spawnparams, 0.92f);
flag = false;
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_ForNetId(Type, spawnparams, 1.15f);
flag = false;
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_ForNetId(Type, spawnparams, 0.8f);
flag = false;
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_ForNetId(Type, spawnparams, 1.25f);
flag = false;
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_ForNetId(Type, spawnparams, 0.85f);
flag = false;
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_ForNetId(Type, spawnparams, 1.1f);
flag = false;
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_ForNetId(Type, spawnparams, 0.9f);
flag = false;
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_ForNetId(Type, spawnparams, 1.15f);
flag = false;
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_ForNetId(Type, spawnparams, 0.85f);
flag = false;
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_ForNetId(Type, spawnparams, 1.13f);
flag = false;
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_ForNetId(Type, spawnparams, 0.87f);
flag = false;
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_ForNetId(Type, spawnparams, 1.07f);
flag = false;
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_ForNetId(Type, spawnparams, 0.93f);
flag = false;
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_ForNetId(Type, spawnparams, 1.1f);
flag = false;
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_ForNetId(Type, spawnparams, 0.9f);
flag = false;
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_ForNetId(Type, spawnparams, 1.05f);
flag = false;
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_ForNetId(Type, spawnparams, 0.87f);
flag = false;
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_ForNetId(Type, spawnparams, 1.15f);
flag = false;
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_ForNetId(Type, spawnparams, 1.1f);
flag = false;
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_ForNetId(Type, spawnparams, 0.85f);
flag = false;
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_ForNetId(Type, spawnparams, 0.9f);
flag = false;
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_ForNetId(Type, spawnparams, 1.1f);
flag = false;
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_ForNetId(Type, spawnparams, 1.15f);
flag = false;
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_ForNetId(Type, spawnparams, 1.08f);
flag = false;
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_ForNetId(Type, spawnparams, 0.92f);
flag = false;
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_ForNetId(Type, spawnparams, 1.13f);
flag = false;
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_ForNetId(Type, spawnparams, 0.87f);
flag = false;
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_ForNetId(Type, spawnparams, 1.11f);
flag = false;
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_ForNetId(Type, spawnparams, 0.89f);
flag = false;
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_ForNetId(Type, spawnparams, 1.13f);
flag = false;
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_ForNetId(Type, spawnparams, 0.93f);
flag = false;
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_ForNetId(Type, spawnparams, 1.15f);
flag = false;
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_ForNetId(Type, spawnparams, 0.85f);
flag = false;
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_ForNetId(Type, spawnparams, 1.1f);
flag = false;
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_ForNetId(Type, spawnparams, 0.9f);
flag = false;
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_ForNetId(Type, spawnparams, 1.15f);
flag = false;
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_ForNetId(Type, spawnparams, 0.85f);
flag = false;
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_ForNetId(Type, spawnparams, 1.15f);
flag = false;
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_ForNetId(Type, spawnparams, 0.85f);
flag = false;
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_ForNetId(Type, spawnparams, 1.2f);
flag = false;
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_ForNetId(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_ForNetId(Type, spawnparams, 0.9f);
flag = false;
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_ForNetId(Type, spawnparams, 0.8f);
flag = false;
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_ForNetId(Type, spawnparams, 1.2f);
flag = false;
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_ForNetId(Type, spawnparams, 0.85f);
flag = false;
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_ForNetId(Type, spawnparams, 1.15f);
flag = false;
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_ForNetId(Type, spawnparams, 1.15f);
flag = false;
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_ForNetId(Type, spawnparams, 0.9f);
flag = false;
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_ForNetId(Type, spawnparams, 1.15f);
flag = false;
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_ForNetId(Type, spawnparams, 0.85f);
flag = false;
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_ForNetId(Type, 1.1f);
flag = true;
this.damage = 18;
this.defense = 6;
this.life = 60;
this.color = new Color(143, 215, 93, 100);
this.value = 500f;
break;
case -9:
this.SetDefaults_ForNetId(Type, 1.2f);
flag = true;
this.damage = 15;
this.defense = 7;
this.life = 45;
this.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, 0, 100);
this.value = 10f;
break;
case -8:
this.SetDefaults_ForNetId(Type, 1.025f);
flag = true;
this.damage = 12;
this.defense = 4;
this.life = 35;
this.color = new Color((int) byte.MaxValue, 30, 0, 100);
this.value = 8f;
break;
case -7:
this.SetDefaults_ForNetId(Type, 1.2f);
flag = true;
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;
break;
case -6:
this.SetDefaults_ForNetId(Type, 1.05f);
flag = true;
this.damage = 15;
this.defense = 4;
this.life = 45;
this.color = new Color(0, 0, 0, 50);
this.value = 20f;
break;
case -5:
this.SetDefaults_ForNetId(Type, 0.9f);
flag = true;
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;
break;
case -4:
this.SetDefaults_ForNetId(Type, 0.6f);
flag = true;
this.damage = 5;
this.defense = 5;
this.life = 150;
this.knockBackResist *= 1.4f;
this.color = new Color(250, 30, 90, 90);
this.value = 10000f;
this.rarity = 2;
break;
case -3:
this.SetDefaults_ForNetId(Type, 0.9f);
flag = true;
this.damage = 6;
this.defense = 0;
this.life = 14;
this.knockBackResist *= 1.2f;
this.color = new Color(0, 220, 40, 100);
this.value = 3f;
break;
case -2:
this.SetDefaults_ForNetId(Type, 0.9f);
flag = true;
this.damage = 45;
this.defense = 20;
this.life = 90;
this.knockBackResist *= 1.2f;
this.value = 100f;
break;
case -1:
this.SetDefaults_ForNetId(Type, 0.6f);
flag = true;
this.damage = 45;
this.defense = 10;
this.life = 90;
this.knockBackResist *= 1.2f;
this.value = 100f;
break;
default:
return;
}
this.netID = id;
this.lifeMax = this.life;
this.defDamage = this.damage;
this.defDefense = this.defense;
if (!flag)
return;
this.ScaleStats(spawnparams.playerCountForMultiplayerDifficultyOverride, spawnparams.gameModeData, spawnparams.strengthMultiplierOverride);
this.life = this.lifeMax;
}
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_ForNetId(int Type, float scaleOverride) => this.SetDefaults(Type);
public void SetDefaults_ForNetId(int Type, NPCSpawnParams spawnparams, float scaleOverride) => this.SetDefaults(Type, spawnparams.WithScale(scaleOverride));
public void SetDefaults(int Type, NPCSpawnParams spawnparams = default (NPCSpawnParams))
{
if (spawnparams.gameModeData == null)
spawnparams.gameModeData = Main.GameModeInfo;
if (Main.getGoodWorld && spawnparams.sizeScaleOverride.HasValue)
{
ref NPCSpawnParams local = ref spawnparams;
float? sizeScaleOverride1 = spawnparams.sizeScaleOverride;
float? sizeScaleOverride2 = spawnparams.sizeScaleOverride;
float? nullable1 = spawnparams.sizeScaleOverride;
float? nullable2 = sizeScaleOverride2.HasValue & nullable1.HasValue ? new float?(sizeScaleOverride2.GetValueOrDefault() * nullable1.GetValueOrDefault()) : new float?();
float? nullable3;
if (!(sizeScaleOverride1.HasValue & nullable2.HasValue))
{
nullable1 = new float?();
nullable3 = nullable1;
}
else
nullable3 = new float?(sizeScaleOverride1.GetValueOrDefault() + nullable2.GetValueOrDefault());
float? nullable4 = nullable3;
float num = 2f;
float? nullable5;
if (!nullable4.HasValue)
{
nullable2 = new float?();
nullable5 = nullable2;
}
else
nullable5 = new float?(nullable4.GetValueOrDefault() / num);
local.sizeScaleOverride = nullable5;
}
if (Type < 0)
{
this.SetDefaultsFromNetId(Type, spawnparams);
}
else
{
this.waterMovementSpeed = this.lavaMovementSpeed = 0.5f;
this.honeyMovementSpeed = 0.25f;
this.netOffset *= 0.0f;
this.altTexture = 0;
this.townNpcVariationIndex = 0;
this.nameOver = 0.0f;
this.takenDamageMultiplier = 1f;
this.extraValue = 0;
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.needsUniqueInfoUpdate = true;
this.netStream = (byte) 32;
bool flag = false;
this.netID = 0;
this.netAlways = false;
this.netSpam = 0;
this.SpawnedFromStatue = false;
this.statsAreScaledForThisManyPlayers = 0;
this.strengthMultiplier = 1f;
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 < 323; ++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.markedByScytheWhip = false;
this.markedByThornWhip = false;
this.markedByFireWhip = false;
this.markedByRainbowWhip = false;
this.markedByBlandWhip = false;
this.markedBySwordWhip = false;
this.markedByMaceWhip = false;
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.housingCategory = 0;
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.reflectsProjectiles = false;
this.canGhostHeal = true;
this.javelined = false;
this.daybreak = false;
this.celled = false;
this.dryadBane = false;
this.betsysCurse = false;
this.oiled = false;
this.despawnEncouraged = 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.SpawnWithHigherTime(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 = 150;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 800f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.alpha = (int) byte.MaxValue;
}
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 = 800f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.dontCountMe = true;
this.alpha = (int) byte.MaxValue;
}
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 = 150;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 800f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.dontCountMe = true;
this.alpha = (int) byte.MaxValue;
}
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;
this.rarity = 1;
}
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.SpawnWithHigherTime(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.NPCHit21;
this.knockBackResist = 0.8f;
this.DeathSound = SoundID.NPCDeath24;
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 = 60;
this.defense = 25;
this.lifeMax = 800;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath2;
this.knockBackResist = 0.2f;
this.value = 10000f;
this.rarity = 1;
}
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.SpawnWithHigherTime(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.SpawnWithHigherTime(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;
this.coldDamage = 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.NPCDeath32;
this.knockBackResist = 0.25f;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.npcSlots = 0.5f;
this.SpawnWithHigherTime(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.NPCDeath32;
this.knockBackResist = 0.25f;
this.value = 500f;
this.SpawnWithHigherTime(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.NPCDeath32;
this.knockBackResist = 0.25f;
this.value = 100f;
this.SpawnWithHigherTime(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.NPCDeath32;
this.knockBackResist = 0.25f;
this.value = 100f;
this.SpawnWithHigherTime(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;
this.value = (float) Item.buyPrice(gold: 5);
}
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 = (float) Item.buyPrice(gold: 5);
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;
this.rarity = 1;
}
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;
this.rarity = 1;
}
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;
this.rarity = 1;
}
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;
this.rarity = 1;
}
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;
this.rarity = 1;
}
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;
this.rarity = 1;
}
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.SpawnWithHigherTime(30);
this.boss = true;
this.value = 50000f;
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 = 300f;
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 = 200f;
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.SpawnWithHigherTime(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.SpawnWithHigherTime(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.SpawnWithHigherTime(2);
this.buffImmune[20] = true;
}
else if (this.type == 240)
{
this.noGravity = true;
this.width = 36;
this.height = 36;
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.SpawnWithHigherTime(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;
this.rarity = 2;
}
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.5f;
this.noGravity = true;
this.noTileCollide = true;
this.SpawnWithHigherTime(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 = 18;
this.defense = 8;
this.lifeMax = 70;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.alpha = 100;
this.value = 90f;
flag = true;
this.knockBackResist = 0.6f;
}
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;
this.dontCountMe = true;
}
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 = 50000f;
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 = 12;
this.height = 10;
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 = 250000f;
this.boss = true;
this.netAlways = true;
this.SpawnWithHigherTime(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 = 10;
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 = 200;
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.SpawnWithHigherTime(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 = 1000000f;
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;
this.chaseable = false;
}
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 = 100000f;
this.boss = true;
this.netAlways = true;
this.SpawnWithHigherTime(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.SpawnWithHigherTime(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 = 12;
this.height = 10;
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 = 10;
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;
this.rarity = 1;
}
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 = 5;
}
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;
this.rarity = 1;
}
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.NPCDeath43;
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 = 18;
this.defense = 0;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 130f;
}
else if (this.type == 514)
{
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 7;
this.defense = 16;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 130f;
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 = 7;
this.defense = 20;
this.lifeMax = 60;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = 130f;
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 = 50;
this.height = 31;
this.aiStyle = 3;
this.damage = 38;
this.defense = 22;
this.lifeMax = 110;
this.HitSound = SoundID.NPCHit31;
this.DeathSound = SoundID.NPCDeath34;
this.knockBackResist = 0.4f;
this.value = 175f;
this.buffImmune[31] = false;
}
else if (this.type == 509)
{
this.width = 40;
this.height = 31;
this.aiStyle = 44;
this.damage = 34;
this.defense = 18;
this.lifeMax = 90;
this.knockBackResist = 0.3f;
this.HitSound = SoundID.NPCHit32;
this.DeathSound = SoundID.NPCDeath35;
this.value = 1775f;
this.buffImmune[31] = false;
}
else if (this.type == 580)
{
this.width = 26;
this.height = 26;
this.aiStyle = 3;
this.damage = 25;
this.defense = 10;
this.lifeMax = 80;
this.HitSound = SoundID.NPCHit31;
this.DeathSound = SoundID.NPCDeath34;
this.knockBackResist = 0.5f;
this.value = 80f;
this.buffImmune[31] = false;
this.npcSlots = 0.8f;
}
else if (this.type == 581)
{
this.width = 30;
this.height = 22;
this.aiStyle = 44;
this.damage = 29;
this.defense = 8;
this.lifeMax = 60;
this.knockBackResist = 0.5f;
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.SpawnWithHigherTime(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.SpawnWithHigherTime(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 = 52;
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.netAlways = 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;
this.rarity = 1;
}
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 = 38;
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 = 38;
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 = 38;
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 = 38;
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 = 38;
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 = 38;
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;
this.rarity = 1;
}
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 = 15;
this.defense = 5;
this.lifeMax = 50;
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.7f;
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 = 6;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit11;
this.DeathSound = SoundID.NPCDeath15;
this.knockBackResist = 0.8f;
this.value = 100f;
}
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;
}
else if (this.type == 582)
{
this.width = 18;
this.height = 18;
this.aiStyle = 3;
this.damage = 12;
this.defense = 4;
this.lifeMax = 45;
this.HitSound = SoundID.NPCHit31;
this.DeathSound = SoundID.NPCDeath34;
this.knockBackResist = 0.75f;
this.value = 40f;
this.buffImmune[31] = false;
this.npcSlots = 0.4f;
}
else if (this.type == 583 || this.type == 584 || this.type == 585)
{
this.width = 18;
this.height = 20;
this.aiStyle = 112;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
switch (this.type)
{
case 583:
this.catchItem = (short) 4068;
break;
case 584:
this.catchItem = (short) 4069;
break;
case 585:
this.catchItem = (short) 4070;
break;
}
this.noGravity = true;
this.rarity = 2;
for (int index = 0; index < 323; ++index)
this.buffImmune[index] = true;
}
else if (this.type == 586)
{
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 40;
this.defense = 20;
this.lifeMax = 400;
this.HitSound = SoundID.NPCHit18;
this.DeathSound = SoundID.NPCDeath21;
this.knockBackResist = 0.0f;
this.value = 1000f;
this.buffImmune[31] = false;
this.alpha = (int) byte.MaxValue;
this.rarity = 1;
}
else if (this.type == 587)
{
this.width = 32;
this.height = 18;
this.aiStyle = 44;
this.damage = 35;
this.defense = 18;
this.lifeMax = 300;
this.HitSound = SoundID.NPCHit1;
this.knockBackResist = 0.0f;
this.DeathSound = SoundID.NPCDeath1;
this.value = 1000f;
this.buffImmune[31] = false;
this.alpha = (int) byte.MaxValue;
this.rarity = 1;
}
else if (this.type == 588)
{
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 == 589)
{
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 == 590 || this.type == 591)
{
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 == 592)
{
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) 4274;
this.rarity = 3;
}
else if (this.type == 593)
{
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) 4274;
this.rarity = 3;
}
else if (this.type == 594)
{
this.width = 20;
this.height = 20;
this.aiStyle = 113;
this.damage = 0;
this.defense = 0;
this.knockBackResist = 0.3f;
this.lifeMax = 1;
this.DeathSound = SoundID.NPCDeath63;
this.value = 0.0f;
this.noGravity = true;
}
else if (this.type >= 595 && this.type <= 601)
{
this.timeLeft *= 3;
this.width = 10;
this.height = 10;
this.aiStyle = 114;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.25f;
this.noGravity = true;
if (this.type == 601)
this.rarity = 3;
this.catchItem = (short) (this.type - 595 + 4334);
}
else if (this.type == 602)
{
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) 4359;
}
else if (this.type == 603)
{
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) 4359;
}
else if (this.type == 604 || this.type == 605)
{
this.width = 10;
this.height = 10;
this.aiStyle = 115;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.25f;
this.noGravity = true;
if (this.type == 605)
this.rarity = 3;
this.catchItem = (short) (this.type - 604 + 4361);
}
else if (this.type == 606)
{
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) 4363;
this.friendly = true;
}
else if (this.type == 607)
{
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) 4373;
}
else if (this.type == 608)
{
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) 4374;
}
else if (this.type == 609)
{
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) 4374;
}
else if (this.type == 610)
{
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) 4375;
}
else if (this.type == 611)
{
this.width = 18;
this.height = 34;
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) 4395;
this.npcSlots = 0.4f;
}
else if (this.type == 612 || this.type == 613)
{
this.width = 10;
this.height = 10;
this.aiStyle = 116;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.npcSlots = 0.25f;
if (this.type == 613)
this.rarity = 3;
this.catchItem = (short) (this.type - 612 + 4418);
this.waterMovementSpeed = 1f;
this.lavaMovementSpeed = 1f;
this.honeyMovementSpeed = 1f;
}
else if (this.type == 614)
{
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = (LegacySoundStyle) null;
this.catchItem = (short) 1338;
}
else if (this.type == 615)
{
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;
}
else if (this.type == 616 || this.type == 617)
{
this.width = 22;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
this.catchItem = (short) (this.type - 616 + 4464);
}
else if (this.type == 618)
{
this.noGravity = true;
this.width = 100;
this.height = 100;
this.aiStyle = 117;
this.damage = 55;
this.defense = 24;
this.lifeMax = 7000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.0f;
this.value = (float) Item.buyPrice(gold: 2);
this.noTileCollide = true;
this.rarity = 1;
}
else if (this.type == 619)
{
this.npcSlots = 1f;
this.width = 44;
this.height = 44;
this.aiStyle = 5;
this.damage = 60;
this.defense = 16;
this.lifeMax = 1000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.knockBackResist = 0.0f;
this.value = 500f;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 620)
{
this.lifeMax = 5000;
this.defense = 30;
this.damage = 70;
this.width = 34;
this.height = 58;
this.aiStyle = 107;
this.HitSound = SoundID.DD2_DrakinHurt;
this.DeathSound = SoundID.DD2_DrakinDeath;
this.knockBackResist = 0.0f;
this.value = (float) Item.buyPrice(silver: 75);
this.npcSlots = 0.0f;
this.lavaImmune = true;
this.LazySetLiquidMovementDD2();
this.netAlways = true;
this.alpha = (int) byte.MaxValue;
this.rarity = 1;
}
else if (this.type == 621)
{
this.npcSlots = 5f;
this.width = 28;
this.height = 28;
this.aiStyle = 6;
this.damage = 90;
this.defense = 0;
this.lifeMax = 6000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.value = (float) Item.buyPrice(silver: 75);
this.alpha = (int) byte.MaxValue;
this.rarity = 1;
}
else if (this.type == 622)
{
this.width = 28;
this.height = 28;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 60;
this.defense = 30;
this.lifeMax = 6000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.dontCountMe = true;
this.npcSlots = 0.0f;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 623)
{
this.width = 28;
this.height = 28;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 50;
this.defense = 40;
this.lifeMax = 6000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.0f;
this.behindTiles = true;
this.dontCountMe = true;
this.npcSlots = 0.0f;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 624)
{
this.width = 14;
this.height = 30;
this.aiStyle = 3;
this.damage = 10;
this.defense = 0;
this.lifeMax = 25;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 1f;
this.rarity = 1;
}
else if (this.type == 625)
{
this.width = 22;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.5f;
}
else if (this.type == 626 || this.type == 627)
{
this.width = 16;
this.height = 20;
this.aiStyle = 118;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 1f;
if (this.type == 627)
this.rarity = 3;
this.catchItem = (short) 4480;
if (this.type == 627)
this.catchItem = (short) 4482;
}
else if (this.type == 628)
{
this.width = 22;
this.height = 40;
this.aiStyle = 119;
this.damage = 15;
this.defense = 0;
this.lifeMax = 50;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.0f;
this.value = 50f;
}
else if (this.type == 629)
{
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 == 630)
{
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 == 631)
{
this.width = 36;
this.height = 48;
this.scale = 1.1f;
this.aiStyle = 3;
this.damage = 85;
this.defense = 35;
this.lifeMax = 1000;
this.HitSound = SoundID.NPCHit41;
this.DeathSound = SoundID.NPCDeath43;
this.knockBackResist = 0.1f;
this.value = 50000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
}
else if (this.type == 632)
{
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 == 633)
{
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 == 634)
{
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 == 635)
{
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 == 636)
{
this.noGravity = true;
this.width = 100;
this.height = 100;
this.aiStyle = 120;
this.damage = 80;
this.defense = 50;
this.lifeMax = 70000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath65;
this.knockBackResist = 0.0f;
this.value = 250000f;
this.noTileCollide = true;
this.boss = true;
this.Opacity = 0.0f;
}
else if (this.type == 637 || this.type == 638)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 28;
if (this.type == 637)
this.height = 20;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.5f;
this.housingCategory = 1;
}
else if (this.type >= 639 && this.type <= 645)
{
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) (4831 + (this.type - 639));
}
else if (this.type >= 646 && this.type <= 652)
{
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) (4838 + (this.type - 646));
}
else if (this.type == 653)
{
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.lavaImmune = true;
this.catchItem = (short) 4845;
}
else if (this.type == 654)
{
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.lavaImmune = true;
this.catchItem = (short) 4847;
}
else if (this.type == 655)
{
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.lavaImmune = true;
this.catchItem = (short) 4849;
}
else if (this.type == 656)
{
this.townNPC = true;
this.friendly = true;
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.5f;
this.housingCategory = 1;
}
else if (this.type == 657)
{
this.width = 114;
this.height = 100;
this.aiStyle = 121;
this.damage = 60;
this.defense = 26;
this.lifeMax = 18000;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath64;
this.lavaImmune = true;
this.knockBackResist = 0.0f;
this.value = 60000f;
this.buffImmune[20] = true;
this.buffImmune[31] = true;
this.boss = true;
}
else if (this.type == 658 || this.type == 659)
{
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 40;
this.defense = 35;
this.lifeMax = 150;
this.scale = 1f;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.buffImmune[20] = true;
}
else if (this.type == 660)
{
this.width = 40;
this.height = 30;
this.aiStyle = 14;
this.damage = 50;
this.defense = 30;
this.lifeMax = 120;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath1;
this.knockBackResist = 0.8f;
this.scale = 1f;
this.buffImmune[20] = true;
}
else if (this.type == 661)
{
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.lavaImmune = true;
this.catchItem = (short) 4961;
this.rarity = 4;
}
else if (this.type == 662)
{
this.width = 18;
this.height = 40;
this.aiStyle = 122;
this.damage = 75;
this.defense = 22;
this.lifeMax = 500;
this.HitSound = SoundID.NPCHit1;
this.DeathSound = SoundID.NPCDeath6;
this.knockBackResist = 0.2f;
this.value = 0.0f;
flag = true;
this.noTileCollide = true;
this.lavaImmune = true;
this.trapImmune = true;
this.noGravity = true;
}
if (flag)
{
for (int index = 0; index < 323; ++index)
this.buffImmune[index] = true;
}
if (Main.dedServ)
this.frame = new Microsoft.Xna.Framework.Rectangle();
else if (TextureAssets.Npc[this.type] != null && TextureAssets.Npc[this.type].IsLoaded)
this.frame = new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Npc[this.type].Width(), TextureAssets.Npc[this.type].Height() / Main.npcFrameCount[this.type]);
else
this.setFrameSize = true;
if (spawnparams.sizeScaleOverride.HasValue)
{
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 = spawnparams.sizeScaleOverride.Value;
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.getGoodWorld)
this.getGoodAdjustments();
this.ScaleStats(spawnparams.playerCountForMultiplayerDifficultyOverride, spawnparams.gameModeData, spawnparams.strengthMultiplierOverride);
this.life = this.lifeMax;
}
}
private void getGoodAdjustments()
{
if (this.type == 13)
{
this.scale *= 1.4f;
this.defense += 2;
}
else if (this.type == 14)
{
this.scale *= 1.4f;
this.defense += 2;
}
else if (this.type == 15)
{
this.scale *= 1.4f;
this.defense += 2;
}
else if (this.type == 35)
this.scale *= 1.25f;
else if (this.type == 36)
this.scale *= 1.15f;
else if (this.type == 113)
{
this.scale *= 0.65f;
this.lifeMax = (int) ((double) this.lifeMax * 1.5);
this.defense += 3;
}
else if (this.type == 114)
{
this.scale *= 0.65f;
this.lifeMax = (int) ((double) this.lifeMax * 1.5);
this.defense += 3;
}
else if (this.type == 115)
this.scale *= 1.4f;
else if (this.type == 116)
this.scale *= 1.4f;
else if (this.type == 125)
this.scale *= 0.8f;
else if (this.type == 126)
this.scale *= 0.8f;
else if (this.type == (int) sbyte.MaxValue)
this.scale *= 1.1f;
else if (this.type == 128)
this.scale *= 1.1f;
else if (this.type == 129)
this.scale *= 1.1f;
else if (this.type == 130)
this.scale *= 1.1f;
else if (this.type == 131)
this.scale *= 1.1f;
else if (this.type == 134)
this.scale *= 1.3f;
else if (this.type == 135)
this.scale *= 1.3f;
else if (this.type == 136)
this.scale *= 1.3f;
else if (this.type == 139)
this.scale *= 1.3f;
else if (this.type == 222)
this.scale *= 1.2f;
else if (this.type == 245)
this.scale *= 0.5f;
else if (this.type == 246)
this.scale *= 0.5f;
else if (this.type == 247 || this.type == 248)
this.scale *= 0.5f;
else if (this.type == 249)
this.scale *= 0.5f;
else if (this.type == 262)
{
this.scale *= 1.3f;
}
else
{
if (this.type != 266)
return;
this.defense = (int) ((double) this.defense * 1.5);
this.damage = (int) ((double) this.damage * 1.2);
this.scale *= 1.1f;
}
}
private void LazySetLiquidMovementDD2()
{
this.waterMovementSpeed = 1f;
this.lavaMovementSpeed = 1f;
this.honeyMovementSpeed = 1f;
}
public static void SetWorldSpecificMonstersByWorldID()
{
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 NPCSpawnParams GetMatchingSpawnParams() => new NPCSpawnParams()
{
sizeScaleOverride = new float?(-1f),
playerCountForMultiplayerDifficultyOverride = new int?(this.statsAreScaledForThisManyPlayers),
strengthMultiplierOverride = new float?(this.strengthMultiplier)
};
public void ScaleStats(
int? activePlayersCount,
GameModeData gameModeData,
float? strengthOverride)
{
if ((!NPCID.Sets.NeedsExpertScaling.IndexInRange<bool>(this.type) || !NPCID.Sets.NeedsExpertScaling[this.type]) && (this.lifeMax <= 5 || this.damage == 0 || this.friendly || this.townNPC))
return;
float strength = 1f;
if (strengthOverride.HasValue)
strength = strengthOverride.Value;
else if (gameModeData.IsJourneyMode)
{
CreativePowers.DifficultySliderPower power = CreativePowerManager.Instance.GetPower<CreativePowers.DifficultySliderPower>();
if (power != null && power.GetIsUnlocked())
strength = power.StrengthMultiplierToGiveNPCs;
}
NPCStrengthHelper npcStrengthHelper = new NPCStrengthHelper(gameModeData, strength);
if (npcStrengthHelper.IsExpertMode)
this.ScaleStats_ApplyExpertTweaks();
this.ScaleStats_ApplyGameMode(gameModeData);
if (npcStrengthHelper.IsExpertMode)
{
int numPlayers = !activePlayersCount.HasValue ? NPC.GetActivePlayerCount() : activePlayersCount.Value;
this.statsAreScaledForThisManyPlayers = numPlayers;
float balance;
float boost;
NPC.GetStatScalingFactors(numPlayers, out balance, out boost);
float bossAdjustment = 1f;
if (npcStrengthHelper.IsMasterMode)
bossAdjustment = 0.85f;
this.ScaleStats_ApplyMultiplayerStats(numPlayers, balance, boost, bossAdjustment);
}
this.strengthMultiplier = strength;
this.ScaleStats_UseStrengthMultiplier(this.strengthMultiplier);
if ((this.type < 0 ? 0 : (NPCID.Sets.ProjectileNPC[this.type] ? 1 : 0)) == 0 && this.lifeMax < 6)
this.lifeMax = 6;
this.life = this.lifeMax;
this.defDamage = this.damage;
this.defDefense = this.defense;
}
public void ScaleStats_UseStrengthMultiplier(float strength)
{
if ((this.type < 0 ? 0 : (NPCID.Sets.ProjectileNPC[this.type] ? 1 : 0)) == 0)
this.lifeMax = (int) ((double) this.lifeMax * (double) strength);
this.damage = (int) ((double) this.damage * (double) strength);
}
public void ScaleStats_Old(int? activePlayersCount, GameModeData gameModeData)
{
if (!gameModeData.IsExpertMode || (this.type < 0 || !NPCID.Sets.NeedsExpertScaling[this.type]) && (this.life <= 5 || this.damage == 0 || this.friendly || this.townNPC))
return;
this.ScaleStats_ApplyExpertTweaks();
this.ScaleStats_ApplyGameMode(gameModeData);
int numPlayers = !activePlayersCount.HasValue ? NPC.GetActivePlayerCount() : activePlayersCount.Value;
this.statsAreScaledForThisManyPlayers = numPlayers;
float balance;
float boost;
NPC.GetStatScalingFactors(numPlayers, out balance, out boost);
float bossAdjustment = 1f;
if (gameModeData.IsMasterMode)
bossAdjustment = 0.85f;
this.ScaleStats_ApplyMultiplayerStats(numPlayers, balance, boost, bossAdjustment);
}
public static float GetBalance()
{
float balance;
NPC.GetStatScalingFactors(NPC.GetActivePlayerCount(), out balance, out float _);
return balance;
}
private float GetMyBalance()
{
if (this.statsAreScaledForThisManyPlayers <= 1)
return 1f;
float balance;
NPC.GetStatScalingFactors(this.statsAreScaledForThisManyPlayers, out balance, out float _);
return balance;
}
private static int GetActivePlayerCount()
{
if (Main.netMode == 0)
return 1;
int num = 0;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index] != null && Main.player[index].active)
++num;
}
return num;
}
private void ScaleStats_ApplyExpertTweaks()
{
bool flag = this.type >= 0 && NPCID.Sets.ProjectileNPC[this.type];
if (!NPCID.Sets.DontDoHardmodeScaling[this.type] && 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)
return;
this.damage = (int) ((double) this.damage * 0.600000023841858);
this.lifeMax = (int) ((double) this.lifeMax * 0.800000011920929);
this.defense = (int) ((double) this.defense * 0.800000011920929);
}
private void ScaleStats_ApplyGameMode(GameModeData gameModeData)
{
int num1 = this.type < 0 ? 0 : (NPCID.Sets.ProjectileNPC[this.type] ? 1 : 0);
int num2 = 0;
if (Main.getGoodWorld)
++num2;
if (num1 == 0)
{
this.value = (float) (int) ((double) this.value * ((double) gameModeData.EnemyMoneyDropMultiplier + (double) num2));
this.lifeMax = (int) ((double) this.lifeMax * ((double) gameModeData.EnemyMaxLifeMultiplier + (double) num2));
}
this.damage = (int) ((double) this.damage * ((double) gameModeData.EnemyDamageMultiplier + (double) num2));
this.knockBackResist *= gameModeData.KnockbackToEnemiesMultiplier;
if (!Main.getGoodWorld)
return;
this.damage += this.damage / 3;
}
private void ScaleStats_ApplyMultiplayerStats(
int numPlayers,
float balance,
float boost,
float bossAdjustment)
{
if (this.type == 5)
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) bossAdjustment);
if (this.type == 4)
this.lifeMax = (int) ((double) this.lifeMax * 0.65 * (double) balance * (double) bossAdjustment);
if (this.type >= 13 && this.type <= 15)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) balance * (double) bossAdjustment);
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.type == 267)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.85 * (double) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 0.9);
this.scale *= 1.05f;
for (float num = 1f; (double) num < (double) balance; num += 0.34f)
{
if ((double) this.knockBackResist < 0.1)
{
this.knockBackResist = 0.0f;
break;
}
this.knockBackResist *= 0.8f;
}
}
if (this.type == 50)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 0.8);
}
if (this.type == 471)
this.lifeMax = (int) ((double) this.lifeMax * 0.85 * ((double) balance * 2.0 + 1.0) / 3.0);
if (this.type == 472)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.85 * ((double) balance + 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) balance * (double) bossAdjustment);
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) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 1.1);
}
else if (this.type == 36)
{
this.lifeMax = (int) ((double) this.lifeMax * 1.3 * (double) balance * (double) bossAdjustment);
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) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 1.5);
}
else if (this.type == 115)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) balance);
if (numPlayers > 4)
this.knockBackResist = 0.0f;
else if (numPlayers > 1)
this.knockBackResist *= 1f - boost;
this.defense += 6;
}
else if (this.type == 116)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) balance);
if (numPlayers > 4)
this.knockBackResist = 0.0f;
else if (numPlayers > 1)
this.knockBackResist *= 1f - boost;
}
else if (this.type == 117 || this.type == 118 || this.type == 119)
this.lifeMax = (int) ((double) this.lifeMax * 0.8);
if (this.type == 657)
this.lifeMax = (int) ((double) this.lifeMax * 0.800000011920929 * (double) balance * (double) bossAdjustment);
if (this.type >= 658 && this.type <= 660)
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) balance * (double) bossAdjustment);
if (this.type >= 134 && this.type <= 136)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) balance * (double) bossAdjustment);
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) balance * 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) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 0.85);
}
if (this.type >= 125 && this.type <= 126)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 0.85);
}
if (this.type == 262)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 1.15);
}
else if (this.type == 264)
{
this.lifeMax = (int) ((double) this.lifeMax * (double) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 1.15);
}
if (this.type == 636)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.7 * (double) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 1.15);
}
if (this.type >= 245 && this.type <= 249)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 0.8);
}
if (this.type == 370)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.6 * (double) balance * (double) bossAdjustment);
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) balance * (double) bossAdjustment);
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) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 0.75);
}
if (this.type == 551)
{
this.lifeMax = (int) ((double) this.lifeMax * 0.75 * (double) balance * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 0.65);
}
else if (NPCID.Sets.BelongsToInvasionOldOnesArmy[this.type])
{
int num = 7;
this.lifeMax = (int) ((double) this.lifeMax * (double) ((float) ((double) balance * (double) (num - 1) + 1.0) / (float) num) * (double) bossAdjustment);
}
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 * (double) bossAdjustment);
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 * (double) bossAdjustment);
this.damage = (int) ((double) this.damage * 0.75);
break;
}
this.defDefense = this.defense;
this.defDamage = this.damage;
this.life = this.lifeMax;
}
private static void GetStatScalingFactors(int numPlayers, out float balance, out float boost)
{
balance = 1f;
boost = 0.35f;
for (int index = 1; index < numPlayers; ++index)
{
balance += boost;
boost += (float) ((1.0 - (double) boost) / 3.0);
}
if ((double) balance > 8.0)
balance = (float) (((double) balance * 2.0 + 8.0) / 3.0);
if ((double) balance <= 1000.0)
return;
balance = 1000f;
}
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;
case 621:
num1 = 623;
index1 = 0;
break;
case 622:
case 623:
num1 = 621;
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 (123208 instructions)
}
public void AI_122_PirateGhost()
{
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlaySound(SoundID.NPCHit6, this.position);
}
NPCAimedTarget targetData = this.GetTargetData();
if (targetData.Invalid)
{
this.TargetClosest();
targetData = this.GetTargetData();
}
if (targetData.Invalid)
{
this.velocity = this.velocity * 0.9f;
this.alpha = Utils.Clamp<int>(this.alpha + 5, 0, (int) byte.MaxValue);
if (this.alpha < (int) byte.MaxValue)
return;
this.StrikeNPCNoInteraction(9999, 0.0f, 0);
}
else
{
this.alpha = Utils.Clamp<int>(this.alpha - 5, 0, (int) byte.MaxValue);
this.velocity = this.velocity.MoveTowards(Vector2.Zero.MoveTowards(targetData.Center - this.Center, 4f), 0.1333333f);
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == this.type && index != this.whoAmI)
{
Vector2 vector2 = Main.npc[index].Center - this.Center;
if ((double) vector2.Length() < 50.0)
{
vector2.Normalize();
vector2 *= 0.1f;
this.velocity = this.velocity - vector2;
this.velocity.X -= vector2.X * 1f;
}
}
}
}
}
public void AI_000_TransformBoundNPC(int playerID, int npcType)
{
this.Transform(npcType);
Main.BestiaryTracker.Chats.RegisterChatStartWith(this);
Main.player[playerID].SetTalkNPC(this.whoAmI);
if (Main.netMode != 2)
return;
NetMessage.SendData(40, number: playerID);
}
private void AI_065_Butterflies()
{
float num1 = this.ai[0];
float num2 = this.ai[1];
Color color;
if (this.type == 661)
{
color = Main.hslToRgb((float) ((double) Main.GlobalTimeWrappedHourly * 0.330000013113022 % 1.0), 1f, 0.5f);
Lighting.AddLight(this.Center, color.ToVector3() * 0.3f + Vector3.One * 0.1f);
int num3 = 60;
bool flag = false;
int num4 = 50;
NPCAimedTarget targetData = this.GetTargetData();
if (targetData.Invalid || (double) targetData.Center.Distance(this.Center) >= 300.0)
flag = true;
if (!targetData.Invalid && targetData.Type == NPCTargetType.Player && !Main.player[this.target].ZoneHallow)
{
num4 = num3;
flag = true;
}
this.ai[2] = MathHelper.Clamp(this.ai[2] + (float) flag.ToDirectionInt(), 0.0f, (float) num4);
if ((double) this.ai[2] >= (double) num3)
{
this.active = false;
if (Main.netMode == 1)
return;
NetMessage.SendData(23, number: this.whoAmI);
return;
}
this.Opacity = Utils.GetLerpValue((float) num3, (float) num4 / 2f, this.ai[2], true);
if ((double) this.ai[2] > 0.0)
{
int num5 = 1;
for (int index = 0; index < num5; ++index)
{
if (Main.rand.Next(5) == 0)
{
float num6 = MathHelper.Lerp(0.9f, 0.6f, this.Opacity);
int dustIndex = Dust.NewDust(this.position, this.width, this.height, 267, newColor: (Main.hslToRgb((float) ((double) Main.GlobalTimeWrappedHourly * 0.300000011920929 % 1.0), 1f, 0.5f) * 0.5f));
Main.dust[dustIndex].position = this.Center + Main.rand.NextVector2Circular((float) this.width, (float) this.height);
Main.dust[dustIndex].velocity *= Main.rand.NextFloat() * 0.8f;
Main.dust[dustIndex].velocity += this.velocity * 0.6f;
Main.dust[dustIndex].noGravity = true;
Main.dust[dustIndex].fadeIn = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.699999988079071 * (double) num6);
Main.dust[dustIndex].scale = 0.35f;
if (dustIndex != 6000)
{
Dust dust = Dust.CloneDust(dustIndex);
dust.scale /= 2f;
dust.fadeIn *= 0.85f;
dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue) * 0.5f;
}
}
}
}
this.dontTakeDamage = (double) this.ai[2] >= (double) (num4 / 2);
}
if (Main.netMode != 1)
{
if ((double) this.ai[2] == 0.0 && this.type != 661)
{
int num7 = 0;
int num8 = 4;
int num9 = 6;
int num10 = 3;
int num11 = 7;
int num12 = 2;
int num13 = 1;
int num14 = 5;
int num15 = Main.rand.Next(100);
this.ai[2] = (float) (1 + (num15 != 0 ? (num15 >= 3 ? (num15 >= 9 ? (num15 >= 19 ? (num15 >= 34 ? (num15 >= 53 ? (num15 >= 75 ? num7 : num8) : num9) : num10) : num11) : num12) : num13) : num14));
}
if ((double) this.ai[3] == 0.0)
this.ai[3] = (float) Main.rand.Next(75, 111) * 0.01f;
--this.localAI[0];
if ((double) this.localAI[0] <= 0.0)
{
this.localAI[0] = (float) Main.rand.Next(90, 240);
this.TargetClosest();
float num16 = Math.Abs(this.Center.X - Main.player[this.target].Center.X);
if ((double) num16 > 700.0 && (double) this.localAI[3] == 0.0)
{
float num17 = (float) Main.rand.Next(50, 151) * 0.01f;
if ((double) num16 > 1000.0)
num17 = (float) Main.rand.Next(150, 201) * 0.01f;
else if ((double) num16 > 850.0)
num17 = (float) Main.rand.Next(100, 151) * 0.01f;
int num18 = this.direction * Main.rand.Next(100, 251);
int num19 = Main.rand.Next(-50, 51);
if ((double) this.position.Y > (double) Main.player[this.target].position.Y - 100.0)
num19 -= Main.rand.Next(100, 251);
float num20 = num17 / (float) Math.Sqrt((double) (num18 * num18 + num19 * num19));
num1 = (float) num18 * num20;
num2 = (float) num19 * num20;
}
else
{
this.localAI[3] = 1f;
double num21 = (double) Main.rand.Next(26, 301) * 0.00999999977648258;
int num22 = Main.rand.Next(-100, 101);
int num23 = Main.rand.Next(-100, 101);
double num24 = Math.Sqrt((double) (num22 * num22 + num23 * num23));
float num25 = (float) (num21 / num24);
num1 = (float) num22 * num25;
num2 = (float) num23 * num25;
}
this.netUpdate = true;
}
}
this.scale = this.ai[3];
int num26 = 60;
this.velocity.X = (this.velocity.X * (float) (num26 - 1) + num1) / (float) num26;
this.velocity.Y = (this.velocity.Y * (float) (num26 - 1) + num2) / (float) num26;
if ((double) this.velocity.Y > 0.0)
{
int num27 = 3;
int index1 = (int) this.Center.X / 16;
int num28 = (int) this.Center.Y / 16;
for (int index2 = num28; index2 < num28 + num27; ++index2)
{
if (Main.tile[index1, index2] != null && (Main.tile[index1, index2].nactive() && Main.tileSolid[(int) Main.tile[index1, index2].type] || Main.tile[index1, index2].liquid > (byte) 0))
{
num2 *= -1f;
if ((double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.9f;
}
}
}
if ((double) this.velocity.Y < 0.0)
{
int num29 = 30;
bool flag = false;
int index3 = (int) this.Center.X / 16;
int num30 = (int) this.Center.Y / 16;
for (int index4 = num30; index4 < num30 + num29; ++index4)
{
if (Main.tile[index3, index4] != null && Main.tile[index3, index4].nactive() && Main.tileSolid[(int) Main.tile[index3, index4].type])
flag = true;
}
if (!flag)
{
num2 *= -1f;
if ((double) this.velocity.Y < 0.0)
this.velocity.Y *= 0.9f;
}
}
if ((double) this.localAI[1] > 0.0)
{
--this.localAI[1];
}
else
{
this.localAI[1] = 15f;
if (this.type == 661)
this.localAI[1] = 10f;
float num31 = 0.0f;
Vector2 zero = Vector2.Zero;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.active && npc.damage > 0 && !npc.friendly && (double) npc.Hitbox.Distance(this.Center) <= 100.0)
{
++num31;
zero += this.DirectionFrom(npc.Center);
}
}
if ((double) num31 > 0.0)
{
this.velocity = this.velocity + zero / num31 * 2f;
if ((double) this.velocity.Length() > 16.0)
this.velocity = this.velocity.SafeNormalize(Vector2.Zero) * 16f;
}
}
if (this.collideX)
{
num1 = (double) this.velocity.X >= 0.0 ? -Math.Abs(num1) : Math.Abs(num1);
this.velocity.X *= -0.2f;
}
if ((double) this.velocity.X < 0.0)
this.direction = -1;
if ((double) this.velocity.X > 0.0)
this.direction = 1;
this.ai[0] = num1;
this.ai[1] = num2;
if (this.type == 356)
this.catchItem = (short) (1994.0 + (double) this.ai[2] - 1.0);
if (this.type != 653)
return;
this.position = this.position + this.netOffset;
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.6f, 0.3f, 0.1f);
if (Main.rand.Next(60) == 0)
{
Vector2 position = this.position;
int width = this.width;
int height = this.height;
color = new Color();
Color newColor = color;
int index = Dust.NewDust(position, width, height, 6, Alpha: 254, newColor: newColor);
Main.dust[index].velocity *= 0.0f;
}
this.position = this.position - this.netOffset;
}
public static Color AI_121_QueenSlime_GetDustColor() => Color.Lerp(new Color(0, 160, (int) byte.MaxValue), Color.Lerp(new Color(200, 200, 200), new Color((int) byte.MaxValue, 80, (int) byte.MaxValue), Main.rand.NextFloat()), Main.rand.NextFloat());
private void AI_121_QueenSlime_FlyMovement()
{
this.noTileCollide = true;
this.noGravity = true;
float num1 = 14f;
float moveSpeed = 0.1f;
float num2 = 250f;
this.TargetClosest();
Vector2 vector2 = this.Center;
if (this.timeLeft > 10)
{
if (!Collision.CanHit((Entity) this, (Entity) Main.player[this.target]))
{
bool flag = false;
Vector2 center = Main.player[this.target].Center;
for (int index = 0; index < 16; ++index)
{
float num3 = (float) (16 * index);
Point tileCoordinates = (center + new Vector2(0.0f, -num3)).ToTileCoordinates();
if (WorldGen.SolidOrSlopedTile(tileCoordinates.X, tileCoordinates.Y))
{
vector2 = center + new Vector2(0.0f, (float) (-(double) num3 + 16.0)) - this.Center;
flag = true;
break;
}
}
if (!flag)
vector2 = center - this.Center;
}
else
vector2 = Main.player[this.target].Center + new Vector2(0.0f, -num2) - this.Center;
}
else
vector2 = this.Center + new Vector2(500f * (float) this.direction, -num2) - this.Center;
float num4 = vector2.Length();
if ((double) Math.Abs(vector2.X) < 40.0)
vector2.X = this.velocity.X;
if ((double) num4 > 100.0 && ((double) this.velocity.X < -12.0 && (double) vector2.X > 0.0 || (double) this.velocity.X > 12.0 && (double) vector2.X < 0.0))
moveSpeed = 0.2f;
Vector2 desiredVelocity;
if ((double) num4 < 40.0)
desiredVelocity = this.velocity;
else if ((double) num4 < 80.0)
{
vector2.Normalize();
desiredVelocity = vector2 * (num1 * 0.65f);
}
else
{
vector2.Normalize();
desiredVelocity = vector2 * num1;
}
this.SimpleFlyMovement(desiredVelocity, moveSpeed);
this.rotation = this.velocity.X * 0.1f;
if ((double) this.rotation > 0.5)
this.rotation = 0.5f;
if ((double) this.rotation >= -0.5)
return;
this.rotation = -0.5f;
}
private void AI_121_QueenSlime()
{
int Damage1 = 30;
int Damage2 = 40;
int num1 = Main.expertMode ? 1 : 0;
float num2 = 1f;
bool flag1 = false;
bool flag2 = this.life <= this.lifeMax / 2;
if ((double) this.localAI[0] == 0.0)
{
this.ai[1] = -100f;
this.localAI[0] = (float) this.lifeMax;
this.TargetClosest();
this.netUpdate = true;
}
Lighting.AddLight(this.Center, 1f, 0.7f, 0.9f);
int num3 = 500;
if (Main.player[this.target].dead || (double) Math.Abs(this.Center.X - Main.player[this.target].Center.X) / 16.0 > (double) num3)
{
this.TargetClosest();
if (Main.player[this.target].dead || (double) Math.Abs(this.Center.X - Main.player[this.target].Center.X) / 16.0 > (double) num3)
{
this.EncourageDespawn(10);
if ((double) Main.player[this.target].Center.X < (double) this.Center.X)
this.direction = 1;
else
this.direction = -1;
}
}
if (!Main.player[this.target].dead && this.timeLeft > 10 && !flag2 && (double) this.ai[3] >= 300.0 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0)
{
this.ai[0] = 2f;
this.ai[1] = 0.0f;
if (Main.netMode != 1)
{
this.netUpdate = true;
this.TargetClosest(false);
Point tileCoordinates1 = this.Center.ToTileCoordinates();
Point tileCoordinates2 = Main.player[this.target].Center.ToTileCoordinates();
Vector2 vector2 = Main.player[this.target].Center - this.Center;
int num4 = 10;
int num5 = 0;
int num6 = 7;
int num7 = 0;
bool flag3 = false;
if ((double) this.ai[3] >= 360.0 || (double) vector2.Length() > 2000.0)
{
if ((double) this.ai[3] > 360.0)
this.ai[3] = 360f;
flag3 = true;
num7 = 100;
}
while (!flag3 && num7 < 100)
{
++num7;
int index1 = Main.rand.Next(tileCoordinates2.X - num4, tileCoordinates2.X + num4 + 1);
int index2 = Main.rand.Next(tileCoordinates2.Y - num4, tileCoordinates2.Y + 1);
if ((index2 < tileCoordinates2.Y - num6 || index2 > tileCoordinates2.Y + num6 || index1 < tileCoordinates2.X - num6 || index1 > tileCoordinates2.X + num6) && (index2 < tileCoordinates1.Y - num5 || index2 > tileCoordinates1.Y + num5 || index1 < tileCoordinates1.X - num5 || index1 > tileCoordinates1.X + num5) && !Main.tile[index1, index2].nactive())
{
int index3 = index2;
int num8 = 0;
if ((!Main.tile[index1, index3].nactive() || !Main.tileSolid[(int) Main.tile[index1, index3].type] ? 0 : (!Main.tileSolidTop[(int) Main.tile[index1, index3].type] ? 1 : 0)) != 0)
{
num8 = 1;
}
else
{
for (; num8 < 150 && index3 + num8 < Main.maxTilesY; ++num8)
{
int index4 = index3 + num8;
if ((!Main.tile[index1, index4].nactive() || !Main.tileSolid[(int) Main.tile[index1, index4].type] ? 0 : (!Main.tileSolidTop[(int) Main.tile[index1, index4].type] ? 1 : 0)) != 0)
{
--num8;
break;
}
}
}
int index5 = index2 + num8;
bool flag4 = true;
if (flag4 && Main.tile[index1, index5].lava())
flag4 = false;
if (flag4 && !Collision.CanHitLine(this.Center, 0, 0, Main.player[this.target].Center, 0, 0))
flag4 = false;
if (flag4)
{
this.localAI[1] = (float) (index1 * 16 + 8);
this.localAI[2] = (float) (index5 * 16 + 16);
break;
}
}
}
if (num7 >= 100)
{
Vector2 bottom = Main.player[(int) Player.FindClosest(this.position, this.width, this.height)].Bottom;
this.localAI[1] = bottom.X;
this.localAI[2] = bottom.Y;
this.ai[3] = 0.0f;
}
}
}
if (!flag2 && (!Collision.CanHitLine(this.Center, 0, 0, Main.player[this.target].Center, 0, 0) || (double) Math.Abs(this.Top.Y - Main.player[this.target].Bottom.Y) > 320.0))
{
this.ai[3] += 1.5f;
}
else
{
float num9 = this.ai[3];
--this.ai[3];
if ((double) this.ai[3] < 0.0)
{
if (Main.netMode != 1 && (double) num9 > 0.0)
this.netUpdate = true;
this.ai[3] = 0.0f;
}
}
if (this.timeLeft <= 10 && (flag2 && (double) this.ai[0] != 0.0 || !flag2 && (double) this.ai[0] != 3.0))
{
this.ai[0] = !flag2 ? 3f : 0.0f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.ai[3] = 0.0f;
this.netUpdate = true;
}
this.noTileCollide = false;
this.noGravity = false;
if (flag2)
{
++this.localAI[3];
if ((double) this.localAI[3] >= 24.0)
this.localAI[3] = 0.0f;
if ((double) this.ai[0] == 4.0 && (double) this.ai[2] == 1.0)
this.localAI[3] = 6f;
if ((double) this.ai[0] == 5.0 && (double) this.ai[2] != 1.0)
this.localAI[3] = 7f;
}
switch ((int) this.ai[0])
{
case 0:
if (flag2)
{
this.AI_121_QueenSlime_FlyMovement();
}
else
{
this.noTileCollide = false;
this.noGravity = false;
if ((double) this.velocity.Y == 0.0)
{
this.velocity.X *= 0.8f;
if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1)
this.velocity.X = 0.0f;
}
}
if (this.timeLeft > 10 && (flag2 || (double) this.velocity.Y == 0.0))
{
++this.ai[1];
int num10 = 60;
if (flag2)
num10 = 120;
if ((double) this.ai[1] > (double) num10)
{
this.ai[1] = 0.0f;
if (flag2)
{
Player player = Main.player[this.target];
this.ai[0] = Main.rand.Next(2) == 1 ? 5f : 4f;
if ((double) this.ai[0] == 4.0)
{
this.ai[2] = 1f;
if (player != null && player.active && !player.dead && ((double) player.Bottom.Y < (double) this.Bottom.Y || (double) Math.Abs(player.Center.X - this.Center.X) > 250.0))
{
this.ai[0] = 5f;
this.ai[2] = 0.0f;
}
}
}
else
{
switch (Main.rand.Next(3))
{
case 1:
this.ai[0] = 4f;
break;
case 2:
this.ai[0] = 5f;
break;
default:
this.ai[0] = 3f;
break;
}
}
this.netUpdate = true;
break;
}
break;
}
break;
case 1:
this.rotation = 0.0f;
++this.ai[1];
num2 = (float) (0.5 + (double) MathHelper.Clamp(this.ai[1] / 30f, 0.0f, 1f) * 0.5);
if ((double) this.ai[1] >= 30.0 && Main.netMode != 1)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.netUpdate = true;
this.TargetClosest();
}
if (Main.netMode == 1 && (double) this.ai[1] >= 60.0)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.TargetClosest();
}
Color dustColor1 = NPC.AI_121_QueenSlime_GetDustColor();
dustColor1.A = (byte) 150;
for (int index6 = 0; index6 < 10; ++index6)
{
int index7 = Dust.NewDust(this.position + Vector2.UnitX * -20f, this.width + 40, this.height, 4, this.velocity.X, this.velocity.Y, 50, dustColor1, 1.5f);
Main.dust[index7].noGravity = true;
Main.dust[index7].velocity *= 2f;
}
break;
case 2:
this.rotation = 0.0f;
++this.ai[1];
num2 = (float) (0.5 + (double) MathHelper.Clamp((float) ((60.0 - (double) this.ai[1]) / 60.0), 0.0f, 1f) * 0.5);
if ((double) this.ai[1] >= 60.0)
flag1 = true;
if ((double) this.ai[1] == 60.0)
Gore.NewGore(this.Center + new Vector2(-40f, (float) (-this.height / 2)), this.velocity, 1258);
if ((double) this.ai[1] >= 60.0 && Main.netMode != 1)
{
this.Bottom = new Vector2(this.localAI[1], this.localAI[2]);
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
if (Main.netMode == 1 && (double) this.ai[1] >= 120.0)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
}
if (!flag1)
{
Color dustColor2 = NPC.AI_121_QueenSlime_GetDustColor();
dustColor2.A = (byte) 150;
for (int index8 = 0; index8 < 10; ++index8)
{
int index9 = Dust.NewDust(this.position + Vector2.UnitX * -20f, this.width + 40, this.height, 4, this.velocity.X, this.velocity.Y, 50, dustColor2, 1.5f);
Main.dust[index9].noGravity = true;
Main.dust[index9].velocity *= 0.5f;
}
break;
}
break;
case 3:
this.rotation = 0.0f;
if ((double) this.velocity.Y == 0.0)
{
this.velocity.X *= 0.8f;
if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1)
this.velocity.X = 0.0f;
this.ai[1] += 4f;
if ((double) this.life < (double) this.lifeMax * 0.66)
this.ai[1] += 4f;
if ((double) this.life < (double) this.lifeMax * 0.33)
this.ai[1] += 4f;
if ((double) this.ai[1] >= 0.0)
{
this.netUpdate = true;
this.TargetClosest();
if ((double) this.ai[2] == 3.0)
{
this.velocity.Y = -13f;
this.velocity.X += 3.5f * (float) this.direction;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
if (this.timeLeft > 10)
{
this.ai[0] = 0.0f;
break;
}
this.ai[1] = -60f;
break;
}
if ((double) this.ai[2] == 2.0)
{
this.velocity.Y = -6f;
this.velocity.X += 4.5f * (float) this.direction;
this.ai[1] = -40f;
++this.ai[2];
break;
}
this.velocity.Y = -8f;
this.velocity.X += 4f * (float) this.direction;
this.ai[1] = -40f;
++this.ai[2];
break;
}
break;
}
if (this.target < (int) byte.MaxValue)
{
float num11 = 3f;
if (Main.getGoodWorld)
num11 = 7f;
if (this.direction == 1 && (double) this.velocity.X < (double) num11 || this.direction == -1 && (double) this.velocity.X > -(double) num11)
{
if (this.direction == -1 && (double) this.velocity.X < 0.1 || this.direction == 1 && (double) this.velocity.X > -0.1)
{
this.velocity.X += 0.2f * (float) this.direction;
break;
}
this.velocity.X *= 0.93f;
break;
}
break;
}
break;
case 4:
this.rotation *= 0.9f;
this.noTileCollide = true;
this.noGravity = true;
if ((double) this.ai[2] == 1.0)
{
this.noTileCollide = false;
this.noGravity = false;
int num12 = 30;
if (flag2)
num12 = 10;
if (Main.getGoodWorld)
num12 = 0;
Player player = Main.player[this.target];
Vector2 center1 = this.Center;
if (!player.dead && player.active && (double) Math.Abs(this.Center.X - player.Center.X) / 16.0 <= (double) num3)
{
Vector2 center2 = player.Center;
}
if ((double) this.velocity.Y == 0.0)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.netUpdate = true;
SoundEngine.PlaySound(SoundID.Item167, this.Center);
if (Main.netMode != 1)
Projectile.NewProjectile(this.Bottom, Vector2.Zero, 922, Damage2, 0.0f, Main.myPlayer);
for (int index10 = 0; index10 < 20; ++index10)
{
int index11 = Dust.NewDust(this.Bottom - new Vector2((float) (this.width / 2), 30f), this.width, 30, 31, this.velocity.X, this.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor());
Main.dust[index11].noGravity = true;
Main.dust[index11].velocity.Y = (float) ((double) Main.rand.NextFloat() * -3.0 - 5.0);
Main.dust[index11].velocity.X *= 7f;
}
}
else if ((double) this.ai[1] >= (double) num12)
{
for (int index12 = 0; index12 < 4; ++index12)
{
Vector2 Position = this.Bottom - new Vector2(Main.rand.NextFloatDirection() * 16f, (float) Main.rand.Next(8));
int index13 = Dust.NewDust(Position, 2, 2, 31, this.velocity.X, this.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.4f);
Main.dust[index13].position = Position;
Main.dust[index13].noGravity = true;
Main.dust[index13].velocity.Y = this.velocity.Y * 0.9f;
Main.dust[index13].velocity.X = (float) ((Main.rand.Next(2) == 0 ? -10.0 : 10.0) + (double) Main.rand.NextFloatDirection() * 3.0);
}
}
this.velocity.X *= 0.8f;
float num13 = this.ai[1];
++this.ai[1];
if ((double) this.ai[1] >= (double) num12)
{
if ((double) num13 < (double) num12)
this.netUpdate = true;
if (flag2 && (double) this.ai[1] > (double) (num12 + 120))
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.velocity.Y *= 0.8f;
this.netUpdate = true;
break;
}
++this.velocity.Y;
float num14 = 14f;
if (Main.getGoodWorld)
{
++this.velocity.Y;
num14 = 15.99f;
}
if ((double) this.velocity.Y == 0.0)
this.velocity.Y = 0.01f;
if ((double) this.velocity.Y >= (double) num14)
{
this.velocity.Y = num14;
break;
}
break;
}
this.velocity.Y *= 0.8f;
break;
}
if (Main.netMode != 1 && (double) this.ai[1] == 0.0)
{
this.TargetClosest();
this.netUpdate = true;
}
++this.ai[1];
if ((double) this.ai[1] >= 30.0)
{
if ((double) this.ai[1] >= 60.0)
{
this.ai[1] = 60f;
if (Main.netMode != 1)
{
this.ai[1] = 0.0f;
this.ai[2] = 1f;
this.velocity.Y = -3f;
this.netUpdate = true;
}
}
Player player = Main.player[this.target];
Vector2 center = this.Center;
if (!player.dead && player.active && (double) Math.Abs(this.Center.X - player.Center.X) / 16.0 <= (double) num3)
center = player.Center;
center.Y -= 384f;
if ((double) this.velocity.Y == 0.0)
{
this.velocity = center - this.Center;
this.velocity = this.velocity.SafeNormalize(Vector2.Zero);
this.velocity = this.velocity * 20f;
break;
}
this.velocity.Y *= 0.95f;
break;
}
break;
case 5:
this.rotation *= 0.9f;
this.noTileCollide = true;
this.noGravity = true;
if (flag2)
this.ai[3] = 0.0f;
if ((double) this.ai[2] == 1.0)
{
++this.ai[1];
if ((double) this.ai[1] >= 10.0)
{
if (Main.netMode != 1)
{
int num15 = 10;
if (Main.getGoodWorld)
num15 = 15;
int num16 = num15;
if (!flag2)
num16 = 6;
for (int index = 0; index < num16; ++index)
{
Vector2 spinningpoint = new Vector2(9f, 0.0f);
spinningpoint = spinningpoint.RotatedBy((double) -index * 6.28318548202515 / (double) num15, Vector2.Zero);
Projectile.NewProjectile(this.Center.X, this.Center.Y, spinningpoint.X, spinningpoint.Y, 926, Damage1, 0.0f, Main.myPlayer);
}
}
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.netUpdate = true;
break;
}
break;
}
if (Main.netMode != 1 && (double) this.ai[1] == 0.0)
{
this.TargetClosest();
this.netUpdate = true;
}
++this.ai[1];
if ((double) this.ai[1] >= 50.0)
{
this.ai[1] = 50f;
if (Main.netMode != 1)
{
this.ai[1] = 0.0f;
this.ai[2] = 1f;
this.netUpdate = true;
}
}
float num17 = 100f;
for (int index14 = 0; index14 < 4; ++index14)
{
Vector2 Position = this.Center + Main.rand.NextVector2CircularEdge(num17, num17);
if (!flag2)
Position += new Vector2(0.0f, 20f);
Vector2 vector2 = (Position - this.Center).SafeNormalize(Vector2.Zero) * -8f;
int index15 = Dust.NewDust(Position, 2, 2, 31, vector2.X, vector2.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.8f);
Main.dust[index15].position = Position;
Main.dust[index15].noGravity = true;
Main.dust[index15].alpha = 250;
Main.dust[index15].velocity = vector2;
Main.dust[index15].customData = (object) this;
}
if (flag2)
{
this.AI_121_QueenSlime_FlyMovement();
break;
}
break;
}
this.dontTakeDamage = this.hide = flag1;
if ((double) num2 != (double) this.scale)
{
this.position.X += (float) (this.width / 2);
this.position.Y += (float) this.height;
this.scale = num2;
this.width = (int) (114.0 * (double) this.scale);
this.height = (int) (100.0 * (double) this.scale);
this.position.X -= (float) (this.width / 2);
this.position.Y -= (float) this.height;
}
if (this.life <= 0)
return;
if (Main.rand.Next(360) == 0)
SoundEngine.PlaySound(65, this.position);
if (Main.netMode == 1)
return;
if ((double) this.localAI[0] >= (double) (this.lifeMax / 2) && this.life < this.lifeMax / 2)
{
this.localAI[0] = (float) this.life;
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.netUpdate = true;
}
int num18 = (int) ((double) this.lifeMax * 0.0199999995529652);
if (flag2)
num18 = (int) ((double) this.lifeMax * 0.0149999996647239);
if ((double) (this.life + num18) >= (double) this.localAI[0])
return;
this.localAI[0] = (float) this.life;
int num19 = Main.rand.Next(1, 3);
for (int index = 0; index < num19; ++index)
{
int X = (int) ((double) this.position.X + (double) Main.rand.Next(this.width - 32));
int Y = (int) ((double) this.position.Y + (double) Main.rand.Next(this.height - 32));
int Type = 658;
switch (Main.rand.Next(3))
{
case 0:
Type = 658;
break;
case 1:
Type = 659;
break;
case 2:
Type = 660;
break;
}
int number = NPC.NewNPC(X, Y, Type);
Main.npc[number].SetDefaults(Type);
Main.npc[number].velocity.X = (float) Main.rand.Next(-15, 16) * 0.1f;
Main.npc[number].velocity.Y = (float) Main.rand.Next(-30, 1) * 0.1f;
Main.npc[number].ai[0] = (float) (-500 * Main.rand.Next(3));
Main.npc[number].ai[1] = 0.0f;
if (Main.netMode == 2 && number < 200)
NetMessage.SendData(23, number: number);
}
}
public bool AI_120_HallowBoss_IsInPhase2() => (double) this.ai[3] == 1.0 || (double) this.ai[3] == 3.0;
public bool AI_120_HallowBoss_IsGenuinelyEnraged() => (double) this.ai[3] == 2.0 || (double) this.ai[3] == 3.0;
private void AI_120_HallowBoss_DoMagicEffect(Vector2 spot, int effectType, float progress)
{
float num1 = 4f;
float num2 = 1f;
float num3 = 0.0f;
float num4 = 0.5f;
int num5 = 2;
int Type = 267;
switch (effectType)
{
case 1:
num2 = 0.5f;
num3 = 2f;
num4 = 0.0f;
break;
case 2:
case 4:
num1 = 50f;
num2 = 0.5f;
num3 = 0.0f;
num4 = 0.0f;
num5 = 4;
break;
case 3:
num1 = 30f;
num2 = 0.1f;
num3 = 2.5f;
num4 = 0.0f;
break;
case 5:
if ((double) progress == 0.0)
{
num5 = 0;
}
else
{
num5 = 5;
Type = Main.rand.Next(86, 92);
}
if ((double) progress >= 1.0)
{
num5 = 0;
break;
}
break;
}
for (int index = 0; index < num5; ++index)
{
Dust dust = Dust.NewDustPerfect(spot, Type, new Vector2?(Main.rand.NextVector2CircularEdge(num1, num1) * (Main.rand.NextFloat() * (1f - num4) + num4)), newColor: Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), Scale: ((float) ((double) Main.rand.NextFloat() * 2.0 + 2.0) * num2));
dust.fadeIn = num3;
dust.noGravity = true;
switch (effectType)
{
case 2:
case 4:
dust.velocity *= 0.005f;
dust.scale = 3f * Utils.GetLerpValue(0.7f, 0.0f, progress, true) * Utils.GetLerpValue(0.0f, 0.3f, progress, true);
dust.velocity = ((float) (6.28318548202515 * ((double) index / 4.0) + 0.785398185253143)).ToRotationVector2() * 8f * Utils.GetLerpValue(1f, 0.0f, progress, true);
dust.velocity += this.velocity * 0.3f;
float num6 = 0.0f;
if (effectType == 4)
num6 = 0.5f;
dust.color = Main.hslToRgb((float) (((double) index / 5.0 + (double) num6 + (double) progress * 0.5) % 1.0), 1f, 0.5f);
dust.color.A /= (byte) 2;
dust.alpha = (int) sbyte.MaxValue;
break;
case 5:
if ((double) progress == 0.0)
{
dust.customData = (object) this;
dust.scale = 1.5f;
dust.fadeIn = 0.0f;
dust.velocity = new Vector2(0.0f, -1f) + Main.rand.NextVector2Circular(1f, 1f);
dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 80) * 0.3f;
break;
}
dust.color = Main.hslToRgb((float) ((double) progress * 2.0 % 1.0), 1f, 0.5f);
dust.alpha = 0;
dust.scale = 1f;
dust.fadeIn = 1.3f;
dust.velocity *= 3f;
dust.velocity.X *= 0.1f;
dust.velocity += this.velocity * 1f;
break;
}
}
}
public static bool ShouldEmpressBeEnraged() => Main.dayTime;
private void AI_120_HallowBoss()
{
Vector2 vector2_1 = new Vector2(-150f, -250f);
Vector2 vector2_2 = new Vector2(150f, -250f);
Vector2 vector2_3 = new Vector2(0.0f, -350f);
Vector2 vector2_4 = new Vector2(0.0f, -350f);
Vector2 vector2_5 = new Vector2(-80f, -500f);
float moveSpeed = 0.5f;
float num1 = 12f;
float num2 = 40f;
float num3 = 6400f;
int Damage1 = 40;
int num4 = 50;
int num5 = 70;
int num6 = 45;
int num7 = 45;
int num8 = 50;
bool flag1 = this.AI_120_HallowBoss_IsInPhase2();
bool flag2 = Main.expertMode;
bool flag3 = flag1 & flag2;
bool flag4 = NPC.ShouldEmpressBeEnraged();
if (this.life == this.lifeMax & flag4 && !this.AI_120_HallowBoss_IsGenuinelyEnraged())
this.ai[3] += 2f;
bool flag5 = true;
int num9 = 30;
int num10 = 30;
int num11 = 30;
int num12 = 35;
int num13 = 65;
if (flag1)
{
num4 = 60;
num6 = 50;
num7 = 50;
num8 = 60;
num5 = 65;
num9 = 35;
num10 = 35;
num11 = 35;
num12 = 40;
num13 = 30;
}
int Damage2 = this.GetAttackDamage_ForProjectiles((float) num4, (float) num9);
int Damage3 = this.GetAttackDamage_ForProjectiles((float) num6, (float) num10);
int Damage4 = this.GetAttackDamage_ForProjectiles((float) num7, (float) num11);
int Damage5 = this.GetAttackDamage_ForProjectiles((float) num8, (float) num12);
int Damage6 = this.GetAttackDamage_ForProjectiles((float) num5, (float) num13);
if (flag4)
{
Damage2 = 9999;
Damage3 = 9999;
Damage4 = 9999;
Damage5 = 9999;
Damage6 = 9999;
flag2 = true;
}
float num14 = flag2 ? 0.3f : 1f;
bool flag6 = true;
int num15 = 0;
if (flag1)
num15 += 15;
if (flag2)
num15 += 5;
switch ((int) this.ai[0])
{
case 0:
if ((double) this.ai[1] == 0.0)
{
this.velocity = new Vector2(0.0f, 5f);
if (Main.netMode != 1)
Projectile.NewProjectile(this.Center + new Vector2(0.0f, -80f), Vector2.Zero, 874, 0, 0.0f, Main.myPlayer);
}
if ((double) this.ai[1] == 10.0)
SoundEngine.PlaySound(SoundID.Item161, this.Center);
this.velocity = this.velocity * 0.95f;
if ((double) this.ai[1] > 10.0 && (double) this.ai[1] < 150.0)
{
int num16 = 2;
for (int index = 0; index < num16; ++index)
{
float num17 = MathHelper.Lerp(1.3f, 0.7f, this.Opacity) * Utils.GetLerpValue(0.0f, 120f, this.ai[1], true);
int dustIndex = Dust.NewDust(this.position, this.width, this.height, 267, newColor: Main.hslToRgb(this.ai[1] / 180f, 1f, 0.5f));
Main.dust[dustIndex].position = this.Center + Main.rand.NextVector2Circular((float) this.width * 3f, (float) this.height * 3f) + new Vector2(0.0f, -150f);
Main.dust[dustIndex].velocity *= Main.rand.NextFloat() * 0.8f;
Main.dust[dustIndex].noGravity = true;
Main.dust[dustIndex].fadeIn = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.699999988079071 * (double) num17);
Main.dust[dustIndex].velocity += Vector2.UnitY * 3f;
Main.dust[dustIndex].scale = 0.35f;
if (dustIndex != 6000)
{
Dust dust = Dust.CloneDust(dustIndex);
dust.scale /= 2f;
dust.fadeIn *= 0.85f;
dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
}
}
}
++this.ai[1];
flag5 = false;
flag6 = false;
this.Opacity = MathHelper.Clamp(this.ai[1] / 180f, 0.0f, 1f);
if ((double) this.ai[1] >= 180.0)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
this.TargetClosest();
break;
}
break;
case 1:
float num18 = flag1 ? 20f : 45f;
if (Main.getGoodWorld)
num18 /= 2f;
if ((double) this.ai[1] <= 10.0)
{
if ((double) this.ai[1] == 0.0)
this.TargetClosest();
NPCAimedTarget targetData = this.GetTargetData();
if (targetData.Invalid)
{
this.ai[0] = 13f;
this.ai[1] = 0.0f;
++this.ai[2];
this.velocity = this.velocity / 4f;
this.netUpdate = true;
break;
}
Vector2 vector2_6 = targetData.Center + new Vector2(0.0f, -300f);
if ((double) this.Distance(vector2_6) > 200.0)
vector2_6 -= this.DirectionTo(vector2_6) * 100f;
Vector2 v = vector2_6 - this.Center;
float lerpValue = Utils.GetLerpValue(100f, 600f, v.Length(), false);
float num19 = v.Length();
if ((double) num19 > 18.0)
num19 = 18f;
this.velocity = Vector2.Lerp(v.SafeNormalize(Vector2.Zero) * num19, v / 6f, lerpValue);
this.netUpdate = true;
}
this.velocity = this.velocity * 0.92f;
++this.ai[1];
if ((double) this.ai[1] >= (double) num18)
{
int num20 = (int) this.ai[2];
int num21 = 2;
int num22 = 0;
if (!flag1)
{
int num23 = num22;
int num24 = num23 + 1;
int num25 = num23;
int num26 = num24;
int num27 = num26 + 1;
int num28 = num26;
int num29 = num27;
int num30 = num29 + 1;
int num31 = num29;
int num32 = num30;
int num33 = num32 + 1;
int num34 = num32;
int num35 = num33;
int num36 = num35 + 1;
int num37 = num35;
int num38 = num36;
int num39 = num38 + 1;
int num40 = num38;
int num41 = num39;
int num42 = num41 + 1;
int num43 = num41;
int num44 = num42;
int num45 = num44 + 1;
int num46 = num44;
int num47 = num45;
int num48 = num47 + 1;
int num49 = num47;
int num50 = num48;
num22 = num50 + 1;
int num51 = num50;
if (num20 % num22 == num25)
num21 = 2;
if (num20 % num22 == num28)
num21 = 8;
if (num20 % num22 == num31)
num21 = 6;
if (num20 % num22 == num34)
num21 = 8;
if (num20 % num22 == num37)
num21 = 5;
if (num20 % num22 == num40)
num21 = 2;
if (num20 % num22 == num43)
num21 = 8;
if (num20 % num22 == num46)
num21 = 4;
if (num20 % num22 == num49)
num21 = 8;
if (num20 % num22 == num51)
num21 = 5;
if ((double) this.life / (double) this.lifeMax <= 0.5)
num21 = 10;
}
if (flag1)
{
int num52 = num22;
int num53 = num52 + 1;
int num54 = num52;
int num55 = num53;
int num56 = num55 + 1;
int num57 = num55;
int num58 = num56;
int num59 = num58 + 1;
int num60 = num58;
int num61 = -1;
if (flag2)
num61 = num59++;
int num62 = num59;
int num63 = num62 + 1;
int num64 = num62;
int num65 = num63;
int num66 = num65 + 1;
int num67 = num65;
int num68 = num66;
int num69 = num68 + 1;
int num70 = num68;
int num71 = num69;
int num72 = num71 + 1;
int num73 = num71;
int num74 = num72;
int num75 = num74 + 1;
int num76 = num74;
int num77 = num75;
int num78 = num77 + 1;
int num79 = num77;
if (num20 % num78 == num54)
num21 = 7;
if (num20 % num78 == num57)
num21 = 2;
if (num20 % num78 == num60)
num21 = 8;
if (num20 % num78 == num64)
num21 = 5;
if (num20 % num78 == num67)
num21 = 2;
if (num20 % num78 == num70)
num21 = 6;
if (num20 % num78 == num70)
num21 = 6;
if (num20 % num78 == num73)
num21 = 4;
if (num20 % num78 == num76)
num21 = 8;
if (num20 % num78 == num61)
num21 = 11;
if (num20 % num78 == num79)
num21 = 12;
}
this.TargetClosest();
NPCAimedTarget targetData = this.GetTargetData();
bool flag7 = false;
if (this.AI_120_HallowBoss_IsGenuinelyEnraged())
{
if (!Main.dayTime)
flag7 = true;
if (Main.dayTime && Main.time >= 53400.0)
flag7 = true;
}
if (((targetData.Invalid ? 1 : ((double) this.Distance(targetData.Center) > (double) num3 ? 1 : 0)) | (flag7 ? 1 : 0)) != 0)
num21 = 13;
if (num21 == 8 && (double) targetData.Center.X > (double) this.Center.X)
num21 = 9;
if (flag2 && (num21 == 5 ? 1 : (num21 == 12 ? 1 : 0)) == 0)
this.velocity = this.DirectionFrom(targetData.Center).SafeNormalize(Vector2.Zero).RotatedBy(1.57079637050629 * (double) ((double) targetData.Center.X > (double) this.Center.X).ToDirectionInt()) * 20f;
this.ai[0] = (float) num21;
this.ai[1] = 0.0f;
++this.ai[2];
this.netUpdate = true;
break;
}
break;
case 2:
if ((double) this.ai[1] == 0.0)
SoundEngine.PlaySound(SoundID.Item164, this.Center);
float num80 = 90f - (float) num15;
Vector2 vector2_7 = new Vector2(-55f, -30f);
NPCAimedTarget targetData1 = this.GetTargetData();
Vector2 vector2_8 = targetData1.Invalid ? this.Center : targetData1.Center;
if ((double) this.Distance(vector2_8 + vector2_1) > (double) num2)
this.SimpleFlyMovement(this.DirectionTo(vector2_8 + vector2_1).SafeNormalize(Vector2.Zero) * num1, moveSpeed);
if ((double) this.ai[1] < 60.0)
this.AI_120_HallowBoss_DoMagicEffect(this.Center + vector2_7, 1, Utils.GetLerpValue(0.0f, 60f, this.ai[1], true));
int num81 = 3;
if (flag2)
num81 = 2;
if ((int) this.ai[1] % num81 == 0 && (double) this.ai[1] < 60.0)
{
float ai1 = this.ai[1] / 60f;
Vector2 velocity = new Vector2(0.0f, -6f).RotatedBy(1.57079637050629 * (double) Main.rand.NextFloatDirection());
if (flag3)
velocity = new Vector2(0.0f, -10f).RotatedBy(6.28318548202515 * (double) Main.rand.NextFloat());
if (Main.netMode != 1)
Projectile.NewProjectile(this.Center + vector2_7, velocity, 873, Damage3, 0.0f, Main.myPlayer, (float) this.target, ai1);
if (Main.netMode != 1)
{
int num82 = (int) ((double) this.ai[1] / (double) num81);
for (int playerIndex = 0; playerIndex < (int) byte.MaxValue; ++playerIndex)
{
if (this.AI_120_HallowBoss_CanShootExtraAt(playerIndex, num82 % 3, 3, 2400f))
Projectile.NewProjectile(this.Center + vector2_7, velocity, 873, Damage3, 0.0f, Main.myPlayer, (float) playerIndex, ai1);
}
}
}
++this.ai[1];
if ((double) this.ai[1] >= 60.0 + (double) num80)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 3:
++this.ai[1];
NPCAimedTarget targetData2 = this.GetTargetData();
Vector2 vector2_9 = targetData2.Invalid ? this.Center : targetData2.Center;
if ((double) this.Distance(vector2_9 + vector2_2) > (double) num2)
this.SimpleFlyMovement(this.DirectionTo(vector2_9 + vector2_2).SafeNormalize(Vector2.Zero) * num1, moveSpeed);
if ((int) this.ai[1] % 180 == 0)
{
Vector2 vector2_10 = new Vector2(0.0f, -100f);
Projectile.NewProjectile(targetData2.Center + vector2_10, Vector2.Zero, 874, Damage1, 0.0f, Main.myPlayer);
}
if ((double) this.ai[1] >= 120.0)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 4:
float num83 = (float) (20 - num15);
Vector2 vector2_11 = new Vector2(0.0f, -100f);
if ((double) this.ai[1] == 0.0)
SoundEngine.PlaySound(SoundID.Item162, this.Center);
if ((double) this.ai[1] >= 6.0 && (double) this.ai[1] < 54.0)
{
this.AI_120_HallowBoss_DoMagicEffect(this.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0.0f, 100f, this.ai[1], true));
this.AI_120_HallowBoss_DoMagicEffect(this.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0.0f, 100f, this.ai[1], true));
}
NPCAimedTarget targetData3 = this.GetTargetData();
Vector2 vector2_12 = targetData3.Invalid ? this.Center : targetData3.Center;
if ((double) this.Distance(vector2_12 + vector2_3) > (double) num2)
this.SimpleFlyMovement(this.DirectionTo(vector2_12 + vector2_3).SafeNormalize(Vector2.Zero) * num1, moveSpeed);
int num84 = 4;
if (flag2)
num84 = 5;
if ((int) this.ai[1] % 4 == 0 && (double) this.ai[1] < 100.0)
{
int num85 = 1;
for (int index = 0; index < num85; ++index)
{
int num86 = (int) this.ai[1] / 4;
Vector2 vector2_13 = Vector2.UnitX.RotatedBy(3.14159274101257 / (double) (num84 * 2) + (double) num86 * (3.14159274101257 / (double) num84) + 0.0);
if (!flag2)
vector2_13.X += (double) vector2_13.X > 0.0 ? 0.5f : -0.5f;
vector2_13.Normalize();
float num87 = 300f;
if (flag2)
num87 = 450f;
Vector2 center1 = targetData3.Center;
if ((double) this.Distance(center1) <= 2400.0)
{
if ((double) Vector2.Dot(targetData3.Velocity.SafeNormalize(Vector2.UnitY), vector2_13) > 0.0)
vector2_13 *= -1f;
int num88 = 90;
Vector2 vector2_14 = center1 + targetData3.Velocity * (float) num88;
Vector2 vector2_15 = center1 + vector2_13 * num87 - targetData3.Velocity * 30f;
if ((double) vector2_15.Distance(center1) < (double) num87)
{
Vector2 vector2_16 = center1 - vector2_15;
if (vector2_16 == Vector2.Zero)
vector2_16 = vector2_13;
vector2_15 = center1 - Vector2.Normalize(vector2_16) * num87;
}
Vector2 vector2_17 = vector2_15;
Vector2 v1 = vector2_14 - vector2_17;
if (Main.netMode != 1)
Projectile.NewProjectile(vector2_15, Vector2.Zero, 919, Damage2, 0.0f, Main.myPlayer, v1.ToRotation(), this.ai[1] / 100f);
if (Main.netMode != 1)
{
int num89 = (int) ((double) this.ai[1] / 4.0);
for (int playerIndex = 0; playerIndex < (int) byte.MaxValue; ++playerIndex)
{
if (this.AI_120_HallowBoss_CanShootExtraAt(playerIndex, num89 % 3, 3, 2400f))
{
Player player = Main.player[playerIndex];
Vector2 center2 = player.Center;
if ((double) Vector2.Dot(player.velocity.SafeNormalize(Vector2.UnitY), vector2_13) > 0.0)
vector2_13 *= -1f;
Vector2 vector2_18 = center2 + player.velocity * (float) num88;
Vector2 vector2_19 = center2 + vector2_13 * num87 - player.velocity * 30f;
if ((double) vector2_19.Distance(center2) < (double) num87)
{
Vector2 vector2_20 = center2 - vector2_19;
if (vector2_20 == Vector2.Zero)
vector2_20 = vector2_13;
vector2_19 = center2 - Vector2.Normalize(vector2_20) * num87;
}
Vector2 vector2_21 = vector2_19;
Vector2 v2 = vector2_18 - vector2_21;
Projectile.NewProjectile(vector2_19, Vector2.Zero, 919, Damage2, 0.0f, Main.myPlayer, v2.ToRotation(), this.ai[1] / 100f);
}
}
}
}
}
}
++this.ai[1];
if ((double) this.ai[1] >= 100.0 + (double) num83)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 5:
if ((double) this.ai[1] == 0.0)
SoundEngine.PlaySound(SoundID.Item163, this.Center);
float num90 = 30f - (float) num15;
Vector2 vector2_22 = new Vector2(55f, -30f);
Vector2 vector2_23 = this.Center + vector2_22;
if ((double) this.ai[1] < 42.0)
this.AI_120_HallowBoss_DoMagicEffect(this.Center + vector2_22, 3, Utils.GetLerpValue(0.0f, 42f, this.ai[1], true));
NPCAimedTarget targetData4 = this.GetTargetData();
Vector2 vector2_24 = targetData4.Invalid ? this.Center : targetData4.Center;
if ((double) this.Distance(vector2_24 + vector2_4) > (double) num2)
this.SimpleFlyMovement(this.DirectionTo(vector2_24 + vector2_4).SafeNormalize(Vector2.Zero) * num1, moveSpeed);
if ((int) this.ai[1] % 42 == 0 && (double) this.ai[1] < 42.0)
{
float num91 = 6.283185f * Main.rand.NextFloat();
for (float num92 = 0.0f; (double) num92 < 1.0; num92 += 0.07692308f)
{
float ai1 = num92;
Vector2 spinningpoint = Vector2.UnitY.RotatedBy(1.57079637050629 + 6.28318548202515 * (double) ai1 + (double) num91);
if (Main.netMode != 1)
Projectile.NewProjectile(vector2_23 + spinningpoint.RotatedBy(-1.57079637050629) * 30f, spinningpoint * 8f, 872, Damage4, 0.0f, Main.myPlayer, ai1: ai1);
}
}
++this.ai[1];
if ((double) this.ai[1] >= 42.0 + (double) num90)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 6:
float num93 = (float) (120 - num15);
Vector2 position = this.Center + new Vector2(0.0f, -100f);
NPCAimedTarget targetData5 = this.GetTargetData();
Vector2 vector2_25 = targetData5.Invalid ? this.Center : targetData5.Center;
if ((double) this.Distance(vector2_25 + vector2_5) > (double) num2)
this.SimpleFlyMovement(this.DirectionTo(vector2_25 + vector2_5).SafeNormalize(Vector2.Zero) * num1 * 0.3f, moveSpeed * 0.7f);
if ((int) this.ai[1] % 60 == 0 && (double) this.ai[1] < 180.0)
{
int num94 = (int) this.ai[1] / 60;
int num95 = (double) targetData5.Center.X > (double) this.Center.X ? 1 : 0;
float num96 = 6f;
if (flag2)
num96 = 8f;
float num97 = 1f / num96;
for (float num98 = 0.0f; (double) num98 < 1.0; num98 += num97)
{
float ai0 = (float) (6.28318548202515 * (((double) num98 + (double) num97 * 0.5 + (double) num94 * (double) num97 * 0.5) % 1.0 + (double) num95));
if (Main.netMode != 1)
Projectile.NewProjectile(position, Vector2.Zero, 923, Damage5, 0.0f, Main.myPlayer, ai0, (float) this.whoAmI);
}
}
++this.ai[1];
if ((double) this.ai[1] >= 180.0 + (double) num93)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 7:
float num99 = 20f;
float num100 = 60f;
float num101 = num100 * 4f;
if (flag2)
{
num99 = 40f;
num100 = 40f;
num101 = num100 * 6f;
}
float num102 = num99 - (float) num15;
NPCAimedTarget targetData6 = this.GetTargetData();
Vector2 vector2_26 = targetData6.Invalid ? this.Center : targetData6.Center;
if ((double) this.Distance(vector2_26 + vector2_4) > (double) num2)
this.SimpleFlyMovement(this.DirectionTo(vector2_26 + vector2_4).SafeNormalize(Vector2.Zero) * num1 * 0.4f, moveSpeed);
if ((double) (int) this.ai[1] % (double) num100 == 0.0 && (double) this.ai[1] < (double) num101)
{
SoundEngine.PlaySound(SoundID.Item162, this.Center);
double num103 = (double) Main.rand.NextFloat();
int num104 = (int) this.ai[1] / (int) num100;
float num105 = 13f;
float num106 = 150f;
float y = num105 * num106;
Vector2 center = targetData6.Center;
if ((double) this.Distance(center) <= 3200.0)
{
Vector2 vector2_27 = Vector2.Zero;
Vector2 vector2_28 = Vector2.UnitY;
float num107 = 0.4f;
float num108 = 1.4f;
float num109 = 1f;
if (flag2)
{
num105 += 5f;
num106 += 50f;
num109 *= 1f;
y *= 0.5f;
}
switch (num104)
{
case 0:
center += new Vector2((float) (-(double) y / 2.0), 0.0f) * num109;
vector2_27 = new Vector2(0.0f, y);
vector2_28 = Vector2.UnitX;
break;
case 1:
center += new Vector2(y / 2f, num106 / 2f) * num109;
vector2_27 = new Vector2(0.0f, y);
vector2_28 = -Vector2.UnitX;
break;
case 2:
center += new Vector2(-y, -y) * num107 * num109;
vector2_27 = new Vector2(y * num108, 0.0f);
vector2_28 = new Vector2(1f, 1f);
break;
case 3:
center += new Vector2((float) ((double) y * (double) num107 + (double) num106 / 2.0), -y * num107) * num109;
vector2_27 = new Vector2(-y * num108, 0.0f);
vector2_28 = new Vector2(-1f, 1f);
break;
case 4:
center += new Vector2(-y, y) * num107 * num109;
vector2_27 = new Vector2(y * num108, 0.0f);
vector2_28 = center.DirectionTo(targetData6.Center);
break;
case 5:
center += new Vector2((float) ((double) y * (double) num107 + (double) num106 / 2.0), y * num107) * num109;
vector2_27 = new Vector2(-y * num108, 0.0f);
vector2_28 = center.DirectionTo(targetData6.Center);
break;
}
for (float num110 = 0.0f; (double) num110 <= 1.0; num110 += 1f / num105)
{
Vector2 vector2_29 = center + vector2_27 * (num110 - 0.5f);
Vector2 v = vector2_28;
if (flag2)
{
Vector2 vector2_30 = targetData6.Velocity * 20f * num110;
Vector2 vector2_31 = vector2_29.DirectionTo(targetData6.Center + vector2_30);
v = Vector2.Lerp(vector2_28, vector2_31, 0.75f).SafeNormalize(Vector2.UnitY);
}
float ai1 = num110;
if (Main.netMode != 1)
Projectile.NewProjectile(vector2_29, Vector2.Zero, 919, Damage6, 0.0f, Main.myPlayer, v.ToRotation(), ai1);
}
}
}
++this.ai[1];
if ((double) this.ai[1] >= (double) num101 + (double) num102)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 8:
case 9:
float num111 = (float) (20 - num15);
Vector2 vector2_32 = this.Center + new Vector2(0.0f, -100f);
flag6 = (double) this.ai[1] < 6.0 || (double) this.ai[1] > 40.0;
int num112 = (double) this.ai[0] == 8.0 ? -1 : 1;
this.AI_120_HallowBoss_DoMagicEffect(this.Center, 5, Utils.GetLerpValue(40f, 90f, this.ai[1], true));
if ((double) this.ai[1] <= 40.0)
{
if ((double) this.ai[1] == 20.0)
SoundEngine.PlaySound(SoundID.Item160, this.Center);
NPCAimedTarget targetData7 = this.GetTargetData();
this.SimpleFlyMovement(this.DirectionTo((targetData7.Invalid ? this.Center : targetData7.Center) + new Vector2((float) (num112 * -550), 0.0f)).SafeNormalize(Vector2.Zero) * num1, moveSpeed * 2f);
if ((double) this.ai[1] == 40.0)
this.velocity = this.velocity * 0.3f;
}
else if ((double) this.ai[1] <= 90.0)
{
this.velocity = Vector2.Lerp(this.velocity, new Vector2((float) (num112 * 50), 0.0f), 0.05f);
if ((double) this.ai[1] == 90.0)
this.velocity = this.velocity * 0.7f;
num14 *= 1.5f;
}
else
this.velocity = this.velocity * 0.92f;
++this.ai[1];
if ((double) this.ai[1] >= 90.0 + (double) num111)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 10:
float num113 = (float) (20 - num15);
if ((double) this.ai[1] == 0.0)
SoundEngine.PlaySound(SoundID.Item161, this.Center);
flag6 = (double) this.ai[1] < 30.0 || (double) this.ai[1] > 170.0;
this.velocity = this.velocity * 0.95f;
if ((double) this.ai[1] == 90.0)
{
if ((double) this.ai[3] == 0.0)
this.ai[3] = 1f;
if ((double) this.ai[3] == 2.0)
this.ai[3] = 3f;
this.Center = this.GetTargetData().Center + new Vector2(0.0f, -250f);
this.netUpdate = true;
}
++this.ai[1];
if ((double) this.ai[1] >= 180.0 + (double) num113)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 11:
if ((double) this.ai[1] == 0.0)
SoundEngine.PlaySound(SoundID.Item162, this.Center);
float num114 = (float) (20 - num15);
Vector2 vector2_33 = new Vector2(0.0f, -100f);
if ((double) this.ai[1] >= 6.0 && (double) this.ai[1] < 54.0)
{
this.AI_120_HallowBoss_DoMagicEffect(this.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0.0f, 100f, this.ai[1], true));
this.AI_120_HallowBoss_DoMagicEffect(this.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0.0f, 100f, this.ai[1], true));
}
NPCAimedTarget targetData8 = this.GetTargetData();
Vector2 vector2_34 = targetData8.Invalid ? this.Center : targetData8.Center;
if ((double) this.Distance(vector2_34 + vector2_3) > (double) num2)
this.SimpleFlyMovement(this.DirectionTo(vector2_34 + vector2_3).SafeNormalize(Vector2.Zero) * num1, moveSpeed);
if ((int) this.ai[1] % 3 == 0 && (double) this.ai[1] < 100.0)
{
int num115 = 1;
for (int index = 0; index < num115; ++index)
{
Vector2 v3 = -targetData8.Velocity;
v3.SafeNormalize(-Vector2.UnitY);
float num116 = 100f;
Vector2 center3 = targetData8.Center;
if ((double) this.Distance(center3) <= 2400.0)
{
int num117 = 90;
Vector2 vector2_35 = center3 + targetData8.Velocity * (float) num117;
Vector2 vector2_36 = center3 + v3 * num116;
if ((double) vector2_36.Distance(center3) < (double) num116)
{
Vector2 vector2_37 = center3 - vector2_36;
if (vector2_37 == Vector2.Zero)
vector2_37 = v3;
vector2_36 = center3 - Vector2.Normalize(vector2_37) * num116;
}
Vector2 vector2_38 = vector2_36;
Vector2 v4 = vector2_35 - vector2_38;
if (Main.netMode != 1)
Projectile.NewProjectile(vector2_36, Vector2.Zero, 919, Damage2, 0.0f, Main.myPlayer, v4.ToRotation(), this.ai[1] / 100f);
if (Main.netMode != 1)
{
int num118 = (int) ((double) this.ai[1] / 3.0);
for (int playerIndex = 0; playerIndex < (int) byte.MaxValue; ++playerIndex)
{
if (this.AI_120_HallowBoss_CanShootExtraAt(playerIndex, num118 % 3, 3, 2400f))
{
Player player = Main.player[playerIndex];
Vector2 v5 = -player.velocity;
v5.SafeNormalize(-Vector2.UnitY);
float num119 = 100f;
Vector2 center4 = player.Center;
int num120 = 90;
Vector2 vector2_39 = center4 + player.velocity * (float) num120;
Vector2 vector2_40 = center4 + v5 * num119;
if ((double) vector2_40.Distance(center4) < (double) num119)
{
Vector2 vector2_41 = center4 - vector2_40;
if (vector2_41 == Vector2.Zero)
vector2_41 = v5;
vector2_40 = center4 - Vector2.Normalize(vector2_41) * num119;
}
Vector2 vector2_42 = vector2_40;
Vector2 v6 = vector2_39 - vector2_42;
Projectile.NewProjectile(vector2_40, Vector2.Zero, 919, Damage2, 0.0f, Main.myPlayer, v6.ToRotation(), this.ai[1] / 100f);
}
}
}
}
}
}
++this.ai[1];
if ((double) this.ai[1] >= 100.0 + (double) num114)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 12:
float num121 = 90f - (float) num15;
Vector2 vector2_43 = new Vector2(-55f, -30f);
if ((double) this.ai[1] == 0.0)
{
SoundEngine.PlaySound(SoundID.Item165, this.Center);
this.velocity = new Vector2(0.0f, -12f);
}
this.velocity = this.velocity * 0.95f;
bool flag8 = (double) this.ai[1] < 60.0 && (double) this.ai[1] >= 10.0;
if (flag8)
this.AI_120_HallowBoss_DoMagicEffect(this.Center + vector2_43, 1, Utils.GetLerpValue(0.0f, 60f, this.ai[1], true));
int num122 = 6;
if (flag2)
num122 = 4;
float ai1_1 = (float) (((double) this.ai[1] - 10.0) / 50.0);
if ((int) this.ai[1] % num122 == 0 & flag8)
{
double num123 = (double) this.ai[1] / 60.0;
Vector2 velocity = new Vector2(0.0f, -20f).RotatedBy(6.28318548202515 * (double) ai1_1);
if (Main.netMode != 1)
Projectile.NewProjectile(this.Center + vector2_43, velocity, 873, Damage3, 0.0f, Main.myPlayer, (float) this.target, ai1_1);
if (Main.netMode != 1)
{
int num124 = (int) ((double) this.ai[1] % (double) num122);
for (int playerIndex = 0; playerIndex < (int) byte.MaxValue; ++playerIndex)
{
if (this.AI_120_HallowBoss_CanShootExtraAt(playerIndex, num124 % 3, 3, 2400f))
Projectile.NewProjectile(this.Center + vector2_43, velocity, 873, Damage3, 0.0f, Main.myPlayer, (float) playerIndex, ai1_1);
}
}
}
++this.ai[1];
if ((double) this.ai[1] >= 60.0 + (double) num121)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 13:
Vector2 vector2_44 = new Vector2(-55f, -30f);
if ((double) this.ai[1] == 0.0)
{
SoundEngine.PlaySound(SoundID.Item165, this.Center);
this.velocity = new Vector2(0.0f, -7f);
}
this.velocity = this.velocity * 0.95f;
this.TargetClosest();
NPCAimedTarget targetData9 = this.GetTargetData();
flag5 = false;
bool flag9 = false;
bool flag10 = false;
if (!flag9)
{
if (this.AI_120_HallowBoss_IsGenuinelyEnraged())
{
if (!Main.dayTime)
flag10 = true;
if (Main.dayTime && Main.time >= 53400.0)
flag10 = true;
}
flag9 |= flag10;
}
if (!flag9)
{
bool flag11 = targetData9.Invalid || (double) this.Distance(targetData9.Center) > (double) num3;
flag9 |= flag11;
}
this.alpha = Utils.Clamp<int>(this.alpha + flag9.ToDirectionInt() * 5, 0, (int) byte.MaxValue);
bool flag12 = this.alpha == 0 || this.alpha == (int) byte.MaxValue;
int num125 = 5;
for (int index = 0; index < num125; ++index)
{
float num126 = MathHelper.Lerp(1.3f, 0.7f, this.Opacity);
int dustIndex = Dust.NewDust(this.position - this.Size * 0.5f, this.width * 2, this.height * 2, 267, newColor: Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f));
Main.dust[dustIndex].position = this.Center + Main.rand.NextVector2Circular((float) this.width, (float) this.height);
Main.dust[dustIndex].velocity *= Main.rand.NextFloat() * 0.8f;
Main.dust[dustIndex].noGravity = true;
Main.dust[dustIndex].scale = (float) (0.899999976158142 + (double) Main.rand.NextFloat() * 1.20000004768372);
Main.dust[dustIndex].fadeIn = (float) (0.400000005960464 + (double) Main.rand.NextFloat() * 1.20000004768372 * (double) num126);
Main.dust[dustIndex].velocity += Vector2.UnitY * -2f;
Main.dust[dustIndex].scale = 0.35f;
if (dustIndex != 6000)
{
Dust dust = Dust.CloneDust(dustIndex);
dust.scale /= 2f;
dust.fadeIn *= 0.85f;
dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
}
}
++this.ai[1];
if ((double) this.ai[1] >= 20.0 & flag12)
{
if (this.alpha == (int) byte.MaxValue)
{
this.active = false;
if (Main.netMode == 1)
return;
NetMessage.SendData(23, number: this.whoAmI);
return;
}
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
break;
}
this.dontTakeDamage = !flag6;
this.damage = this.GetAttackDamage_ScaledByStrength((float) this.defDamage * num14);
if (flag4)
this.damage = 9999;
this.defense = !flag1 ? this.defDefense : (int) ((double) this.defDefense * 1.20000004768372);
if ((double) ++this.localAI[0] >= 44.0)
this.localAI[0] = 0.0f;
if (flag5)
this.alpha = Utils.Clamp<int>(this.alpha - 5, 0, (int) byte.MaxValue);
Lighting.AddLight(this.Center, Vector3.One * this.Opacity);
}
private static void AI_120_HallowBoss_DeprecatedShot(
ref NPCAimedTarget targetData,
float stormsCount,
int stormIndexInSeries,
ref Vector2 offsetDirection,
float distance)
{
int num = 1;
Vector2 position1 = offsetDirection * distance * (float) num * new Vector2(3f, 1f) - targetData.Velocity * 90f + targetData.Center;
Vector2 vector2_1 = position1 - targetData.Center;
if ((double) Vector2.Dot(targetData.Velocity.SafeNormalize(Vector2.Zero), vector2_1.SafeNormalize(Vector2.Zero)) > 0.970000028610229)
{
Vector2 vector2_2 = vector2_1.RotatedBy(0.785398185253143 * (double) (Main.rand.Next(2) * 2 - 1));
position1 = targetData.Center + vector2_2;
}
Vector2 position2 = position1;
Vector2 velocity = (targetData.Center - position2) / 90f;
Projectile.NewProjectile(position2, velocity, 871, 1, 0.0f, Main.myPlayer);
if (stormIndexInSeries == 0)
position1 = position2;
Projectile.NewProjectile(position1, Vector2.Zero, 871, 1, 0.0f, Main.myPlayer, ai1: ((float) stormIndexInSeries * (1f / stormsCount)));
}
private bool AI_120_HallowBoss_CanShootExtraAt(
int playerIndex,
int rotationIndexToAttack,
int rotationSize,
float attackScanDistance)
{
if (playerIndex == this.target || playerIndex % rotationSize != rotationIndexToAttack)
return false;
Player player = Main.player[playerIndex];
return player.active && !player.dead && this.playerInteraction[playerIndex] && (double) this.Distance(player.Center) <= (double) attackScanDistance;
}
private void AI_119_Dandelion()
{
this.TargetClosest();
Player player = Main.player[this.target];
float windSpeedCurrent = Main.windSpeedCurrent;
float num1 = player.Center.X - this.Center.X;
float num2 = Math.Abs(num1);
float num3 = Math.Abs(player.Center.Y - this.Center.Y);
if (!Main.IsItAHappyWindyDay && this.timeLeft > 10)
this.timeLeft = 10;
bool flag = player.active && !player.dead && (double) num3 < 100.0 && (double) num2 < 600.0 && ((double) num1 > 0.0 && (double) windSpeedCurrent > 0.0 || (double) num1 < 0.0 && (double) windSpeedCurrent < 0.0);
if ((double) this.ai[0] == 1.0)
{
this.localAI[0] = 0.0f;
if ((double) num2 < 500.0)
this.localAI[0] = 1f;
if (Main.netMode == 1)
return;
if (!flag)
{
this.ai[0] = 0.0f;
this.netUpdate = true;
}
else
{
if ((double) this.localAI[0] != 1.0)
return;
++this.localAI[1];
if ((double) this.localAI[1] > 80.0)
{
this.ai[0] = 0.0f;
this.netUpdate = true;
}
else
{
if ((double) this.localAI[1] != 40.0)
return;
for (int index = 0; index < 1 + Main.rand.Next(3); ++index)
{
int num4 = -1;
if ((double) num1 > 0.0)
num4 = 1;
Vector2 velocity = new Vector2(2f * (float) num4, -2f);
Vector2 vector2 = new Vector2((float) (num4 * Main.rand.Next(-2, 10)), (float) (10 + Main.rand.Next(-6, 6)));
velocity += vector2 * 0.25f;
Vector2 position = this.Center + vector2;
position.X += (float) (num4 * 6);
if ((double) velocity.Y > 0.0)
velocity.Y *= -1f;
Projectile.NewProjectile(position, velocity, 836, this.damage / 2, 1f, ai0: ((float) this.target));
}
this.netUpdate = true;
}
}
}
else
{
if ((double) this.ai[0] != 0.0)
return;
this.localAI[0] = 0.0f;
this.localAI[1] = 0.0f;
if (!(Main.netMode != 1 & flag))
return;
this.ai[0] = 1f;
this.netUpdate = true;
}
}
private void AI_118_Seahorses()
{
this.noGravity = this.wet;
float waterLineHeight;
Collision.GetWaterLineIterate(this.Center.ToTileCoordinates(), out waterLineHeight);
bool flag1 = (double) waterLineHeight > 0.0 && (double) this.Top.Y - (double) waterLineHeight < 20.0;
if (!this.wet)
{
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.95f;
this.rotation += (float) (((double) this.velocity.X + (double) this.velocity.Y) / 2.0 * 0.0500000007450581);
}
else
{
--this.ai[1];
if ((double) this.ai[1] <= 0.0)
{
this.velocity = this.velocity + this.ai[0].ToRotationVector2() * 0.06f;
float num = this.velocity.Length();
if ((double) num > 3.0 || (double) num < -3.0)
{
this.velocity.X = Math.Min(3f, Math.Max(-3f, this.velocity.X));
this.ai[1] = (float) Main.rand.Next(450, 600);
this.ai[0] = Main.rand.NextFloat() * 6.283185f;
if (flag1 && (double) this.ai[0] > 3.14159274101257)
this.ai[0] -= 3.141593f;
this.netUpdate = true;
}
}
else
this.velocity = this.velocity * 0.95f;
this.rotation = this.velocity.X * 0.1f;
}
bool flag2 = this.collideY && this.wet && (!flag1 || (double) this.velocity.Y < 0.0);
if (!(this.collideX | flag2))
return;
Vector2 rotationVector2 = this.ai[0].ToRotationVector2();
if (this.collideX)
rotationVector2.X *= -1f;
if (flag2)
rotationVector2.Y *= -1f;
this.ai[0] = rotationVector2.ToRotation();
this.velocity = this.ai[0].ToRotationVector2() * this.velocity.Length();
this.netUpdate = true;
}
private void AI_117_BloodNautilus()
{
float moveSpeed = 0.15f;
float num1 = 7.5f;
float num2 = 60f;
float num3 = 90f;
float num4 = 180f;
float num5 = 90f;
float num6 = 90f;
int num7 = 3;
float num8 = 180f;
bool flag = false;
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
this.alpha = (int) byte.MaxValue;
if (Main.netMode != 1)
{
this.ai[0] = -1f;
this.netUpdate = true;
}
}
if ((double) this.ai[0] != -1.0 && Main.rand.Next(4) == 0)
{
this.position = this.position + this.netOffset;
Dust dust = Dust.NewDustDirect(this.position + new Vector2(5f), this.width - 10, this.height - 10, 5);
dust.velocity *= 0.5f;
if ((double) dust.velocity.Y < 0.0)
dust.velocity.Y *= -1f;
dust.alpha = 120;
dust.scale = (float) (1.0 + (double) Main.rand.NextFloat() * 0.400000005960464);
dust.velocity += this.velocity * 0.3f;
this.position = this.position - this.netOffset;
}
if (this.target == (int) byte.MaxValue)
{
this.TargetClosest();
this.ai[2] = (float) this.direction;
}
if (Main.player[this.target].dead || (double) Vector2.Distance(Main.player[this.target].Center, this.Center) > 2000.0)
this.TargetClosest();
NPCAimedTarget npcAimedTarget = this.GetTargetData();
if (Main.dayTime || !Main.bloodMoon)
npcAimedTarget = new NPCAimedTarget();
int num9 = -1;
switch (this.ai[0])
{
case -1f:
this.velocity = this.velocity * 0.98f;
int num10 = Math.Sign(npcAimedTarget.Center.X - this.Center.X);
if (num10 != 0)
{
this.direction = num10;
this.spriteDirection = -this.direction;
}
if ((double) this.localAI[1] == 0.0 && this.alpha < 100)
{
this.localAI[1] = 1f;
int num11 = 36;
for (int index1 = 0; index1 < num11; ++index1)
{
this.position = this.position + this.netOffset;
Vector2 vector2_1 = (Vector2.Normalize(this.velocity) * new Vector2((float) this.width / 2f, (float) this.height) * 0.75f * 0.5f).RotatedBy((double) (index1 - (num11 / 2 - 1)) * 6.28318548202515 / (double) num11) + this.Center;
Vector2 vector2_2 = vector2_1 - this.Center;
int index2 = Dust.NewDust(vector2_1 + vector2_2, 0, 0, 5, vector2_2.X * 2f, vector2_2.Y * 2f, 100, Scale: 1.4f);
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity = Vector2.Normalize(vector2_2) * 3f;
this.position = this.position - this.netOffset;
}
}
if ((double) this.ai[2] > 5.0)
{
this.velocity.Y = -2.5f;
this.alpha -= 10;
if (Collision.SolidCollision(this.position, this.width, this.height))
{
this.alpha += 15;
if (this.alpha > 150)
this.alpha = 150;
}
if (this.alpha < 0)
this.alpha = 0;
}
++this.ai[2];
if ((double) this.ai[2] >= 50.0)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.ai[3] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 0.0f:
Vector2 vector2_3 = npcAimedTarget.Center + new Vector2((float) (-(double) this.ai[2] * 300.0), -200f);
if ((double) this.Center.Distance(vector2_3) > 50.0)
this.SimpleFlyMovement(this.DirectionTo(vector2_3) * num1, moveSpeed);
this.direction = (double) this.Center.X < (double) npcAimedTarget.Center.X ? 1 : -1;
float targetAngle1 = this.Center.DirectionTo(npcAimedTarget.Center).ToRotation() - 0.4712389f * (float) this.spriteDirection;
if (this.spriteDirection == -1)
targetAngle1 += 3.141593f;
if (this.spriteDirection != this.direction)
{
this.spriteDirection = this.direction;
this.rotation = -this.rotation;
targetAngle1 = -targetAngle1;
}
this.rotation = this.rotation.AngleTowards(targetAngle1, 0.02f);
++this.ai[1];
if ((double) this.ai[1] > (double) num2)
{
int num12 = (int) this.ai[3];
if (num12 % 7 == 3)
{
num9 = 3;
break;
}
if (num12 % 2 == 0)
{
SoundEngine.PlaySound(SoundID.Item170, this.Center);
num9 = 2;
break;
}
SoundEngine.PlaySound(SoundID.Item170, this.Center);
num9 = 1;
break;
}
break;
case 1f:
this.direction = (double) this.Center.X < (double) npcAimedTarget.Center.X ? -1 : 1;
float targetAngle2 = this.Center.DirectionFrom(npcAimedTarget.Center).ToRotation() - 0.4712389f * (float) this.spriteDirection;
if (this.spriteDirection == -1)
targetAngle2 += 3.141593f;
if (this.spriteDirection != this.direction & (double) this.ai[1] < (double) num3)
{
this.spriteDirection = this.direction;
this.rotation = -this.rotation;
targetAngle2 = -targetAngle2;
}
if ((double) this.ai[1] < (double) num3)
{
if ((double) this.ai[1] == (double) num3 - 1.0)
SoundEngine.PlaySound(SoundID.Item172, this.Center);
flag = true;
this.velocity = this.velocity * 0.95f;
this.rotation = this.rotation.AngleLerp(targetAngle2, 0.02f);
this.position = this.position + this.netOffset;
Vector2 mouthPosition;
Vector2 mouthDirection;
this.BloodNautilus_GetMouthPositionAndRotation(out mouthPosition, out mouthDirection);
Dust dust1 = Dust.NewDustDirect(mouthPosition + mouthDirection * 60f - new Vector2(40f), 80, 80, 16, Alpha: 150, newColor: Color.Transparent, Scale: 0.6f);
dust1.fadeIn = 1f;
dust1.velocity = dust1.position.DirectionTo(mouthPosition + Main.rand.NextVector2Circular(15f, 15f)) * dust1.velocity.Length();
dust1.noGravity = true;
Dust dust2 = Dust.NewDustDirect(mouthPosition + mouthDirection * 100f - new Vector2(30f), 60, 60, 16, Alpha: 100, newColor: Color.Transparent, Scale: 0.9f);
dust2.fadeIn = 1.5f;
dust2.velocity = dust2.position.DirectionTo(mouthPosition + Main.rand.NextVector2Circular(15f, 15f)) * (dust2.velocity.Length() + 5f);
dust2.noGravity = true;
this.position = this.position - this.netOffset;
}
else if ((double) this.ai[1] < (double) num3 + (double) num4)
{
this.position = this.position + this.netOffset;
this.rotation = this.rotation.AngleLerp(targetAngle2, 0.07f);
Vector2 mouthPosition;
Vector2 mouthDirection;
this.BloodNautilus_GetMouthPositionAndRotation(out mouthPosition, out mouthDirection);
if ((double) this.Center.Distance(npcAimedTarget.Center) > 30.0)
this.velocity = mouthDirection * -16f + this.Center.DirectionTo(npcAimedTarget.Center) * 2f;
for (int index = 0; index < 4; ++index)
{
Dust dust3 = Dust.NewDustDirect(mouthPosition + mouthDirection * 60f - new Vector2(15f), 30, 30, 5, newColor: Color.Transparent, Scale: 1.5f);
dust3.velocity = dust3.position.DirectionFrom(mouthPosition + Main.rand.NextVector2Circular(5f, 5f)) * dust3.velocity.Length();
dust3.position -= mouthDirection * 60f;
Dust dust4 = Dust.NewDustDirect(mouthPosition + mouthDirection * 100f - new Vector2(20f), 40, 40, 5, Alpha: 100, newColor: Color.Transparent, Scale: 1.5f);
dust4.velocity = dust4.position.DirectionFrom(mouthPosition + Main.rand.NextVector2Circular(10f, 10f)) * (dust4.velocity.Length() + 5f);
dust4.position -= mouthDirection * 100f;
}
this.position = this.position - this.netOffset;
}
++this.ai[1];
if ((double) this.ai[1] >= (double) num3 + (double) num4)
{
num9 = 0;
break;
}
break;
case 2f:
this.direction = (double) this.Center.X < (double) npcAimedTarget.Center.X ? 1 : -1;
float targetAngle3 = this.Center.DirectionTo(npcAimedTarget.Center).ToRotation() - 0.4712389f * (float) this.spriteDirection;
if (this.spriteDirection == -1)
targetAngle3 += 3.141593f;
if (this.spriteDirection != this.direction)
{
this.spriteDirection = this.direction;
this.rotation = -this.rotation;
targetAngle3 = -targetAngle3;
}
this.rotation = this.rotation.AngleLerp(targetAngle3, 0.2f);
if ((double) this.ai[1] < (double) num5)
{
this.position = this.position + this.netOffset;
this.velocity = this.velocity * 0.95f;
Vector2 mouthPosition;
Vector2 mouthDirection;
this.BloodNautilus_GetMouthPositionAndRotation(out mouthPosition, out mouthDirection);
if (Main.rand.Next(4) != 0)
{
Dust dust5 = Dust.NewDustDirect(mouthPosition + mouthDirection * 60f - new Vector2(60f), 120, 120, 16, Alpha: 150, newColor: Color.Transparent, Scale: 0.6f);
dust5.fadeIn = 1f;
dust5.velocity = dust5.position.DirectionTo(mouthPosition + Main.rand.NextVector2Circular(15f, 15f)) * (dust5.velocity.Length() + 3f);
dust5.noGravity = true;
Dust dust6 = Dust.NewDustDirect(mouthPosition + mouthDirection * 100f - new Vector2(80f), 160, 160, 16, Alpha: 100, newColor: Color.Transparent, Scale: 0.9f);
dust6.fadeIn = 1.5f;
dust6.velocity = dust6.position.DirectionTo(mouthPosition + Main.rand.NextVector2Circular(15f, 15f)) * (dust6.velocity.Length() + 5f);
dust6.noGravity = true;
}
this.position = this.position - this.netOffset;
}
else if ((double) this.ai[1] < (double) num5 + (double) num6)
{
this.position = this.position + this.netOffset;
this.velocity = this.velocity * 0.9f;
float num13 = (float) (((double) this.ai[1] - (double) num5) % ((double) num6 / (double) num7));
Vector2 mouthPosition;
Vector2 mouthDirection;
this.BloodNautilus_GetMouthPositionAndRotation(out mouthPosition, out mouthDirection);
if ((double) num13 < (double) num6 / (double) num7 * 0.800000011920929)
{
for (int index = 0; index < 5; ++index)
{
Dust dust7 = Dust.NewDustDirect(mouthPosition + mouthDirection * 50f - new Vector2(15f), 30, 30, 5, newColor: Color.Transparent, Scale: 1.5f);
dust7.velocity = dust7.position.DirectionFrom(mouthPosition + Main.rand.NextVector2Circular(5f, 5f)) * dust7.velocity.Length();
dust7.position -= mouthDirection * 60f;
Dust dust8 = Dust.NewDustDirect(mouthPosition + mouthDirection * 90f - new Vector2(20f), 40, 40, 5, Alpha: 100, newColor: Color.Transparent, Scale: 1.5f);
dust8.velocity = dust8.position.DirectionFrom(mouthPosition + Main.rand.NextVector2Circular(10f, 10f)) * (dust8.velocity.Length() + 5f);
dust8.position -= mouthDirection * 100f;
}
}
if ((int) num13 == 0)
{
this.velocity = this.velocity + mouthDirection * -8f;
for (int index = 0; index < 20; ++index)
{
Dust dust9 = Dust.NewDustDirect(mouthPosition + mouthDirection * 60f - new Vector2(15f), 30, 30, 5, newColor: Color.Transparent, Scale: 1.5f);
dust9.velocity = dust9.position.DirectionFrom(mouthPosition + Main.rand.NextVector2Circular(5f, 5f)) * dust9.velocity.Length();
dust9.position -= mouthDirection * 60f;
Dust dust10 = Dust.NewDustDirect(mouthPosition + mouthDirection * 100f - new Vector2(20f), 40, 40, 5, Alpha: 100, newColor: Color.Transparent, Scale: 1.5f);
dust10.velocity = dust10.position.DirectionFrom(mouthPosition + Main.rand.NextVector2Circular(10f, 10f)) * (dust10.velocity.Length() + 5f);
dust10.position -= mouthDirection * 100f;
}
if (Main.netMode != 1)
{
int num14 = Main.rand.Next(5, 11);
Vector2 vector2_4 = mouthDirection * 10f;
int damageForProjectiles = this.GetAttackDamage_ForProjectiles(30f, 25f);
for (int index = 0; index < num14; ++index)
{
Vector2 velocity = vector2_4 + Main.rand.NextVector2Square(-6f, 6f);
Projectile.NewProjectile(mouthPosition - mouthDirection * 5f, velocity, 814, damageForProjectiles, 0.0f, Main.myPlayer);
}
}
}
this.position = this.position - this.netOffset;
}
++this.ai[1];
if ((double) this.ai[1] >= (double) num5 + (double) num6)
{
num9 = 0;
break;
}
break;
case 3f:
this.direction = (double) this.Center.X < (double) npcAimedTarget.Center.X ? 1 : -1;
float targetAngle4 = 0.0f;
this.spriteDirection = this.direction;
if ((double) this.ai[1] < (double) num8)
{
this.position = this.position + this.netOffset;
this.velocity = Vector2.Lerp(this.velocity, new Vector2(0.0f, MathHelper.Clamp((float) (1.0 - (double) this.ai[1] / (double) num8 * 1.5), 0.0f, 1f) * -1.5f), 0.03f);
this.velocity = Vector2.Zero;
this.rotation = this.rotation.AngleLerp(targetAngle4, 0.02f);
this.BloodNautilus_GetMouthPositionAndRotation(out Vector2 _, out Vector2 _);
float t = this.ai[1] / num8;
Lighting.AddLight(this.Center, new Vector3(1f, 0.5f, 0.5f) * (Utils.GetLerpValue(0.0f, 0.5f, t, false) * Utils.GetLerpValue(1f, 0.5f, t, false)));
if (Main.rand.Next(3) != 0)
{
Dust dust = Dust.NewDustDirect(this.Center - new Vector2(6f), 12, 12, 5, Alpha: 60, newColor: Color.Transparent, Scale: 1.4f);
dust.position += new Vector2((float) (this.spriteDirection * 12), 12f);
dust.velocity *= 0.1f;
}
this.position = this.position - this.netOffset;
}
if ((double) this.ai[1] == 10.0 || (double) this.ai[1] == 20.0 || (double) this.ai[1] == 30.0)
this.BloodNautilus_CallForHelp();
++this.ai[1];
if ((double) this.ai[1] >= (double) num8)
{
num9 = 0;
break;
}
break;
}
if (num9 != -1)
{
this.ai[0] = (float) num9;
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
this.netUpdate = true;
this.TargetClosest();
if (num9 == 0)
this.ai[2] = (float) this.direction;
else
++this.ai[3];
}
this.reflectsProjectiles = flag;
}
private void BloodNautilus_CallForHelp()
{
if (Main.netMode == 1 || !Main.player[this.target].active || Main.player[this.target].dead || (double) this.Distance(Main.player[this.target].Center) > 2000.0 || NPC.CountNPCS(619) >= 3)
return;
Point tileCoordinates = this.Center.ToTileCoordinates();
Point point = tileCoordinates;
int num1 = 20;
int num2 = 3;
int num3 = 8;
int num4 = 2;
int num5 = 0;
bool flag1 = false;
while (!flag1 && num5 < 100)
{
++num5;
int index1 = Main.rand.Next(point.X - num1, point.X + num1 + 1);
int index2 = Main.rand.Next(point.Y - num1, point.Y + num1 + 1);
if ((index2 < point.Y - num3 || index2 > point.Y + num3 || index1 < point.X - num3 || index1 > point.X + num3) && (index2 < tileCoordinates.Y - num2 || index2 > tileCoordinates.Y + num2 || index1 < tileCoordinates.X - num2 || index1 > tileCoordinates.X + num2) && !Main.tile[index1, index2].nactive())
{
bool flag2 = true;
if (flag2 && Main.tile[index1, index2].lava())
flag2 = false;
if (flag2 && Collision.SolidTiles(index1 - num4, index1 + num4, index2 - num4, index2 + num4))
flag2 = false;
if (flag2 && !Collision.CanHitLine(this.Center, 0, 0, Main.player[this.target].Center, 0, 0))
flag2 = false;
if (flag2)
{
Projectile.NewProjectile((float) (index1 * 16 + 8), (float) (index2 * 16 + 8), 0.0f, 0.0f, 813, 0, 0.0f, Main.myPlayer);
break;
}
}
}
}
public static bool TooWindyForButterflies => (double) Math.Abs(Main.windSpeedTarget) >= 0.400000005960464;
private void AI_116_WaterStriders()
{
bool flag1 = false;
float waterLineHeight;
if (Collision.GetWaterLine(this.Center.ToTileCoordinates(), out waterLineHeight))
{
float num = this.Bottom.Y - 1f;
if ((double) this.Center.Y > (double) waterLineHeight)
{
this.velocity.Y -= 0.8f;
if ((double) this.velocity.Y < -4.0)
this.velocity.Y = -4f;
if ((double) num + (double) this.velocity.Y < (double) waterLineHeight)
this.velocity.Y = waterLineHeight - num;
}
else
{
this.velocity.Y = MathHelper.Min(this.velocity.Y, waterLineHeight - num);
flag1 = true;
}
}
else if (this.wet)
this.velocity.Y -= 0.2f;
if ((int) this.ai[0] != 0)
return;
++this.ai[1];
this.velocity.X *= 0.9f;
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.6f;
bool flag2 = this.wet | flag1;
bool flag3 = flag2 || (double) this.velocity.Y == 0.0;
int num1 = Main.rand.Next(120, 241);
if (!flag2)
num1 = Main.rand.Next(60, 241);
if (!flag3 || (double) this.ai[1] < (double) num1)
return;
this.ai[1] = 0.0f;
this.velocity.X = Main.rand.NextFloatDirection() * 5f;
this.netUpdate = true;
if (flag2)
return;
if ((double) this.velocity.Y == 0.0)
this.velocity.Y = -2f;
this.ai[1] = 60f;
}
private void AI_115_LadyBugs()
{
if (Main.netMode != 1)
{
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = (float) ((double) Main.rand.NextFloat() * 0.200000002980232 + 0.699999988079071);
this.netUpdate = true;
}
if ((double) --this.localAI[0] <= 0.0)
{
this.localAI[0] = (float) Main.rand.Next(60, 181);
if (Main.rand.Next(5) == 0)
{
if ((double) this.ai[2] == 0.0)
{
this.ai[2] = 1f;
this.ai[0] = 0.0f;
this.netUpdate = true;
}
else if ((double) this.ai[2] == 1.0)
{
this.TargetClosest();
this.ai[2] = 0.0f;
this.ai[0] = Main.rand.NextFloat() * 6.283185f;
if ((double) this.Distance(Main.player[this.target].Center) > 700.0)
this.ai[0] = this.AngleTo(Main.player[this.target].Center) + Main.rand.NextFloatDirection() * 0.3f;
this.netUpdate = true;
}
}
this.TargetClosest();
this.ai[0] = Main.rand.NextFloat() * 6.283185f;
if ((double) this.Distance(Main.player[this.target].Center) > 700.0)
this.ai[0] = this.AngleTo(Main.player[this.target].Center) + Main.rand.NextFloatDirection() * 0.3f;
this.netUpdate = true;
}
}
this.scale = this.ai[1];
if ((double) this.ai[2] == 0.0)
{
Vector2 vector2 = this.ai[0].ToRotationVector2() * 1f;
vector2.X += Main.windSpeedTarget * 0.8f;
this.velocity = Vector2.Lerp(this.velocity, vector2, 0.0125f);
if ((double) this.velocity.Y > 0.0)
{
int num1 = 4;
int index1 = (int) this.Center.X / 16;
int num2 = (int) this.Center.Y / 16;
for (int index2 = num2; index2 < num2 + num1; ++index2)
{
if (Main.tile[index1, index2] != null && (Main.tile[index1, index2].nactive() && Main.tileSolid[(int) Main.tile[index1, index2].type] || Main.tile[index1, index2].liquid > (byte) 0))
{
this.ai[0] = -this.ai[0];
if ((double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.9f;
}
}
}
if ((double) this.velocity.Y < 0.0)
{
int num3 = 30;
bool flag = false;
int index3 = (int) this.Center.X / 16;
int num4 = (int) this.Center.Y / 16;
for (int index4 = num4; index4 < num4 + num3; ++index4)
{
if (Main.tile[index3, index4] != null && (Main.tile[index3, index4].nactive() && Main.tileSolid[(int) Main.tile[index3, index4].type] || Main.tile[index3, index4].liquid > (byte) 0))
flag = true;
}
if (!flag)
{
this.ai[0] = -this.ai[0];
if ((double) this.velocity.Y < 0.0)
this.velocity.Y *= 0.9f;
}
}
if (this.collideX)
{
this.ai[0] = (float) (-(double) this.ai[0] + 3.14159274101257);
this.velocity.X *= -0.2f;
}
}
else
{
if ((double) this.velocity.Y > 0.0)
{
int num5 = 4;
int index5 = (int) this.Center.X / 16 + this.direction;
int num6 = (int) this.Center.Y / 16;
for (int index6 = num6; index6 < num6 + num5; ++index6)
{
if (Main.tile[index5, index6] != null && Main.tile[index5, index6].liquid > (byte) 0)
{
this.TargetClosest();
this.velocity.Y = -1f;
this.ai[2] = 0.0f;
this.ai[0] = (float) ((double) Main.rand.NextFloat() * 0.785398185253143 - 1.57079637050629);
if ((double) this.Distance(Main.player[this.target].Center) > 700.0)
this.ai[0] = this.AngleTo(Main.player[this.target].Center) + Main.rand.NextFloatDirection() * 0.3f;
this.netUpdate = true;
return;
}
}
}
if ((double) this.velocity.Y != 0.0)
{
this.velocity.X *= 0.98f;
this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 2f, 0.005f);
}
else
{
this.velocity = Vector2.Lerp(this.velocity, Vector2.UnitX * (float) this.direction, 0.05f);
this.velocity.Y += 0.2f;
if (this.collideX)
{
this.direction *= -1;
this.velocity.X *= -0.2f;
this.netUpdate = true;
}
}
}
this.direction = (double) this.velocity.X > 0.0 ? 1 : -1;
}
private void AI_114_Dragonflies()
{
if ((double) this.localAI[0] == 0.0 && Main.netMode != 1)
{
this.localAI[0] = 1f;
Vector2 center = this.Center;
this.ai[2] = center.X;
this.ai[3] = center.Y;
this.velocity = (Main.rand.NextVector2Circular(5f, 3f) + Main.rand.NextVector2CircularEdge(5f, 3f)) * 0.4f;
this.ai[1] = 0.0f;
this.ai[0] = 1f;
this.netUpdate = true;
}
switch ((int) this.ai[0])
{
case 0:
this.velocity = this.velocity * 0.94f;
if (Main.netMode != 1 && (double) ++this.ai[1] >= (double) (60 + Main.rand.Next(60)))
{
Vector2 vector2 = new Vector2(this.ai[2], this.ai[3]);
if ((double) this.Distance(vector2) > 96.0)
this.velocity = this.DirectionTo(vector2) * 3f;
else if ((double) this.Distance(vector2) > 16.0)
this.velocity = this.DirectionTo(vector2) * 1f + Main.rand.NextVector2Circular(1f, 0.5f);
else
this.velocity = (Main.rand.NextVector2Circular(5f, 3f) + Main.rand.NextVector2CircularEdge(5f, 3f)) * 0.4f;
this.ai[1] = 0.0f;
this.ai[0] = 1f;
this.netUpdate = true;
break;
}
break;
case 1:
int num1 = 4;
if ((double) this.Distance(new Vector2(this.ai[2], this.ai[3])) > 112.0)
num1 = 200;
if ((double) ++this.ai[1] >= (double) num1)
{
this.ai[1] = 0.0f;
this.ai[0] = 0.0f;
this.netUpdate = true;
}
int index1 = (int) this.Center.X / 16;
int num2 = (int) this.Center.Y / 16;
int num3 = 3;
for (int index2 = num2; index2 < num2 + num3; ++index2)
{
if (Main.tile[index1, index2] != null && (Main.tile[index1, index2].nactive() && Main.tileSolid[(int) Main.tile[index1, index2].type] || Main.tile[index1, index2].liquid > (byte) 0))
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.9f;
this.velocity.Y -= 0.2f;
}
}
if ((double) this.velocity.Y < 0.0)
{
int num4 = 30;
bool flag = false;
for (int index3 = num2; index3 < num2 + num4; ++index3)
{
if (Main.tile[index1, index3] != null && Main.tile[index1, index3].nactive() && Main.tileSolid[(int) Main.tile[index1, index3].type])
{
flag = true;
break;
}
}
if (!flag && (double) this.velocity.Y < 0.0)
{
this.velocity.Y *= 0.9f;
break;
}
break;
}
break;
}
if ((double) this.velocity.X != 0.0)
this.direction = (double) this.velocity.X > 0.0 ? 1 : -1;
if (this.wet)
this.velocity.Y = -3f;
if ((double) this.localAI[1] > 0.0)
{
--this.localAI[1];
}
else
{
this.localAI[1] = 15f;
float num5 = 0.0f;
Vector2 zero = Vector2.Zero;
for (int index4 = 0; index4 < 200; ++index4)
{
NPC npc = Main.npc[index4];
if (npc.active && npc.damage > 0 && !npc.friendly && (double) npc.Hitbox.Distance(this.Center) <= 100.0)
{
++num5;
zero += this.DirectionFrom(npc.Center);
}
}
for (int index5 = 0; index5 < (int) byte.MaxValue; ++index5)
{
Player player = Main.player[index5];
if (player.active && (double) player.Hitbox.Distance(this.Center) <= 150.0)
{
++num5;
zero += this.DirectionFrom(player.Center);
}
}
if ((double) num5 > 0.0)
{
float num6 = 2f;
Vector2 vector2_1 = zero / num5 * num6;
this.velocity = this.velocity + vector2_1;
if ((double) this.velocity.Length() > 16.0)
this.velocity = this.velocity.SafeNormalize(Vector2.Zero) * 16f;
Vector2 vector2_2 = this.Center + vector2_1 * 10f;
this.ai[1] = -10f;
this.ai[0] = 1f;
this.ai[2] = vector2_2.X;
this.ai[3] = vector2_2.Y;
this.netUpdate = true;
}
else
{
if (Main.netMode == 1 || (double) (new Vector2(this.ai[2], this.ai[3]) - this.Center).Length() >= 16.0)
return;
int maxValue = 30;
if (Main.tile[(int) this.ai[2] / 16, (int) this.ai[3] / 16].type != (ushort) 519)
maxValue = 4;
if (Main.rand.Next(maxValue) != 0)
return;
int cattailX = (int) this.ai[2];
int cattailY = (int) this.ai[2];
if (NPC.FindCattailTop((int) this.ai[2] / 16, (int) this.ai[3] / 16, out cattailX, out cattailY))
{
this.ai[2] = (float) (cattailX * 16);
this.ai[3] = (float) (cattailY * 16);
this.netUpdate = true;
}
else
{
int i = (int) ((double) this.Center.X / 16.0);
int j = (int) ((double) this.Center.Y / 16.0);
while (!WorldGen.SolidTile(i, j) && (double) j < Main.worldSurface)
++j;
int num7 = j - Main.rand.Next(3, 6);
this.ai[2] = (float) (i * 16);
this.ai[3] = (float) (num7 * 16);
this.netUpdate = true;
}
}
}
}
private void AI_113_WindyBalloon()
{
if ((double) this.localAI[0] == 0.0 && Main.netMode != 1)
{
this.TargetClosest();
this.localAI[0] = 1f;
this.ai[2] = (float) (Main.rand.Next(7) + 1);
int index = NPC.NewNPC((int) this.position.X, (int) this.position.Y, 1);
if (Main.rand.Next(180) == 0)
Main.npc[index].SetDefaults(-4);
else if (Main.rand.Next(10) == 0)
Main.npc[index].SetDefaults(-7);
else if (Main.rand.Next(3) == 0)
Main.npc[index].SetDefaults(-3);
Main.npc[index].ai[0] = -999f;
Main.npc[index].netUpdate = true;
this.ai[3] = (float) index;
this.netUpdate = true;
this.ai[1] = Main.npc[index].scale;
}
this.position = this.Center;
this.Size = new Vector2(20f, 20f) * this.ai[1];
this.scale = this.ai[1];
this.Center = this.position;
NPC slaveNpc = this.AI_113_WindyBalloon_GetSlaveNPC();
this.rotation = this.velocity.X * 0.05f;
if (slaveNpc != null)
{
NPCAimedTarget targetData = this.GetTargetData();
float num1 = float.PositiveInfinity;
int num2 = 0;
Vector2 zero = Vector2.Zero;
if (!targetData.Invalid)
{
Vector2 vector2 = targetData.Center - this.Bottom;
if ((double) vector2.Y < 0.0)
num2 = (int) vector2.Y / -16;
num1 = vector2.Length();
if (this.direction != Math.Sign(vector2.X))
num2 = 0;
}
if (this.wet || slaveNpc.wet || this.collideX || this.collideY && (double) this.oldVelocity.Y < 0.0)
{
float num3 = this.oldVelocity.X + (float) (this.direction * 8);
this.position.X -= num3;
slaveNpc.position.X -= num3;
this.TargetClosest(false);
this.direction *= -1;
this.velocity.X = (float) (this.direction * 2);
this.life = -1;
this.HitEffect();
this.active = false;
this.netUpdate = true;
SoundEngine.PlaySound(this.DeathSound, this.position);
}
else
{
if (this.collideY)
{
this.velocity.Y = (double) this.oldVelocity.Y > 0.0 ? 1f : -1f;
this.TargetClosest(false);
}
float num4 = (float) (2.0 + (double) Math.Abs(Main.windSpeedTarget) * 2.0);
if (Math.Sign(this.velocity.X) != this.direction || (double) Math.Abs(this.velocity.X) < (double) num4)
{
this.velocity.X += (float) this.direction * 0.01f;
if ((double) this.velocity.X * (double) this.direction < 0.0)
{
if ((double) Math.Abs(this.velocity.X) > (double) num4)
this.velocity.X += (float) this.direction * 0.1f;
else
this.velocity.X += (float) this.direction * 0.05f;
}
else if ((double) Math.Abs(this.velocity.X) > (double) num4)
this.velocity.X = (float) this.direction * num4;
}
int index1 = (int) (((double) this.position.X + (double) (this.width / 2)) / 16.0) + this.direction;
int num5 = (int) (((double) this.position.Y + (double) this.height) / 16.0);
bool flag1 = true;
int num6 = 8 + num2;
bool flag2 = false;
for (int index2 = num5; index2 < num5 + num6; ++index2)
{
if (Main.tile[index1, index2] == null)
Main.tile[index1, index2] = new Tile();
if (Main.tile[index1, index2].nactive() && Main.tileSolid[(int) Main.tile[index1, index2].type] || Main.tile[index1, index2].liquid > (byte) 0)
{
if (index2 < num5 + 5 + num2)
flag2 = true;
flag1 = false;
break;
}
}
if ((double) num1 < 400.0 && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num7 = 2f;
float num8 = 0.035f;
if ((double) this.Center.Y + (double) (this.height / 4) > (double) Main.player[this.target].position.Y + (double) (Main.player[this.target].height / 4) && (double) this.velocity.Y > -(double) num7)
{
this.velocity.Y -= num8;
if ((double) this.velocity.Y > 0.0)
this.velocity.Y -= num8;
}
else if ((double) this.Center.Y + (double) (this.height / 4) < (double) Main.player[this.target].position.Y + (double) (Main.player[this.target].height / 4) && (double) this.velocity.Y < (double) num7)
{
this.velocity.Y += num8;
if ((double) this.velocity.Y < 0.0)
this.velocity.Y += num8;
}
}
else
{
if (flag1)
this.velocity.Y += 0.05f;
else
this.velocity.Y -= 0.1f;
if (flag2)
this.velocity.Y -= 0.2f;
if ((double) this.velocity.Y > 2.0)
this.velocity.Y = 2f;
if ((double) this.velocity.Y < -4.0)
this.velocity.Y = -4f;
}
slaveNpc.Center = this.Bottom + new Vector2(0.0f, -8f) + new Vector2(0.0f, 56f * this.ai[1]);
slaveNpc.velocity = this.velocity;
}
}
else
{
this.velocity.Y = MathHelper.Clamp(this.velocity.Y - 0.2f, -8f, 8f);
this.velocity.X = MathHelper.Clamp(this.velocity.X + Main.windSpeedTarget * 0.3f, -4f, 4f);
if (!this.collideX && !this.collideY)
return;
this.position.X -= this.oldVelocity.X + (float) (this.direction * 8);
this.TargetClosest(false);
this.direction *= -1;
this.velocity.X = (float) (this.direction * 2);
this.life = -1;
this.HitEffect();
this.active = false;
this.netUpdate = true;
SoundEngine.PlaySound(this.DeathSound, this.position);
}
}
public NPC AI_113_WindyBalloon_GetSlaveNPC()
{
int index = (int) this.ai[3];
NPC npc;
if (index >= 0 && index < 200)
{
npc = Main.npc[index];
if (!npc.active || npc.type != 1 || (double) npc.ai[0] != -999.0)
{
npc = (NPC) null;
this.ai[3] = -1f;
this.netUpdate = true;
}
}
else
npc = (NPC) null;
return npc;
}
private void AI_112_FairyCritter()
{
bool flag1 = false;
this.lavaImmune = true;
if (Main.netMode != 1 && (double) this.ai[2] > 1.0)
{
int num = 18000;
++this.localAI[1];
if ((double) this.localAI[1] >= (double) num)
{
this.ai[2] = 7f;
if ((double) Main.player[this.target].Center.X < (double) this.Center.X)
this.direction = 1;
else
this.direction = -1;
this.netUpdate = true;
}
}
switch ((int) this.ai[2])
{
case 0:
this.lavaImmune = false;
this.noTileCollide = false;
if ((double) this.ai[0] == 0.0 && (double) this.ai[1] == 0.0)
{
this.ai[0] = this.Center.X;
this.ai[1] = this.Center.Y;
}
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
this.velocity = new Vector2(MathHelper.Lerp(2f, 4f, Main.rand.NextFloat()) * (float) (Main.rand.Next(2) * 2 - 1), MathHelper.Lerp(1f, 2f, Main.rand.NextFloat()) * (float) (Main.rand.Next(2) * 2 - 1));
this.velocity = this.velocity * 0.7f;
this.netUpdate = true;
}
Vector2 vector2_1 = new Vector2(this.ai[0], this.ai[1]) - this.Center;
if ((double) vector2_1.Length() > 20.0)
{
this.velocity = this.velocity + new Vector2((double) vector2_1.X > 0.0 ? 1f : -1f, (double) vector2_1.Y > 0.0 ? 1f : -1f) * 0.04f;
if ((double) Math.Abs(this.velocity.Y) > 2.0)
this.velocity.Y *= 0.95f;
}
this.TargetClosest();
Player player = Main.player[this.target];
if (!player.dead && (double) player.Distance(this.Center) < 250.0)
{
this.ai[2] = 1f;
this.direction = (double) player.Center.X > (double) this.Center.X ? -1 : 1;
if ((double) this.velocity.X * (double) this.direction < 0.0)
this.velocity.X = (float) (this.direction * 2);
this.ai[3] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 1:
this.lavaImmune = false;
this.noTileCollide = false;
if (this.collideX)
{
this.direction *= -1;
this.velocity.X = (float) (this.direction * 2);
}
if (this.collideY)
this.velocity.Y = (double) this.oldVelocity.Y > 0.0 ? 1f : -1f;
float num1 = 4.5f;
if (Math.Sign(this.velocity.X) != this.direction || (double) Math.Abs(this.velocity.X) < (double) num1)
{
this.velocity.X += (float) this.direction * 0.04f;
if ((double) this.velocity.X * (double) this.direction < 0.0)
{
if ((double) Math.Abs(this.velocity.X) > (double) num1)
this.velocity.X += (float) this.direction * 0.4f;
else
this.velocity.X += (float) this.direction * 0.2f;
}
else if ((double) Math.Abs(this.velocity.X) > (double) num1)
this.velocity.X = (float) this.direction * num1;
}
int num2 = (int) (((double) this.position.X + (double) (this.width / 2)) / 16.0);
int num3 = 20;
if (this.direction < 0)
num2 -= num3;
int num4 = (int) (((double) this.position.Y + (double) this.height) / 16.0);
bool flag2 = true;
int num5 = 8;
bool flag3 = false;
for (int index1 = num2; index1 <= num2 + num3; ++index1)
{
for (int index2 = num4; index2 < num4 + num5; ++index2)
{
if (Main.tile[index1, index2] == null)
Main.tile[index1, index2] = new Tile();
if (Main.tile[index1, index2].nactive() && Main.tileSolid[(int) Main.tile[index1, index2].type] || Main.tile[index1, index2].liquid > (byte) 0)
{
if (index2 < num4 + 5)
flag3 = true;
flag2 = false;
break;
}
}
}
if (flag2)
this.velocity.Y += 0.05f;
else
this.velocity.Y -= 0.2f;
if (flag3)
this.velocity.Y -= 0.3f;
if ((double) this.velocity.Y > 3.0)
this.velocity.Y = 3f;
if ((double) this.velocity.Y < -5.0)
{
this.velocity.Y = -5f;
break;
}
break;
case 2:
this.noTileCollide = true;
NPCAimedTarget targetData1 = this.GetTargetData();
bool flag4 = false;
if (targetData1.Type == NPCTargetType.Player)
flag4 = Main.player[this.target].dead;
if (flag4)
{
this.ai[2] = 1f;
this.direction = (double) targetData1.Center.X > (double) this.Center.X ? -1 : 1;
if ((double) this.velocity.X * (double) this.direction < 0.0)
this.velocity.X = (float) (this.direction * 2);
this.ai[3] = 0.0f;
this.netUpdate = true;
break;
}
Microsoft.Xna.Framework.Rectangle r1 = Utils.CenteredRectangle(targetData1.Center, new Vector2((float) (targetData1.Width + 60), (float) (targetData1.Height / 2)));
if (Main.netMode != 1 && this.Hitbox.Intersects(r1))
{
Point treasureCoords;
if (this.GetFairyTreasureCoords(out treasureCoords))
{
this.ai[0] = (float) treasureCoords.X;
this.ai[1] = (float) treasureCoords.Y;
this.ai[2] = 3f;
this.ai[3] = 0.0f;
this.netUpdate = true;
break;
}
this.ai[2] = 6f;
this.ai[3] = 0.0f;
this.netUpdate = true;
break;
}
Vector2 vector2_2 = r1.ClosestPointInRect(this.Center);
Vector2 vector2_3 = this.DirectionTo(vector2_2) * 2f;
float num6 = this.Distance(vector2_2);
if ((double) num6 > 150.0)
vector2_3 *= 2f;
else if ((double) num6 > 80.0)
vector2_3 *= 1.5f;
this.velocity = Vector2.Lerp(this.velocity, vector2_3, 0.07f);
Point tileCoordinates1 = this.Center.ToTileCoordinates();
if ((double) this.ai[3] < 300.0)
{
bool goDownwards;
bool goUpwards;
this.GetBirdFlightRecommendation(6, 3, tileCoordinates1, out goDownwards, out goUpwards);
if (goDownwards)
this.velocity.Y += 0.05f;
if (goUpwards)
this.velocity.Y -= 0.02f;
if ((double) this.velocity.Y > 2.0)
this.velocity.Y = 2f;
if ((double) this.velocity.Y < -4.0)
this.velocity.Y = -4f;
}
if (WorldGen.InWorld(tileCoordinates1.X, tileCoordinates1.Y))
{
this.ai[3] = !WorldGen.SolidTile(tileCoordinates1) ? Math.Max(this.ai[3] - 1f, 0.0f) : Math.Min(this.ai[3] + 2f, 400f);
break;
}
break;
case 3:
this.noTileCollide = true;
if ((double) this.ai[3] == 15.0)
SoundEngine.PlaySound(27, (int) this.position.X, (int) this.position.Y);
if ((double) this.ai[3] <= 15.0)
{
this.velocity = this.velocity * 0.9f;
}
else
{
this.spriteDirection = (double) Main.player[this.target].Center.X <= (double) this.Center.X ? 1 : -1;
flag1 = true;
float num7 = 0.0f;
float num8 = this.ai[3] - 15f;
float circleHeight = 22f;
if ((double) num8 <= 65.0)
{
num7 = 0.3926991f;
circleHeight = 14f;
}
else if ((double) num8 <= 130.0)
{
num7 = -0.3926991f;
circleHeight = 18f;
}
float circleRotation = num7 * (float) this.direction;
Vector2 fairyCircleOffset = this.GetFairyCircleOffset(num8 / 65f, circleRotation, circleHeight);
this.velocity = this.GetFairyCircleOffset((float) ((double) num8 / 65.0 + 1.0 / 65.0), circleRotation, circleHeight) - fairyCircleOffset;
}
++this.ai[3];
if ((double) this.ai[3] >= 210.0)
{
this.ai[2] = 4f;
this.TargetClosest();
this.ai[3] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 4:
this.noTileCollide = true;
NPCAimedTarget targetData2 = this.GetTargetData();
bool flag5 = false;
if (targetData2.Type == NPCTargetType.Player)
flag5 = Main.player[this.target].dead;
if (flag5)
{
this.ai[2] = 1f;
this.direction = (double) targetData2.Center.X > (double) this.Center.X ? -1 : 1;
if ((double) this.velocity.X * (double) this.direction < 0.0)
this.velocity.X = (float) (this.direction * 2);
this.ai[3] = 0.0f;
this.netUpdate = true;
break;
}
Microsoft.Xna.Framework.Rectangle r2 = Utils.CenteredRectangle(new Vector2((float) ((double) this.ai[0] * 16.0 + 8.0), (float) ((double) this.ai[1] * 16.0 + 8.0)), Vector2.One * 5f);
if (this.Hitbox.Intersects(r2))
{
this.ai[2] = 5f;
this.ai[3] = 0.0f;
this.netUpdate = true;
break;
}
float num9 = this.Distance(targetData2.Center);
float num10 = 300f;
if ((double) num9 > (double) num10)
{
if ((double) num9 < (double) num10 + 100.0 && !Collision.SolidCollision(this.position, this.width, this.height))
{
this.noTileCollide = false;
if (this.collideX)
this.velocity.X *= -1f;
if (this.collideY)
this.velocity.Y *= -1f;
}
flag1 = true;
this.spriteDirection = (double) Main.player[this.target].Center.X <= (double) this.Center.X ? 1 : -1;
Vector2 vector2_4 = this.DirectionFrom(targetData2.Center);
if ((double) num9 > (double) num10 + 60.0)
{
this.velocity = this.velocity + vector2_4 * -0.1f;
if (Main.rand.Next(30) == 0)
SoundEngine.PlaySound(27, (int) this.position.X, (int) this.position.Y);
}
else if ((double) num9 < (double) num10 + 30.0)
this.velocity = this.velocity + this.DirectionTo(r2.ClosestPointInRect(this.Center)) * 0.1f;
if ((double) this.velocity.Length() > 1.0)
{
this.velocity = this.velocity * (1f / this.velocity.Length());
break;
}
break;
}
Vector2 vector2_5 = r2.ClosestPointInRect(this.Center);
Vector2 vector2_6 = this.DirectionTo(vector2_5);
float num11 = this.Distance(vector2_5);
if ((double) num11 > 150.0)
vector2_6 *= 3f;
else if ((double) num11 > 80.0)
vector2_6 *= 2f;
Point tileCoordinates2 = this.Center.ToTileCoordinates();
if ((double) this.ai[3] < 300.0)
{
this.velocity = Vector2.Lerp(this.velocity, vector2_6, 0.07f);
bool goDownwards;
bool goUpwards;
this.GetBirdFlightRecommendation(4, 2, tileCoordinates2, out goDownwards, out goUpwards);
if (goDownwards)
this.velocity.Y += 0.05f;
if (goUpwards)
this.velocity.Y -= 0.05f;
if ((double) this.velocity.Y > 1.0)
this.velocity.Y = 1f;
if ((double) this.velocity.Y < -1.0)
this.velocity.Y = -1f;
}
else
this.velocity = Vector2.Lerp(this.velocity, vector2_6, 0.07f);
this.ai[3] = !WorldGen.SolidTile(tileCoordinates2) ? Math.Max(this.ai[3] - 1f, 0.0f) : Math.Min(this.ai[3] + 2f, 400f);
break;
case 5:
this.localAI[1] = 0.0f;
this.noTileCollide = true;
bool flag6 = false;
Tile tileSafely = Framing.GetTileSafely(new Point((int) this.ai[0], (int) this.ai[1]));
if (!tileSafely.active() || !SceneMetrics.IsValidForOreFinder(tileSafely))
flag6 = true;
if ((double) this.ai[3] == 15.0)
SoundEngine.PlaySound(27, (int) this.position.X, (int) this.position.Y);
if ((double) this.ai[3] <= 15.0)
{
this.velocity = this.velocity * 0.9f;
}
else
{
flag1 = true;
float num12 = this.ai[3] - 15f;
int num13;
float num14 = (float) (Math.Cos((double) (num13 = (int) ((double) num12 / 50.0)) * 1.0) * 6.28318548202515 / 16.0);
float circleHeight = (float) (Math.Cos((double) num13 * 2.0) * 10.0 + 8.0);
float circleRotation = num14 * (float) this.direction;
Vector2 fairyCircleOffset = this.GetFairyCircleOffset(num12 / 50f, circleRotation, circleHeight);
this.velocity = this.GetFairyCircleOffset((float) ((double) num12 / 50.0 + 0.0199999995529652), circleRotation, circleHeight) - fairyCircleOffset;
this.spriteDirection = (double) Main.player[this.target].Center.X <= (double) this.Center.X ? 1 : -1;
}
++this.ai[3];
if (Main.netMode != 1 && (double) this.ai[3] > 200.0)
{
this.active = false;
switch (Main.netMode)
{
case 0:
NPC.FairyEffects(this.Center, this.type - 583);
break;
case 2:
this.netSkip = -1;
this.life = 0;
NetMessage.SendData(23, number: this.whoAmI);
NetMessage.SendData(112, number: 2, number2: ((float) (int) this.Center.X), number3: ((float) (int) this.Center.Y), number4: ((float) (this.type - 583)));
break;
}
}
else
break;
break;
case 6:
this.noTileCollide = true;
Vector2 vector2_7 = Main.player[this.target].Center - this.Center;
if ((double) vector2_7.Length() > 100.0)
{
this.ai[2] = 2f;
this.TargetClosest();
this.ai[3] = 0.0f;
this.netUpdate = true;
break;
}
if (!Collision.SolidCollision(this.position, this.width, this.height))
{
this.noTileCollide = false;
if (this.collideX)
this.velocity.X *= -1f;
if (this.collideY)
this.velocity.Y *= -1f;
}
if ((double) vector2_7.Length() > 20.0)
{
this.velocity = this.velocity + new Vector2((double) vector2_7.X > 0.0 ? 1f : -1f, (double) vector2_7.Y > 0.0 ? 1f : -1f) * 0.04f;
if ((double) Math.Abs(this.velocity.Y) > 2.0)
this.velocity.Y *= 0.95f;
}
Point treasureCoords1;
if (Main.netMode != 1 && this.GetFairyTreasureCoords(out treasureCoords1))
{
this.ai[0] = (float) treasureCoords1.X;
this.ai[1] = (float) treasureCoords1.Y;
this.ai[2] = 3f;
this.ai[3] = 0.0f;
this.netUpdate = true;
break;
}
break;
case 7:
this.noTileCollide = true;
this.velocity.X += 0.05f * (float) this.direction;
this.velocity.X = MathHelper.Clamp(this.velocity.X, -10f, 10f);
this.velocity.Y -= 0.025f;
this.velocity.Y = MathHelper.Clamp(this.velocity.Y, -5f, 5f);
this.EncourageDespawn(10);
break;
}
this.dontTakeDamage = this.dontTakeDamageFromHostiles = (double) this.ai[2] > 1.0;
for (int index = 0; index < 200; ++index)
{
if (index != this.whoAmI && Main.npc[index].active && Main.npc[index].aiStyle == 112 && (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 * 1.5)
{
if ((double) this.position.Y < (double) Main.npc[index].position.Y)
this.velocity.Y -= 0.05f;
else
this.velocity.Y += 0.05f;
}
}
if (!flag1)
{
this.direction = (double) this.velocity.X >= 0.0 ? 1 : -1;
this.spriteDirection = -this.direction;
}
Color color1 = Color.HotPink;
Color color2 = Color.LightPink;
int num15 = 4;
if (this.type == 584)
{
color1 = Color.LimeGreen;
color2 = Color.LightSeaGreen;
}
if (this.type == 585)
{
color1 = Color.RoyalBlue;
color2 = Color.LightBlue;
}
if ((int) Main.timeForVisualEffects % 2 == 0)
{
this.position = this.position + this.netOffset;
Dust dust = Dust.NewDustDirect(this.Center - new Vector2((float) num15) * 0.5f, num15 + 4, num15 + 4, 278, Alpha: 200, newColor: Color.Lerp(color1, color2, Main.rand.NextFloat()), Scale: 0.65f);
dust.velocity *= 0.0f;
dust.velocity += this.velocity * 0.3f;
dust.noGravity = true;
dust.noLight = true;
this.position = this.position - this.netOffset;
}
Lighting.AddLight(this.Center, color1.ToVector3() * 0.7f);
}
public static void FairyEffects(Vector2 Position, int type)
{
Color color1 = Color.HotPink;
Color color2 = Color.LightPink;
int num = 4;
if (type == 1)
{
color1 = Color.LimeGreen;
color2 = Color.LightSeaGreen;
}
if (type == 2)
{
color1 = Color.RoyalBlue;
color2 = Color.LightBlue;
}
for (int index = 0; index < 40; ++index)
{
Dust dust = Dust.NewDustDirect(Position - new Vector2((float) num) * 0.5f, num + 4, num + 4, 278, Alpha: 200, newColor: Color.Lerp(color1, color2, Main.rand.NextFloat()), Scale: 0.65f);
dust.velocity *= 1.5f;
if (index >= 30)
dust.velocity *= 3.5f;
else if (index >= 20)
dust.velocity *= 2f;
dust.fadeIn = (float) Main.rand.Next(0, 17) * 0.1f;
dust.noGravity = true;
}
SoundEngine.PlaySound(SoundID.Item4, (int) Position.X, (int) Position.Y);
}
private void GetBirdFlightRecommendation(
int downScanRange,
int upRange,
Point tCoords,
out bool goDownwards,
out bool goUpwards)
{
tCoords.X += this.direction;
goDownwards = true;
goUpwards = false;
int x = tCoords.X;
for (int y = tCoords.Y; y < tCoords.Y + downScanRange && WorldGen.InWorld(x, y); ++y)
{
Tile tile = Main.tile[x, y];
if (tile == null)
break;
if (tile.nactive() && Main.tileSolid[(int) tile.type] || tile.liquid > (byte) 0)
{
if (y < tCoords.Y + upRange)
goUpwards = true;
goDownwards = false;
break;
}
}
}
private Vector2 GetFairyCircleOffset(
float elapsedTime,
float circleRotation,
float circleHeight)
{
return ((((float) (6.28318548202515 * (double) elapsedTime + 1.57079637050629)).ToRotationVector2() + new Vector2(0.0f, -1f)) * new Vector2((float) (6 * -this.direction), circleHeight)).RotatedBy((double) circleRotation);
}
private bool GetFairyTreasureCoords(out Point treasureCoords)
{
treasureCoords = new Point();
Point tileCoordinates = this.Center.ToTileCoordinates();
Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle(tileCoordinates.X, tileCoordinates.Y, 1, 1);
rectangle1.Inflate(75, 50);
int blackEdgeWidth = Main.Map.BlackEdgeWidth;
Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle(0, 0, Main.maxTilesX, Main.maxTilesY);
rectangle2.Inflate(-blackEdgeWidth, -blackEdgeWidth);
Microsoft.Xna.Framework.Rectangle rectangle3 = Microsoft.Xna.Framework.Rectangle.Intersect(rectangle1, rectangle2);
int num1 = -1;
float num2 = -1f;
for (int left = rectangle3.Left; left <= rectangle3.Right; ++left)
{
for (int top = rectangle3.Top; top <= rectangle3.Bottom; ++top)
{
Tile t = Main.tile[left, top];
if (t != null && t.active() && TileID.Sets.FriendlyFairyCanLureTo[(int) t.type] && SceneMetrics.IsValidForOreFinder(t))
{
short num3 = Main.tileOreFinderPriority[(int) t.type];
if (TileID.Sets.Ore[(int) t.type])
{
int num4 = 3;
int num5 = 3;
int num6 = 40;
int num7 = 0;
for (int index1 = left - num4; index1 <= left + num4; ++index1)
{
for (int index2 = top - num5; index2 <= top + num5; ++index2)
{
if (Main.tile[index1, index2].active() && (int) Main.tile[index1, index2].type == (int) t.type)
++num7;
}
}
if (num7 < num6)
num3 = (short) -1;
}
if (num1 <= (int) num3)
{
float num8 = this.Distance(new Vector2((float) (left * 16 + 8), (float) (top * 16 + 8)));
if (num1 != (int) num3 || (double) num8 < (double) num2)
{
num1 = (int) num3;
num2 = num8;
treasureCoords.X = left;
treasureCoords.Y = top;
}
}
}
}
}
return num1 != -1;
}
private void AI_069_DukeFishron()
{
bool expertMode = Main.expertMode;
float num1 = expertMode ? 1.2f : 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 || (double) Vector2.Distance(player.Center, center) > 5600.0)
{
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;
this.EncourageDespawn(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;
}
SoundEngine.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)
SoundEngine.PlaySound(29, (int) center.X, (int) center.Y, 20);
if ((double) this.ai[2] % (double) num7 == 0.0)
{
SoundEngine.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))
SoundEngine.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))
SoundEngine.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)
SoundEngine.PlaySound(29, (int) center.X, (int) center.Y, 20);
if ((double) this.ai[2] % (double) num15 == 0.0)
{
SoundEngine.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))
SoundEngine.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))
SoundEngine.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))
SoundEngine.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)
SoundEngine.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;
if (Main.getGoodWorld)
num *= 2;
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 damageForProjectiles = this.GetAttackDamage_ForProjectiles(22f, 18f);
int Type = 100;
vector2.X += SpeedX * 5f;
vector2.Y += SpeedY * 5f;
int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, damageForProjectiles, 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;
if (Main.getGoodWorld)
{
num12 *= 1.2f;
num13 *= 1.2f;
}
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;
SoundEngine.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.type == 210 || this.type == 211)
NPCUtils.TargetClosestNonBees(this);
else if (this.target < 0 || this.target <= (int) byte.MaxValue || Main.player[this.target].dead)
this.TargetClosest();
if (this.type == 619)
{
if (Main.dayTime)
{
this.velocity.Y -= 0.3f;
this.EncourageDespawn(60);
}
this.position = this.position + this.netOffset;
if (this.alpha == (int) byte.MaxValue)
{
this.spriteDirection = this.direction;
this.velocity.Y = -6f;
for (int index = 0; index < 35; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 5);
dust.velocity *= 1f;
dust.scale = (float) (1.0 + (double) Main.rand.NextFloat() * 0.5);
dust.fadeIn = (float) (1.5 + (double) Main.rand.NextFloat() * 0.5);
dust.velocity += this.velocity * 0.5f;
}
}
this.alpha -= 15;
if (this.alpha < 0)
this.alpha = 0;
if (this.alpha != 0)
{
for (int index = 0; index < 2; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 5);
dust.velocity *= 1f;
dust.scale = (float) (1.0 + (double) Main.rand.NextFloat() * 0.5);
dust.fadeIn = (float) (1.5 + (double) Main.rand.NextFloat() * 0.5);
dust.velocity += this.velocity * 0.3f;
}
}
this.position = this.position - this.netOffset;
}
NPCAimedTarget targetData = this.GetTargetData();
bool flag1 = false;
if (targetData.Type == NPCTargetType.Player)
flag1 = Main.player[this.target].dead;
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 == 619)
{
num1 = 6f;
num2 = 0.1f;
}
else if (this.type == 252)
{
if (targetData.Type != NPCTargetType.None && Collision.CanHit((Entity) this, targetData))
{
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);
if ((double) this.position.Y / 16.0 < Main.worldSurface)
{
if ((double) Main.player[this.target].position.Y - (double) this.position.Y > 300.0 && (double) this.velocity.Y < 0.0)
this.velocity.Y *= 0.97f;
if ((double) Main.player[this.target].position.Y - (double) this.position.Y < 80.0 && (double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.97f;
}
}
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.ai[1];
float num5 = (float) (((double) this.ai[1] - 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 = targetData.Position.X + (float) (targetData.Width / 2);
float num7 = targetData.Position.Y + (float) (targetData.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 flag2 = false;
if ((double) num12 > 600.0)
flag2 = 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;
}
int num15 = this.type == 6 || this.type == 139 || this.type == 173 ? 1 : (this.type == 205 ? 1 : 0);
bool flag3 = this.type == 42 || this.type == 94 || this.type == 619 || this.type == 176 || this.type == 210 || this.type == 211 || this.type >= 231 && this.type <= 235;
bool flag4 = this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && this.type != 619;
int num16 = flag3 ? 1 : 0;
if ((num15 | num16) != 0)
{
if ((double) num13 > 100.0 | flag3)
{
++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.type == 619))
{
this.velocity.X += SpeedX1 * 0.007f;
this.velocity.Y += SpeedY1 * 0.007f;
}
}
if (flag1)
{
SpeedX1 = (float) ((double) this.direction * (double) num1 / 2.0);
SpeedY1 = (float) (-(double) num1 / 2.0);
}
else if (this.type == 619 && (double) this.Center.Y > (double) targetData.Center.Y - 200.0)
this.velocity.Y -= 0.3f;
if ((double) this.velocity.X < (double) SpeedX1)
{
this.velocity.X += num2;
if (flag4 && (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 (flag4 && (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 (flag4 && (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 (flag4 && (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 (targetData.Type != NPCTargetType.None && Collision.CanHit((Entity) this, targetData))
{
int damageForProjectiles = this.GetAttackDamage_ForProjectiles(25f, 22f);
int Type = 84;
Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX1, SpeedY1, Type, damageForProjectiles, 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.type == 619)
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 == 619 || 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 num17 = 0.7f;
if (this.type == 6 || this.type == 173)
num17 = 0.4f;
if (this.collideX)
{
this.netUpdate = true;
this.velocity.X = this.oldVelocity.X * -num17;
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 * -num17;
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;
}
this.position = this.position + this.netOffset;
if (this.type == 619)
{
int index = Dust.NewDust(this.position, this.width, this.height, 5, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100);
Main.dust[index].velocity *= 0.5f;
}
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;
}
this.position = this.position - this.netOffset;
}
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.type == 619) && 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)
{
SoundEngine.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 (targetData.Type == NPCTargetType.Player)
{
Player player = Main.player[this.target];
if (player != null && (double) player.stealth == 0.0 && player.itemAnimation == 0)
this.ai[1] = 0.0f;
}
if ((double) this.ai[1] >= 130.0)
{
if (targetData.Type != NPCTargetType.None && Collision.CanHit((Entity) this, targetData))
{
float num18 = 8f;
Vector2 vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) (this.height / 2));
float num19 = targetData.Center.X - vector2_2.X + (float) Main.rand.Next(-20, 21);
float num20 = targetData.Center.Y - vector2_2.Y + (float) Main.rand.Next(-20, 21);
if ((double) num19 < 0.0 && (double) this.velocity.X < 0.0 || (double) num19 > 0.0 && (double) this.velocity.X > 0.0)
{
float num21 = (float) Math.Sqrt((double) num19 * (double) num19 + (double) num20 * (double) num20);
float num22 = num18 / num21;
float SpeedX2 = num19 * num22;
float SpeedY2 = num20 * num22;
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 & flag2)
{
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)
{
if (this.type == 94 && !flag1)
{
if (this.justHit)
this.localAI[0] = 0.0f;
++this.localAI[0];
if ((double) this.localAI[0] == 180.0)
{
if (targetData.Type != NPCTargetType.None && Collision.CanHit((Entity) this, targetData))
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 (this.type == 619 && !flag1)
{
if (this.justHit)
this.localAI[0] += 10f;
++this.localAI[0];
if ((double) this.localAI[0] >= 120.0)
{
if (targetData.Type != NPCTargetType.None && Collision.CanHit((Entity) this, targetData))
{
if ((double) (this.Center - targetData.Center).Length() < 400.0)
{
this.velocity = -this.DirectionTo(new Vector2(targetData.Center.X, targetData.Position.Y)) * 5f;
this.netUpdate = true;
this.localAI[0] = 0.0f;
Projectile.NewProjectile(this.Center, this.DirectionTo(new Vector2(targetData.Center.X + (float) Main.rand.Next(-100, 101), targetData.Position.Y + (float) Main.rand.Next(-100, 101))) * 15f, 811, 50, 1f, Main.myPlayer);
}
else
this.localAI[0] = 50f;
}
else
this.localAI[0] = 50f;
}
}
}
if (((!Main.dayTime || this.type == 173 || this.type == 619 || 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 ? 0 : (this.type < 231 ? 1 : (this.type > 235 ? 1 : 0))) | (flag1 ? 1 : 0)) != 0)
{
this.velocity.Y -= num2 * 2f;
this.EncourageDespawn(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;
}
public void CopyInteractions(NPC npc)
{
for (int index = 0; index < this.playerInteraction.Length; ++index)
this.playerInteraction[index] = npc.playerInteraction[index];
this.lastInteraction = npc.lastInteraction;
}
public static int GetEaterOfWorldsSegmentsCount() => !Main.expertMode ? 65 : 70;
public static int GetEaterOfWorldsSegmentsCountByGamemode(int gamemode)
{
GameModeData gameModeData;
return !Main.RegisterdGameModes.TryGetValue(gamemode, out gameModeData) || !gameModeData.IsExpertMode ? 65 : 70;
}
public static int GetBrainOfCthuluCreepersCount() => Main.getGoodWorld ? 40 : 20;
private void AI_006_Worms()
{
if (this.type == 117 && (double) this.localAI[1] == 0.0)
{
this.localAI[1] = 1f;
SoundEngine.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)
{
SoundEngine.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;
}
}
if (this.type >= 621 && this.type <= 623)
{
this.position = this.position + this.netOffset;
this.dontTakeDamage = this.alpha > 0;
if (this.type == 621 || this.type != 621 && Main.npc[(int) this.ai[1]].alpha < 85)
{
if (this.dontTakeDamage)
{
for (int index = 0; index < 2; ++index)
Dust.NewDust(this.position, this.width, this.height, 5, Alpha: 100);
}
this.alpha -= 42;
if (this.alpha < 0)
this.alpha = 0;
}
if (this.alpha == 0 && Main.rand.Next(5) == 0)
Dust.NewDust(this.position, this.width, this.height, 5, Alpha: 100);
this.position = this.position - this.netOffset;
}
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 || Main.getGoodWorld))
{
int x = (int) ((double) this.Center.X / 16.0);
int y = (int) ((double) this.Center.Y / 16.0);
if (WorldGen.InWorld(x, y) && Main.tile[x, y].wall == (ushort) 0 && 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;
case 621:
flag1 = false;
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)
{
this.EncourageDespawn(300);
if (flag1)
this.velocity.Y += num1;
}
if (this.type == 621 && Main.dayTime)
{
this.EncourageDespawn(60);
++this.velocity.Y;
}
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[number].CopyInteractions(this);
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[number].CopyInteractions(this);
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[number].CopyInteractions(this);
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[number].CopyInteractions(this);
Main.npc[index9].ai[0] = (float) number;
NetMessage.SendData(23, number: number);
index9 = number;
}
}
if (this.type == 621 && (double) this.ai[0] == 0.0)
{
this.ai[3] = (float) this.whoAmI;
this.realLife = this.whoAmI;
int index11 = this.whoAmI;
int num4 = 16;
for (int index12 = 0; index12 < num4; ++index12)
{
int Type = 622;
if (index12 == num4 - 1)
Type = 623;
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[number].CopyInteractions(this);
Main.npc[index11].ai[0] = (float) number;
NetMessage.SendData(23, number: number);
index11 = 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) NPC.GetEaterOfWorldsSegmentsCount();
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);
Main.npc[(int) this.ai[0]].CopyInteractions(this);
}
else if ((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)
{
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, this.whoAmI);
Main.npc[(int) this.ai[0]].CopyInteractions(this);
}
else
{
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);
Main.npc[(int) this.ai[0]].CopyInteractions(this);
}
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 index13 = this.whoAmI;
int num5 = 30;
for (int index14 = 0; index14 < num5; ++index14)
{
int Type = 413;
if (index14 == num5 - 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) index13;
Main.npc[number].CopyInteractions(this);
Main.npc[index13].ai[0] = (float) number;
NetMessage.SendData(23, number: number);
index13 = 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:
case 622:
case 623:
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:
case 621:
case 622:
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 num6 = (float) this.life / (float) this.lifeMax;
float num7 = this.ai[0];
this.SetDefaultsKeepPlayerInteraction(this.type);
this.life = (int) ((double) this.lifeMax * (double) num6);
this.ai[0] = num7;
this.TargetClosest();
this.netUpdate = true;
this.whoAmI = whoAmI;
this.alpha = 0;
}
if (this.type == 14 && (!Main.npc[(int) this.ai[0]].active || Main.npc[(int) this.ai[0]].aiStyle != this.aiStyle))
{
this.type = 15;
int whoAmI = this.whoAmI;
float num8 = (float) this.life / (float) this.lifeMax;
float num9 = this.ai[1];
this.SetDefaultsKeepPlayerInteraction(this.type);
this.life = (int) ((double) this.lifeMax * (double) num8);
this.ai[1] = num9;
this.TargetClosest();
this.netUpdate = true;
this.whoAmI = whoAmI;
this.alpha = 0;
}
}
if (!this.active && Main.netMode == 2)
NetMessage.SendData(28, number: this.whoAmI, number2: -1f);
}
int num10 = (int) ((double) this.position.X / 16.0) - 1;
int num11 = (int) (((double) this.position.X + (double) this.width) / 16.0) + 2;
int num12 = (int) ((double) this.position.Y / 16.0) - 1;
int num13 = (int) (((double) this.position.Y + (double) this.height) / 16.0) + 2;
if (num10 < 0)
num10 = 0;
if (num11 > Main.maxTilesX)
num11 = Main.maxTilesX;
if (num12 < 0)
num12 = 0;
if (num13 > Main.maxTilesY)
num13 = 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 >= 621 && this.type <= 623)
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 = num10; i < num11; ++i)
{
for (int j = num12; j < num13; ++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() && Main.tileSolid[(int) Main.tile[i, j].type])
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 || this.type == 621))
{
Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height);
int num14 = 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 - num14, (int) Main.player[index].position.Y - num14, num14 * 2, num14 * 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 || this.type >= 621 && this.type <= 623)
{
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)
{
this.position = this.position + this.netOffset;
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;
this.position = this.position - this.netOffset;
}
float num15 = 8f;
float num16 = 0.07f;
if (this.type == 95)
{
num15 = 5.5f;
num16 = 0.045f;
}
if (this.type == 10)
{
num15 = 6f;
num16 = 0.05f;
}
if (this.type == 513)
{
num15 = 7f;
num16 = 0.1f;
}
if (this.type == 13)
{
num15 = 10f;
num16 = 0.07f;
if (Main.expertMode)
{
num15 = 12f;
num16 = 0.15f;
}
if (Main.getGoodWorld)
{
num15 += 4f;
num16 += 0.05f;
}
}
if (this.type == 510)
{
if (!Main.player[this.target].dead && Main.player[this.target].ZoneSandstorm)
{
num15 = 16f;
num16 = 0.35f;
}
else
{
num15 = 10f;
num16 = 0.25f;
}
}
if (this.type == 87)
{
num15 = 11f;
num16 = 0.25f;
}
if (this.type == 621)
{
num15 = 15f;
num16 = 0.45f;
}
if (this.type == 375)
{
num15 = 6f;
num16 = 0.15f;
}
if (this.type == 454)
{
num15 = 20f;
num16 = 0.55f;
}
if (this.type == 402)
{
num15 = 6f;
num16 = 0.2f;
}
if (this.type == 117 && Main.wofNPCIndex >= 0)
{
double num17;
if ((num17 = (double) ((float) Main.npc[Main.wofNPCIndex].life / (float) Main.npc[Main.wofNPCIndex].lifeMax)) < 0.5)
{
++num15;
num16 += 0.1f;
}
if (num17 < 0.25)
{
++num15;
num16 += 0.1f;
}
if (num17 < 0.1)
{
num15 += 2f;
num16 += 0.1f;
}
}
Vector2 vector2_3 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num18 = Main.player[this.target].position.X + (float) (Main.player[this.target].width / 2);
float num19 = Main.player[this.target].position.Y + (float) (Main.player[this.target].height / 2);
if (this.type == 412)
{
num15 = 10f;
num16 = 0.3f;
int num20 = -1;
int num21 = (int) ((double) Main.player[this.target].Center.X / 16.0);
int num22 = (int) ((double) Main.player[this.target].Center.Y / 16.0);
for (int i = num21 - 2; i <= num21 + 2; ++i)
{
for (int j = num22; j <= num22 + 15; ++j)
{
if (WorldGen.SolidTile2(i, j))
{
num20 = j;
break;
}
}
if (num20 > 0)
break;
}
if (num20 > 0)
{
num20 *= 16;
float num23 = (float) (num20 - 800);
if ((double) Main.player[this.target].position.Y > (double) num23)
{
num19 = num23;
if ((double) Math.Abs(this.Center.X - Main.player[this.target].Center.X) < 500.0)
num18 = (double) this.velocity.X <= 0.0 ? Main.player[this.target].Center.X - 600f : Main.player[this.target].Center.X + 600f;
}
}
else
{
num15 = 14f;
num16 = 0.5f;
}
float num24 = num15 * 1.3f;
float num25 = num15 * 0.7f;
float num26 = this.velocity.Length();
if ((double) num26 > 0.0)
{
if ((double) num26 > (double) num24)
{
this.velocity.Normalize();
this.velocity = this.velocity * num24;
}
else if ((double) num26 < (double) num25)
{
this.velocity.Normalize();
this.velocity = this.velocity * num25;
}
}
if (num20 > 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;
num18 -= vector2_5.X;
num19 -= 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;
num18 -= vector2_7.X;
num19 -= vector2_7.Y;
}
}
}
}
}
float num27 = (float) ((int) ((double) num18 / 16.0) * 16);
float num28 = (float) ((int) ((double) num19 / 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 num29 = num27 - vector2_3.X;
float num30 = num28 - vector2_3.Y;
if (this.type == 375)
{
num29 *= -1f;
num30 *= -1f;
}
float num31 = (float) Math.Sqrt((double) num29 * (double) num29 + (double) num30 * (double) num30);
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);
num29 = Main.npc[(int) this.ai[1]].position.X + (float) (Main.npc[(int) this.ai[1]].width / 2) - vector2_3.X;
num30 = 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) num30, (double) num29) + 1.57f;
float num32 = (float) Math.Sqrt((double) num29 * (double) num29 + (double) num30 * (double) num30);
int num33 = this.width;
if (this.type >= 87 && this.type <= 92)
num33 = 42;
if (this.type >= 454 && this.type <= 459)
num33 = 36;
if (this.type >= 13 && this.type <= 15)
num33 = (int) ((double) num33 * (double) this.scale);
if (this.type >= 513 && this.type <= 515)
num33 -= 6;
if (this.type >= 412 && this.type <= 414)
num33 += 6;
if (this.type >= 621 && this.type <= 623)
num33 = 24;
if (Main.getGoodWorld && this.type >= 13 && this.type <= 15)
num33 = 62;
float num34 = (num32 - (float) num33) / num32;
float num35 = num29 * num34;
float num36 = num30 * num34;
this.velocity = Vector2.Zero;
this.position.X += num35;
this.position.Y += num36;
if (this.type >= 87 && this.type <= 92)
{
if ((double) num35 < 0.0)
this.spriteDirection = 1;
else if ((double) num35 > 0.0)
this.spriteDirection = -1;
}
if (this.type >= 454 && this.type <= 459)
{
if ((double) num35 < 0.0)
this.spriteDirection = 1;
else if ((double) num35 > 0.0)
this.spriteDirection = -1;
}
if (this.type >= 621 && this.type <= 623)
{
if ((double) num35 < 0.0)
{
this.spriteDirection = 1;
goto label_422;
}
else if ((double) num35 > 0.0)
{
this.spriteDirection = -1;
goto label_422;
}
else
goto label_422;
}
else
goto label_422;
}
}
if (!flag2)
{
this.TargetClosest();
this.velocity.Y += 0.11f;
if ((double) this.velocity.Y > (double) num15)
this.velocity.Y = num15;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num15 * 0.4)
{
if ((double) this.velocity.X < 0.0)
this.velocity.X -= num16 * 1.1f;
else
this.velocity.X += num16 * 1.1f;
}
else if ((double) this.velocity.Y == (double) num15)
{
if ((double) this.velocity.X < (double) num29)
this.velocity.X += num16;
else if ((double) this.velocity.X > (double) num29)
this.velocity.X -= num16;
}
else if ((double) this.velocity.Y > 4.0)
{
if ((double) this.velocity.X < 0.0)
this.velocity.X += num16 * 0.9f;
else
this.velocity.X -= num16 * 0.9f;
}
}
else
{
if (this.type != 621 && this.type != 87 && this.type != 117 && this.type != 454 && this.type != 412 && this.soundDelay == 0)
{
float num37 = num31 / 40f;
if ((double) num37 < 10.0)
num37 = 10f;
if ((double) num37 > 20.0)
num37 = 20f;
this.soundDelay = (int) num37;
SoundEngine.PlaySound(15, (int) this.position.X, (int) this.position.Y);
}
float num38 = (float) Math.Sqrt((double) num29 * (double) num29 + (double) num30 * (double) num30);
float num39 = Math.Abs(num29);
float num40 = Math.Abs(num30);
float num41 = num15 / num38;
float num42 = num29 * num41;
float num43 = num30 * num41;
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 num44;
for (int number = (int) this.ai[0]; number > 0 && number < 200 && Main.npc[number].active && Main.npc[number].aiStyle == this.aiStyle; number = num44)
{
num44 = (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);
}
num42 = 0.0f;
num43 = num15;
}
}
bool flag6 = false;
if (this.type == 87)
{
if (((double) this.velocity.X > 0.0 && (double) num42 < 0.0 || (double) this.velocity.X < 0.0 && (double) num42 > 0.0 || (double) this.velocity.Y > 0.0 && (double) num43 < 0.0 || (double) this.velocity.Y < 0.0 && (double) num43 > 0.0) && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > (double) num16 / 2.0 && (double) num38 < 300.0)
{
flag6 = true;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num15)
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) num15 / 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) num15)
this.velocity.Y -= num16;
}
}
if (this.type == 454 || this.type == 621)
{
float num45 = 300f;
if (this.type == 621)
num45 = 120f;
if (((double) this.velocity.X > 0.0 && (double) num42 < 0.0 || (double) this.velocity.X < 0.0 && (double) num42 > 0.0 || (double) this.velocity.Y > 0.0 && (double) num43 < 0.0 || (double) this.velocity.Y < 0.0 && (double) num43 > 0.0) && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > (double) num16 / 2.0 && (double) num38 < (double) num45)
{
flag6 = true;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num15)
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) num15 / 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) num15)
this.velocity.Y -= num16;
}
}
if (!flag6)
{
if ((double) this.velocity.X > 0.0 && (double) num42 > 0.0 || (double) this.velocity.X < 0.0 && (double) num42 < 0.0 || (double) this.velocity.Y > 0.0 && (double) num43 > 0.0 || (double) this.velocity.Y < 0.0 && (double) num43 < 0.0)
{
if ((double) this.velocity.X < (double) num42)
this.velocity.X += num16;
else if ((double) this.velocity.X > (double) num42)
this.velocity.X -= num16;
if ((double) this.velocity.Y < (double) num43)
this.velocity.Y += num16;
else if ((double) this.velocity.Y > (double) num43)
this.velocity.Y -= num16;
if ((double) Math.Abs(num43) < (double) num15 * 0.2 && ((double) this.velocity.X > 0.0 && (double) num42 < 0.0 || (double) this.velocity.X < 0.0 && (double) num42 > 0.0))
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y += num16 * 2f;
else
this.velocity.Y -= num16 * 2f;
}
if ((double) Math.Abs(num42) < (double) num15 * 0.2 && ((double) this.velocity.Y > 0.0 && (double) num43 < 0.0 || (double) this.velocity.Y < 0.0 && (double) num43 > 0.0))
{
if ((double) this.velocity.X > 0.0)
this.velocity.X += num16 * 2f;
else
this.velocity.X -= num16 * 2f;
}
}
else if ((double) num39 > (double) num40)
{
if ((double) this.velocity.X < (double) num42)
this.velocity.X += num16 * 1.1f;
else if ((double) this.velocity.X > (double) num42)
this.velocity.X -= num16 * 1.1f;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num15 * 0.5)
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y += num16;
else
this.velocity.Y -= num16;
}
}
else
{
if ((double) this.velocity.Y < (double) num43)
this.velocity.Y += num16 * 1.1f;
else if ((double) this.velocity.Y > (double) num43)
this.velocity.Y -= num16 * 1.1f;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num15 * 0.5)
{
if ((double) this.velocity.X > 0.0)
this.velocity.X += num16;
else
this.velocity.X -= num16;
}
}
}
}
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 || this.type == 621)
{
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)
{
float num46 = Vector2.Distance(Main.player[this.target].Center, this.Center);
int num47 = 0;
if ((double) Vector2.Normalize(Main.player[this.target].Center - this.Center).ToRotation().AngleTowards(this.velocity.ToRotation(), 1.570796f) == (double) this.velocity.ToRotation() && (double) num46 < 350.0)
num47 = 4;
if ((double) num47 > this.frameCounter)
++this.frameCounter;
if ((double) num47 < this.frameCounter)
--this.frameCounter;
if (this.frameCounter < 0.0)
this.frameCounter = 0.0;
if (this.frameCounter > 4.0)
this.frameCounter = 4.0;
}
label_422:
if (this.type < 13 || this.type > 15 || this.type != 13 && (this.type == 13 || Main.npc[(int) this.ai[1]].alpha >= 85))
return;
if (this.alpha > 0 && this.life > 0)
{
for (int index15 = 0; index15 < 2; ++index15)
{
int index16 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, Alpha: 100, Scale: 2f);
Main.dust[index16].noGravity = true;
Main.dust[index16].noLight = true;
}
}
if ((double) (this.position - this.oldPosition).Length() <= 2.0)
return;
this.alpha -= 42;
if (this.alpha >= 0)
return;
this.alpha = 0;
}
private void AI_002_FloatingEye()
{
if ((this.type == 170 || this.type == 171 || this.type == 180) && Main.rand.Next(1000) == 0)
SoundEngine.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 (NPC.DespawnEncouragement_AIStyle2_FloatingEye_IsDiscouraged(this.type, this.position, this.target))
{
this.EncourageDespawn(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)
{
this.position = this.position + this.netOffset;
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;
this.position = this.position - this.netOffset;
}
}
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)
{
this.position = this.position + this.netOffset;
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;
this.position = this.position - this.netOffset;
}
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();
}
public static bool DespawnEncouragement_AIStyle2_FloatingEye_IsDiscouraged(
int npcID,
Vector2 npcPosition,
int target = 255)
{
if (Main.player[target].ZoneGraveyard || !Main.dayTime || (double) npcPosition.Y > Main.worldSurface * 16.0)
return false;
return npcID == 2 || npcID == 133 || npcID == 190 || npcID == 191 || npcID == 192 || npcID == 193 || npcID == 194 || npcID == 317 || npcID == 318;
}
private bool AI_007_TownEntities_IsInAGoodRestingSpot(
int tileX,
int tileY,
int idealRestX,
int idealRestY)
{
return !Main.dayTime && (double) this.ai[0] == 5.0 ? Math.Abs(tileX - idealRestX) < 7 && Math.Abs(tileY - idealRestY) < 7 : (this.type != 361 && this.type != 445 || !this.wet) && tileX == idealRestX && tileY == idealRestY;
}
private void AI_007_FindGoodRestingSpot(
int myTileX,
int myTileY,
out int floorX,
out int floorY)
{
floorX = this.homeTileX;
floorY = this.homeTileY;
if (floorX == -1 || floorY == -1)
return;
while (!WorldGen.SolidOrSlopedTile(floorX, floorY) && floorY < Main.maxTilesY - 20)
++floorY;
if (Main.dayTime || (double) this.ai[0] == 5.0 && Math.Abs(myTileX - floorX) < 7 && Math.Abs(myTileY - floorY) < 7)
return;
Point point1 = new Point(floorX, floorY);
Point point2 = new Point(-1, -1);
int num1 = -1;
int num2 = 7;
int num3 = 6;
int num4 = 2;
int num5 = 1;
int num6 = 2;
for (int index1 = point1.X - num2; index1 <= point1.X + num2; index1 += num5)
{
for (int index2 = point1.Y + num4; index2 >= point1.Y - num3; index2 -= num6)
{
Tile tile = Main.tile[index1, index2];
if (tile != null && tile.active() && (!TileID.Sets.CanBeSatOnForNPCs[(int) tile.type] || (int) tile.frameY % 40 != 0 || index2 + 1 <= point1.Y + num4))
{
int num7 = Math.Abs(index1 - point1.X) + Math.Abs(index2 - point1.Y);
if (num1 == -1 || num7 < num1)
{
num1 = num7;
point2.X = index1;
point2.Y = index2;
}
}
}
}
if (num1 == -1)
return;
Tile tile1 = Main.tile[point2.X, point2.Y];
if (tile1.type == (ushort) 497 || tile1.type == (ushort) 15)
{
if ((int) tile1.frameY % 40 != 0)
--point2.Y;
point2.Y += 2;
}
floorX = point2.X;
floorY = point2.Y;
}
private void AI_007_TryForcingSitting(int homeFloorX, int homeFloorY)
{
Tile tile = Main.tile[homeFloorX, homeFloorY - 1];
bool flag = this.type != 638 && this.type != 656 && (double) this.ai[0] != 5.0;
if (flag)
flag = ((flag ? 1 : 0) & (tile == null || !tile.active() ? 0 : (tile.type == (ushort) 15 ? 1 : (tile.type == (ushort) 497 ? 1 : 0)))) != 0;
if (flag)
flag = ((flag ? 1 : 0) & (tile.type != (ushort) 15 ? 1 : (tile.frameY != (short) 1080 ? 1 : 0))) != 0;
if (!flag)
return;
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) (homeFloorX * 16 + 8 + 2 * this.direction), (float) (homeFloorY * 16));
this.velocity = Vector2.Zero;
this.localAI[3] = 0.0f;
this.netUpdate = true;
}
private void AI_007_TownEntities()
{
int maxValue1 = 300;
if (this.type == 638 || this.type == 656)
maxValue1 = 0;
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.masterMode ? (!Main.expertMode ? (this.dryadWard ? this.defDefense + 6 : this.defDefense) : (this.dryadWard ? this.defDefense + 10 : this.defDefense)) : (this.dryadWard ? this.defDefense + 14 : this.defDefense);
if (this.isLikeATownNPC)
{
if (NPC.combatBookWasUsed)
{
num1 += 0.2f;
this.defense += 6;
}
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.downedQueenSlime)
{
num1 += 0.15f;
this.defense += 6;
}
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.downedQueenSlime)
{
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)
{
int projectileSearch = NPC.lazyNPCOwnedProjectileSearchArray[this.whoAmI];
bool flag2 = false;
if (Main.projectile.IndexInRange<Projectile>(projectileSearch))
{
Projectile projectile = Main.projectile[projectileSearch];
if (projectile.active && projectile.type == 582 && (double) projectile.ai[1] == (double) this.whoAmI)
flag2 = true;
}
this.localAI[0] = (float) flag2.ToInt();
}
if ((this.type == 362 || this.type == 364 || this.type == 602 || this.type == 608) && 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;
case 588:
NPC.savedGolfer = true;
break;
}
if (this.type >= 0 && this.type < 663 && 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 index1 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
int index2 = (int) ((double) this.position.Y + (double) this.height + 1.0) / 16;
int floorX;
int floorY;
this.AI_007_FindGoodRestingSpot(index1, index2, out floorX, out floorY);
if (this.type == 441)
NPC.taxCollector = true;
this.directionY = -1;
if (this.direction == 0)
this.direction = 1;
for (int index3 = 0; index3 < (int) byte.MaxValue; ++index3)
{
if (Main.player[index3].active && Main.player[index3].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[index3].position.X + (double) (Main.player[index3].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;
SoundEngine.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 (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 < 300.0)
this.direction = 1;
else if ((double) this.position.X / 16.0 > (double) (Main.maxTilesX - 300))
this.direction = -1;
}
if (!WorldGen.InWorld(index1, index2) || Main.tile[index1, index2] == null)
return;
if (!this.homeless && Main.netMode != 1 && this.townNPC && (flag1 || Main.tileDungeon[(int) Main.tile[index1, index2].type]) && !this.AI_007_TownEntities_IsInAGoodRestingSpot(index1, index2, floorX, floorY))
{
bool flag4 = true;
for (int index4 = 0; index4 < 2 && flag4; ++index4)
{
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 (index4 == 1)
rectangle = new Microsoft.Xna.Framework.Rectangle(floorX * 16 + 8 - NPC.sWidth / 2 - NPC.safeRangeX, floorY * 16 + 8 - NPC.sHeight / 2 - NPC.safeRangeY, NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2);
for (int index5 = 0; index5 < (int) byte.MaxValue; ++index5)
{
if (Main.player[index5].active && new Microsoft.Xna.Framework.Rectangle((int) Main.player[index5].position.X, (int) Main.player[index5].position.Y, Main.player[index5].width, Main.player[index5].height).Intersects(rectangle))
{
flag4 = false;
break;
}
}
}
if (flag4)
{
if (this.type == 37 || !Collision.SolidTiles(floorX - 1, floorX + 1, floorY - 3, floorY - 1))
{
this.velocity.X = 0.0f;
this.velocity.Y = 0.0f;
this.position.X = (float) (floorX * 16 + 8 - this.width / 2);
this.position.Y = (float) (floorY * 16 - this.height) - 0.1f;
this.netUpdate = true;
this.AI_007_TryForcingSitting(floorX, floorY);
}
else
{
this.homeless = true;
WorldGen.QuickFindHome(this.whoAmI);
}
}
}
bool flag5 = this.type == 300 || this.type == 447 || this.type == 610;
bool flag6 = this.type == 616 || this.type == 617 || this.type == 625;
bool flag7 = this.type == 361 || this.type == 445;
bool canBreathUnderWater = flag6 | flag7;
int num2 = NPCID.Sets.IsTownPet[this.type] ? 1 : 0;
bool flag8 = flag6 | flag7;
float num3 = 200f;
if (NPCID.Sets.DangerDetectRange[this.type] != -1)
num3 = (float) NPCID.Sets.DangerDetectRange[this.type];
bool flag9 = false;
bool flag10 = false;
float num4 = -1f;
float num5 = -1f;
int num6 = 0;
int index6 = -1;
int index7 = -1;
if (!flag6 && Main.netMode != 1 && !flag3)
{
for (int index8 = 0; index8 < 200; ++index8)
{
if (Main.npc[index8].active && !Main.npc[index8].friendly && Main.npc[index8].damage > 0 && (double) Main.npc[index8].Distance(this.Center) < (double) num3 && (this.type != 453 || !NPCID.Sets.Skeletons[Main.npc[index8].type]) && (Main.npc[index8].noTileCollide || Collision.CanHit(this.Center, 0, 0, Main.npc[index8].Center, 0, 0)))
{
flag9 = true;
float num7 = Main.npc[index8].Center.X - this.Center.X;
if (this.type == 614)
{
if ((double) num7 < 0.0 && ((double) num4 == -1.0 || (double) num7 > (double) num4))
{
num5 = num7;
index7 = index8;
}
if ((double) num7 > 0.0 && ((double) num5 == -1.0 || (double) num7 < (double) num5))
{
num4 = num7;
index6 = index8;
}
}
else
{
if ((double) num7 < 0.0 && ((double) num4 == -1.0 || (double) num7 > (double) num4))
{
num4 = num7;
index6 = index8;
}
if ((double) num7 > 0.0 && ((double) num5 == -1.0 || (double) num7 < (double) num5))
{
num5 = num7;
index7 = index8;
}
}
}
}
if (flag9)
{
num6 = (double) num4 != -1.0 ? ((double) num5 != -1.0 ? ((double) num5 < -(double) num4).ToDirectionInt() : -1) : 1;
float num8 = 0.0f;
if ((double) num4 != -1.0)
num8 = -num4;
if ((double) num8 == 0.0 || (double) num5 < (double) num8 && (double) num5 > 0.0)
num8 = num5;
if ((double) this.ai[0] == 8.0)
{
if (this.direction == -num6)
{
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) num8)
{
flag9 = false;
flag10 = NPCID.Sets.AttackType[this.type] > -1;
}
else if ((double) this.ai[0] != 1.0)
{
int tileX = (int) (((double) this.position.X + (double) (this.width / 2) + (double) (15 * this.direction)) / 16.0);
int tileY = (int) (((double) this.position.Y + (double) this.height - 16.0) / 16.0);
bool currentlyDrowning = this.wet && !canBreathUnderWater;
bool avoidFalling;
this.AI_007_TownEntities_GetWalkPrediction(index1, floorX, canBreathUnderWater, currentlyDrowning, tileX, tileY, out bool _, out avoidFalling);
if (!avoidFalling)
{
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 = -num6;
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 = -num6;
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 1.0 && this.direction != -num6)
{
this.direction = -num6;
this.netUpdate = true;
}
}
}
}
if ((double) this.ai[0] == 0.0)
{
if ((double) this.localAI[3] > 0.0)
--this.localAI[3];
int petIdleChance = 120;
if (this.type == 638)
petIdleChance = 60;
if (flag7 && this.wet)
{
this.ai[0] = 1f;
this.ai[1] = (float) (200 + Main.rand.Next(500, 700));
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.netUpdate = true;
}
else if (flag1 && !flag3 && !NPCID.Sets.TownCritter[this.type])
{
if (Main.netMode != 1)
{
if (index1 == floorX && index2 == floorY)
{
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;
this.AI_007_TryForcingSitting(floorX, floorY);
}
if (NPCID.Sets.IsTownPet[this.type])
this.AI_007_AttemptToPlayIdleAnimationsForPets(petIdleChance * 4);
}
else
{
if (index1 > floorX)
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 (!flag3 && NPCID.Sets.IsTownPet[this.type] && (double) this.ai[1] >= 100.0 && (double) this.ai[1] <= 150.0)
this.AI_007_AttemptToPlayIdleAnimationsForPets(petIdleChance);
if ((double) this.ai[1] > 0.0)
--this.ai[1];
bool flag11 = true;
int tileX = (int) (((double) this.position.X + (double) (this.width / 2) + (double) (15 * this.direction)) / 16.0);
int tileY = (int) (((double) this.position.Y + (double) this.height - 16.0) / 16.0);
bool currentlyDrowning = this.wet && !canBreathUnderWater;
bool avoidFalling;
this.AI_007_TownEntities_GetWalkPrediction(index1, floorX, canBreathUnderWater, currentlyDrowning, tileX, tileY, out bool _, out avoidFalling);
if (avoidFalling)
flag11 = false;
if ((double) this.ai[1] <= 0.0)
{
if (flag11)
{
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;
}
else
{
this.direction *= -1;
this.ai[1] = (float) (60 + Main.rand.Next(120));
this.netUpdate = true;
}
}
}
}
if (Main.netMode != 1 && (!flag1 || this.AI_007_TownEntities_IsInAGoodRestingSpot(index1, index2, floorX, floorY)))
{
if (index1 < floorX - 25 || index1 > floorX + 25)
{
if ((double) this.localAI[3] == 0.0)
{
if (index1 < floorX - 50 && this.direction == -1)
{
this.direction = 1;
this.netUpdate = true;
}
else if (index1 > floorX + 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 && this.AI_007_TownEntities_IsInAGoodRestingSpot(index1, index2, floorX, floorY) && !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 currentlyDrowning = !canBreathUnderWater && Collision.DrownCollision(this.position, this.width, this.height, 1f, true);
if (!currentlyDrowning)
{
if (Main.netMode != 1 && !this.homeless && !Main.tileDungeon[(int) Main.tile[index1, index2].type] && (index1 < floorX - 35 || index1 > floorX + 35))
{
if ((double) this.position.X < (double) (floorX * 16) && this.direction == -1)
this.ai[1] -= 5f;
else if ((double) this.position.X > (double) (floorX * 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 num9 = 1f;
float num10 = 0.07f;
if (this.type == 614 & flag9)
{
num9 = 1.5f;
num10 = 0.1f;
}
else if (this.type == 299 || this.type == 539 || this.type == 538 || this.type >= 639 && this.type <= 645)
num9 = 1.5f;
else if (flag6)
{
if (this.wet)
{
num10 = 1f;
num9 = 2f;
}
else
{
num10 = 0.07f;
num9 = 0.5f;
}
}
if (this.type == 625)
{
if (this.wet)
{
num10 = 1f;
num9 = 2.5f;
}
else
{
num10 = 0.07f;
num9 = 0.2f;
}
}
if (flag5)
{
num9 = 2f;
num10 = 1f;
}
if (this.friendly && flag9 | currentlyDrowning)
{
num9 = 1.5f + (float) (1.0 - (double) this.life / (double) this.lifeMax) * 0.9f;
num10 = 0.1f;
}
if (flag7 && this.wet)
{
if ((double) Math.Abs(this.velocity.X) < 0.0500000007450581 && (double) Math.Abs(this.velocity.Y) < 0.0500000007450581)
this.velocity.X += num9 * 10f * (float) this.direction;
else
this.velocity.X *= 0.9f;
}
else if ((double) this.velocity.X < -(double) num9 || (double) this.velocity.X > (double) num9)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num9 && this.direction == 1)
{
this.velocity.X += num10;
if ((double) this.velocity.X > (double) num9)
this.velocity.X = num9;
}
else if ((double) this.velocity.X > -(double) num9 && this.direction == -1)
{
this.velocity.X -= num10;
if ((double) this.velocity.X > (double) num9)
this.velocity.X = num9;
}
bool holdsMatching = true;
if ((double) (this.homeTileY * 16 - 32) > (double) this.position.Y)
holdsMatching = false;
if (!holdsMatching && (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 num11 = (int) (((double) this.position.X + (double) (this.width / 2) + (double) (15 * this.direction)) / 16.0);
int num12 = (int) (((double) this.position.Y + (double) this.height - 16.0) / 16.0);
bool keepwalking;
bool avoidFalling;
this.AI_007_TownEntities_GetWalkPrediction(index1, floorX, canBreathUnderWater, currentlyDrowning, num11, num12, out keepwalking, out avoidFalling);
if (!avoidFalling && this.wet && !canBreathUnderWater && this.AI_007_TownEntities_CheckIfWillDrown(currentlyDrowning) && (double) this.localAI[3] <= 0.0)
{
avoidFalling = true;
this.localAI[3] = 600f;
}
if (avoidFalling)
{
int num13 = (int) (((double) this.position.X + (double) (this.width / 2)) / 16.0);
int num14 = 0;
for (int index9 = -1; index9 <= 1; ++index9)
{
Tile tileSafely = Framing.GetTileSafely(num13 + index9, num12 + 1);
if (tileSafely.nactive() && Main.tileSolid[(int) tileSafely.type])
++num14;
}
if (num14 <= 2)
{
if ((double) this.velocity.X != 0.0)
this.netUpdate = true;
keepwalking = avoidFalling = false;
this.ai[0] = 0.0f;
this.ai[1] = (float) (50 + Main.rand.Next(50));
this.ai[2] = 0.0f;
this.localAI[3] = 40f;
}
}
if ((double) this.position.X == (double) this.localAI[3])
{
this.direction *= -1;
this.netUpdate = true;
this.localAI[3] = 600f;
}
if (currentlyDrowning)
{
if ((double) this.localAI[3] > 0.0)
--this.localAI[3];
}
else
this.localAI[3] = -1f;
Tile tileSafely1 = Framing.GetTileSafely(num11, num12);
Tile tileSafely2 = Framing.GetTileSafely(num11, num12 - 1);
Tile tileSafely3 = Framing.GetTileSafely(num11, num12 - 2);
bool flag12 = this.height / 16 < 3;
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(num11, num12 - 2, this.direction))
{
this.closeDoor = true;
this.doorX = num11;
this.doorY = num12 - 2;
NetMessage.SendData(19, number2: ((float) num11), number3: ((float) (num12 - 2)), number4: ((float) this.direction));
this.netUpdate = true;
this.ai[1] += 80f;
}
else if (WorldGen.OpenDoor(num11, num12 - 2, -this.direction))
{
this.closeDoor = true;
this.doorX = num11;
this.doorY = num12 - 2;
NetMessage.SendData(19, number2: ((float) num11), number3: ((float) (num12 - 2)), number4: ((float) -this.direction));
this.netUpdate = true;
this.ai[1] += 80f;
}
else if (WorldGen.ShiftTallGate(num11, num12 - 2, false))
{
this.closeDoor = true;
this.doorX = num11;
this.doorY = num12 - 2;
NetMessage.SendData(19, number: 4, number2: ((float) num11), number3: ((float) (num12 - 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)
{
bool flag13 = false;
bool flag14 = false;
if (tileSafely3.nactive() && Main.tileSolid[(int) tileSafely3.type] && !Main.tileSolidTop[(int) tileSafely3.type] && (!flag12 || tileSafely2.nactive() && Main.tileSolid[(int) tileSafely2.type] && !Main.tileSolidTop[(int) tileSafely2.type]))
{
if (!Collision.SolidTilesVersatile(num11 - this.direction * 2, num11 - this.direction, num12 - 5, num12 - 1) && !Collision.SolidTiles(num11, num11, num12 - 5, num12 - 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 (flag9)
{
flag14 = true;
flag13 = true;
}
else
flag13 = true;
}
else if (tileSafely2.nactive() && Main.tileSolid[(int) tileSafely2.type] && !Main.tileSolidTop[(int) tileSafely2.type])
{
if (!Collision.SolidTilesVersatile(num11 - this.direction * 2, num11 - this.direction, num12 - 4, num12 - 1) && !Collision.SolidTiles(num11, num11, num12 - 4, num12 - 2))
{
this.velocity.Y = -5f;
this.netUpdate = true;
}
else if (flag9)
{
flag14 = true;
flag13 = true;
}
else
flag13 = true;
}
else if ((double) this.position.Y + (double) this.height - (double) (num12 * 16) > 20.0 && tileSafely1.nactive() && Main.tileSolid[(int) tileSafely1.type] && !tileSafely1.topSlope())
{
if (!Collision.SolidTilesVersatile(num11 - this.direction * 2, num11, num12 - 3, num12 - 1))
{
this.velocity.Y = -4.4f;
this.netUpdate = true;
}
else if (flag9)
{
flag14 = true;
flag13 = true;
}
else
flag13 = true;
}
else if (avoidFalling)
{
flag13 = true;
if (flag9)
flag14 = true;
}
if (flag14)
{
keepwalking = false;
this.velocity.X = 0.0f;
this.ai[0] = 8f;
this.ai[1] = 240f;
this.netUpdate = true;
}
if (flag13)
{
this.direction *= -1;
this.velocity.X *= -1f;
this.netUpdate = true;
}
if (keepwalking)
{
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 || (double) this.ai[0] == 20.0 || (double) this.ai[0] == 21.0 || (double) this.ai[0] == 22.0 || (double) this.ai[0] == 23.0)
{
this.velocity.X *= 0.8f;
--this.ai[1];
if ((double) this.ai[0] == 8.0 && (double) this.ai[1] < 60.0 & flag9)
{
this.ai[1] = 180f;
this.netUpdate = true;
}
if ((double) this.ai[0] == 5.0)
{
Point tileCoordinates = (this.Bottom + Vector2.UnitY * -2f).ToTileCoordinates();
Tile tile = Main.tile[tileCoordinates.X, tileCoordinates.Y];
if (tile.type != (ushort) 15 && tile.type != (ushort) 497)
this.ai[1] = 0.0f;
else
Main.sittingManager.AddNPC(this.whoAmI, tileCoordinates);
}
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 || (double) this.ai[0] == 19.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 index10 = (int) this.ai[2];
if (index10 < 0 || index10 > (int) byte.MaxValue || !Main.player[index10].CanBeTalkedTo || (double) Main.player[index10].Distance(this.Center) > 200.0 || !Collision.CanHitLine(this.Top, 0, 0, Main.player[index10].Top, 0, 0))
this.ai[1] = 0.0f;
if ((double) this.ai[1] > 0.0)
{
int num15 = (double) this.Center.X < (double) Main.player[index10].Center.X ? 1 : -1;
if (num15 != this.direction)
this.netUpdate = true;
this.direction = num15;
}
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 num16 = 0;
float KnockBack = 0.0f;
float num17 = 0.0f;
int num18 = 0;
int num19 = 0;
int maxValue2 = 0;
float num20 = 0.0f;
float num21 = (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;
num17 = 6f;
num16 = 20;
num18 = 10;
num19 = 180;
maxValue2 = 120;
num20 = 16f;
KnockBack = 7f;
}
else if (this.type == 633)
{
Type = 880;
num17 = 24f;
num16 = 15;
num18 = 1;
num20 = 0.0f;
KnockBack = 7f;
num19 = 15;
maxValue2 = 10;
if (this.ShouldBestiaryGirlBeLycantrope())
{
Type = 929;
num16 = (int) ((double) num16 * 1.5);
}
}
else if (this.type == 550)
{
Type = 669;
num17 = 6f;
num16 = 24;
num18 = 10;
num19 = 120;
maxValue2 = 60;
num20 = 16f;
KnockBack = 9f;
}
else if (this.type == 588)
{
Type = 721;
num17 = 8f;
num16 = 15;
num18 = 5;
num19 = 20;
maxValue2 = 10;
num20 = 16f;
KnockBack = 9f;
}
else if (this.type == 208)
{
Type = 588;
num17 = 6f;
num16 = 30;
num18 = 10;
num19 = 60;
maxValue2 = 120;
num20 = 16f;
KnockBack = 6f;
}
else if (this.type == 17)
{
Type = 48;
num17 = 9f;
num16 = 12;
num18 = 10;
num19 = 60;
maxValue2 = 60;
num20 = 16f;
KnockBack = 1.5f;
}
else if (this.type == 369)
{
Type = 520;
num17 = 12f;
num16 = 10;
num18 = 10;
num19 = 0;
maxValue2 = 1;
num20 = 16f;
KnockBack = 3f;
}
else if (this.type == 453)
{
Type = 21;
num17 = 14f;
num16 = 14;
num18 = 10;
num19 = 0;
maxValue2 = 1;
num20 = 16f;
KnockBack = 3f;
}
else if (this.type == 107)
{
Type = 24;
num17 = 5f;
num16 = 15;
num18 = 10;
num19 = 60;
maxValue2 = 60;
num20 = 16f;
KnockBack = 1f;
}
else if (this.type == 124)
{
Type = 582;
num17 = 10f;
num16 = 11;
num18 = 1;
num19 = 30;
maxValue2 = 30;
KnockBack = 3.5f;
}
else if (this.type == 18)
{
Type = 583;
num17 = 8f;
num16 = 8;
num18 = 1;
num19 = 15;
maxValue2 = 10;
KnockBack = 2f;
num20 = 10f;
}
else if (this.type == 142)
{
Type = 589;
num17 = 7f;
num16 = 22;
num18 = 1;
num19 = 10;
maxValue2 = 1;
KnockBack = 2f;
num20 = 10f;
}
if (Main.expertMode)
num16 = (int) ((double) num16 * (double) Main.GameModeInfo.TownNPCDamageMultiplier);
int Damage = (int) ((double) num16 * (double) num1);
this.velocity.X *= 0.8f;
--this.ai[1];
++this.localAI[3];
if ((double) this.localAI[3] == (double) num18 && Main.netMode != 1)
{
Vector2 vec = -Vector2.UnitY;
if (num6 == 1 && this.spriteDirection == 1 && index7 != -1)
vec = this.DirectionTo(Main.npc[index7].Center + new Vector2(0.0f, -num20 * MathHelper.Clamp(this.Distance(Main.npc[index7].Center) / num21, 0.0f, 1f)));
if (num6 == -1 && this.spriteDirection == -1 && index6 != -1)
vec = this.DirectionTo(Main.npc[index6].Center + new Vector2(0.0f, -num20 * MathHelper.Clamp(this.Distance(Main.npc[index6].Center) / num21, 0.0f, 1f)));
if (vec.HasNaNs() || Math.Sign(vec.X) != this.spriteDirection)
vec = new Vector2((float) this.spriteDirection, -1f);
Vector2 vector2 = vec * num17 + Utils.RandomVector2(Main.rand, -max, max);
int index11 = 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[index11].npcProj = true;
Main.projectile[index11].noDropItem = true;
if (this.type == 588)
Main.projectile[index11].timeLeft = 480;
}
if ((double) this.ai[1] <= 0.0)
{
this.ai[0] = (double) this.localAI[2] == 8.0 & flag9 ? 8f : 0.0f;
this.ai[1] = (float) (num19 + Main.rand.Next(maxValue2));
this.ai[2] = 0.0f;
this.localAI[1] = this.localAI[3] = (float) (num19 / 2 + Main.rand.Next(maxValue2));
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 12.0)
{
int Type = 0;
int num22 = 0;
float num23 = 0.0f;
int num24 = 0;
int num25 = 0;
int maxValue3 = 0;
float KnockBack = 0.0f;
int num26 = 0;
bool flag15 = 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 index12 = -1;
if (num6 == 1 && this.spriteDirection == 1)
index12 = index7;
if (num6 == -1 && this.spriteDirection == -1)
index12 = index6;
if (this.type == 19)
{
Type = 14;
num23 = 13f;
num22 = 24;
num25 = 14;
maxValue3 = 4;
KnockBack = 3f;
num24 = 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)
{
num22 = 15;
if ((double) this.localAI[3] > (double) num24)
{
num24 = 10;
flag15 = true;
}
if ((double) this.localAI[3] > (double) num24)
{
num24 = 20;
flag15 = true;
}
if ((double) this.localAI[3] > (double) num24)
{
num24 = 30;
flag15 = true;
}
}
}
else if (this.type == 227)
{
Type = 587;
num23 = 10f;
num22 = 8;
num25 = 10;
maxValue3 = 1;
KnockBack = 1.75f;
num24 = 1;
max = 0.5f;
if ((double) this.localAI[3] > (double) num24)
{
num24 = 12;
flag15 = true;
}
if ((double) this.localAI[3] > (double) num24)
{
num24 = 24;
flag15 = true;
}
if (Main.hardMode)
num22 += 2;
}
else if (this.type == 368)
{
Type = 14;
num23 = 13f;
num22 = 24;
num25 = 12;
maxValue3 = 5;
KnockBack = 2f;
num24 = 1;
max = 0.2f;
if (Main.hardMode)
{
num22 = 30;
Type = 357;
}
}
else if (this.type == 22)
{
num23 = 10f;
num22 = 8;
num24 = 1;
if (Main.hardMode)
{
Type = 2;
num25 = 15;
maxValue3 = 10;
num22 += 6;
}
else
{
Type = 1;
num25 = 30;
maxValue3 = 20;
}
KnockBack = 2.75f;
num26 = 4;
max = 0.7f;
}
else if (this.type == 228)
{
Type = 267;
num23 = 14f;
num22 = 20;
num24 = 1;
num25 = 10;
maxValue3 = 1;
KnockBack = 3f;
num26 = 6;
max = 0.4f;
}
else if (this.type == 178)
{
Type = 242;
num23 = 13f;
num22 = 15;
num25 = 10;
maxValue3 = 1;
KnockBack = 2f;
num24 = 1;
if ((double) this.localAI[3] > (double) num24)
{
num24 = 8;
flag15 = true;
}
if ((double) this.localAI[3] > (double) num24)
{
num24 = 16;
flag15 = true;
}
max = 0.3f;
}
else if (this.type == 229)
{
Type = 14;
num23 = 14f;
num22 = 24;
num25 = 10;
maxValue3 = 1;
KnockBack = 2f;
num24 = 1;
max = 0.7f;
if ((double) this.localAI[3] > (double) num24)
{
num24 = 16;
flag15 = true;
}
if ((double) this.localAI[3] > (double) num24)
{
num24 = 24;
flag15 = true;
}
if ((double) this.localAI[3] > (double) num24)
{
num24 = 32;
flag15 = true;
}
if ((double) this.localAI[3] > (double) num24)
{
num24 = 40;
flag15 = true;
}
if ((double) this.localAI[3] > (double) num24)
{
num24 = 48;
flag15 = true;
}
if ((double) this.localAI[3] == 0.0 && index12 != -1 && (double) this.Distance(Main.npc[index12].Center) < (double) NPCID.Sets.PrettySafe[this.type])
{
max = 0.1f;
Type = 162;
num22 = 50;
KnockBack = 10f;
num23 = 24f;
}
}
else if (this.type == 209)
{
Type = Utils.SelectRandom<int>(Main.rand, 134, 133, 135);
num24 = 1;
switch (Type)
{
case 133:
num23 = 10f;
num22 = 25;
num25 = 10;
maxValue3 = 1;
KnockBack = 6f;
max = 0.2f;
break;
case 134:
num23 = 13f;
num22 = 20;
num25 = 20;
maxValue3 = 10;
KnockBack = 4f;
max = 0.1f;
break;
case 135:
num23 = 12f;
num22 = 30;
num25 = 30;
maxValue3 = 10;
KnockBack = 7f;
max = 0.2f;
break;
}
}
if (Main.expertMode)
num22 = (int) ((double) num22 * (double) Main.GameModeInfo.TownNPCDamageMultiplier);
int Damage = (int) ((double) num22 * (double) num1);
this.velocity.X *= 0.8f;
--this.ai[1];
++this.localAI[3];
if ((double) this.localAI[3] == (double) num24 && Main.netMode != 1)
{
Vector2 vec = Vector2.Zero;
if (index12 != -1)
vec = this.DirectionTo(Main.npc[index12].Center + new Vector2(0.0f, (float) -num26));
if (vec.HasNaNs() || Math.Sign(vec.X) != this.spriteDirection)
vec = new Vector2((float) this.spriteDirection, 0.0f);
Vector2 vector2 = vec * num23 + Utils.RandomVector2(Main.rand, -max, max);
int index13 = 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[index13].npcProj = true;
Main.projectile[index13].noDropItem = true;
}
if ((double) this.localAI[3] == (double) num24 & flag15 && index12 != -1)
{
Vector2 vector2 = this.DirectionTo(Main.npc[index12].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 & flag9 ? 8f : 0.0f;
this.ai[1] = (float) (num25 + Main.rand.Next(maxValue3));
this.ai[2] = 0.0f;
this.localAI[1] = this.localAI[3] = (float) (num25 / 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 index14 = 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[index14].npcProj = true;
Main.projectile[index14].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 num27 = 0;
float num28 = 0.0f;
int num29 = 0;
int num30 = 0;
int maxValue4 = 0;
float KnockBack = 0.0f;
float num31 = 0.0f;
float num32 = (float) NPCID.Sets.DangerDetectRange[this.type];
float num33 = 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 index15 = -1;
if (num6 == 1 && this.spriteDirection == 1)
index15 = index7;
if (num6 == -1 && this.spriteDirection == -1)
index15 = index6;
if (this.type == 54)
{
Type = 585;
num28 = 10f;
num27 = 16;
num29 = 30;
num30 = 20;
maxValue4 = 15;
KnockBack = 2f;
max = 1f;
}
else if (this.type == 108)
{
Type = 15;
num28 = 6f;
num27 = 18;
num29 = 15;
num30 = 15;
maxValue4 = 5;
KnockBack = 3f;
num31 = 20f;
}
else if (this.type == 160)
{
Type = 590;
num27 = 40;
num29 = 15;
num30 = 10;
maxValue4 = 1;
KnockBack = 3f;
while ((double) this.localAI[3] > (double) num29)
num29 += 15;
}
else if (this.type == 20)
{
Type = 586;
num29 = 24;
num30 = 10;
maxValue4 = 1;
KnockBack = 3f;
}
if (Main.expertMode)
num27 = (int) ((double) num27 * (double) Main.GameModeInfo.TownNPCDamageMultiplier);
int Damage = (int) ((double) num27 * (double) num1);
this.velocity.X *= 0.8f;
--this.ai[1];
++this.localAI[3];
if ((double) this.localAI[3] == (double) num29 && Main.netMode != 1)
{
Vector2 vec = Vector2.Zero;
if (index15 != -1)
vec = this.DirectionTo(Main.npc[index15].Center + new Vector2(0.0f, -num31 * MathHelper.Clamp(this.Distance(Main.npc[index15].Center) / num32, 0.0f, 1f)));
if (vec.HasNaNs() || Math.Sign(vec.X) != this.spriteDirection)
vec = new Vector2((float) this.spriteDirection, 0.0f);
Vector2 vector2_1 = vec * num28 + Utils.RandomVector2(Main.rand, -max, max);
if (this.type == 108)
{
int num34 = Utils.SelectRandom<int>(Main.rand, 1, 1, 1, 1, 2, 2, 3);
for (int index16 = 0; index16 < num34; ++index16)
{
Vector2 vector2_2 = Utils.RandomVector2(Main.rand, -3.4f, 3.4f);
int index17 = 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[index17].npcProj = true;
Main.projectile[index17].noDropItem = true;
}
}
else if (this.type == 160)
{
if (index15 != -1)
{
Vector2 vector2_3 = Main.npc[index15].position - Main.npc[index15].Size * 2f + Main.npc[index15].Size * Utils.RandomVector2(Main.rand, 0.0f, 1f) * 5f;
for (int index18 = 10; index18 > 0 && WorldGen.SolidTile(Framing.GetTileSafely((int) vector2_3.X / 16, (int) vector2_3.Y / 16)); vector2_3 = Main.npc[index15].position - Main.npc[index15].Size * 2f + Main.npc[index15].Size * Utils.RandomVector2(Main.rand, 0.0f, 1f) * 5f)
--index18;
int index19 = Projectile.NewProjectile(vector2_3.X, vector2_3.Y, 0.0f, 0.0f, Type, Damage, KnockBack, Main.myPlayer);
Main.projectile[index19].npcProj = true;
Main.projectile[index19].noDropItem = true;
}
}
else if (this.type == 20)
{
int index20 = 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[index20].npcProj = true;
Main.projectile[index20].noDropItem = true;
}
else
{
int index21 = 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[index21].npcProj = true;
Main.projectile[index21].noDropItem = true;
}
}
if ((double) num33 > 0.0)
{
Vector3 vector3 = NPCID.Sets.MagicAuraColor[this.type].ToVector3() * num33;
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 & flag9 ? 8f : 0.0f;
this.ai[1] = (float) (num30 + Main.rand.Next(maxValue4));
this.ai[2] = 0.0f;
this.localAI[1] = this.localAI[3] = (float) (num30 / 2 + Main.rand.Next(maxValue4));
this.netUpdate = true;
}
}
else if ((double) this.ai[0] == 15.0)
{
int num35 = 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 num36 = 0;
float num37 = 0.0f;
int num38 = 0;
int num39 = 0;
if (num6 == 1)
{
int spriteDirection1 = this.spriteDirection;
}
if (num6 == -1)
{
int spriteDirection2 = this.spriteDirection;
}
if (this.type == 207)
{
num36 = 11;
num38 = num39 = 32;
num35 = 12;
maxValue5 = 6;
num37 = 4.25f;
}
else if (this.type == 441)
{
num36 = 9;
num38 = num39 = 28;
num35 = 9;
maxValue5 = 3;
num37 = 3.5f;
}
else if (this.type == 353)
{
num36 = 10;
num38 = num39 = 32;
num35 = 15;
maxValue5 = 8;
num37 = 5f;
}
else if (this.type == 637 || this.type == 638 || this.type == 656)
{
num36 = 10;
num38 = num39 = 32;
num35 = 15;
maxValue5 = 8;
num37 = 3f;
}
if (Main.expertMode)
num36 = (int) ((double) num36 * (double) Main.GameModeInfo.TownNPCDamageMultiplier);
int Damage = (int) ((double) num36 * (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, num38, num39);
Microsoft.Xna.Framework.Rectangle itemRectangle = new Microsoft.Xna.Framework.Rectangle((int) swingStats.Item1.X, (int) swingStats.Item1.Y, num38, num39);
if (this.spriteDirection == -1)
itemRectangle.X -= num38;
itemRectangle.Y -= num39;
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, num37, this.spriteDirection);
if (Main.netMode != 0)
NetMessage.SendData(28, number: number, number2: ((float) Damage), number3: num37, number4: ((float) this.spriteDirection));
npc.netUpdate = true;
npc.immune[player] = (int) this.ai[1] + 2;
}
}
}
if ((double) this.ai[1] <= 0.0)
{
bool flag16 = false;
if (flag9)
{
if (!Collision.CanHit(this.Center, 0, 0, this.Center + Vector2.UnitX * (float) -num6 * 32f, 0, 0) || (double) this.localAI[2] == 8.0)
flag16 = true;
if (flag16)
{
int num40 = NPCID.Sets.AttackTime[this.type];
int index22 = num6 == 1 ? index7 : index6;
int index23 = num6 == 1 ? index6 : index7;
if (index22 != -1 && !Collision.CanHit(this.Center, 0, 0, Main.npc[index22].Center, 0, 0))
index22 = index23 == -1 || !Collision.CanHit(this.Center, 0, 0, Main.npc[index23].Center, 0, 0) ? -1 : index23;
if (index22 != -1)
{
this.ai[0] = 15f;
this.ai[1] = (float) num40;
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index22].position.X ? 1 : -1;
this.netUpdate = true;
}
else
flag16 = false;
}
}
if (!flag16)
{
this.ai[0] = (double) this.localAI[2] == 8.0 & flag9 ? 8f : 0.0f;
this.ai[1] = (float) (num35 + Main.rand.Next(maxValue5));
this.ai[2] = 0.0f;
this.localAI[1] = this.localAI[3] = (float) (num35 / 2 + Main.rand.Next(maxValue5));
this.netUpdate = true;
}
}
}
if (flag8 && this.wet)
{
if (flag7)
this.ai[1] = 50f;
if (this.collideX)
{
this.direction *= -1;
this.velocity.X *= -0.25f;
}
float waterLineHeight;
if (Collision.GetWaterLine(this.Center.ToTileCoordinates(), out waterLineHeight))
{
float num41 = this.Center.Y + 1f;
if ((double) this.Center.Y > (double) waterLineHeight)
{
this.velocity.Y -= 0.8f;
if ((double) this.velocity.Y < -4.0)
this.velocity.Y = -4f;
if ((double) num41 + (double) this.velocity.Y < (double) waterLineHeight)
this.velocity.Y = waterLineHeight - num41;
}
else
this.velocity.Y = MathHelper.Min(this.velocity.Y, waterLineHeight - num41);
}
else
this.velocity.Y -= 0.2f;
}
if (Main.netMode == 1 || !this.isLikeATownNPC || flag3)
return;
bool flag17 = (double) this.ai[0] < 2.0 && !flag9;
bool flag18 = ((double) this.ai[0] < 2.0 || (double) this.ai[0] == 8.0) && flag9 | flag10;
if ((double) this.localAI[1] > 0.0)
--this.localAI[1];
if ((double) this.localAI[1] > 0.0)
flag18 = false;
if (flag18 && this.type == 124 && (double) this.localAI[0] == 1.0)
flag18 = false;
if (flag18 && this.type == 20)
{
flag18 = false;
for (int index24 = 0; index24 < 200; ++index24)
{
NPC npc = Main.npc[index24];
if (npc.active && npc.townNPC && (double) this.Distance(npc.Center) <= 1200.0 && npc.FindBuffIndex(165) == -1)
{
flag18 = true;
break;
}
}
}
if (this.CanTalk & flag17 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(300) == 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 index25 = 0; index25 < 200; ++index25)
{
NPC npc = Main.npc[index25];
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.CanBeTalkedTo && !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] = 3f;
this.ai[1] = (float) num43;
this.ai[2] = (float) index25;
this.direction = directionInt;
this.netUpdate = true;
npc.ai[0] = 4f;
npc.ai[1] = (float) num43;
npc.ai[2] = (float) this.whoAmI;
npc.direction = -directionInt;
npc.netUpdate = true;
break;
}
}
}
else if (this.CanTalk & flag17 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(1800) == 0)
{
int num46 = 420;
int num47 = Main.rand.Next(2) != 0 ? num46 * Main.rand.Next(1, 3) : num46 * Main.rand.Next(1, 4);
int num48 = 100;
int num49 = 20;
for (int index26 = 0; index26 < 200; ++index26)
{
NPC npc = Main.npc[index26];
bool flag20 = (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.CanBeTalkedTo && !NPCID.Sets.IsTownPet[npc.type] && !flag20 && (double) npc.Distance(this.Center) < (double) num48 && (double) npc.Distance(this.Center) > (double) num49 && 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) num47;
this.ai[2] = (float) index26;
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) num47;
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 (!NPCID.Sets.IsTownPet[this.type] & flag17 && (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 num50 = 300;
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] = 6f;
this.ai[1] = (float) num50;
this.ai[2] = (float) index27;
this.direction = directionInt;
this.netUpdate = true;
break;
}
}
}
else if (flag17 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(600) == 0 && this.type == 550)
{
int num52 = 300;
int num53 = 150;
for (int index28 = 0; index28 < (int) byte.MaxValue; ++index28)
{
Player player = Main.player[index28];
if (player.active && !player.dead && (double) player.Distance(this.Center) < (double) num53 && 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) num52;
this.ai[2] = (float) index28;
this.direction = directionInt;
this.netUpdate = true;
break;
}
}
}
else if (!NPCID.Sets.IsTownPet[this.type] & flag17 && (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 (flag17 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(600) == 0 && this.type == 229 && !flag10)
{
this.ai[0] = 11f;
this.ai[1] = (float) (30 * Main.rand.Next(1, 4));
this.netUpdate = true;
}
else if (flag17 && (double) this.ai[0] == 0.0 && (double) this.velocity.Y == 0.0 && Main.rand.Next(1200) == 0)
{
int num54 = 220;
int num55 = 150;
for (int index29 = 0; index29 < (int) byte.MaxValue; ++index29)
{
Player player = Main.player[index29];
if (player.CanBeTalkedTo && (double) player.Distance(this.Center) < (double) num55 && 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) num54;
this.ai[2] = (float) index29;
this.direction = directionInt;
this.netUpdate = true;
break;
}
}
}
else if (flag17 && (double) this.ai[0] == 1.0 && (double) this.velocity.Y == 0.0 && maxValue1 > 0 && Main.rand.Next(maxValue1) == 0)
{
Point tileCoordinates = (this.Bottom + Vector2.UnitY * -2f).ToTileCoordinates();
bool flag21 = WorldGen.InWorld(tileCoordinates.X, tileCoordinates.Y, 1);
if (flag21)
{
for (int index30 = 0; index30 < 200; ++index30)
{
if (Main.npc[index30].active && Main.npc[index30].aiStyle == 7 && Main.npc[index30].townNPC && (double) Main.npc[index30].ai[0] == 5.0 && (Main.npc[index30].Bottom + Vector2.UnitY * -2f).ToTileCoordinates() == tileCoordinates)
{
flag21 = false;
break;
}
}
for (int index31 = 0; index31 < (int) byte.MaxValue; ++index31)
{
if (Main.player[index31].active && Main.player[index31].sitting.isSitting && Main.player[index31].Center.ToTileCoordinates() == tileCoordinates)
{
flag21 = false;
break;
}
}
}
if (flag21)
{
Tile tile = Main.tile[tileCoordinates.X, tileCoordinates.Y];
bool flag22 = tile.type == (ushort) 15 || tile.type == (ushort) 497;
if (flag22 && tile.type == (ushort) 15 && tile.frameY == (short) 1098)
flag22 = false;
if (flag22)
{
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 + 16));
this.velocity = Vector2.Zero;
this.localAI[3] = 0.0f;
this.netUpdate = true;
}
}
}
else if (flag17 && (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.TileActionAttempt(DelegateMethods.SearchAvoidedByNPCs)))
{
Point tileCoordinates = (this.Center + new Vector2((float) (this.direction * 10), 0.0f)).ToTileCoordinates();
bool flag23 = WorldGen.InWorld(tileCoordinates.X, tileCoordinates.Y, 1);
if (flag23)
{
Tile tileSafely = Framing.GetTileSafely(tileCoordinates.X, tileCoordinates.Y);
if (!tileSafely.nactive() || !TileID.Sets.InteractibleByNPCs[(int) tileSafely.type])
flag23 = false;
}
if (flag23)
{
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 (Main.netMode != 1 && (double) this.ai[0] < 2.0 && (double) this.velocity.Y == 0.0 && this.type == 18 && this.breath > 0)
{
int index32 = -1;
for (int index33 = 0; index33 < 200; ++index33)
{
NPC npc = Main.npc[index33];
if (npc.active && npc.townNPC && npc.life != npc.lifeMax && (index32 == -1 || npc.lifeMax - npc.life > Main.npc[index32].lifeMax - Main.npc[index32].life) && Collision.CanHitLine(this.position, this.width, this.height, npc.position, npc.width, npc.height) && (double) this.Distance(npc.Center) < 500.0)
index32 = index33;
}
if (index32 != -1)
{
this.ai[0] = 13f;
this.ai[1] = 34f;
this.ai[2] = (float) index32;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index32].position.X ? 1 : -1;
this.netUpdate = true;
}
}
if (flag18 && (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 num56 = NPCID.Sets.AttackTime[this.type];
int index34 = num6 == 1 ? index7 : index6;
int index35 = num6 == 1 ? index6 : index7;
if (index34 != -1 && !Collision.CanHit(this.Center, 0, 0, Main.npc[index34].Center, 0, 0))
index34 = index35 == -1 || !Collision.CanHit(this.Center, 0, 0, Main.npc[index35].Center, 0, 0) ? -1 : index35;
bool flag24 = index34 != -1;
if (flag24 && this.type == 633)
flag24 = (double) Vector2.Distance(this.Center, Main.npc[index34].Center) <= 50.0;
if (flag24)
{
this.localAI[2] = this.ai[0];
this.ai[0] = 10f;
this.ai[1] = (float) num56;
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index34].position.X ? 1 : -1;
this.netUpdate = true;
}
}
else if (flag18 && (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 num57 = NPCID.Sets.AttackTime[this.type];
int index36 = num6 == 1 ? index7 : index6;
int index37 = num6 == 1 ? index6 : index7;
if (index36 != -1 && !Collision.CanHitLine(this.Center, 0, 0, Main.npc[index36].Center, 0, 0))
index36 = index37 == -1 || !Collision.CanHitLine(this.Center, 0, 0, Main.npc[index37].Center, 0, 0) ? -1 : index37;
if (index36 != -1)
{
Vector2 vector2 = this.DirectionTo(Main.npc[index36].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) num57;
this.ai[2] = vector2.Y;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index36].position.X ? 1 : -1;
this.netUpdate = true;
}
}
}
if (flag18 && (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 num58 = NPCID.Sets.AttackTime[this.type];
int index38 = num6 == 1 ? index7 : index6;
int index39 = num6 == 1 ? index6 : index7;
if (index38 != -1 && !Collision.CanHitLine(this.Center, 0, 0, Main.npc[index38].Center, 0, 0))
index38 = index39 == -1 || !Collision.CanHitLine(this.Center, 0, 0, Main.npc[index39].Center, 0, 0) ? -1 : index39;
if (index38 != -1)
{
this.localAI[2] = this.ai[0];
this.ai[0] = 14f;
this.ai[1] = (float) num58;
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index38].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) num58;
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.netUpdate = true;
}
}
if (!flag18 || (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 num59 = NPCID.Sets.AttackTime[this.type];
int index40 = num6 == 1 ? index7 : index6;
int index41 = num6 == 1 ? index6 : index7;
if (index40 != -1 && !Collision.CanHit(this.Center, 0, 0, Main.npc[index40].Center, 0, 0))
index40 = index41 == -1 || !Collision.CanHit(this.Center, 0, 0, Main.npc[index41].Center, 0, 0) ? -1 : index41;
if (index40 == -1)
return;
this.localAI[2] = this.ai[0];
this.ai[0] = 15f;
this.ai[1] = (float) num59;
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.direction = (double) this.position.X < (double) Main.npc[index40].position.X ? 1 : -1;
this.netUpdate = true;
}
}
}
private void AI_007_TownEntities_GetWalkPrediction(
int myTileX,
int homeFloorX,
bool canBreathUnderWater,
bool currentlyDrowning,
int tileX,
int tileY,
out bool keepwalking,
out bool avoidFalling)
{
keepwalking = false;
avoidFalling = true;
bool flag = myTileX >= homeFloorX - 35 && myTileX <= homeFloorX + 35;
if (this.townNPC && (double) this.ai[1] < 30.0)
{
keepwalking = !Utils.PlotTileLine(this.Top, this.Bottom, (float) this.width, new Utils.TileActionAttempt(DelegateMethods.SearchAvoidedByNPCs));
if (!keepwalking)
{
Microsoft.Xna.Framework.Rectangle hitbox = this.Hitbox;
hitbox.X -= 20;
hitbox.Width += 40;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].friendly && index != this.whoAmI && (double) Main.npc[index].velocity.X == 0.0 && hitbox.Intersects(Main.npc[index].Hitbox))
{
keepwalking = true;
break;
}
}
}
}
if (!keepwalking & currentlyDrowning)
keepwalking = true;
if (avoidFalling && (NPCID.Sets.TownCritter[this.type] || !flag && this.direction == Math.Sign(homeFloorX - myTileX)))
avoidFalling = false;
if (!avoidFalling)
return;
int num = 0;
for (int index = -1; index <= 4; ++index)
{
Tile tileSafely = Framing.GetTileSafely(tileX - this.direction * num, tileY + index);
if (tileSafely.lava() && tileSafely.liquid > (byte) 0)
{
avoidFalling = true;
break;
}
if (tileSafely.nactive() && Main.tileSolid[(int) tileSafely.type])
{
avoidFalling = false;
break;
}
}
}
private bool AI_007_TownEntities_CheckIfWillDrown(bool currentlyDrowning)
{
bool flag1 = currentlyDrowning;
bool flag2 = false;
if (!flag1)
flag2 = Collision.DrownCollision(this.position + new Vector2((float) (this.width * this.direction), 0.0f), this.width, this.height, 1f);
return flag2 || Collision.DrownCollision(this.position + new Vector2((float) (this.width * this.direction), (float) (this.height * 2 - 16 - (flag1 ? 16 : 0))), this.width, 16 + (flag1 ? 16 : 0), 1f);
}
private void AI_007_AttemptToPlayIdleAnimationsForPets(int petIdleChance)
{
if ((double) this.velocity.X != 0.0 || Main.netMode == 1 || Main.rand.Next(petIdleChance) != 0)
return;
int num = 3;
if (this.type == 638)
num = 2;
this.ai[0] = (float) Main.rand.Next(20, 20 + num);
this.ai[1] = (float) (200 + Main.rand.Next(300));
if ((double) this.ai[0] == 20.0 && this.type == 637)
this.ai[1] = (float) (500 + Main.rand.Next(200));
if ((double) this.ai[0] == 21.0 && this.type == 638)
this.ai[1] = (float) (100 + Main.rand.Next(100));
if ((double) this.ai[0] == 22.0 && this.type == 656)
this.ai[1] = (float) (200 + Main.rand.Next(200));
this.ai[2] = 0.0f;
this.localAI[3] = 0.0f;
this.netUpdate = true;
}
public bool NPCCanStickToWalls()
{
int num1 = (int) this.Center.X / 16;
int num2 = (int) this.Center.Y / 16;
int num3 = 0;
for (int i = num1 - 1; i <= num1 + 1; ++i)
{
for (int j = num2 - 1; j <= num2 + 1; ++j)
{
Tile tileSafely = Framing.GetTileSafely(i, j);
if ((!tileSafely.active() || !Main.tileSolid[(int) tileSafely.type] || TileID.Sets.Platforms[(int) tileSafely.type]) && tileSafely.wall > (ushort) 0)
{
++num3;
if (num3 > 4)
return true;
}
}
}
return false;
}
private void AI_003_Fighters()
{
if ((double) Main.player[this.target].position.Y + (double) Main.player[this.target].height == (double) this.position.Y + (double) this.height)
this.directionY = -1;
bool flag1 = false;
if (this.type == 624)
{
int num = (int) ((double) this.Center.X / 16.0);
int j = (int) ((double) this.Bottom.Y / 16.0);
if (Main.dayTime && WorldGen.InAPlaceWithWind(this.position, this.width, this.height))
{
this.position = this.position + this.netOffset;
int index1 = Dust.NewDust(this.position, this.width, this.height, 43, Alpha: 254, newColor: Color.White, Scale: 0.5f);
Main.dust[index1].velocity *= 0.2f;
this.position = this.position - this.netOffset;
if (WorldGen.SolidTileAllowBottomSlope(num, j))
{
for (int index2 = 0; index2 < 5; ++index2)
{
this.position = this.position + this.netOffset;
int index3 = Dust.NewDust(this.position, this.width, this.height, 43, Alpha: 254, newColor: Color.White, Scale: 0.5f);
Main.dust[index3].velocity *= 0.2f;
this.position = this.position - this.netOffset;
}
if (Main.netMode != 1 && TileObject.CanPlace(num, j - 1, 567, 0, this.direction, out TileObject _, true) && WorldGen.PlaceTile(num, j - 1, 567, style: Main.rand.Next(5)))
{
if (Main.netMode == 2)
NetMessage.SendTileSquare(-1, num, j - 1, 3);
if (Main.netMode != 1)
{
if (this.IsNPCValidForBestiaryKillCredit())
Main.BestiaryTracker.Kills.RegisterKill(this);
this.CountKillForBannersAndDropThem();
}
this.life = 0;
this.active = false;
return;
}
}
}
}
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.GameModeInfo.KnockbackToEnemiesMultiplier;
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 == 586)
{
if (this.alpha == (int) byte.MaxValue)
{
this.TargetClosest();
this.spriteDirection = this.direction;
this.velocity.Y = -6f;
this.netUpdate = true;
for (int index = 0; index < 35; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 5);
dust.velocity *= 1f;
dust.scale = (float) (1.0 + (double) Main.rand.NextFloat() * 0.5);
dust.fadeIn = (float) (1.5 + (double) Main.rand.NextFloat() * 0.5);
dust.velocity += this.velocity * 0.5f;
}
}
this.alpha -= 15;
if (this.alpha < 0)
this.alpha = 0;
this.position = this.position + this.netOffset;
if (this.alpha != 0)
{
for (int index = 0; index < 2; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 5);
dust.velocity *= 1f;
dust.scale = (float) (1.0 + (double) Main.rand.NextFloat() * 0.5);
dust.fadeIn = (float) (1.5 + (double) Main.rand.NextFloat() * 0.5);
dust.velocity += this.velocity * 0.3f;
}
}
if (Main.rand.Next(3) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 5);
dust.velocity *= 0.0f;
dust.alpha = 120;
dust.scale = (float) (0.699999988079071 + (double) Main.rand.NextFloat() * 0.5);
dust.velocity += this.velocity * 0.3f;
}
this.position = this.position - this.netOffset;
if (this.wet)
{
this.knockBackResist = 0.0f;
this.ai[3] = -0.10101f;
this.noGravity = true;
Vector2 center = this.Center;
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_2 = Main.player[this.target].Center - this.Center;
vector2_2.Normalize();
float num = MathHelper.Clamp(1f + Math.Abs(this.Center.Y - Main.player[this.target].Center.Y) / 40f, 5f, 20f);
Vector2 vector2_3 = vector2_2 * num;
if ((double) this.velocity.Y > 0.0)
{
this.velocity = (this.velocity * 29f + vector2_3) / 30f;
return;
}
this.velocity = (this.velocity * 4f + vector2_3) / 5f;
return;
}
float num1 = 5f;
if ((double) this.velocity.Y > 0.0)
num1 = 3f;
if ((double) this.velocity.Y < 0.0)
num1 = 8f;
Vector2 vector2 = new Vector2((float) this.direction, -1f);
vector2.Normalize();
vector2 *= num1;
if ((double) num1 < 5.0)
{
this.velocity = (this.velocity * 24f + vector2) / 25f;
return;
}
this.velocity = (this.velocity * 9f + vector2) / 10f;
return;
}
this.noGravity = false;
Vector2 center2 = this.Center;
this.position.X = center2.X - (float) (this.width / 2);
this.position.Y = center2.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 > 15.0)
num = 15f;
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.directionY = -1;
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 num2 = 300;
int num3 = 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) num2)
{
if (this.justHit)
this.ai[2] += 15f;
++this.ai[2];
}
else if ((double) this.velocity.Y == 0.0)
{
this.ai[2] = (float) -num3;
this.netUpdate = true;
}
}
Microsoft.Xna.Framework.Rectangle hitbox;
if (this.type == 631)
{
if (this.target < 0 || this.target == (int) byte.MaxValue || Main.player[this.target].dead || !Main.player[this.target].active)
this.TargetClosest((double) this.ai[2] > 0.0);
Player player = Main.player[this.target];
bool flag2 = !player.dead && player.active && (double) this.Center.Distance(player.Center) < 320.0;
int num4 = 24;
if ((double) this.ai[2] == 0.0)
{
this.ai[3] = 65f;
if (flag2 && Collision.CanHit((Entity) player, (Entity) this))
{
this.ai[2] = 100f;
this.ai[3] = 0.0f;
this.velocity.X = (float) this.direction * 0.01f;
this.netUpdate = true;
}
}
else
{
if ((double) this.ai[2] < 100.0)
{
++this.ai[2];
this.velocity.X *= 0.9f;
if ((double) Math.Abs(this.velocity.X) < 0.001)
this.velocity.X = 0.0f;
if ((double) Math.Abs(this.velocity.Y) > 1.0)
this.ai[2] = 0.0f;
if ((double) this.ai[2] == (double) (100 - num4 / 2) && Main.netMode != 1 && !player.Hitbox.Intersects(this.Hitbox) && Collision.CanHit((Entity) player, (Entity) this))
{
float num5 = 10f;
Vector2 center = this.Center;
Vector2 vec = this.DirectionTo(Main.player[this.target].Center) * num5;
if (vec.HasNaNs())
vec = new Vector2((float) this.direction * num5, 0.0f);
int Damage = this.damage / 4;
Vector2 vector2 = (vec + Utils.RandomVector2(Main.rand, -0.8f, 0.8f)).SafeNormalize(Vector2.Zero) * num5;
Projectile.NewProjectile(center.X, center.Y, vector2.X, vector2.Y, 909, Damage, 1f, Main.myPlayer);
}
if ((double) this.ai[2] < 100.0)
return;
this.ai[2] = 100f;
this.ai[3] = 0.0f;
this.velocity.X = (float) this.direction * 0.01f;
this.netUpdate = true;
return;
}
if ((double) this.velocity.Y == 0.0 && flag2)
{
hitbox = player.Hitbox;
if (hitbox.Intersects(this.Hitbox) || Collision.CanHit((Entity) player, (Entity) this))
{
this.ai[2] = (float) (100 - num4);
this.netUpdate = true;
}
}
}
}
if (this.type == 480)
{
int num6 = 180;
int num7 = 300;
int num8 = 180;
int num9 = 60;
int num10 = 20;
if (this.life < this.lifeMax / 3)
{
num6 = 120;
num7 = 240;
num8 = 240;
num9 = 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) (-num8 - num10);
this.netUpdate = true;
}
}
else
{
if ((double) this.ai[2] < 0.0 && (double) this.ai[2] < (double) -num8)
{
this.position = this.position + this.netOffset;
this.velocity.X *= 0.9f;
if ((double) this.velocity.Y < -2.0 || (double) this.velocity.Y > 4.0 || this.justHit)
{
this.ai[2] = (float) num6;
}
else
{
++this.ai[2];
if ((double) this.ai[2] == 0.0)
this.ai[2] = (float) num7;
}
float num11 = this.ai[2] + (float) num8 + (float) num10;
if ((double) num11 == 1.0)
SoundEngine.PlaySound(4, (int) this.position.X, (int) this.position.Y, 17);
if ((double) num11 < (double) num10)
{
Vector2 Position = this.Top + new Vector2((float) (this.spriteDirection * 6), 6f);
float num12 = MathHelper.Lerp(20f, 30f, (float) (((double) num11 * 3.0 + 50.0) / 182.0));
double num13 = (double) Main.rand.NextFloat();
for (float num14 = 0.0f; (double) num14 < 2.0; ++num14)
{
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 * num12;
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);
this.position = this.position - this.netOffset;
return;
}
if ((double) this.ai[2] < 0.0 && (double) this.ai[2] >= (double) -num8)
{
this.position = this.position + this.netOffset;
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) num6;
}
else
{
++this.ai[2];
if ((double) this.ai[2] == 0.0)
this.ai[2] = (float) num7;
}
float num15 = this.ai[2] + (float) num8;
if ((double) num15 < 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 num16 = MathHelper.Lerp(20f, 30f, (float) (((double) num15 * 3.0 + 50.0) / 182.0));
double num17 = (double) Main.rand.NextFloat();
for (float num18 = 0.0f; (double) num18 < 1.0; ++num18)
{
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 * num16;
dust.noGravity = true;
dust.velocity = vector2 * 4f;
dust.scale = 0.5f + Main.rand.NextFloat();
}
}
this.position = this.position - this.netOffset;
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_4 = player1.Center - this.Center;
if ((double) vector2_4.Length() >= 700.0)
return;
bool flag3 = (double) vector2_4.Length() < 30.0;
if (!flag3)
{
float x = 0.7853982f.ToRotationVector2().X;
Vector2 vector2_5 = Vector2.Normalize(vector2_4);
if ((double) vector2_5.X > (double) x || (double) vector2_5.X < -(double) x)
flag3 = 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) || !flag3 || (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 || player1.creativeGodMode)
return;
player1.AddBuff(156, num9 + (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.GameModeInfo.KnockbackToEnemiesMultiplier;
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 num19 = 8f;
float num20 = 40f;
Vector2 vector2 = Main.player[this.target].Center - this.Center;
float num21 = vector2.Length();
float num22 = num19 + num21 / 200f;
vector2.Normalize();
vector2 *= num22;
this.velocity = (this.velocity * (num20 - 1f) + vector2) / num20;
if ((double) num21 >= 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 index4 = (int) this.Center.X / 16;
int index5 = (int) ((double) this.position.Y + (double) this.height + 12.0) / 16;
bool flag4 = false;
for (int index6 = index4 - 1; index6 <= index4 + 1; ++index6)
{
if (Main.tile[index6, index5] == null)
Main.tile[index4, index5] = new Tile();
if (Main.tile[index6, index5].active() && Main.tileSolid[(int) Main.tile[index6, index5].type])
flag4 = true;
}
if (flag4 && !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 index7 = 0; index7 < 2; ++index7)
{
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 index8 = Dust.NewDust(Position, 1, 1, 27, newColor: newColor);
Main.dust[index8].velocity = -vector2_7 * 0.3f;
Main.dust[index8].alpha = 100;
if (Main.rand.Next(2) == 0)
{
Main.dust[index8].noGravity = true;
Main.dust[index8].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.EncourageDespawn(1);
}
}
if (this.type == 419)
{
this.reflectsProjectiles = false;
this.takenDamageMultiplier = 1f;
int num23 = 6;
int num24 = 10;
float num25 = 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) -num23)
{
--this.ai[2];
this.velocity.X *= 0.9f;
return;
}
if ((double) this.ai[2] == (double) -num23)
{
--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 * num25;
this.netUpdate = true;
return;
}
if ((double) this.ai[2] < (double) -num23)
{
--this.ai[2];
if ((double) this.velocity.Y == 0.0)
this.ai[2] = 60f;
else if ((double) this.ai[2] < (double) (-num23 - num24))
{
this.velocity.Y += 0.15f;
if ((double) this.velocity.Y > 24.0)
this.velocity.Y = 24f;
}
this.reflectsProjectiles = true;
this.takenDamageMultiplier = 3f;
if (!this.justHit)
return;
this.ai[2] = 60f;
this.netUpdate = true;
return;
}
}
}
if (this.type == 415)
{
int num26 = 42;
int num27 = 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 num28 = 0;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 516)
++num28;
}
if (num28 > 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) -num26)
{
--this.ai[2];
if ((double) this.ai[2] == (double) -num26)
this.ai[2] = (float) (180 + 30 * Main.rand.Next(10));
this.velocity.X *= 0.8f;
if ((double) this.ai[2] != (double) -num27 && (double) this.ai[2] != (double) (-num27 - 8) && (double) this.ai[2] != (double) (-num27 - 16))
return;
this.position = this.position + this.netOffset;
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;
}
this.position = this.position - this.netOffset;
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)
{
this.position = this.position + this.netOffset;
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;
this.position = this.position - this.netOffset;
}
}
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)
{
this.position = this.position + this.netOffset;
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
dust.noGravity = true;
dust.scale = 1f;
dust.noLight = true;
this.position = this.position - this.netOffset;
}
}
if (this.type == 590)
{
this.position = this.position + this.netOffset;
int num29 = (int) ((double) this.position.Y + 6.0) / 16;
if (this.spriteDirection < 0)
{
int num30 = (int) ((double) this.Center.X - 22.0) / 16;
Tile tileSafely1 = Framing.GetTileSafely(num30, num29);
Tile tileSafely2 = Framing.GetTileSafely(num30 + 1, num29);
if (WorldGen.InWorld(num30, num29) && tileSafely2.liquid == (byte) 0 && tileSafely1.liquid == (byte) 0)
{
Lighting.AddLight(num30, num29, 1f, 0.95f, 0.8f);
if (Main.rand.Next(30) == 0)
Dust.NewDust(new Vector2(this.Center.X - 22f, this.position.Y + 6f), 1, 1, 6);
}
}
else
{
int num31 = (int) ((double) this.Center.X + 14.0) / 16;
Tile tileSafely3 = Framing.GetTileSafely(num31, num29);
Tile tileSafely4 = Framing.GetTileSafely(num31 - 1, num29);
if (WorldGen.InWorld(num31, num29) && tileSafely4.liquid == (byte) 0 && tileSafely3.liquid == (byte) 0)
{
Lighting.AddLight(num31, num29, 1f, 0.95f, 0.8f);
if (Main.rand.Next(30) == 0)
Dust.NewDust(new Vector2(this.Center.X + 14f, this.position.Y + 6f), 1, 1, 6);
}
}
this.position = this.position - this.netOffset;
}
else if (this.type == 591)
{
this.position = this.position + this.netOffset;
if (!this.wet)
{
if (this.spriteDirection < 0)
{
Lighting.AddLight(new Vector2(this.Center.X - 36f, this.position.Y + 24f), 1f, 0.95f, 0.8f);
if ((double) this.ai[2] == 0.0 && Main.rand.Next(30) == 0)
Dust.NewDust(new Vector2(this.Center.X - 36f, this.position.Y + 24f), 1, 1, 6);
}
else
{
Lighting.AddLight(new Vector2(this.Center.X + 28f, this.position.Y + 24f), 1f, 0.95f, 0.8f);
if ((double) this.ai[2] == 0.0 && Main.rand.Next(30) == 0)
Dust.NewDust(new Vector2(this.Center.X + 28f, this.position.Y + 24f), 1, 1, 6);
}
}
this.position = this.position - this.netOffset;
}
bool flag5 = false;
bool flag6 = false;
if ((double) this.velocity.X == 0.0)
flag6 = true;
if (this.justHit)
flag6 = 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 num32 = 60;
if (this.type == 120)
{
num32 = 180;
if ((double) this.ai[3] == -120.0)
{
this.velocity = this.velocity * 0.0f;
this.ai[3] = 0.0f;
this.position = this.position + this.netOffset;
SoundEngine.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 num33 = this.oldPos[2].X + (float) this.width * 0.5f - vector2.X;
float num34 = this.oldPos[2].Y + (float) this.height * 0.5f - vector2.Y;
float num35 = 2f / (float) Math.Sqrt((double) num33 * (double) num33 + (double) num34 * (double) num34);
float SpeedX = num33 * num35;
float SpeedY = num34 * num35;
for (int index9 = 0; index9 < 20; ++index9)
{
int index10 = Dust.NewDust(this.position, this.width, this.height, 71, SpeedX, SpeedY, 200, Scale: 2f);
Main.dust[index10].noGravity = true;
Main.dust[index10].velocity.X *= 2f;
}
for (int index11 = 0; index11 < 20; ++index11)
{
int index12 = Dust.NewDust(this.oldPos[2], this.width, this.height, 71, -SpeedX, -SpeedY, 200, Scale: 2f);
Main.dust[index12].noGravity = true;
Main.dust[index12].velocity.X *= 2f;
}
this.position = this.position - this.netOffset;
}
}
bool flag7 = false;
bool flag8 = 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 == 591 || 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 == 580 || 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 || this.type == 582 || this.type == 624 || this.type == 631)
flag8 = false;
bool flag9 = false;
switch (this.type)
{
case 425:
case 471:
flag9 = true;
break;
}
bool flag10 = 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)
{
flag10 = false;
break;
}
break;
}
if (!flag9 & flag10)
{
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))
flag7 = true;
if ((((double) this.position.X == (double) this.oldPosition.X ? 1 : ((double) this.ai[3] >= (double) num32 ? 1 : 0)) | (flag7 ? 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) (num32 * 10))
this.ai[3] = 0.0f;
if (this.justHit)
this.ai[3] = 0.0f;
if ((double) this.ai[3] == (double) num32)
this.netUpdate = true;
hitbox = Main.player[this.target].Hitbox;
if (hitbox.Intersects(this.Hitbox))
this.ai[3] = 0.0f;
}
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 index13 = 0; index13 < 100; ++index13)
{
int index14 = Main.rand.Next(maxValue);
int index15 = index14;
while (index15 == index14)
index15 = Main.rand.Next(maxValue);
int num36 = numArray[index14];
numArray[index14] = numArray[index15];
numArray[index15] = num36;
}
}
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 num37 = (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 *= num37;
if (maxValue > 0)
{
--maxValue;
vector2_12 = Main.player[numArray[maxValue]].Center - this.Center;
vector2_12.Normalize();
vector2_12 *= num37;
}
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.GameModeInfo.KnockbackToEnemiesMultiplier;
if (this.type == 469)
{
this.knockBackResist = 0.45f * Main.GameModeInfo.KnockbackToEnemiesMultiplier;
if ((double) this.ai[2] == 1.0)
this.knockBackResist = 0.0f;
bool flag11 = false;
int num38 = (int) this.Center.X / 16;
int num39 = (int) this.Center.Y / 16;
for (int index16 = num38 - 1; index16 <= num38 + 1; ++index16)
{
for (int index17 = num39 - 1; index17 <= num39 + 1; ++index17)
{
if (Main.tile[index16, index17] != null && Main.tile[index16, index17].wall > (ushort) 0)
{
flag11 = true;
break;
}
}
if (flag11)
break;
}
if ((double) this.ai[2] == 0.0 & flag11)
{
if ((double) this.velocity.Y == 0.0)
{
flag1 = true;
this.velocity.Y = -4.6f;
this.velocity.X *= 1.3f;
}
else if ((double) this.velocity.Y > 0.0 && !Main.player[this.target].dead)
this.ai[2] = 1f;
}
if (flag11 && (double) this.ai[2] == 1.0 && !Main.player[this.target].dead && Collision.CanHit(this.Center, 1, 1, Main.player[this.target].Center, 1, 1))
{
Vector2 vector2 = Main.player[this.target].Center - this.Center;
float num40 = vector2.Length();
vector2.Normalize();
this.velocity = (this.velocity * 29f + vector2 * (float) (4.5 + (double) num40 / 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))
{
flag1 = true;
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 (this.type == 624 && this.target < (int) byte.MaxValue)
{
if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.ai[3] = (float) num32;
this.directionY = -1;
if (this.type == 624 && (!Main.dayTime || !WorldGen.InAPlaceWithWind(this.position, this.width, this.height)) && (double) (this.Center - Main.player[this.target].Center).Length() > 500.0)
{
this.velocity.X *= 0.95f;
if ((double) this.velocity.X <= -0.1 || (double) this.velocity.X >= 0.1)
return;
this.velocity.X = 0.0f;
return;
}
}
else if ((double) Main.player[this.target].Center.Y > (double) this.Center.Y - 128.0)
this.ai[3] = 0.0f;
}
if ((double) this.ai[3] < (double) num32 && NPC.DespawnEncouragement_AIStyle3_Fighters_NotDiscouraged(this.type, this.position, this))
{
if ((this.type == 3 || this.type == 591 || this.type == 590 || 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 || this.type == 632 || this.type == 635) && Main.rand.Next(1000) == 0)
SoundEngine.PlaySound(14, (int) this.position.X, (int) this.position.Y);
if ((this.type == 489 || this.type == 586) && Main.rand.Next(800) == 0)
SoundEngine.PlaySound(14, (int) this.position.X, (int) this.position.Y, this.type);
if ((this.type == 78 || this.type == 79 || this.type == 80 || this.type == 630) && Main.rand.Next(500) == 0)
SoundEngine.PlaySound(26, (int) this.position.X, (int) this.position.Y);
if (this.type == 159 && Main.rand.Next(500) == 0)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, 7);
if (this.type == 162 && Main.rand.Next(500) == 0)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, 6);
if (this.type == 181 && Main.rand.Next(500) == 0)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, 8);
if (this.type >= 269 && this.type <= 280 && Main.rand.Next(1000) == 0)
SoundEngine.PlaySound(14, (int) this.position.X, (int) this.position.Y);
this.TargetClosest();
if (this.directionY > 0 && (double) Main.player[this.target].Center.Y <= (double) this.Bottom.Y)
this.directionY = -1;
}
else if ((double) this.ai[2] <= 0.0 || !NPC.DespawnEncouragement_AIStyle3_Fighters_CanBeBusyWithAction(this.type))
{
if (Main.dayTime && (double) this.position.Y / 16.0 < Main.worldSurface && this.type != 624 && this.type != 631)
this.EncourageDespawn(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 || this.type == 586 || this.type == 631 || this.type == 635)
{
float num41 = 1.5f;
if (this.type == 294)
num41 = 2f;
else if (this.type == 295)
num41 = 1.75f;
else if (this.type == 296)
num41 = 1.25f;
else if (this.type == 201)
num41 = 1.1f;
else if (this.type == 202)
num41 = 0.9f;
else if (this.type == 203)
num41 = 1.2f;
else if (this.type == 338)
num41 = 1.75f;
else if (this.type == 339)
num41 = 1.25f;
else if (this.type == 340)
num41 = 2f;
else if (this.type == 385)
num41 = 1.8f;
else if (this.type == 389)
num41 = 2.25f;
else if (this.type == 462)
num41 = 4f;
else if (this.type == 463)
num41 = 0.75f;
else if (this.type == 466)
num41 = 3.75f;
else if (this.type == 469)
num41 = 3.25f;
else if (this.type == 480)
num41 = (float) (1.5 + (1.0 - (double) this.life / (double) this.lifeMax) * 2.0);
else if (this.type == 425)
num41 = 6f;
else if (this.type == 429)
num41 = 4f;
else if (this.type == 631)
num41 = 0.9f;
else if (this.type == 586)
num41 = (float) (1.5 + (1.0 - (double) this.life / (double) this.lifeMax) * 3.5);
if (this.type == 21 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 342 || this.type == 635)
num41 *= (float) (1.0 + (1.0 - (double) this.scale));
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.8f;
}
else if ((double) this.velocity.X < (double) num41 && this.direction == 1)
{
if (this.type == 466 && (double) this.velocity.X < -2.0)
this.velocity.X *= 0.9f;
if (this.type == 586 && (double) this.velocity.Y == 0.0 && (double) this.velocity.X < -1.0)
this.velocity.X *= 0.9f;
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num41)
this.velocity.X = num41;
}
else if ((double) this.velocity.X > -(double) num41 && this.direction == -1)
{
if (this.type == 466 && (double) this.velocity.X > 2.0)
this.velocity.X *= 0.9f;
if (this.type == 586 && (double) this.velocity.Y == 0.0 && (double) this.velocity.X > 1.0)
this.velocity.X *= 0.9f;
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num41)
this.velocity.X = -num41;
}
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 num42 = 1.5f;
if (this.type == 269)
num42 = 2f;
if (this.type == 270)
num42 = 1f;
if (this.type == 271)
num42 = 1.5f;
if (this.type == 272)
num42 = 3f;
if (this.type == 273)
num42 = 1.25f;
if (this.type == 274)
num42 = 3f;
if (this.type == 275)
num42 = 3.25f;
if (this.type == 276)
num42 = 2f;
if (this.type == 277)
num42 = 2.75f;
if (this.type == 278)
num42 = 1.8f;
if (this.type == 279)
num42 = 1.3f;
if (this.type == 280)
num42 = 2.5f;
float num43 = num42 * (float) (1.0 + (1.0 - (double) this.scale));
if ((double) this.velocity.X < -(double) num43 || (double) this.velocity.X > (double) num43)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num43 && this.direction == 1)
{
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num43)
this.velocity.X = num43;
}
else if ((double) this.velocity.X > -(double) num43 && this.direction == -1)
{
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num43)
this.velocity.X = -num43;
}
}
else if (this.type >= 305 && this.type <= 314)
{
float num44 = 1.5f;
if (this.type == 305 || this.type == 310)
num44 = 2f;
if (this.type == 306 || this.type == 311)
num44 = 1.25f;
if (this.type == 307 || this.type == 312)
num44 = 2.25f;
if (this.type == 308 || this.type == 313)
num44 = 1.5f;
if (this.type == 309 || this.type == 314)
num44 = 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)
{
flag1 = true;
this.velocity.Y = -7f;
this.velocity.X = num44 * (float) this.direction;
}
}
else if (this.spriteDirection == this.direction)
this.velocity.X = (float) (((double) this.velocity.X * 10.0 + (double) num44 * (double) this.direction) / 11.0);
}
else if ((double) this.velocity.X < -(double) num44 || (double) this.velocity.X > (double) num44)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num44 && this.direction == 1)
{
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num44)
this.velocity.X = num44;
}
else if ((double) this.velocity.X > -(double) num44 && this.direction == -1)
{
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num44)
this.velocity.X = -num44;
}
}
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 || this.type == 630)
{
float num45 = 1f;
float num46 = 0.05f;
if (this.life < this.lifeMax / 2)
{
num45 = 2f;
num46 = 0.1f;
}
if (this.type == 79 || this.type == 630)
num45 *= 1.5f;
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 == 287)
{
float num47 = 5f;
float num48 = 0.2f;
if ((double) this.velocity.X < -(double) num47 || (double) this.velocity.X > (double) num47)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.7f;
}
else if ((double) this.velocity.X < (double) num47 && this.direction == 1)
{
this.velocity.X += num48;
if ((double) this.velocity.X > (double) num47)
this.velocity.X = num47;
}
else if ((double) this.velocity.X > -(double) num47 && this.direction == -1)
{
this.velocity.X -= num48;
if ((double) this.velocity.X < -(double) num47)
this.velocity.X = -num47;
}
}
else if (this.type == 243)
{
float num49 = 1f;
float num50 = 0.07f;
float num51 = num49 + (float) ((1.0 - (double) this.life / (double) this.lifeMax) * 1.5);
float num52 = num50 + (float) ((1.0 - (double) this.life / (double) this.lifeMax) * 0.150000005960464);
if ((double) this.velocity.X < -(double) num51 || (double) this.velocity.X > (double) num51)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.7f;
}
else if ((double) this.velocity.X < (double) num51 && this.direction == 1)
{
this.velocity.X += num52;
if ((double) this.velocity.X > (double) num51)
this.velocity.X = num51;
}
else if ((double) this.velocity.X > -(double) num51 && this.direction == -1)
{
this.velocity.X -= num52;
if ((double) this.velocity.X < -(double) num51)
this.velocity.X = -num51;
}
}
else if (this.type == 251)
{
float num53 = 1f;
float num54 = 0.08f;
float num55 = num53 + (float) ((1.0 - (double) this.life / (double) this.lifeMax) * 2.0);
float num56 = num54 + (float) ((1.0 - (double) this.life / (double) this.lifeMax) * 0.200000002980232);
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)
{
this.velocity.X += num56;
if ((double) this.velocity.X > (double) num55)
this.velocity.X = num55;
}
else if ((double) this.velocity.X > -(double) num55 && this.direction == -1)
{
this.velocity.X -= num56;
if ((double) this.velocity.X < -(double) num55)
this.velocity.X = -num55;
}
}
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 num57 = 0.15f;
float num58 = 1.5f;
if ((double) this.velocity.X < -(double) num58 || (double) this.velocity.X > (double) num58)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.7f;
}
else if ((double) this.velocity.X < (double) num58 && this.direction == 1)
{
this.velocity.X += num57;
if ((double) this.velocity.X > (double) num58)
this.velocity.X = num58;
}
else if ((double) this.velocity.X > -(double) num58 && this.direction == -1)
{
this.velocity.X -= num57;
if ((double) this.velocity.X < -(double) num58)
this.velocity.X = -num58;
}
}
}
else if (this.type == 460)
{
float num59 = 3f;
float num60 = 0.1f;
if ((double) Math.Abs(this.velocity.X) > 2.0)
num60 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 2.5)
num60 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 3.0)
num60 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 3.5)
num60 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 4.0)
num60 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 4.5)
num60 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 5.0)
num60 *= 0.8f;
if ((double) Math.Abs(this.velocity.X) > 5.5)
num60 *= 0.8f;
float num61 = num59 + (float) ((1.0 - (double) this.life / (double) this.lifeMax) * 3.0);
if ((double) this.velocity.X < -(double) num61 || (double) this.velocity.X > (double) num61)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.7f;
}
else if ((double) this.velocity.X < (double) num61 && this.direction == 1)
{
if ((double) this.velocity.X < 0.0)
this.velocity.X *= 0.93f;
this.velocity.X += num60;
if ((double) this.velocity.X > (double) num61)
this.velocity.X = num61;
}
else if ((double) this.velocity.X > -(double) num61 && this.direction == -1)
{
if ((double) this.velocity.X > 0.0)
this.velocity.X *= 0.93f;
this.velocity.X -= num60;
if ((double) this.velocity.X < -(double) num61)
this.velocity.X = -num61;
}
}
else if (this.type == 508 || this.type == 580 || this.type == 582)
{
float num62 = 2.5f;
float num63 = 10f;
float num64 = Math.Abs(this.velocity.X);
if (this.type == 582)
{
num62 = 2.5f;
num63 = 7f;
if ((double) num64 > 2.75)
{
num62 = 3.5f;
num63 += 75f;
}
else if ((double) num64 > 2.25)
{
num62 = 2f;
num63 += 55f;
}
}
else if ((double) num64 > 2.75)
{
num62 = 3.5f;
num63 += 80f;
}
else if ((double) num64 > 2.25)
{
num62 = 3f;
num63 += 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.95f;
if ((double) this.velocity.X < 0.0 && this.direction > 0)
this.velocity = this.velocity * 0.95f;
}
if ((double) Math.Abs(this.velocity.Y) > (double) NPC.gravity)
num63 *= 3f;
if ((double) this.velocity.X <= 0.0 && this.direction < 0)
this.velocity.X = (float) (((double) this.velocity.X * (double) num63 - (double) num62) / ((double) num63 + 1.0));
else if ((double) this.velocity.X >= 0.0 && this.direction > 0)
this.velocity.X = (float) (((double) this.velocity.X * (double) num63 + (double) num62) / ((double) num63 + 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 num65 = 5f;
float num66 = 0.25f;
float num67 = 0.7f;
if (this.type == 427)
{
num65 = 6f;
num66 = 0.2f;
num67 = 0.8f;
}
else if (this.type == 415)
{
num65 = 4f;
num66 = 0.1f;
num67 = 0.95f;
}
else if (this.type == 419)
{
num65 = 6f;
num66 = 0.15f;
num67 = 0.85f;
}
else if (this.type == 518)
{
num65 = 5f;
num66 = 0.1f;
num67 = 0.95f;
}
else if (this.type == 532)
{
num65 = 5f;
num66 = 0.15f;
num67 = 0.98f;
}
if ((double) this.velocity.X < -(double) num65 || (double) this.velocity.X > (double) num65)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * num67;
}
else if ((double) this.velocity.X < (double) num65 && this.direction == 1)
{
this.velocity.X += num66;
if ((double) this.velocity.X > (double) num65)
this.velocity.X = num65;
}
else if ((double) this.velocity.X > -(double) num65 && this.direction == -1)
{
this.velocity.X -= num66;
if ((double) this.velocity.X < -(double) num65)
this.velocity.X = -num65;
}
}
else if (this.type >= 430 && this.type <= 436 || this.type == 494 || this.type == 495 || this.type == 591)
{
if ((double) this.ai[2] == 0.0)
{
this.damage = this.defDamage;
float num68 = 1f * (float) (1.0 + (1.0 - (double) this.scale));
if ((double) this.velocity.X < -(double) num68 || (double) this.velocity.X > (double) num68)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num68 && this.direction == 1)
{
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num68)
this.velocity.X = num68;
}
else if ((double) this.velocity.X > -(double) num68 && this.direction == -1)
{
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num68)
this.velocity.X = -num68;
}
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 num69 = 50;
if (this.type >= 494 && this.type <= 495)
num69 = 42;
if ((double) vector2.Length() < (double) num69 && 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 num70 = 1f;
if (this.type == 624)
num70 = 2.5f;
if (this.type == 186)
num70 = 1.1f;
if (this.type == 187)
num70 = 0.9f;
if (this.type == 188)
num70 = 1.2f;
if (this.type == 189)
num70 = 0.8f;
if (this.type == 132)
num70 = 0.95f;
if (this.type == 200)
num70 = 0.87f;
if (this.type == 223)
num70 = 1.05f;
if (this.type == 632)
num70 = 0.8f;
if (this.type == 489)
{
float num71 = (Main.player[this.target].Center - this.Center).Length() * (1f / 400f);
if ((double) num71 > 1.5)
num71 = 1.5f;
num70 = (!Main.expertMode ? 2.5f - num71 : 3f - num71) * 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)
num70 *= (float) (1.0 + (1.0 - (double) this.scale));
if ((double) this.velocity.X < -(double) num70 || (double) this.velocity.X > (double) num70)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num70 && this.direction == 1)
{
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num70)
this.velocity.X = num70;
}
else if ((double) this.velocity.X > -(double) num70 && this.direction == -1)
{
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num70)
this.velocity.X = -num70;
}
}
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))
{
flag1 = true;
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 num72 = Main.player[this.target].Center.X - (float) (this.direction * 400) - this.Center.X;
float num73 = Main.player[this.target].Bottom.Y - this.Bottom.Y;
if ((double) num72 < 0.0 && (double) this.velocity.X > 0.0)
this.velocity.X *= 0.9f;
else if ((double) num72 > 0.0 && (double) this.velocity.X < 0.0)
this.velocity.X *= 0.9f;
if ((double) num72 < 0.0 && (double) this.velocity.X > -5.0)
this.velocity.X -= 0.1f;
else if ((double) num72 > 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) num73 < -20.0 && (double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.8f;
else if ((double) num73 > 20.0 && (double) this.velocity.Y < 0.0)
this.velocity.Y *= 0.8f;
if ((double) num73 < -20.0 && (double) this.velocity.Y > -5.0)
this.velocity.Y -= 0.3f;
else if ((double) num73 > 20.0 && (double) this.velocity.Y < 5.0)
this.velocity.Y += 0.3f;
}
if (Main.rand.Next(3) == 0)
{
this.position = this.position + this.netOffset;
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;
this.position = this.position - this.netOffset;
}
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))
{
flag1 = true;
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 damageForProjectiles = this.GetAttackDamage_ForProjectiles(75f, 50f);
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, damageForProjectiles, 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 num74 = Main.player[this.target].Center.X - this.Center.X;
float num75 = Main.player[this.target].Center.Y - this.Center.Y;
if ((double) num74 < 0.0 && (double) this.velocity.X > 0.0)
this.velocity.X *= 0.98f;
else if ((double) num74 > 0.0 && (double) this.velocity.X < 0.0)
this.velocity.X *= 0.98f;
if ((double) num74 < -20.0 && (double) this.velocity.X > -6.0)
this.velocity.X -= 0.015f;
else if ((double) num74 > 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) num75 < -20.0 && (double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.98f;
else if ((double) num75 > 20.0 && (double) this.velocity.Y < 0.0)
this.velocity.Y *= 0.98f;
if ((double) num75 < -20.0 && (double) this.velocity.Y > -6.0)
this.velocity.Y -= 0.15f;
else if ((double) num75 > 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))
{
flag1 = true;
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 num76 = Main.player[this.target].Center.X - (float) (this.direction * 300) - this.Center.X;
if ((double) num76 < 40.0 && (double) this.velocity.X > 0.0)
this.velocity.X *= 0.98f;
else if ((double) num76 > 40.0 && (double) this.velocity.X < 0.0)
this.velocity.X *= 0.98f;
if ((double) num76 < 40.0 && (double) this.velocity.X > -5.0)
this.velocity.X -= 0.2f;
else if ((double) num76 > 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))
{
flag1 = true;
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)
{
this.position = this.position + this.netOffset;
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;
this.position = this.position - this.netOffset;
}
if ((double) this.ai[1] >= 57.0)
{
this.position = this.position + this.netOffset;
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;
this.position = this.position - this.netOffset;
}
if (Main.rand.Next(6) == 0)
{
this.position = this.position + this.netOffset;
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;
this.position = this.position - this.netOffset;
}
}
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 num77 = (double) Main.player[this.target].position.X + (double) Main.player[this.target].width * 0.5 - (double) vector2.X;
float num78 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y;
if (Math.Sqrt(num77 * num77 + (double) num78 * (double) num78) > 300.0)
this.Transform(158);
}
if (Main.netMode != 1)
{
if (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;
int damageForProjectiles = this.GetAttackDamage_ForProjectiles(18f, 18f);
Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2.X, vector2.Y, 472, damageForProjectiles, 0.0f, Main.myPlayer);
}
}
if ((double) this.velocity.Y == 0.0)
{
int newType = -1;
switch (this.type)
{
case 163:
newType = 238;
break;
case 164:
newType = 165;
break;
case 236:
newType = 237;
break;
case 239:
newType = 240;
break;
case 530:
newType = 531;
break;
}
if (newType != -1 && this.NPCCanStickToWalls())
this.Transform(newType);
}
}
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 num79 = (float) Main.rand.Next(30, 900) * ((float) this.life / (float) this.lifeMax) + 30f;
if (Main.netMode != 1 && (double) this.ai[2] >= (double) num79 && (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 num80 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2.X;
float num81 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y;
float num82 = num80 + (float) Main.rand.Next(-40, 41);
float num83 = num81 + (float) Main.rand.Next(-40, 41);
float num84 = (float) Math.Sqrt((double) num82 * (double) num82 + (double) num83 * (double) num83);
this.netUpdate = true;
float num85 = (float) (15.0 / (double) num84);
float SpeedX = num82 * num85;
float SpeedY = num83 * num85;
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 num86 = (float) Main.rand.Next(60, 1800) * ((float) this.life / (float) this.lifeMax) + 15f;
if (Main.netMode != 1 && (double) this.ai[2] >= (double) num86 && (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 num87 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2.X;
float num88 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y;
float num89 = num87 + (float) Main.rand.Next(-40, 41);
float num90 = num88 + (float) Main.rand.Next(-30, 0);
float num91 = (float) Math.Sqrt((double) num89 * (double) num89 + (double) num90 * (double) num90);
this.netUpdate = true;
float num92 = (float) (15.0 / (double) num91);
float SpeedX = num89 * num92;
float SpeedY = num90 * num92;
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 num93 = (int) this.position.X / 16;
int num94 = (int) this.position.Y / 16;
int num95 = (int) this.position.X / 16;
int num96 = (int) this.position.Y / 16;
int num97 = 5;
int num98 = 0;
bool flag12 = false;
int num99 = 2;
int num100 = 0;
while (!flag12 && num98 < 100)
{
++num98;
int index18 = Main.rand.Next(num93 - num97, num93 + num97);
for (int index19 = Main.rand.Next(num94 - num97, num94 + num97); index19 < num94 + num97; ++index19)
{
if ((index19 < num94 - num99 || index19 > num94 + num99 || index18 < num93 - num99 || index18 > num93 + num99) && (index19 < num96 - num100 || index19 > num96 + num100 || index18 < num95 - num100 || index18 > num95 + num100) && Main.tile[index18, index19].nactive())
{
bool flag13 = true;
if (Main.tile[index18, index19 - 1].lava())
flag13 = false;
if (flag13 && Main.tileSolid[(int) Main.tile[index18, index19].type] && !Collision.SolidTiles(index18 - 1, index18 + 1, index19 - 4, index19 - 1))
{
int index20 = NPC.NewNPC(index18 * 16 - this.width / 2, index19 * 16, 387);
Main.npc[index20].position.Y = (float) (index19 * 16 - Main.npc[index20].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 num101 = -1;
int num102 = -1;
if (this.type == 411)
{
flag14 = true;
num101 = 90;
num102 = 90;
if ((double) this.ai[1] <= 150.0)
flag16 = false;
}
if ((double) this.ai[1] > 0.0)
--this.ai[1];
if (this.justHit)
{
this.ai[1] = 30f;
this.ai[2] = 0.0f;
}
int num103 = 70;
if (this.type == 379 || this.type == 380)
num103 = 80;
if (this.type == 381 || this.type == 382)
num103 = 80;
if (this.type == 520)
num103 = 15;
if (this.type == 350)
num103 = 110;
if (this.type == 291)
num103 = 200;
if (this.type == 292)
num103 = 120;
if (this.type == 293)
num103 = 90;
if (this.type == 111)
num103 = 180;
if (this.type == 206)
num103 = 50;
if (this.type == 481)
num103 = 100;
if (this.type == 214)
num103 = 40;
if (this.type == 215)
num103 = 80;
if (this.type == 290)
num103 = 30;
if (this.type == 411)
num103 = 300;
if (this.type == 409)
num103 = 60;
if (this.type == 424)
num103 = 180;
if (this.type == 426)
num103 = 60;
bool flag17 = false;
if (this.type == 216)
{
if ((double) this.localAI[2] >= 20.0)
flag17 = true;
num103 = !flag17 ? 8 : 60;
}
int num104 = num103 / 2;
if (this.type == 424)
num104 = num103 - 1;
if (this.type == 426)
num104 = num103 - 1;
if (this.confused)
this.ai[2] = 0.0f;
if ((double) this.ai[2] > 0.0)
{
if (flag16)
this.TargetClosest();
if ((double) this.ai[1] == (double) num104)
{
if (this.type == 216)
++this.localAI[2];
float num105 = 11f;
if (this.type == 111)
num105 = 9f;
if (this.type == 206)
num105 = 7f;
if (this.type == 290)
num105 = 9f;
if (this.type == 293)
num105 = 4f;
if (this.type == 214)
num105 = 14f;
if (this.type == 215)
num105 = 16f;
if (this.type == 382)
num105 = 7f;
if (this.type == 520)
num105 = 8f;
if (this.type == 409)
num105 = 4f;
if (this.type >= 449 && this.type <= 452)
num105 = 7f;
if (this.type == 481)
num105 = 8f;
if (this.type == 468)
num105 = 7.5f;
if (this.type == 411)
num105 = 1f;
if (this.type >= 498 && this.type <= 506)
num105 = 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 num106 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2.X;
float num107 = Math.Abs(num106) * 0.1f;
if (this.type == 291 || this.type == 292)
num107 = 0.0f;
if (this.type == 215)
num107 = Math.Abs(num106) * 0.08f;
if (this.type == 214 || this.type == 216 && !flag17)
num107 = 0.0f;
if (this.type == 381 || this.type == 382 || this.type == 520)
num107 = 0.0f;
if (this.type >= 449 && this.type <= 452)
num107 = (float) ((double) Math.Abs(num106) * (double) Main.rand.Next(10, 50) * 0.00999999977648258);
if (this.type == 468)
num107 = (float) ((double) Math.Abs(num106) * (double) Main.rand.Next(10, 50) * 0.00999999977648258);
if (this.type == 481)
num107 = (float) ((double) Math.Abs(num106) * (double) Main.rand.Next(-10, 11) * 0.00350000010803342);
if (this.type >= 498 && this.type <= 506)
num107 = (float) ((double) Math.Abs(num106) * (double) Main.rand.Next(1, 11) * (1.0 / 400.0));
float num108 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y - num107;
if (this.type == 291)
{
num106 += (float) Main.rand.Next(-40, 41) * 0.2f;
num108 += (float) Main.rand.Next(-40, 41) * 0.2f;
}
else if (this.type == 381 || this.type == 382 || this.type == 520)
{
float num109 = num106 + (float) Main.rand.Next(-100, 101) * 0.4f;
float num110 = num108 + (float) Main.rand.Next(-100, 101) * 0.4f;
num106 = num109 * ((float) Main.rand.Next(85, 116) * 0.01f);
num108 = num110 * ((float) Main.rand.Next(85, 116) * 0.01f);
if (this.type == 520)
{
float num111 = num106 + (float) Main.rand.Next(-100, 101) * 0.6f;
float num112 = num108 + (float) Main.rand.Next(-100, 101) * 0.6f;
num106 = num111 * ((float) Main.rand.Next(85, 116) * 0.015f);
num108 = num112 * ((float) Main.rand.Next(85, 116) * 0.015f);
}
}
else if (this.type == 481)
{
num106 += (float) Main.rand.Next(-40, 41) * 0.4f;
num108 += (float) Main.rand.Next(-40, 41) * 0.4f;
}
else if (this.type >= 498 && this.type <= 506)
{
num106 += (float) Main.rand.Next(-40, 41) * 0.3f;
num108 += (float) Main.rand.Next(-40, 41) * 0.3f;
}
else if (this.type != 292)
{
num106 += (float) Main.rand.Next(-40, 41);
num108 += (float) Main.rand.Next(-40, 41);
}
float num113 = (float) Math.Sqrt((double) num106 * (double) num106 + (double) num108 * (double) num108);
this.netUpdate = true;
float num114 = num105 / num113;
float num115 = num106 * num114;
float SpeedY = num108 * num114;
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 = 15;
}
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 = this.GetAttackDamage_ForProjectiles(60f, 45f);
}
if (this.type == 424)
{
Type = 573;
Damage = this.GetAttackDamage_ForProjectiles(60f, 45f);
}
if (this.type == 426)
{
Type = 581;
Damage = this.GetAttackDamage_ForProjectiles(60f, 45f);
}
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 += num115;
vector2.Y += SpeedY;
if (this.type == 290)
Damage = this.GetAttackDamage_ForProjectiles((float) Damage, (float) Damage * 0.75f);
if (this.type >= 381 && this.type <= 392)
Damage = this.GetAttackDamage_ForProjectiles((float) Damage, (float) Damage * 0.8f);
if (Main.netMode != 1)
{
if (this.type == 292)
{
for (int index = 0; index < 4; ++index)
{
float num116 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2.X;
float num117 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y;
float num118 = 12f / (float) Math.Sqrt((double) num116 * (double) num116 + (double) num117 * (double) num117);
float num119;
float num120 = num119 = num116 + (float) Main.rand.Next(-40, 41);
float num121;
float num122 = num121 = num117 + (float) Main.rand.Next(-40, 41);
num115 = num120 * num118;
SpeedY = num122 * num118;
Projectile.NewProjectile(vector2.X, vector2.Y, num115, SpeedY, Type, Damage, 0.0f, Main.myPlayer);
}
}
else if (this.type == 411)
Projectile.NewProjectile(vector2.X, vector2.Y, num115, 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(num115, SpeedY - 6f);
}
else
Projectile.NewProjectile(vector2.X, vector2.Y, num115, SpeedY, Type, Damage, 0.0f, Main.myPlayer);
}
this.ai[2] = (double) Math.Abs(SpeedY) <= (double) Math.Abs(num115) * 2.0 ? ((double) Math.Abs(num115) <= (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 || num101 != -1 && (double) this.ai[1] >= (double) num101 && (double) this.ai[1] < (double) (num101 + num102) && (!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 num123 = 10f;
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num124 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2.X;
float num125 = Math.Abs(num124) * 0.1f;
float num126 = Main.player[this.target].position.Y + (float) Main.player[this.target].height * 0.5f - vector2.Y - num125;
float num127 = num124 + (float) Main.rand.Next(-40, 41);
float num128 = num126 + (float) Main.rand.Next(-40, 41);
float num129 = (float) Math.Sqrt((double) num127 * (double) num127 + (double) num128 * (double) num128);
float num130 = 700f;
if (this.type == 214)
num130 = 550f;
if (this.type == 215)
num130 = 800f;
if (this.type >= 498 && this.type <= 506)
num130 = 190f;
if (this.type >= 449 && this.type <= 452)
num130 = 200f;
if (this.type == 481)
num130 = 400f;
if (this.type == 468)
num130 = 400f;
if ((double) num129 < (double) num130)
{
this.netUpdate = true;
this.velocity.X *= 0.5f;
float num131 = num123 / num129;
float num132 = num127 * num131;
float num133 = num128 * num131;
this.ai[2] = 3f;
this.ai[1] = (float) num103;
this.ai[2] = (double) Math.Abs(num133) <= (double) Math.Abs(num132) * 2.0 ? ((double) Math.Abs(num132) <= (double) Math.Abs(num133) * 2.0 ? ((double) num133 <= 0.0 ? 4f : 2f) : 3f) : ((double) num133 <= 0.0 ? 5f : 1f);
}
}
}
if ((double) this.ai[2] <= 0.0 || flag14 && (num101 == -1 || (double) this.ai[1] < (double) num101 || (double) this.ai[1] >= (double) (num101 + num102)))
{
float num134 = 1f;
float num135 = 0.07f;
float num136 = 0.8f;
if (this.type == 214)
{
num134 = 2f;
num135 = 0.09f;
}
else if (this.type == 215)
{
num134 = 1.5f;
num135 = 0.08f;
}
else if (this.type == 381 || this.type == 382)
{
num134 = 2f;
num135 = 0.5f;
}
else if (this.type == 520)
{
num134 = 4f;
num135 = 1f;
num136 = 0.7f;
}
else if (this.type == 411)
{
num134 = 2f;
num135 = 0.5f;
}
else if (this.type == 409)
{
num134 = 2f;
num135 = 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) num134 ? 1 : ((double) this.velocity.X > (double) num134 ? 1 : 0)) | (flag19 ? 1 : 0)) != 0)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * num136;
}
else if ((double) this.velocity.X < (double) num134 && this.direction == 1)
{
this.velocity.X += num135;
if ((double) this.velocity.X > (double) num134)
this.velocity.X = num134;
}
else if ((double) this.velocity.X > -(double) num134 && this.direction == -1)
{
this.velocity.X -= num135;
if ((double) this.velocity.X < -(double) num134)
this.velocity.X = -num134;
}
}
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] > 60.0)
{
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f - (float) (this.direction * 24), this.position.Y + 4f);
if (Main.rand.Next(5) != 0 || NPC.AnyNPCs(378))
{
int num137 = Main.rand.Next(3, 8) * this.direction;
int num138 = Main.rand.Next(-8, -5);
int index = Projectile.NewProjectile(vector2.X, vector2.Y, (float) num137, (float) num138, 75, 80, 0.0f, Main.myPlayer);
Main.projectile[index].timeLeft = 300;
this.ai[2] = 0.0f;
}
else
{
this.ai[2] = -120f;
NetMessage.SendData(23, number: NPC.NewNPC((int) vector2.X, (int) vector2.Y, 378));
}
}
}
if ((double) this.velocity.Y == 0.0 | flag1)
{
int index21 = (int) ((double) this.position.Y + (double) this.height + 7.0) / 16;
int index22 = (int) ((double) this.position.Y - 9.0) / 16;
int num139 = (int) this.position.X / 16;
int num140 = (int) ((double) this.position.X + (double) this.width) / 16;
int num141 = (int) ((double) this.position.X + 8.0) / 16;
int num142 = (int) ((double) this.position.X + (double) this.width - 8.0) / 16;
bool flag20 = false;
for (int index23 = num141; index23 <= num142; ++index23)
{
if (index23 >= num139 && index23 <= num140 && Main.tile[index23, index21] == null)
{
flag20 = true;
}
else
{
if (Main.tile[index23, index22] != null && Main.tile[index23, index22].nactive() && Main.tileSolid[(int) Main.tile[index23, index22].type])
{
flag5 = false;
break;
}
if (!flag20 && index23 >= num139 && index23 <= num140 && Main.tile[index23, index21].nactive() && Main.tileSolid[(int) Main.tile[index23, index21].type])
flag5 = true;
}
}
if (!flag5 && (double) this.velocity.Y < 0.0)
this.velocity.Y = 0.0f;
if (flag20)
return;
}
if (this.type == 428)
flag5 = false;
if ((double) this.velocity.Y >= 0.0 && (this.type != 580 || this.directionY != 1))
{
int num143 = 0;
if ((double) this.velocity.X < 0.0)
num143 = -1;
if ((double) this.velocity.X > 0.0)
num143 = 1;
Vector2 position = this.position;
position.X += this.velocity.X;
int x = (int) (((double) position.X + (double) (this.width / 2) + (double) ((this.width / 2 + 1) * num143)) / 16.0);
int y = (int) (((double) position.Y + (double) this.height - 1.0) / 16.0);
if (WorldGen.InWorld(x, y, 4))
{
if (Main.tile[x, y] == null)
Main.tile[x, y] = new Tile();
if (Main.tile[x, y - 1] == null)
Main.tile[x, y - 1] = new Tile();
if (Main.tile[x, y - 2] == null)
Main.tile[x, y - 2] = new Tile();
if (Main.tile[x, y - 3] == null)
Main.tile[x, y - 3] = new Tile();
if (Main.tile[x, y + 1] == null)
Main.tile[x, y + 1] = new Tile();
if (Main.tile[x - num143, y - 3] == null)
Main.tile[x - num143, y - 3] = new Tile();
if ((double) (x * 16) < (double) position.X + (double) this.width && (double) (x * 16 + 16) > (double) position.X && (Main.tile[x, y].nactive() && !Main.tile[x, y].topSlope() && !Main.tile[x, y - 1].topSlope() && Main.tileSolid[(int) Main.tile[x, y].type] && !Main.tileSolidTop[(int) Main.tile[x, y].type] || Main.tile[x, y - 1].halfBrick() && Main.tile[x, y - 1].nactive()) && (!Main.tile[x, y - 1].nactive() || !Main.tileSolid[(int) Main.tile[x, y - 1].type] || Main.tileSolidTop[(int) Main.tile[x, y - 1].type] || Main.tile[x, y - 1].halfBrick() && (!Main.tile[x, y - 4].nactive() || !Main.tileSolid[(int) Main.tile[x, y - 4].type] || Main.tileSolidTop[(int) Main.tile[x, y - 4].type])) && (!Main.tile[x, y - 2].nactive() || !Main.tileSolid[(int) Main.tile[x, y - 2].type] || Main.tileSolidTop[(int) Main.tile[x, y - 2].type]) && (!Main.tile[x, y - 3].nactive() || !Main.tileSolid[(int) Main.tile[x, y - 3].type] || Main.tileSolidTop[(int) Main.tile[x, y - 3].type]) && (!Main.tile[x - num143, y - 3].nactive() || !Main.tileSolid[(int) Main.tile[x - num143, y - 3].type]))
{
float num144 = (float) (y * 16);
if (Main.tile[x, y].halfBrick())
num144 += 8f;
if (Main.tile[x, y - 1].halfBrick())
num144 -= 8f;
if ((double) num144 < (double) position.Y + (double) this.height)
{
float num145 = position.Y + (float) this.height - num144;
float num146 = 16.1f;
if (this.type == 163 || this.type == 164 || this.type == 236 || this.type == 239 || this.type == 530)
num146 += 8f;
if ((double) num145 <= (double) num146)
{
this.gfxOffY += this.position.Y + (float) this.height - num144;
this.position.Y = num144 - (float) this.height;
this.stepSpeed = (double) num145 >= 9.0 ? 2f : 1f;
}
}
}
}
}
if (flag5)
{
int index24 = (int) (((double) this.position.X + (double) (this.width / 2) + (double) (15 * this.direction)) / 16.0);
int index25 = (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 == 580 || this.type == 508 || this.type == 415 || this.type == 530 || this.type == 532 || this.type == 582)
index24 = (int) (((double) this.position.X + (double) (this.width / 2) + (double) ((this.width / 2 + 16) * this.direction)) / 16.0);
if (Main.tile[index24, index25] == null)
Main.tile[index24, index25] = new Tile();
if (Main.tile[index24, index25 - 1] == null)
Main.tile[index24, index25 - 1] = new Tile();
if (Main.tile[index24, index25 - 2] == null)
Main.tile[index24, index25 - 2] = new Tile();
if (Main.tile[index24, index25 - 3] == null)
Main.tile[index24, index25 - 3] = new Tile();
if (Main.tile[index24, index25 + 1] == null)
Main.tile[index24, index25 + 1] = new Tile();
if (Main.tile[index24 + this.direction, index25 - 1] == null)
Main.tile[index24 + this.direction, index25 - 1] = new Tile();
if (Main.tile[index24 + this.direction, index25 + 1] == null)
Main.tile[index24 + this.direction, index25 + 1] = new Tile();
if (Main.tile[index24 - this.direction, index25 + 1] == null)
Main.tile[index24 - this.direction, index25 + 1] = new Tile();
Main.tile[index24, index25 + 1].halfBrick();
if (((!Main.tile[index24, index25 - 1].nactive() ? 0 : (Main.tile[index24, index25 - 1].type == (ushort) 10 ? 1 : (Main.tile[index24, index25 - 1].type == (ushort) 388 ? 1 : 0))) & (flag8 ? 1 : 0)) != 0)
{
++this.ai[2];
this.ai[3] = 0.0f;
if ((double) this.ai[2] >= 60.0)
{
bool flag21 = this.type == 3 || this.type == 430 || this.type == 590 || 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.type == 21 || this.type == 324 || this.type == 323 || this.type == 322 || this.type == 44 || this.type == 196 || this.type == 167 || this.type == 77 || this.type == 197 || this.type == 202 || this.type == 203 || this.type == 449 || this.type == 450 || this.type == 451 || this.type == 452 || this.type == 481 || this.type == 201 || this.type == 635;
bool flag22 = Main.player[this.target].ZoneGraveyard && Main.rand.Next(60) == 0;
if (((!Main.bloodMoon || Main.getGoodWorld ? (!flag22 ? 1 : 0) : 0) & (flag21 ? 1 : 0)) != 0)
this.ai[1] = 0.0f;
this.velocity.X = 0.5f * (float) -this.direction;
int num147 = 5;
if (Main.tile[index24, index25 - 1].type == (ushort) 388)
num147 = 2;
this.ai[1] += (float) num147;
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 flag23 = false;
if ((double) this.ai[1] >= 10.0)
{
flag23 = true;
this.ai[1] = 10f;
}
if (this.type == 460)
flag23 = true;
WorldGen.KillTile(index24, index25 - 1, true);
if ((Main.netMode != 1 || !flag23) && flag23 && Main.netMode != 1)
{
if (this.type == 26)
{
WorldGen.KillTile(index24, index25 - 1);
if (Main.netMode == 2)
NetMessage.SendData(17, number2: ((float) index24), number3: ((float) (index25 - 1)));
}
else
{
if (Main.tile[index24, index25 - 1].type == (ushort) 10)
{
bool flag24 = WorldGen.OpenDoor(index24, index25 - 1, this.direction);
if (!flag24)
{
this.ai[3] = (float) num32;
this.netUpdate = true;
}
if (Main.netMode == 2 & flag24)
NetMessage.SendData(19, number2: ((float) index24), number3: ((float) (index25 - 1)), number4: ((float) this.direction));
}
if (Main.tile[index24, index25 - 1].type == (ushort) 388)
{
bool flag25 = WorldGen.ShiftTallGate(index24, index25 - 1, false);
if (!flag25)
{
this.ai[3] = (float) num32;
this.netUpdate = true;
}
if (Main.netMode == 2 & flag25)
NetMessage.SendData(19, number: 4, number2: ((float) index24), number3: ((float) (index25 - 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[index24, index25 - 2].nactive() && Main.tileSolid[(int) Main.tile[index24, index25 - 2].type])
{
if (Main.tile[index24, index25 - 3].nactive() && Main.tileSolid[(int) Main.tile[index24, index25 - 3].type])
{
this.velocity.Y = -8f;
this.netUpdate = true;
}
else
{
this.velocity.Y = -7f;
this.netUpdate = true;
}
}
else if (Main.tile[index24, index25 - 1].nactive() && Main.tileSolid[(int) Main.tile[index24, index25 - 1].type])
{
if (this.type == 624)
{
this.velocity.Y = -8f;
if (WorldGen.SolidTile((int) this.Center.X / 16, (int) ((double) this.position.Y + (double) this.height) / 16 - 8))
{
this.direction *= -1;
this.spriteDirection = this.direction;
this.velocity.X = (float) (3 * this.direction);
}
}
else
this.velocity.Y = -6f;
this.netUpdate = true;
}
else if ((double) this.position.Y + (double) this.height - (double) (index25 * 16) > 20.0 && Main.tile[index24, index25].nactive() && !Main.tile[index24, index25].topSlope() && Main.tileSolid[(int) Main.tile[index24, index25].type])
{
this.velocity.Y = -5f;
this.netUpdate = true;
}
else if (this.directionY < 0 && this.type != 67 && (!Main.tile[index24, index25 + 1].nactive() || !Main.tileSolid[(int) Main.tile[index24, index25 + 1].type]) && (!Main.tile[index24 + this.direction, index25 + 1].nactive() || !Main.tileSolid[(int) Main.tile[index24 + this.direction, index25 + 1].type]))
{
this.velocity.Y = -8f;
this.velocity.X *= 1.5f;
this.netUpdate = true;
}
else if (flag8)
{
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
}
if ((double) this.velocity.Y == 0.0 & flag6 && (double) this.ai[3] == 1.0)
this.velocity.Y = -5f;
if ((double) this.velocity.Y == 0.0 && (Main.expertMode ? 1 : (this.type == 586 ? 1 : 0)) != 0 && (double) Main.player[this.target].Bottom.Y < (double) this.Top.Y && (double) Math.Abs(this.Center.X - Main.player[this.target].Center.X) < (double) (Main.player[this.target].width * 3) && Collision.CanHit((Entity) this, (Entity) Main.player[this.target]))
{
if (this.type == 586)
{
int num148 = (int) (((double) this.Bottom.Y - 16.0 - (double) Main.player[this.target].Bottom.Y) / 16.0);
if (num148 < 14 && Collision.CanHit((Entity) this, (Entity) Main.player[this.target]))
{
if (num148 < 7)
this.velocity.Y = -8.8f;
else if (num148 < 8)
this.velocity.Y = -9.2f;
else if (num148 < 9)
this.velocity.Y = -9.7f;
else if (num148 < 10)
this.velocity.Y = -10.3f;
else if (num148 < 11)
this.velocity.Y = -10.6f;
else
this.velocity.Y = -11f;
}
}
if ((double) this.velocity.Y == 0.0)
{
int num149 = 6;
if ((double) Main.player[this.target].Bottom.Y > (double) this.Top.Y - (double) (num149 * 16))
{
this.velocity.Y = -7.9f;
}
else
{
int index26 = (int) ((double) this.Center.X / 16.0);
int num150 = (int) ((double) this.Bottom.Y / 16.0) - 1;
for (int index27 = num150; index27 > num150 - num149; --index27)
{
if (Main.tile[index26, index27].nactive() && TileID.Sets.Platforms[(int) Main.tile[index26, index27].type])
{
this.velocity.Y = -7.9f;
break;
}
}
}
}
}
}
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)
{
int num151 = 100;
int num152 = 50;
if (this.type == 586)
{
num151 = 150;
num152 = 150;
}
if ((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)))) < (double) num151 && (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)))) < (double) num152 && (this.direction > 0 && (double) this.velocity.X >= 1.0 || this.direction < 0 && (double) this.velocity.X <= -1.0))
{
if (this.type == 586)
{
this.velocity.X += (float) this.direction;
this.velocity.X *= 2f;
if ((double) this.velocity.X > 8.0)
this.velocity.X = 8f;
if ((double) this.velocity.X < -8.0)
this.velocity.X = -8f;
this.velocity.Y = -4.5f;
if ((double) this.position.Y > (double) Main.player[this.target].position.Y + 40.0)
this.velocity.Y -= 2f;
if ((double) this.position.Y > (double) Main.player[this.target].position.Y + 80.0)
this.velocity.Y -= 2f;
if ((double) this.position.Y > (double) Main.player[this.target].position.Y + 120.0)
this.velocity.Y -= 2f;
}
else
{
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 (flag8)
{
this.ai[1] = 0.0f;
this.ai[2] = 0.0f;
}
if (Main.netMode == 1 || this.type != 120 || (double) this.ai[3] < (double) num32)
return;
int num153 = (int) Main.player[this.target].position.X / 16;
int num154 = (int) Main.player[this.target].position.Y / 16;
int num155 = (int) this.position.X / 16;
int num156 = (int) this.position.Y / 16;
int num157 = 20;
int num158 = 0;
bool flag26 = 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)
{
num158 = 100;
flag26 = true;
}
while (!flag26 && num158 < 100)
{
++num158;
int index28 = Main.rand.Next(num153 - num157, num153 + num157);
for (int index29 = Main.rand.Next(num154 - num157, num154 + num157); index29 < num154 + num157; ++index29)
{
if ((index29 < num154 - 4 || index29 > num154 + 4 || index28 < num153 - 4 || index28 > num153 + 4) && (index29 < num156 - 1 || index29 > num156 + 1 || index28 < num155 - 1 || index28 > num155 + 1) && Main.tile[index28, index29].nactive())
{
bool flag27 = true;
if (this.type == 32 && Main.tile[index28, index29 - 1].wall == (ushort) 0)
flag27 = false;
else if (Main.tile[index28, index29 - 1].lava())
flag27 = false;
if (flag27 && Main.tileSolid[(int) Main.tile[index28, index29].type] && !Collision.SolidTiles(index28 - 1, index28 + 1, index29 - 4, index29 - 1))
{
this.position.X = (float) (index28 * 16 - this.width / 2);
this.position.Y = (float) (index29 * 16 - this.height);
this.netUpdate = true;
this.ai[3] = -120f;
}
}
}
}
}
public static bool DespawnEncouragement_AIStyle3_Fighters_NotDiscouraged(
int npcID,
Vector2 position,
NPC npcInstance)
{
return Main.eclipse || !Main.dayTime || npcInstance != null && npcInstance.SpawnedFromStatue || (double) position.Y > Main.worldSurface * 16.0 || npcInstance != null && Main.player[npcInstance.target].ZoneGraveyard || Main.snowMoon && (npcID == 343 || npcID == 350) || Main.invasionType == 1 && (npcID == 26 || npcID == 27 || npcID == 28 || npcID == 111 || npcID == 471) || npcID == 73 || npcID == 624 || npcID == 631 && (double) npcInstance.ai[2] > 0.0 || Main.invasionType == 3 && npcID >= 212 && npcID <= 216 || Main.invasionType == 4 && (npcID == 381 || npcID == 382 || npcID == 383 || npcID == 385 || npcID == 386 || npcID == 389 || npcID == 391 || npcID == 520) || npcID == 31 || npcID == 294 || npcID == 295 || npcID == 296 || npcID == 47 || npcID == 67 || npcID == 77 || npcID == 78 || npcID == 79 || npcID == 80 || npcID == 630 || npcID == 110 || npcID == 120 || npcID == 168 || npcID == 181 || npcID == 185 || npcID == 198 || npcID == 199 || npcID == 206 || npcID == 217 || npcID == 218 || npcID == 219 || npcID == 220 || npcID == 239 || npcID == 243 || npcID == 254 || npcID == (int) byte.MaxValue || npcID == 257 || npcID == 258 || npcID == 291 || npcID == 292 || npcID == 293 || npcID == 379 || npcID == 380 || npcID == 464 || npcID == 470 || npcID == 424 || npcID == 411 && (npcInstance == null || (double) npcInstance.ai[1] >= 180.0 || (double) npcInstance.ai[1] < 90.0) || npcID == 409 || npcID == 425 || npcID == 429 || npcID == 427 || npcID == 428 || npcID == 580 || npcID == 582 || npcID == 508 || npcID == 415 || npcID == 419 || npcID >= 524 && npcID <= 527 || npcID == 528 || npcID == 529 || npcID == 530 || npcID == 532;
}
public static bool DespawnEncouragement_AIStyle3_Fighters_CanBeBusyWithAction(int npcID) => npcID == 110 || npcID == 111 || npcID == 206 || npcID == 216 || npcID == 214 || npcID == 215 || npcID == 291 || npcID == 292 || npcID == 293 || npcID == 350 || npcID == 381 || npcID == 382 || npcID == 383 || npcID == 385 || npcID == 386 || npcID == 389 || npcID == 391 || npcID == 469 || npcID == 166 || npcID == 466 || npcID == 471 || npcID == 411 || npcID == 409 || npcID == 424 || npcID == 425 || npcID == 426 || npcID == 415 || npcID == 419 || npcID == 520;
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)
{
this.ai[1] = (float) NPC.AI_001_Slimes_GenerateItemInsideBody((double) this.ai[0] == -999.0);
this.netUpdate = true;
}
}
if (this.type == 1 && (double) this.ai[0] == -999.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
this.rotation = 0.0f;
}
else
{
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.AI_001_SetRainbowSlimeColor();
}
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)
{
this.position = this.position + this.netOffset;
int index = Dust.NewDust(this.position, this.width, this.height, 14, Alpha: this.alpha, newColor: this.color);
Main.dust[index].velocity *= 0.3f;
this.position = this.position - this.netOffset;
}
}
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 && !this.wet)
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)
{
this.position = this.position + this.netOffset;
int index = Dust.NewDust(this.position, this.width, this.height, 76);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.1f;
this.position = this.position - this.netOffset;
}
if (this.type == 184)
{
if (Main.rand.Next(8) == 0)
{
this.position = this.position + this.netOffset;
int index = Dust.NewDust(this.position - this.velocity, this.width, this.height, 76);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.15f;
this.position = this.position - this.netOffset;
}
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);
int damageForProjectiles = this.GetAttackDamage_ForProjectiles(9f, 9f);
Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_2.X, vector2_2.Y, 174, damageForProjectiles, 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);
int damageForProjectiles = this.GetAttackDamage_ForProjectiles(9f, 9f);
Projectile.NewProjectile(vector2_3.X, vector2_3.Y, vector2_4.X, vector2_4.Y, 605, damageForProjectiles, 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 == 658)
{
flag = true;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
if (!this.wet && Main.player[this.target].active && !Main.player[this.target].dead && !Main.player[this.target].npcTypeNoAggro[this.type])
{
Player player = Main.player[this.target];
Vector2 center = this.Center;
float num11 = player.Center.X - center.X;
float num12 = player.Center.Y - center.Y;
float num13 = (float) Math.Sqrt((double) num11 * (double) num11 + (double) num12 * (double) num12);
int num14 = NPC.CountNPCS(658);
if (Main.expertMode && num14 < 5 && (double) Math.Abs(num11) < 500.0 && (double) Math.Abs(num12) < 550.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 < 3; ++index)
{
Vector2 vector2 = new Vector2((float) (index - 1), -4f);
vector2.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00499999988824129);
vector2.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00499999988824129);
vector2.Normalize();
vector2 *= (float) (6.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
if ((double) num13 > 350.0)
vector2 *= 2f;
else if ((double) num13 > 250.0)
vector2 *= 1.5f;
int projectilesMultiLerp = this.GetAttackDamage_ForProjectiles_MultiLerp(15f, 20f, 25f);
Projectile.NewProjectile(center.X, center.Y, vector2.X, vector2.Y, 920, projectilesMultiLerp, 0.0f, Main.myPlayer);
this.localAI[0] = 25f;
if (num14 > 4)
break;
}
}
}
else if ((double) Math.Abs(num11) < 500.0 && (double) Math.Abs(num12) < 550.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)
{
float num15 = num13;
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 num16 = Main.player[this.target].position.Y - center.Y - (float) Main.rand.Next(0, 200);
float num17 = 4.5f / (float) Math.Sqrt((double) num11 * (double) num11 + (double) num16 * (double) num16) * 2f;
if ((double) num15 > 350.0)
num17 *= 2f;
else if ((double) num15 > 250.0)
num17 *= 1.5f;
float SpeedX = num11 * num17;
float SpeedY = num16 * num17;
this.localAI[0] = 50f;
int projectilesMultiLerp = this.GetAttackDamage_ForProjectiles_MultiLerp(15f, 20f, 25f);
Projectile.NewProjectile(center.X, center.Y, SpeedX, SpeedY, 920, projectilesMultiLerp, 0.0f, Main.myPlayer);
}
}
}
}
if (this.type == 659)
{
flag = true;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
if (!this.wet && Main.player[this.target].active && !Main.player[this.target].dead && !Main.player[this.target].npcTypeNoAggro[this.type])
{
Player player = Main.player[this.target];
Vector2 center = this.Center;
float num18 = player.Center.X - center.X;
float num19 = player.Center.Y - center.Y;
float num20 = (float) Math.Sqrt((double) num18 * (double) num18 + (double) num19 * (double) num19);
if ((double) Math.Abs(num18) < 500.0 && (double) Math.Abs(num19) < 550.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 num21 = Main.player[this.target].position.Y - center.Y - (float) Main.rand.Next(0, 200);
float num22 = 4.5f / (float) Math.Sqrt((double) num18 * (double) num18 + (double) num21 * (double) num21) * 2f;
if ((double) num20 > 350.0)
num22 *= 1.75f;
else if ((double) num20 > 250.0)
num22 *= 1.25f;
float SpeedX = num18 * num22;
float SpeedY = num21 * num22;
this.localAI[0] = 40f;
if (Main.expertMode)
this.localAI[0] = 30f;
int projectilesMultiLerp = this.GetAttackDamage_ForProjectiles_MultiLerp(15f, 20f, 25f);
Projectile.NewProjectile(center.X, center.Y, SpeedX, SpeedY, 921, projectilesMultiLerp, 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 num23 = Main.player[this.target].position.X + (float) Main.player[this.target].width * 0.5f - vector2_5.X;
float num24 = Main.player[this.target].position.Y - vector2_5.Y;
float num25 = (float) Math.Sqrt((double) num23 * (double) num23 + (double) num24 * (double) num24);
if (Main.expertMode && (double) num25 < 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);
int damageForProjectiles = this.GetAttackDamage_ForProjectiles(13f, 13f);
Projectile.NewProjectile(vector2_5.X, vector2_5.Y, vector2_6.X, vector2_6.Y, 176, damageForProjectiles, 0.0f, Main.myPlayer);
this.localAI[0] = 80f;
}
}
}
if ((double) num25 < 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 num26 = Main.player[this.target].position.Y - vector2_5.Y - (float) Main.rand.Next(-30, 20) - num25 * 0.05f;
float num27 = Main.player[this.target].position.X - vector2_5.X - (float) Main.rand.Next(-20, 20);
float num28 = 7f / (float) Math.Sqrt((double) num27 * (double) num27 + (double) num26 * (double) num26);
float SpeedX = num27 * num28;
float SpeedY = num26 * num28;
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)
{
this.position = this.position + this.netOffset;
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;
this.position = this.position - this.netOffset;
}
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 == 658)
this.ai[0] += 5f;
if (this.type == 659)
this.ai[0] += 3f;
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];
}
float num29 = -1000f;
if (this.type == 659)
num29 = -500f;
int num30 = 0;
if ((double) this.ai[0] >= 0.0)
num30 = 1;
if ((double) this.ai[0] >= (double) num29 && (double) this.ai[0] <= (double) num29 * 0.5)
num30 = 2;
if ((double) this.ai[0] >= (double) num29 * 2.0 && (double) this.ai[0] <= (double) num29 * 1.5)
num30 = 3;
if (num30 > 0)
{
this.netUpdate = true;
if (flag && (double) this.ai[2] == 1.0)
this.TargetClosest();
if (num30 == 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 (num30 == 1)
this.ai[0] += num29;
else
this.ai[0] += num29 * 2f;
}
if (this.type == 659)
{
this.velocity.Y *= 1.6f;
this.velocity.X *= 1.2f;
}
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)
{
this.direction = -this.direction;
this.velocity.X *= -1f;
}
if (!WorldGen.SolidTile((int) ((double) this.Center.X / 16.0), (int) ((double) this.Center.Y / 16.0) - 1) || -(double) this.velocity.Y + (double) this.height <= 16.0)
return;
this.velocity.Y = (float) -(16 - this.height);
}
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;
}
}
}
public void AI_001_SetRainbowSlimeColor()
{
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;
}
private static int AI_001_Slimes_GenerateItemInsideBody(bool isBallooned)
{
int num1 = Main.rand.Next(4);
int num2;
if (isBallooned)
{
switch (Main.rand.Next(13))
{
case 1:
num2 = 4368;
break;
case 2:
num2 = 4369;
break;
case 3:
num2 = 4370;
break;
case 4:
num2 = 4371;
break;
case 5:
num2 = 4612;
break;
case 6:
num2 = 4674;
break;
case 7:
case 8:
case 9:
num2 = 4343;
break;
case 10:
case 11:
case 12:
num2 = 4344;
break;
default:
num2 = 4367;
break;
}
}
else
{
switch (num1)
{
case 0:
switch (Main.rand.Next(7))
{
case 0:
num2 = 290;
break;
case 1:
num2 = 292;
break;
case 2:
num2 = 296;
break;
case 3:
num2 = 2322;
break;
default:
num2 = Main.netMode == 0 || Main.rand.Next(2) != 0 ? 2350 : 2997;
break;
}
break;
case 1:
switch (Main.rand.Next(4))
{
case 0:
num2 = 8;
break;
case 1:
num2 = 166;
break;
case 2:
num2 = 965;
break;
default:
num2 = 58;
break;
}
break;
case 2:
num2 = Main.rand.Next(2) != 0 ? Main.rand.Next(699, 703) : Main.rand.Next(11, 15);
break;
default:
switch (Main.rand.Next(3))
{
case 0:
num2 = 71;
break;
case 1:
num2 = 72;
break;
default:
num2 = 73;
break;
}
break;
}
}
return num2;
}
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)
SoundEngine.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 = SoundEngine.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 = SoundEngine.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)
SoundEngine.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)
SoundEngine.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);
SoundEngine.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);
SoundEngine.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 (SoundEngine.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 (this.type == 315)
{
Lighting.AddLight(this.Center, 0.4f, 0.36f, 0.2f);
int num3 = this.frame.Height;
if (num3 < 1)
num3 = 1;
switch (this.frame.Y / num3)
{
case 4:
case 5:
case 6:
case 7:
Vector2 vector2_1 = this.Bottom + new Vector2(-30f, -8f);
Vector2 vector2_2 = new Vector2(60f, 8f);
if (Main.rand.Next(3) != 0)
{
Dust dust = Dust.NewDustPerfect(vector2_1 + new Vector2(Main.rand.NextFloat() * vector2_2.X, Main.rand.NextFloat() * vector2_2.Y), 6, new Vector2?(this.velocity));
dust.scale = 0.6f;
dust.fadeIn = 1.1f;
dust.noGravity = true;
dust.noLight = true;
break;
}
break;
}
}
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_3 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
double num4 = (double) Main.player[this.target].position.X + (double) Main.player[this.target].width * 0.5 - (double) vector2_3.X;
float num5 = Main.player[this.target].position.Y - vector2_3.Y;
float num6 = (float) Math.Sqrt(num4 * num4 + (double) num5 * (double) num5);
if ((double) num6 < 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_4 = Vector2.UnitY.RotatedByRandom(6.28318548202515);
dust.position = Position + vector2_4 * 20f;
dust.velocity = -vector2_4 * 2f;
dust.scale = (float) (0.5 + (double) vector2_4.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_5 = Vector2.UnitY.RotatedByRandom(6.28318548202515);
dust.position = Position + vector2_5 * 4f;
dust.velocity = vector2_5 * 4f + Vector2.UnitX * Main.rand.NextFloat() * (float) this.spriteDirection * -5f;
dust.scale = (float) (0.5 + (double) vector2_5.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, this.GetAttackDamage_ForProjectiles(50f, 35f), 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) num6 < 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) num6 < 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) num6 < 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;
SoundEngine.PlaySound(3, this.Center, 11);
}
if (this.type == 546 && !Main.player[this.target].ZoneDesert)
{
int direction = this.direction;
this.TargetClosest();
if (!Main.player[this.target].ZoneDesert)
{
this.EncourageDespawn(10);
this.ai[3] = (float) num1;
this.direction = direction;
}
}
if ((double) this.ai[3] < (double) num1)
{
if ((this.type == 329 || this.type == 315) && !Main.pumpkinMoon)
this.EncourageDespawn(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 num7 = 6f;
float num8 = 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) num7 || (double) this.velocity.X > (double) num7)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num7 && this.direction == 1)
{
this.velocity.X += 0.07f;
if ((double) this.velocity.X > (double) num7)
this.velocity.X = num7;
}
else if ((double) this.velocity.X > -(double) num7 && this.direction == -1)
{
this.velocity.X -= 0.07f;
if ((double) this.velocity.X < -(double) num7)
this.velocity.X = -num7;
}
}
else if (this.type == 410)
{
if (Math.Sign(this.velocity.X) != this.direction)
this.velocity.X *= 0.9f;
num7 = 6f;
num8 = 0.2f;
}
else if (this.type == 423)
{
if (Math.Sign(this.velocity.X) != this.direction)
this.velocity.X *= 0.85f;
num7 = 10f;
num8 = 0.2f;
}
else if (this.type == 546)
{
if (Math.Sign(this.velocity.X) != this.direction)
this.velocity.X *= 0.92f;
float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedTarget)) * (float) Math.Sign(Main.windSpeedTarget);
if (!Main.player[this.target].ZoneSandstorm)
num9 = 0.0f;
num7 = (float) (4.0 + (double) num9 * (double) this.direction * 3.0);
num8 = 0.05f;
}
if ((double) this.velocity.X < -(double) num7 || (double) this.velocity.X > (double) num7)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * 0.8f;
}
else if ((double) this.velocity.X < (double) num7 && this.direction == 1)
{
this.velocity.X += num8;
if ((double) this.velocity.X > (double) num7)
this.velocity.X = num7;
}
else if ((double) this.velocity.X > -(double) num7 && this.direction == -1)
{
this.velocity.X -= num8;
if ((double) this.velocity.X < -(double) num7)
this.velocity.X = -num7;
}
}
if ((double) this.velocity.Y >= 0.0)
{
int num10 = 0;
if ((double) this.velocity.X < 0.0)
num10 = -1;
if ((double) this.velocity.X > 0.0)
num10 = 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) * num10)) / 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 - num10, index2 - 3].nactive() || !Main.tileSolid[(int) Main.tile[index1 - num10, index2 - 3].type]))
{
float num11 = (float) (index2 * 16);
if (Main.tile[index1, index2].halfBrick())
num11 += 8f;
if (Main.tile[index1, index2 - 1].halfBrick())
num11 -= 8f;
if ((double) num11 < (double) position.Y + (double) this.height)
{
float num12 = position.Y + (float) this.height - num11;
if ((double) num12 <= 16.1)
{
this.gfxOffY += this.position.Y + (float) this.height - num11;
this.position.Y = num11 - (float) this.height;
this.stepSpeed = (double) num12 >= 9.0 ? 2f : 1f;
}
}
}
}
if ((double) this.velocity.Y == 0.0)
{
bool flag6 = true;
int index3 = (int) ((double) this.position.Y - 7.0) / 16;
int num13 = (int) ((double) this.position.X - 7.0) / 16;
int num14 = (int) ((double) this.position.X + (double) this.width + 7.0) / 16;
for (int index4 = num13; index4 <= num14; ++index4)
{
if (Main.tile[index4, index3] != null && Main.tile[index4, index3].nactive() && Main.tileSolid[(int) Main.tile[index4, index3].type])
{
flag6 = false;
break;
}
}
if (flag6)
{
int index5 = (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 index6 = (int) (((double) this.position.Y + (double) this.height - 15.0) / 16.0);
if (Main.tile[index5, index6] == null)
Main.tile[index5, index6] = new Tile();
if (Main.tile[index5, index6 - 1] == null)
Main.tile[index5, index6 - 1] = new Tile();
if (Main.tile[index5, index6 - 2] == null)
Main.tile[index5, index6 - 2] = new Tile();
if (Main.tile[index5, index6 - 3] == null)
Main.tile[index5, index6 - 3] = new Tile();
if (Main.tile[index5, index6 + 1] == null)
Main.tile[index5, index6 + 1] = new Tile();
if (Main.tile[index5 + this.direction, index6 - 1] == null)
Main.tile[index5 + this.direction, index6 - 1] = new Tile();
if (Main.tile[index5 + this.direction, index6 + 1] == null)
Main.tile[index5 + this.direction, index6 + 1] = new Tile();
if (Main.tile[index5 - this.direction, index6 + 1] == null)
Main.tile[index5 - this.direction, index6 + 1] = new Tile();
if (Main.tile[index5 + this.direction, index6 + 3] == null)
Main.tile[index5 + this.direction, index6 + 3] = 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 flag7 = this.type == 410 || this.type == 423;
float num15 = 3f;
if (Main.tile[index5, index6 - 2].nactive() && Main.tileSolid[(int) Main.tile[index5, index6 - 2].type])
{
if (Main.tile[index5, index6 - 3].nactive() && Main.tileSolid[(int) Main.tile[index5, index6 - 3].type])
{
this.velocity.Y = -8.5f;
this.netUpdate = true;
}
else
{
this.velocity.Y = -7.5f;
this.netUpdate = true;
}
}
else if (Main.tile[index5, index6 - 1].nactive() && !Main.tile[index5, index6 - 1].topSlope() && Main.tileSolid[(int) Main.tile[index5, index6 - 1].type])
{
this.velocity.Y = -7f;
this.netUpdate = true;
}
else if ((double) this.position.Y + (double) this.height - (double) (index6 * 16) > 20.0 && Main.tile[index5, index6].nactive() && !Main.tile[index5, index6].topSlope() && Main.tileSolid[(int) Main.tile[index5, index6].type])
{
this.velocity.Y = -6f;
this.netUpdate = true;
}
else if ((this.directionY < 0 || (double) Math.Abs(this.velocity.X) > (double) num15) && (!flag7 || !Main.tile[index5, index6 + 1].nactive() || !Main.tileSolid[(int) Main.tile[index5, index6 + 1].type]) && (!Main.tile[index5, index6 + 2].nactive() || !Main.tileSolid[(int) Main.tile[index5, index6 + 2].type]) && (!Main.tile[index5 + this.direction, index6 + 3].nactive() || !Main.tileSolid[(int) Main.tile[index5 + this.direction, index6 + 3].type]))
{
this.velocity.Y = -8f;
this.netUpdate = true;
}
}
}
}
if (this.type == 423 && (double) Math.Abs(this.velocity.X) >= (double) num7 * 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;
float num16 = 30f;
float num17 = 0.0f;
bool flag17 = false;
bool flag18 = true;
bool flag19 = false;
int num18 = 30;
bool flag20 = false;
bool flag21 = false;
bool flag22 = false;
bool flag23 = false;
LegacySoundStyle legacySoundStyle = (LegacySoundStyle) null;
int maxValue1 = 0;
bool flag24 = false;
float max2 = 1f;
float num19 = 0.07f;
float num20 = 0.8f;
float num21 = (float) (this.width / 2 + 6);
bool flag25 = this.directionY < 0;
bool flag26 = false;
int num22 = 1;
bool flag27 = false;
float num23 = 5f;
float num24 = 3f;
float num25 = 8f;
float amount1 = 0.05f;
float amount2 = 0.04f;
float amount3 = 0.1f;
bool flag28 = false;
float num26 = 0.025f;
NPCAimedTarget targetData = this.GetTargetData();
NPCUtils.NPCTargetingMethod npcTargetingMethod = new NPCUtils.NPCTargetingMethod(NPCUtils.TargetClosestCommon);
if (NPCID.Sets.BelongsToInvasionOldOnesArmy[this.type])
npcTargetingMethod = new NPCUtils.NPCTargetingMethod(NPCUtils.TargetClosestOldOnesInvasion);
if (targetData.Type == NPCTargetType.NPC && Main.npc[this.TranslatedTargetIndex].type == 548 && Main.npc[this.TranslatedTargetIndex].dontTakeDamageFromHostiles)
{
npcTargetingMethod(this, true, new Vector2?());
targetData = this.GetTargetData();
}
if (NPCID.Sets.FighterUsesDD2PortalAppearEffect[this.type])
{
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);
flag2 &= (double) this.ai[0] <= 0.0;
}
if (flag2)
{
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 flag29 = NPCID.Sets.FighterUsesDD2PortalAppearEffect[this.type];
bool flag30 = true;
Vector2 size;
switch (this.type)
{
case 552:
case 553:
case 554:
legacySoundStyle = SoundID.DD2_GoblinScream;
maxValue1 = 1000;
flag5 = true;
flag21 = DD2Event.EnemiesShouldChasePlayers;
if (this.type == 553)
{
num19 += 0.01f;
max2 += 0.2f;
}
if (this.type == 554)
{
num19 += 0.02f;
max2 += 0.4f;
}
if ((double) this.localAI[3] < 60.0)
{
num19 = (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 num27 = (double) this.localAI[3] >= 60.0 ? 1 : 0;
flag21 = DD2Event.EnemiesShouldChasePlayers;
flag24 = 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 (num27 == 0)
{
num11 = 1f;
num19 = (float) (0.00999999977648258 + (double) this.localAI[3] / 60.0 * 0.0500000007450581);
}
if (this.type == 555)
{
max2 = 0.88f;
max1 = 0.6f;
Damage = this.GetAttackDamage_ForProjectiles(20f, 15f);
}
if (this.type == 555)
{
max2 = 0.88f;
max1 = 0.6f;
Damage = this.GetAttackDamage_ForProjectiles(30f, 25f);
}
if (this.type == 557)
{
max2 = 1.12f;
max1 = 0.4f;
Damage = this.GetAttackDamage_ForProjectiles(40f, 35f);
}
if ((double) this.ai[1] == (double) num9)
{
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_GoblinBomberThrow, this.Center);
break;
}
break;
case 561:
case 562:
case 563:
int num28 = (double) this.localAI[3] >= 60.0 ? 1 : 0;
if ((double) this.ai[1] == 82.0)
{
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_JavelinThrowersAttack, this.Center);
maxValue1 = 7;
legacySoundStyle = SoundID.DD2_JavelinThrowersTaunt;
}
flag21 = DD2Event.EnemiesShouldChasePlayers;
flag24 = 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 (num28 == 0)
{
num11 = 1f;
num19 = (float) (0.00999999977648258 + (double) this.localAI[3] / 60.0 * 0.0500000007450581);
}
if (this.type == 561)
{
max2 = 0.88f;
max1 = 0.6f;
Damage = this.GetAttackDamage_ForProjectiles(15f, 10f);
num10 = 11.5f;
num11 -= 100f;
}
if (this.type == 562)
{
max2 = 0.94f;
max1 = 0.5f;
Damage = this.GetAttackDamage_ForProjectiles(30f, 20f);
num10 = 12.2f;
num11 -= 50f;
}
if (this.type == 563)
{
max2 = 1f;
max1 = 0.4f;
Damage = this.GetAttackDamage_ForProjectiles(45f, 30f);
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.TileActionAttempt(DelegateMethods.CastLightOpen));
flag21 = DD2Event.EnemiesShouldChasePlayers;
int num29 = (double) this.localAI[3] >= 120.0 ? 1 : 0;
if (num29 == 0)
num19 = 0.0f;
if (num29 != 0)
{
this.dontTakeDamage = false;
break;
}
this.dontTakeDamage = true;
this.velocity.X = 0.0f;
flag24 = true;
flag20 = true;
this.ai[3] = 0.0f;
if ((double) this.localAI[3] == 0.0)
this.alpha = (int) byte.MaxValue;
++this.localAI[3];
float num30 = this.localAI[3];
if ((double) num30 >= 110.0)
{
this.alpha -= 26;
if (this.alpha < 0)
this.alpha = 0;
}
if ((double) num30 >= 100.0)
{
int num31 = (int) this.localAI[3] / 20;
size = this.Size;
float num32 = size.Length() / 2f / 20f;
int maxValue2 = 5;
for (int index = 0; index < num31 * 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 * num32;
}
}
}
else
{
int num33 = (int) this.localAI[3] / 10;
size = this.Size;
float num34 = size.Length() / 2f / 20f;
int maxValue3 = 5;
for (int index = 0; (double) index < (double) num33 * 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 * num34 * Main.rand.NextFloat();
dust.velocity.Y *= Utils.GetLerpValue((float) this.width * 0.75f, 0.0f, Math.Abs(dust.position.X - this.Center.X), true);
}
}
}
if ((double) num30 > 100.0 && (int) num30 % 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;
num19 = 0.16f;
num20 = 0.7f;
max2 = 1.4f;
flag5 = true;
num4 = 600f;
flag21 = DD2Event.EnemiesShouldChasePlayers;
if ((double) this.localAI[3] < 60.0)
num19 = (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 num35 = (double) ((SlotId) ref slotId1).ToFloat();
localAi[1] = (float) num35;
}
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 = SoundEngine.GetActiveSound(SlotId.FromFloat(this.localAI[1]));
if (activeSound == null)
{
float[] localAi = this.localAI;
slotId1 = SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_WitherBeastAuraPulse, this.Center);
double num36 = (double) ((SlotId) ref slotId1).ToFloat();
localAi[1] = (float) num36;
}
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.creativeGodMode)
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:
flag21 = DD2Event.EnemiesShouldChasePlayers;
flag24 = 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 = this.GetAttackDamage_ForProjectiles(35f, 25f);
if (this.type == 571)
Damage = this.GetAttackDamage_ForProjectiles(60f, 45f);
max2 = 0.77f;
if ((double) this.ai[0] > 0.0)
{
if ((double) this.ai[1] == 40.0)
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_DrakinShot, this.Center);
else if ((double) this.ai[1] == 60.0)
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_DrakinBreathIn, this.Center);
}
if ((double) this.localAI[3] < 60.0)
{
num11 = 1f;
num19 = (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 num37 = (double) ((SlotId) ref invalid).ToFloat();
localAi1[0] = (float) num37;
float[] localAi2 = this.localAI;
slotId2 = (SlotId) SlotId.Invalid;
double num38 = (double) ((SlotId) ref slotId2).ToFloat();
localAi2[1] = (float) num38;
}
flag21 = DD2Event.EnemiesShouldChasePlayers;
if ((double) this.ai[1] == 2.0)
{
SoundEngine.GetActiveSound(SlotId.FromFloat(this.localAI[0]))?.Stop();
SoundEngine.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 = this.GetAttackDamage_ScaledByStrength(80f);
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;
SoundEngine.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 = SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldIgnite, this.Center);
double num39 = (double) ((SlotId) ref slotId2).ToFloat();
localAi[0] = (float) num39;
}
++this.localAI[2];
if ((double) this.localAI[2] == 30.0)
{
float[] localAi3 = this.localAI;
slotId2 = SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldIgniteLoop, this.Center);
double num40 = (double) ((SlotId) ref slotId2).ToFloat();
localAi3[0] = (float) num40;
float[] localAi4 = this.localAI;
slotId2 = SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldScreamChargeLoop, this.Center);
double num41 = (double) ((SlotId) ref slotId2).ToFloat();
localAi4[1] = (float) num41;
}
}
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 = SoundEngine.GetActiveSound(SlotId.FromFloat(this.localAI[0]));
if (activeSound1 == null)
{
float[] localAi = this.localAI;
slotId2 = SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldIgniteLoop, this.Center);
double num42 = (double) ((SlotId) ref slotId2).ToFloat();
localAi[0] = (float) num42;
}
else
activeSound1.Position = this.Center;
ActiveSound activeSound2 = SoundEngine.GetActiveSound(SlotId.FromFloat(this.localAI[1]));
if (activeSound2 == null)
{
float[] localAi = this.localAI;
slotId2 = SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldScreamChargeLoop, this.Center);
double num43 = (double) ((SlotId) ref slotId2).ToFloat();
localAi[1] = (float) num43;
}
else
activeSound2.Position = this.Center;
}
if ((double) this.ai[1] > 0.0 && (double) this.ai[0] == 0.0)
{
flag5 = true;
num5 = 40;
num4 = 64f;
num19 = 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)
{
num19 = (float) (0.00999999977648258 + (double) this.localAI[3] / 60.0 * 0.0500000007450581);
break;
}
break;
case 576:
case 577:
maxValue1 = 700;
legacySoundStyle = SoundID.DD2_OgreRoar;
num21 -= 32f;
flag5 = true;
num6 = 60;
num4 = 130f;
num5 = 44;
flag21 = DD2Event.EnemiesShouldChasePlayers;
num7 = 0.7f;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
if ((double) this.ai[0] <= 0.0)
{
float num44 = this.ai[1];
float num45 = this.Distance(targetData.Center);
if ((double) this.localAI[3] >= 60.0)
{
if ((double) num45 <= (double) num4 + 300.0 && (double) this.localAI[0] <= 0.0)
this.ai[1] = 2f;
else if ((double) num45 > (double) num4 + 30.0)
this.ai[1] = 1f;
else if ((double) num45 <= (double) num4)
{
this.ai[1] = 0.0f;
if ((double) num44 == 1.0)
this.ai[0] = 0.0f;
}
}
if ((double) num44 != (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)
{
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_OgreAttack, this.Center);
break;
}
break;
case 1:
flag3 = true;
num5 = 90;
num4 = 1000f;
num6 = 240;
Damage = this.GetAttackDamage_ForProjectiles(40f, 30f);
flag15 = false;
vector2_1 = new Vector2((float) (this.direction * 30), -70f);
Type = 676;
if ((double) this.ai[0] == 80.0)
{
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_OgreSpit, this.Center);
break;
}
break;
case 2:
num5 = 90;
num4 = 250f;
flag4 = true;
Damage = this.GetAttackDamage_ForProjectiles(60f, 40f);
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)
{
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_OgreGroundPound, this.Center);
break;
}
break;
}
if ((double) this.ai[0] < (double) -num6)
{
this.ai[0] = (float) -num6;
break;
}
break;
case 620:
flag27 = this.wet;
flag30 = false;
flag16 = true;
num17 = 150f;
num16 = 20f;
bool dayTime = Main.dayTime;
flag21 = !dayTime;
flag24 = true;
flag12 = true;
flag15 = (double) this.ai[1] > 40.0;
num8 = 60;
num9 = 40;
if ((double) this.ai[1] > 10.0 && (double) this.ai[1] <= 40.0 && (int) this.ai[1] % 5 == 0)
num9 = (int) this.ai[1] - 1;
Type = 811;
vector2_1.X -= (float) (4 * this.direction);
vector2_1.Y -= 20f;
num13 = 0.15f;
max1 = 2.5f;
num11 = 600f;
num10 = 13f;
num14 = 1;
num15 = 0.0f;
Damage = this.GetAttackDamage_ForProjectiles(40f, 30f);
max2 = 8f;
num19 *= 3f;
num20 = 0.9f;
if ((double) this.ai[0] > 0.0)
{
if ((double) this.ai[1] == 40.0)
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_DrakinShot, this.Center);
else if ((double) this.ai[1] == 60.0)
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_DrakinBreathIn, this.Center);
}
this.position = this.position + this.netOffset;
if (this.alpha == (int) byte.MaxValue)
{
this.spriteDirection = this.direction;
this.velocity.Y = -6f;
this.netUpdate = true;
for (int index = 0; index < 35; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 5);
dust.velocity *= 1f;
dust.scale = (float) (1.0 + (double) Main.rand.NextFloat() * 0.5);
dust.fadeIn = (float) (1.5 + (double) Main.rand.NextFloat() * 0.5);
dust.velocity += this.velocity * 0.5f;
}
}
this.alpha -= 15;
if (this.alpha < 0)
this.alpha = 0;
if (this.alpha != 0)
{
for (int index = 0; index < 2; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 5);
dust.velocity *= 1f;
dust.scale = (float) (1.0 + (double) Main.rand.NextFloat() * 0.5);
dust.fadeIn = (float) (1.5 + (double) Main.rand.NextFloat() * 0.5);
dust.velocity += this.velocity * 0.3f;
}
}
if (Main.rand.Next(3) == 0)
Dust.NewDustDirect(this.position, this.width, this.height, 5, Alpha: 50, Scale: 1.3f).velocity = Vector2.Zero;
this.position = this.position - this.netOffset;
if (dayTime)
{
flag12 = false;
flag24 = false;
flag23 = true;
break;
}
if ((double) this.velocity.Y == 0.0 && (double) targetData.Hitbox.Bottom < (double) this.Top.Y && (double) Math.Abs(this.Center.X - (float) targetData.Hitbox.Center.X) < (double) (this.width * 3) && Collision.CanHit(this.Hitbox.TopLeft(), this.Hitbox.Width, this.Hitbox.Height, targetData.Hitbox.TopLeft(), targetData.Hitbox.Width, targetData.Hitbox.Height))
{
int num46 = (int) (((double) this.Bottom.Y - 16.0 - (double) targetData.Hitbox.Bottom) / 16.0);
if (num46 < 27)
{
if (num46 < 11)
{
this.velocity.Y = -11f;
break;
}
if (num46 < 15)
{
this.velocity.Y = -13f;
break;
}
if (num46 < 19)
{
this.velocity.Y = -14f;
break;
}
this.velocity.Y = -15.9f;
break;
}
break;
}
break;
}
if (flag28)
{
bool flag31 = (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 -= num26;
else
this.velocity.X += num26;
if ((double) this.position.Y < (double) Main.npc[index].position.Y)
this.velocity.Y -= num26;
else
this.velocity.Y += num26;
}
}
if (flag31)
this.velocity.Y = 0.0f;
}
if (flag29)
{
if ((double) this.localAI[3] == 0.0)
this.alpha = (int) byte.MaxValue;
if ((double) this.localAI[3] == 30.0)
SoundEngine.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 num47 = (int) this.localAI[3] / 10;
size = this.Size;
float num48 = size.Length() / 2f / 20f;
int maxValue4 = 5;
if (this.type == 576 || this.type == 577)
maxValue4 = 1;
for (int index = 0; index < num47; ++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 * num48;
dust.velocity += this.velocity;
}
}
}
}
if (flag27)
{
this.noGravity = true;
this.TargetClosest(false);
if (this.collideX)
this.velocity.X = -this.oldVelocity.X;
if ((double) this.velocity.X != 0.0)
this.direction = Math.Sign(this.direction);
if (Collision.CanHit(this.position, this.width, this.height, targetData.Position, targetData.Width, targetData.Height))
{
Vector2 vector2_3 = targetData.Center - this.Center;
vector2_3.Normalize();
this.velocity = Vector2.Lerp(this.velocity, vector2_3 * num23, amount1);
}
else
{
float num49 = num23;
if ((double) this.velocity.Y > 0.0)
num49 = num24;
if ((double) this.velocity.Y < 0.0)
num49 = num25;
Vector2 vector2_4 = new Vector2((float) this.direction, -1f);
vector2_4.Normalize();
Vector2 vector2_5 = vector2_4 * num49;
if ((double) num49 < (double) num23)
this.velocity = Vector2.Lerp(this.velocity, vector2_5, amount2);
else
this.velocity = Vector2.Lerp(this.velocity, vector2_5, amount3);
}
}
else
{
bool flag32 = false;
if (flag12 | flag5 && (double) this.ai[0] > 0.0)
flag18 = false;
if (flag12 && (double) this.ai[1] > 0.0)
flag22 = true;
if (flag5 && (double) this.ai[0] > 0.0)
flag22 = 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 * num22;
if (flag7)
{
this.velocity.X *= num7;
flag24 = true;
flag20 = true;
this.ai[3] = 0.0f;
this.netUpdate = true;
}
--this.ai[0];
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = (float) -num6;
this.netUpdate = true;
}
}
}
if (flag3 && (double) this.ai[0] > 0.0)
{
if (flag15)
{
npcTargetingMethod(this, true, new Vector2?());
targetData = this.GetTargetData();
}
if ((double) this.ai[0] == (double) num9)
{
Vector2 vector2_6 = this.Center + vector2_1;
Vector2 v = targetData.Center - vector2_6;
v.Y -= Math.Abs(v.X) * num13;
Vector2 vector2_7 = v.SafeNormalize(-Vector2.UnitY) * num10;
for (int index = 0; index < num14; ++index)
{
Vector2 vector2_8 = vector2_7;
Vector2 vector2_9 = vector2_6;
Vector2 velocity = !nullable.HasValue ? vector2_8 + Utils.RandomVector2(Main.rand, -max1, max1) : vector2_8 + nullable.Value;
Vector2 position = vector2_9 + vector2_7 * 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 (!flag17 & flag18)
{
if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X * (double) this.direction < 0.0)
flag19 = true;
if ((((double) this.position.X == (double) this.oldPosition.X ? 1 : ((double) this.ai[3] >= (double) num18 ? 1 : 0)) | (flag19 ? 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) (num18 * 10))
this.ai[3] = 0.0f;
if (this.justHit && !flag30)
this.ai[3] = 0.0f;
if (targetData.Hitbox.Intersects(this.Hitbox))
this.ai[3] = 0.0f;
if ((double) this.ai[3] == (double) num18)
{
this.netUpdate = true;
if (flag30)
{
this.noGravity = true;
this.noTileCollide = true;
this.position.X += (float) (this.direction * this.width * 2);
int num50 = 20;
size = this.Size;
float num51 = size.Length() / 2f / 20f;
int maxValue5 = 5;
if (this.type == 576 || this.type == 577)
maxValue5 = 1;
for (int index = 0; index < num50; ++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 * num51;
dust.noGravity = true;
dust.fadeIn = 1.5f;
dust.velocity *= 3f;
}
}
return;
}
}
}
if (!flag20)
{
if ((double) this.ai[3] < (double) num18 & flag21)
{
if (maxValue1 > 0 && Main.rand.Next(maxValue1) == 0)
SoundEngine.PlayTrackedSound((SoundStyle) legacySoundStyle, this.Center);
int num52 = this.HasValidTarget ? 1 : 0;
npcTargetingMethod(this, true, new Vector2?());
targetData = this.GetTargetData();
int num53 = this.HasValidTarget ? 1 : 0;
if (num52 != num53)
this.netUpdate = true;
}
else if (!flag22)
{
if (flag23)
this.EncourageDespawn(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 * num22;
this.ai[2] = 0.0f;
this.netUpdate = true;
}
}
}
else if ((double) this.ai[2] != 0.0)
{
this.ai[2] = 0.0f;
this.netUpdate = true;
}
if (this.direction == 0)
this.direction = 1;
}
}
if (!flag24)
{
if ((double) this.velocity.X < -(double) max2 || (double) this.velocity.X > (double) max2)
{
if ((double) this.velocity.Y == 0.0)
this.velocity = this.velocity * num20;
}
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 + num19 * (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] = num16;
this.ai[0] = 0.0f;
}
if ((double) this.ai[0] > 0.0)
{
if (flag15)
{
npcTargetingMethod(this, true, new Vector2?());
targetData = this.GetTargetData();
}
if ((double) this.ai[1] == (double) num9)
{
Vector2 vector2_10 = this.Center + vector2_1;
Vector2 v = targetData.Center - vector2_10;
v.Y -= Math.Abs(v.X) * num13;
Vector2 vector2_11 = v.SafeNormalize(-Vector2.UnitY) * num10;
for (int index = 0; index < num14; ++index)
{
Vector2 vector2_12 = vector2_10;
Vector2 vector2_13 = vector2_11;
Vector2 velocity = !nullable.HasValue ? vector2_13 + Utils.RandomVector2(Main.rand, -max1, max1) : vector2_13 + nullable.Value;
Vector2 position = vector2_12 + velocity * num15;
if (Main.netMode != 1)
Projectile.NewProjectile(position, velocity, Type, Damage, 0.0f, Main.myPlayer);
}
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 (flag16)
this.direction = (double) vector2_11.X > 0.0 ? 1 : -1;
}
bool flag33 = true;
if ((double) this.velocity.Y != 0.0 && !flag14 || (double) this.ai[1] <= 0.0)
{
bool flag34 = false;
if ((double) num17 != 0.0 && (double) this.ai[1] <= 0.0)
flag34 = true;
this.ai[0] = 0.0f;
this.ai[1] = flag34 ? num17 : 0.0f;
}
else if (!flag13 || !flag33 && (!flag14 || (double) this.velocity.Y == 0.0))
{
this.velocity.X *= 0.9f;
this.spriteDirection = this.direction * num22;
}
}
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_14 = targetData.Center - this.Center;
if ((double) vector2_14.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_14.Y) <= (double) Math.Abs(vector2_14.X) * 2.0 ? ((double) Math.Abs(vector2_14.X) <= (double) Math.Abs(vector2_14.Y) * 2.0 ? ((double) vector2_14.Y > 0.0 ? 2f : 4f) : 3f) : ((double) vector2_14.Y > 0.0 ? 1f : 5f);
if (flag16)
this.direction = (double) vector2_14.X > 0.0 ? 1 : -1;
}
}
if ((double) this.ai[0] <= 0.0 || flag13)
{
bool flag35 = (double) this.Distance(targetData.Center) < (double) num12;
if (flag35 && 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)) | (flag35 ? 1 : 0)) != 0)
{
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= num20;
}
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 + num19 * (float) this.direction, -max2, max2);
}
}
}
if ((double) this.velocity.Y == 0.0)
{
int index12 = (int) ((double) this.Bottom.Y + 7.0) / 16;
int num54 = (int) this.Left.X / 16;
int num55 = (int) this.Right.X / 16;
int index13;
for (int index14 = num54; index14 <= num55; 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])
{
flag32 = true;
break;
}
}
}
Point tileCoordinates = this.Center.ToTileCoordinates();
if (WorldGen.InWorld(tileCoordinates.X, tileCoordinates.Y, 5) && !this.noGravity)
{
Vector2 cPosition;
int cWidth;
int cHeight;
this.GetTileCollisionParameters(out cPosition, out cWidth, out cHeight);
Vector2 vector2_15 = this.position - cPosition;
Collision.StepUp(ref cPosition, ref this.velocity, cWidth, cHeight, ref this.stepSpeed, ref this.gfxOffY);
this.position = cPosition + vector2_15;
}
if (flag32)
{
int index = (int) ((double) this.Center.X + (double) num21 * (double) this.direction) / 16;
int j = ((int) this.Bottom.Y - 15) / 16;
bool flag36 = (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 num56 = 5;
if (Main.tile[index, j - 1].type == (ushort) 388)
num56 = 2;
this.velocity.X = 0.5f * (float) -this.direction;
this.ai[1] += (float) num56;
bool flag37 = false;
if ((double) this.ai[1] >= 10.0)
{
flag37 = true;
this.ai[1] = 10f;
}
if (flag10)
flag37 = true;
WorldGen.KillTile(index, j - 1, true);
if (Main.netMode != 1 & flag37)
{
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 flag38 = WorldGen.OpenDoor(index, j - 1, this.direction);
if (!flag38)
{
this.ai[3] = (float) num18;
this.netUpdate = true;
}
if (Main.netMode == 2 & flag38)
NetMessage.SendData(19, number2: ((float) index), number3: ((float) (j - 1)), number4: ((float) this.direction));
}
if (tileSafely4.type == (ushort) 388)
{
bool flag39 = WorldGen.ShiftTallGate(index, j - 1, false);
if (!flag39)
{
this.ai[3] = (float) num18;
this.netUpdate = true;
}
if (Main.netMode == 2 & flag39)
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 * num22) > 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 (flag36 && tileSafely3.nactive() && !tileSafely3.topSlope() && Main.tileSolid[(int) tileSafely3.type])
{
this.velocity.Y = -5f;
this.netUpdate = true;
}
else if (flag25 && (!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 (flag26 && (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 (!flag2 || !this.noTileCollide)
return;
this.wet = false;
if (flag29)
{
if (this.alpha < 60)
this.alpha += 20;
this.localAI[3] = 40f;
}
int num57 = (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 Position = new Vector2(this.Center.X - (float) (Width / 2), this.position.Y + (float) this.height - (float) height);
bool flag40 = false;
if ((double) this.position.Y + (double) this.height < (double) targetData.Position.Y + (double) targetData.Height - 16.0)
flag40 = true;
if (flag40)
this.velocity.Y += 0.5f;
else if (Collision.SolidCollision(Position, Width, height) || (double) targetData.Center.Y - (double) this.Center.Y < -100.0 || (double) targetData.Center.Y - (double) this.Center.Y < 10.0 && (double) Math.Abs(targetData.Center.X - this.Center.X) < 60.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 (num57 == 0)
return;
this.velocity.Y = 0.0f;
}
}
private void AI_084_LunaticCultist()
{
if ((double) this.ai[0] != -1.0 && Main.rand.Next(1000) == 0)
SoundEngine.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 damageForProjectiles1 = this.GetAttackDamage_ForProjectiles(35f, 25f);
if (expertMode)
num1 = 90;
if (Main.getGoodWorld)
num1 -= 30;
int num2 = 18;
int num3 = 3;
int damageForProjectiles2 = this.GetAttackDamage_ForProjectiles(30f, 20f);
if (expertMode)
{
num2 = 12;
num3 = 4;
}
if (Main.getGoodWorld)
{
num2 = 10;
num3 = 5;
}
int num4 = 80;
int damageForProjectiles3 = this.GetAttackDamage_ForProjectiles(45f, 30f);
if (expertMode)
num4 = 40;
if (Main.getGoodWorld)
num4 -= 20;
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)
{
SoundEngine.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)
SoundEngine.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, damageForProjectiles1, 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, damageForProjectiles2, 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, damageForProjectiles3, 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)
SoundEngine.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.GameModeInfo.KnockbackToEnemiesMultiplier;
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 = SoundEngine.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 = SoundEngine.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 = SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_KoboldFlyerChargeScream, this.Center);
double num27 = (double) ((SlotId) ref slotId).ToFloat();
localAi[1] = (float) num27;
SoundEngine.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 = SoundEngine.GetActiveSound(SlotId.FromFloat(this.localAI[2]));
if (activeSound == null)
{
float[] localAi = this.localAI;
slotId = SoundEngine.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 = SoundEngine.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 = SoundEngine.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 = this.GetAttackDamage_ScaledByStrength(80f);
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;
SoundEngine.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.TileActionAttempt(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)
SoundEngine.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)
SoundEngine.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 Terraria.WorldBuilding.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)
SoundEngine.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 = 50;
num9 = 10f;
num10 = 50f;
num6 = 5;
num7 = 30;
center += new Vector2((float) (-this.spriteDirection * 20), 10f);
this.position = this.position + this.netOffset;
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;
}
this.position = this.position - this.netOffset;
}
if (flag3)
{
if ((double) this.localAI[1] == 0.0)
this.alpha = (int) byte.MaxValue;
if ((double) this.localAI[1] == 30.0)
SoundEngine.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;
this.EncourageDespawn(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 index = 0; index < 1000; ++index)
{
if (Main.projectile[index].active && Main.projectile[index].CanBeReflected() && this.CanReflectProjectile(Main.projectile[index]))
this.ReflectProjectile(Main.projectile[index]);
}
}
public bool CanReflectProjectile(Projectile proj)
{
bool flag = proj.Hitbox.Intersects(this.Hitbox);
if (this.type == 618)
this.BloodNautilus_GetMouthPositionAndRotation(out Vector2 _, out Vector2 _);
return flag;
}
public void BloodNautilus_GetMouthPositionAndRotation(
out Vector2 mouthPosition,
out Vector2 mouthDirection)
{
float f = this.rotation + 0.4712389f * (float) this.spriteDirection;
if (this.spriteDirection == -1)
f += 3.141593f;
mouthDirection = f.ToRotationVector2();
mouthPosition = this.Center + mouthDirection * 50f;
}
public void ReflectProjectile(Projectile proj)
{
SoundEngine.PlaySound(SoundID.Item150, proj.position);
for (int index1 = 0; index1 < 3; ++index1)
{
int index2 = Dust.NewDust(proj.position, proj.width, proj.height, 31);
Main.dust[index2].velocity *= 0.3f;
}
proj.hostile = true;
proj.friendly = false;
Vector2 vector2 = Main.player[proj.owner].Center - proj.Center;
vector2.Normalize();
vector2 *= proj.oldVelocity.Length();
proj.velocity = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
proj.velocity.Normalize();
Projectile projectile1 = proj;
projectile1.velocity = projectile1.velocity * vector2.Length();
Projectile projectile2 = proj;
projectile2.velocity = projectile2.velocity + vector2 * 20f;
proj.velocity.Normalize();
Projectile projectile3 = proj;
projectile3.velocity = projectile3.velocity * vector2.Length();
proj.damage /= 2;
proj.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()
{
if (this.type == 441 || this.type == 37 || this.type == 633)
return false;
if (this.ForcePartyHatOn)
return true;
return !this.IsABestiaryIconDummy && this.frame.Height > 0 && this.townNPC && BirthdayParty.PartyIsUp;
}
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;
int num3 = num2 % 5;
if (num3 == 0)
++num3;
return (PartyHatColor) num3;
}
public void SetFrameSize()
{
Main.instance.LoadNPC(this.type);
if (!this.setFrameSize)
return;
this.frame = new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Npc[this.type].Width(), TextureAssets.Npc[this.type].Height() / Main.npcFrameCount[this.type]);
this.setFrameSize = false;
}
public void FindFrame()
{
this.position = this.position + this.netOffset;
int num1 = 1;
if (!Main.dedServ)
{
if (!TextureAssets.Npc[this.type].IsLoaded)
return;
num1 = TextureAssets.Npc[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;
switch (this.type)
{
case 1:
case 16:
case 59:
case 71:
case 81:
case 138:
case 147:
case 183:
case 184:
case 204:
case 225:
case 302:
case 304:
case 333:
case 334:
case 335:
case 336:
case 535:
case 537:
case 658:
case 659:
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;
break;
}
break;
case 2:
case 23:
case 121:
case 169:
case 190:
case 191:
case 192:
case 193:
case 194:
case 317:
case 318:
case 660:
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;
}
if ((this.type == 121 || this.type == 660) && (double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
this.frame.Y = num1 * 2;
}
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 || this.type == 660)
{
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;
float num3 = 8f;
if (this.type == 660)
num3 = 6f;
if (this.frameCounter >= (double) num3)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
break;
}
break;
case 3:
case 52:
case 53:
case 132:
case 161:
case 186:
case 187:
case 188:
case 189:
case 200:
case 223:
case 251:
case 254:
case (int) byte.MaxValue:
case 319:
case 320:
case 321:
case 331:
case 332:
case 342:
case 536:
case 590:
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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < 16.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 24.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 32.0)
{
this.frame.Y = num1;
break;
}
this.frameCounter = 0.0;
break;
case 4:
case 125:
case 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)
{
this.frame.Y += num1 * 3;
break;
}
break;
case 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])
{
this.frame.Y = 0;
break;
}
break;
case 6:
case 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])
{
this.frame.Y = 0;
break;
}
break;
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 26:
case 27:
case 28:
case 31:
case 37:
case 38:
case 44:
case 54:
case 73:
case 77:
case 78:
case 79:
case 80:
case 104:
case 107:
case 108:
case 120:
case 124:
case 140:
case 142:
case 159:
case 160:
case 162:
case 167:
case 178:
case 181:
case 185:
case 196:
case 197:
case 198:
case 201:
case 202:
case 203:
case 207:
case 208:
case 209:
case 212:
case 213:
case 227:
case 228:
case 229:
case 287:
case 294:
case 295:
case 296:
case 310:
case 311:
case 312:
case 313:
case 314:
case 322:
case 323:
case 324:
case 326:
case 338:
case 339:
case 340:
case 353:
case 368:
case 369:
case 441:
case 453:
case 460:
case 462:
case 463:
case 489:
case 534:
case 550:
case 588:
case 630:
case 632:
case 633:
case 635:
case 637:
case 638:
case 656:
int num4 = this.isLikeATownNPC ? 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 num5 = Main.npcFrameCount[this.type] - NPCID.Sets.AttackFrameCount[this.type];
if ((double) this.ai[0] >= 20.0 && (double) this.ai[0] <= 22.0)
{
int num6 = this.frame.Y / num1;
switch (this.ai[0])
{
case 20f:
if (this.type == 656)
{
if ((double) this.ai[1] > 30.0 && (num6 < 7 || num6 > 9))
num6 = 7;
if (num6 > 0)
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
++num6;
if (num6 > 8 && (double) this.ai[1] > 30.0)
num6 = 8;
if (num6 > 9)
num6 = 0;
}
}
if (this.type == 637)
{
if ((double) this.ai[1] > 30.0 && (num6 < 10 || num6 > 16))
num6 = 10;
if (num6 > 0)
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
++num6;
if (num6 > 13 && (double) this.ai[1] > 30.0)
num6 = 13;
if (num6 > 16)
num6 = 0;
}
}
if (this.type == 638)
{
if ((double) this.ai[1] > 30.0 && (num6 < 23 || num6 > 27))
num6 = 23;
if (num6 > 0)
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
++num6;
if (num6 > 26 && (double) this.ai[1] > 30.0)
num6 = 24;
if (num6 > 27)
{
num6 = 0;
break;
}
break;
}
break;
}
break;
case 21f:
if (this.type == 656)
{
if ((double) this.ai[1] > 30.0 && (num6 < 10 || num6 > 16))
num6 = 10;
if (num6 > 0)
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
++num6;
if (num6 > 13 && (double) this.ai[1] > 30.0)
num6 = 13;
if (num6 > 16)
num6 = 0;
}
}
if (this.type == 637)
{
if ((double) this.ai[1] > 30.0 && (num6 < 17 || num6 > 21))
num6 = 17;
if (num6 > 0)
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
++num6;
if (num6 > 19 && (double) this.ai[1] > 30.0)
num6 = 19;
if (num6 > 21)
num6 = 0;
}
}
if (this.type == 638)
{
if ((double) this.ai[1] > 30.0 && (num6 < 17 || num6 > 22))
num6 = 17;
if (num6 > 0)
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
++num6;
if (num6 > 21 && (double) this.ai[1] > 30.0)
num6 = 18;
if (num6 > 22)
{
num6 = 0;
break;
}
break;
}
break;
}
break;
case 22f:
if (this.type == 656)
{
int num7 = Main.npcFrameCount[this.type];
if ((double) this.ai[1] > 40.0 && (num6 < 17 || num6 >= num7))
num6 = 17;
if (num6 > 0)
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
++num6;
if (num6 > 20 && (double) this.ai[1] > 40.0)
num6 = 19;
if (num6 >= num7)
num6 = 0;
}
}
if (this.type == 637)
{
if ((double) this.ai[1] > 30.0 && (num6 < 17 || num6 > 27))
num6 = 17;
if (num6 > 0)
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
++num6;
if (num6 > 27)
{
num6 = (double) this.ai[1] > 30.0 ? 22 : 20;
break;
}
if ((double) this.ai[1] <= 30.0 && num6 == 22)
{
num6 = 0;
break;
}
if ((double) this.ai[1] > 30.0 && num6 > 19 && num6 < 22)
{
num6 = 22;
break;
}
break;
}
break;
}
break;
}
this.frame.Y = num6 * num1;
break;
}
if ((double) this.ai[0] == 2.0)
{
++this.frameCounter;
if (this.frame.Y / num1 == num5 - 1 && this.frameCounter >= 5.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
break;
}
if (this.frame.Y / num1 == 0 && this.frameCounter >= 40.0)
{
this.frame.Y = num1 * (num5 - 1);
this.frameCounter = 0.0;
break;
}
if (this.frame.Y != 0 && this.frame.Y != num1 * (num5 - 1))
{
this.frame.Y = 0;
this.frameCounter = 0.0;
break;
}
break;
}
if ((double) this.ai[0] == 11.0)
{
++this.frameCounter;
if (this.frame.Y / num1 == num5 - 1 && this.frameCounter >= 50.0)
{
if (this.frameCounter == 50.0)
{
int num8 = Main.rand.Next(4);
for (int index1 = 0; index1 < 3 + num8; ++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 >= 100.0 && Main.rand.Next(20) == 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
break;
}
break;
}
if (this.frame.Y / num1 == 0 && this.frameCounter >= 20.0)
{
this.frame.Y = num1 * (num5 - 1);
this.frameCounter = 0.0;
if (Main.netMode != 1)
{
EmoteBubble.NewBubble(89, new WorldUIAnchor((Entity) this), 90);
break;
}
break;
}
if (this.frame.Y != 0 && this.frame.Y != num1 * (num5 - 1))
{
this.frame.Y = 0;
this.frameCounter = 0.0;
break;
}
break;
}
if ((double) this.ai[0] == 5.0)
{
this.frame.Y = num1 * (num5 - 3);
if (this.type == 637)
this.frame.Y = num1 * 19;
this.frameCounter = 0.0;
break;
}
if ((double) this.ai[0] == 6.0)
{
++this.frameCounter;
int num9 = this.frame.Y / num1;
switch (num5 - num9)
{
case 1:
case 2:
case 4:
case 5:
int num10 = 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 : num5 - 5) : num5 - 4) : num5 - 5) : 0) : num5 - 5) : num5 - 4) : num5 - 5) : 0) : num5 - 5) : num5 - 4) : num5 - 5) : 0) : num5 - 5) : num5 - 4) : num5 - 5) : 0) : num5 - 5) : num5 - 4) : num5 - 5) : 0) : num5 - 5) : num5 - 4) : num5 - 5) : 0;
if (num10 == num5 - 4 && num9 == num5 - 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 * num10;
if (this.frameCounter >= 300.0)
{
this.frameCounter = 0.0;
break;
}
break;
default:
if (num9 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
goto case 1;
}
else
goto case 1;
}
}
else if (((double) this.ai[0] == 7.0 || (double) this.ai[0] == 19.0) && !NPCID.Sets.IsTownPet[this.type])
{
++this.frameCounter;
int num11 = this.frame.Y / num1;
switch (num5 - num11)
{
case 1:
case 2:
case 4:
case 5:
int num12 = 0;
if (this.frameCounter < 16.0)
num12 = 0;
else if (this.frameCounter == 16.0 && Main.netMode != 1)
EmoteBubble.NewBubbleNPC(new WorldUIAnchor((Entity) this), 112);
else if (this.frameCounter < 128.0)
num12 = this.frameCounter % 16.0 < 8.0 ? num5 - 2 : 0;
else if (this.frameCounter < 160.0)
num12 = 0;
else if (this.frameCounter == 160.0 && Main.netMode != 1)
EmoteBubble.NewBubbleNPC(new WorldUIAnchor((Entity) this), 60);
else
num12 = this.frameCounter >= 220.0 ? 0 : (this.frameCounter % 12.0 < 6.0 ? num5 - 2 : 0);
this.frame.Y = num1 * num12;
if (this.frameCounter >= 220.0)
{
this.frameCounter = 0.0;
break;
}
break;
default:
if (num11 != 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 num13 = this.frame.Y / num1;
switch (num5 - num13)
{
case 1:
case 2:
case 4:
case 5:
int num14 = this.frameCounter >= 10.0 ? (this.frameCounter >= 16.0 ? num5 - 4 : num5 - 5) : 0;
if ((double) this.ai[1] < 16.0)
num14 = num5 - 5;
if ((double) this.ai[1] < 10.0)
num14 = 0;
this.frame.Y = num1 * num14;
break;
default:
if (num13 != 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 num15 = this.frame.Y / num1;
switch (num5 - num15)
{
case 1:
case 2:
case 4:
case 5:
int num16 = 0;
num16 = this.frameCounter >= 10.0 ? (this.frameCounter >= 16.0 ? num5 - 2 : num5 - 1) : 0;
if ((double) this.ai[1] < 16.0)
num16 = num5 - 1;
if ((double) this.ai[1] < 10.0)
num16 = 0;
int num17 = Main.npcFrameCount[this.type] - 2;
this.frame.Y = num1 * num17;
break;
default:
if (num15 != 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 num18 = this.frame.Y / num1;
if ((uint) (num18 - num5) > 3U && num18 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
int num19 = 10;
int num20 = 6;
if (this.type == 633)
{
num19 = 0;
num20 = 2;
}
int num21 = this.frameCounter >= (double) num19 ? (this.frameCounter >= (double) (num19 + num20) ? (this.frameCounter >= (double) (num19 + num20 * 2) ? (this.frameCounter >= (double) (num19 + num20 * 3) ? (this.frameCounter >= (double) (num19 + num20 * 4) ? 0 : num5 + 3) : num5 + 2) : num5 + 1) : num5) : 0;
this.frame.Y = num1 * num21;
break;
}
if ((double) this.ai[0] == 15.0)
{
++this.frameCounter;
int num22 = this.frame.Y / num1;
if ((uint) (num22 - num5) > 3U && num22 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
float num23 = this.ai[1] / (float) NPCID.Sets.AttackTime[this.type];
int num24 = (double) num23 <= 0.649999976158142 ? ((double) num23 <= 0.5 ? ((double) num23 <= 0.349999994039536 ? ((double) num23 <= 0.0 ? 0 : num5 + 3) : num5 + 2) : num5 + 1) : num5;
this.frame.Y = num1 * num24;
break;
}
if ((double) this.ai[0] == 12.0)
{
++this.frameCounter;
int num25 = this.frame.Y / num1;
if ((uint) (num25 - num5) > 4U && num25 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
int num26 = num5 + this.GetShootingFrame(this.ai[2]);
this.frame.Y = num1 * num26;
break;
}
if ((double) this.ai[0] == 14.0)
{
++this.frameCounter;
int num27 = this.frame.Y / num1;
if ((uint) (num27 - num5) > 1U && num27 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
int num28 = 12;
int num29 = this.frameCounter % (double) num28 * 2.0 < (double) num28 ? num5 : num5 + 1;
this.frame.Y = num1 * num29;
break;
}
if (this.CanTalk && ((double) this.ai[0] == 3.0 || (double) this.ai[0] == 4.0))
{
++this.frameCounter;
int num30 = this.frame.Y / num1;
switch (num5 - num30)
{
case 1:
case 2:
case 4:
case 5:
bool flag = (double) this.ai[0] == 3.0;
int num31 = 0;
int num32 = 0;
int time1 = -1;
int time2 = -1;
if (this.frameCounter < 10.0)
num31 = 0;
else if (this.frameCounter < 16.0)
num31 = num5 - 5;
else if (this.frameCounter < 46.0)
num31 = num5 - 4;
else if (this.frameCounter < 60.0)
num31 = num5 - 5;
else if (this.frameCounter < 216.0)
num31 = 0;
else if (this.frameCounter == 216.0 && Main.netMode != 1)
time1 = 70;
else if (this.frameCounter < 286.0)
num31 = this.frameCounter % 12.0 < 6.0 ? num5 - 2 : 0;
else if (this.frameCounter < 320.0)
num31 = 0;
else if (this.frameCounter == 320.0 && Main.netMode != 1)
time1 = 100;
else
num31 = this.frameCounter >= 420.0 ? 0 : (this.frameCounter % 16.0 < 8.0 ? num5 - 2 : 0);
if (this.frameCounter < 70.0)
num32 = 0;
else if (this.frameCounter == 70.0 && Main.netMode != 1)
time2 = 90;
else
num32 = 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 : num5 - 1) : 0) : num5 - 5) : num5 - 4) : num5 - 5) : (this.frameCounter % 16.0 < 8.0 ? num5 - 2 : 0);
if (flag)
{
NPC npc = Main.npc[(int) this.ai[2]];
if (time1 != -1)
EmoteBubble.NewBubbleNPC(new WorldUIAnchor((Entity) this), time1, new WorldUIAnchor((Entity) npc));
if (time2 != -1 && npc.CanTalk)
EmoteBubble.NewBubbleNPC(new WorldUIAnchor((Entity) npc), time2, new WorldUIAnchor((Entity) this));
}
this.frame.Y = num1 * (flag ? num31 : num32);
if (this.frameCounter >= 420.0)
{
this.frameCounter = 0.0;
break;
}
break;
default:
if (num30 != 0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
goto case 1;
}
else
goto case 1;
}
}
else if (this.CanTalk && ((double) this.ai[0] == 16.0 || (double) this.ai[0] == 17.0))
{
++this.frameCounter;
int num33 = this.frame.Y / num1;
switch (num5 - num33)
{
case 1:
case 2:
case 4:
case 5:
bool flag = (double) this.ai[0] == 16.0;
int num34 = 0;
int time = -1;
if (this.frameCounter < 10.0)
num34 = 0;
else if (this.frameCounter < 16.0)
num34 = num5 - 5;
else if (this.frameCounter < 22.0)
num34 = num5 - 4;
else if (this.frameCounter < 28.0)
num34 = num5 - 5;
else if (this.frameCounter < 34.0)
num34 = num5 - 4;
else if (this.frameCounter < 40.0)
num34 = num5 - 5;
else if (this.frameCounter == 40.0 && Main.netMode != 1)
time = 45;
else if (this.frameCounter < 70.0)
num34 = num5 - 4;
else if (this.frameCounter < 76.0)
num34 = num5 - 5;
else if (this.frameCounter < 82.0)
num34 = num5 - 4;
else if (this.frameCounter < 88.0)
num34 = num5 - 5;
else if (this.frameCounter < 94.0)
num34 = num5 - 4;
else if (this.frameCounter < 100.0)
num34 = num5 - 5;
else if (this.frameCounter == 100.0 && Main.netMode != 1)
time = 45;
else if (this.frameCounter < 130.0)
num34 = num5 - 4;
else if (this.frameCounter < 136.0)
num34 = num5 - 5;
else if (this.frameCounter < 142.0)
num34 = num5 - 4;
else if (this.frameCounter < 148.0)
num34 = num5 - 5;
else if (this.frameCounter < 154.0)
num34 = num5 - 4;
else if (this.frameCounter < 160.0)
num34 = num5 - 5;
else if (this.frameCounter == 160.0 && Main.netMode != 1)
time = 75;
else
num34 = this.frameCounter >= 220.0 ? (this.frameCounter >= 226.0 ? 0 : num5 - 5) : num5 - 4;
if (flag && time != -1)
{
int num35 = (int) this.localAI[2];
int num36 = (int) this.localAI[3];
int num37 = (int) Main.npc[(int) this.ai[2]].localAI[3];
int num38 = (int) Main.npc[(int) this.ai[2]].localAI[2];
int num39 = 3 - num35 - num36;
int num40 = 0;
if (this.frameCounter == 40.0)
num40 = 1;
if (this.frameCounter == 100.0)
num40 = 2;
if (this.frameCounter == 160.0)
num40 = 3;
int num41 = 3 - num40;
int num42 = -1;
int num43 = 0;
while (num42 < 0 && ++num43 < 100)
{
num42 = Main.rand.Next(2);
if (num42 == 0 && num38 >= num36)
num42 = -1;
if (num42 == 1 && num37 >= num35)
num42 = -1;
if (num42 == -1 && num41 <= num39)
num42 = 2;
}
if (num42 == 0)
{
++Main.npc[(int) this.ai[2]].localAI[3];
++num37;
}
if (num42 == 1)
{
++Main.npc[(int) this.ai[2]].localAI[2];
++num38;
}
int emoticon1 = Utils.SelectRandom<int>(Main.rand, 38, 37, 36);
int emoticon2 = emoticon1;
if (num42 == 0)
{
switch (emoticon1)
{
case 36:
emoticon2 = 38;
break;
case 37:
emoticon2 = 36;
break;
case 38:
emoticon2 = 37;
break;
}
}
else if (num42 == 1)
{
switch (emoticon1)
{
case 36:
emoticon2 = 37;
break;
case 37:
emoticon2 = 38;
break;
case 38:
emoticon2 = 36;
break;
}
}
if (num41 == 0)
{
if (num37 >= 2)
emoticon1 -= 3;
if (num38 >= 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 ? num34 : num34);
if (this.frameCounter >= 420.0)
{
this.frameCounter = 0.0;
break;
}
break;
default:
if (num33 != 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 == 638)
{
int num44 = this.frame.Y / num1;
if (num44 > 7)
num44 = 0;
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
++num44;
if (num44 > 7)
num44 = 0;
}
this.frame.Y = num44 * num1;
break;
}
if (this.type == 140 || this.type == 489)
{
this.frame.Y = num1;
this.frameCounter = 0.0;
break;
}
this.frame.Y = 0;
this.frameCounter = 0.0;
break;
}
int num45 = 6;
if (this.type == 632)
num45 = 12;
if (this.type == 534)
num45 = 12;
if (this.type == 638)
num45 = 12;
if (this.type == 656)
num45 = 12;
if (this.type == 489)
{
num45 = 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)
num45 = 9;
int num46 = num1 * 2;
if (this.type == 638)
num46 = num1 * 9;
if (this.type == 656)
num46 = num1;
if (this.frame.Y < num46)
this.frame.Y = num46;
if (this.frameCounter > (double) num45)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type] - num4)
{
this.frame.Y = num46;
break;
}
break;
}
}
}
else
{
if (this.type == 462)
{
this.frameCounter = 0.0;
this.frame.Y = (double) this.velocity.Y >= 0.0 ? num1 * 2 : num1;
break;
}
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 == 120 || this.type == 140 || this.type == 159 || this.type == 167 || this.type == 197 || this.type == 201 || this.type == 202)
this.frame.Y = 0;
if (this.type == 638)
{
this.frame.Y = num1 * 8;
break;
}
break;
}
break;
case 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;
break;
}
if (this.frameCounter <= 8.0)
{
this.frame.Y = num1 * 5;
break;
}
if (this.frameCounter <= 12.0)
{
this.frame.Y = num1 * 6;
break;
}
if (this.frameCounter <= 16.0)
{
this.frame.Y = num1 * 7;
break;
}
if (this.frameCounter <= 20.0)
{
this.frame.Y = num1 * 8;
break;
}
this.frame.Y = num1 * 9;
this.frameCounter = 100.0;
break;
}
++this.frameCounter;
if (this.frameCounter <= 4.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter <= 8.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter <= 12.0)
{
this.frame.Y = num1 * 2;
break;
}
this.frame.Y = num1 * 3;
if (this.frameCounter >= 16.0)
{
this.frameCounter = 0.0;
break;
}
break;
case 29:
case 32:
case 45:
case 172:
case 281:
case 282:
case 283:
case 284:
case 285:
case 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 * 2;
break;
}
if ((double) this.ai[1] > 0.0)
{
this.frame.Y += num1;
break;
}
break;
case 34:
++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;
break;
}
break;
case 42:
case 231:
case 232:
case 233:
case 234:
case 235:
++this.frameCounter;
if (this.frameCounter < 2.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < 4.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 6.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 8.0)
{
this.frame.Y = num1;
break;
}
this.frameCounter = 0.0;
break;
case 43:
case 56:
case 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;
break;
}
break;
case 46:
case 47:
case 303:
case 337:
case 443:
case 464:
case 540:
case 614:
case 646:
case 647:
case 648:
case 649:
case 650:
case 651:
case 652:
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;
break;
}
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 = 0;
break;
}
break;
}
if ((double) this.velocity.Y < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 4;
break;
}
if ((double) this.velocity.Y > 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 6;
break;
}
break;
case 48:
case 49:
case 51:
case 60:
case 82:
case 93:
case 137:
case 182:
case 210:
case 211:
case 253:
case 316:
case 634:
case 662:
if (this.type == 60)
{
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: 2f);
Main.dust[index].noGravity = true;
}
if (this.type == 634 && Main.rand.Next(10) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 165, this.velocity.X, this.velocity.Y, 50);
Main.dust[index].velocity *= 0.1f;
Main.dust[index].noGravity = true;
}
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;
int num47 = 6;
int num48 = Main.npcFrameCount[this.type];
if (this.type == 49 || this.type == 51 || this.type == 60 || this.type == 634)
--num48;
if (this.type == 48)
num47 = 5;
if (this.frameCounter >= (double) num47)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * num48)
{
this.frame.Y = 0;
break;
}
break;
case 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;
break;
}
break;
}
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;
break;
}
break;
}
break;
case 55:
case 57:
case 58:
case 102:
case 241:
case 465:
case 592:
case 607:
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.wet)
{
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < 12.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 18.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 24.0)
{
this.frame.Y = num1 * 3;
break;
}
this.frameCounter = 0.0;
break;
}
if (this.frameCounter < 6.0)
{
this.frame.Y = num1 * 4;
break;
}
if (this.frameCounter < 12.0)
{
this.frame.Y = num1 * 5;
break;
}
this.frameCounter = 0.0;
break;
case 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;
break;
}
int num49 = 5;
int num50 = 5;
++this.frameCounter;
if (this.frameCounter >= (double) (num49 * num50))
this.frameCounter = 0.0;
this.frame.Y = ((int) (this.frameCounter / (double) num49) + 1) * num1;
break;
case 62:
case 66:
this.spriteDirection = this.direction;
this.rotation = this.velocity.X * 0.1f;
int num51 = 5;
int num52 = 5;
++this.frameCounter;
if (this.frameCounter >= (double) (num51 * num52))
this.frameCounter = 0.0;
this.frame.Y = (int) (this.frameCounter / (double) num51) * num1;
break;
case 63:
case 64:
case 103:
case 242:
case 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;
break;
}
if (this.frameCounter < 12.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 18.0)
{
this.frame.Y = num1 * 2;
break;
}
this.frame.Y = num1 * 3;
if (this.frameCounter >= 23.0)
{
this.frameCounter = 0.0;
break;
}
break;
case 65:
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.wet && this.type == 65)
{
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < 12.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 18.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 24.0)
{
this.frame.Y = num1 * 3;
break;
}
this.frameCounter = 0.0;
break;
}
break;
case 67:
case 217:
case 218:
case 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;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * (Main.npcFrameCount[this.type] - 1);
break;
case 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;
break;
}
break;
}
break;
case 74:
case 297:
case 298:
case 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;
break;
}
int num53 = Main.npcFrameCount[this.type] - 1;
++this.frameCounter;
if (this.frameCounter >= 4.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num1 * num53)
{
this.frame.Y = 0;
break;
}
break;
case 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;
break;
}
break;
case 83:
case 84:
case 179:
if ((double) this.ai[0] == 2.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
++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;
break;
}
break;
}
break;
case 85:
case 341:
case 629:
if ((double) this.ai[0] == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
int num54 = 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) (num54 * 4))
this.frameCounter = (double) (num54 * 4);
if (this.frameCounter < (double) num54)
this.frame.Y = num1;
else if (this.frameCounter < (double) (num54 * 2))
this.frame.Y = num1 * 2;
else if (this.frameCounter < (double) (num54 * 3))
this.frame.Y = num1 * 3;
else if (this.frameCounter < (double) (num54 * 4))
this.frame.Y = num1 * 4;
else if (this.frameCounter < (double) (num54 * 5))
this.frame.Y = num1 * 5;
else if (this.frameCounter < (double) (num54 * 6))
this.frame.Y = num1 * 4;
else if (this.frameCounter < (double) (num54 * 7))
{
this.frame.Y = num1 * 3;
}
else
{
this.frame.Y = num1 * 2;
if (this.frameCounter >= (double) (num54 * 8))
this.frameCounter = (double) num54;
}
}
if ((double) this.ai[3] == 2.0 || this.IsABestiaryIconDummy && this.type == 85)
{
this.frame.Y += num1 * 6;
break;
}
if ((double) this.ai[3] == 3.0)
{
this.frame.Y += num1 * 12;
break;
}
break;
case 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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
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;
break;
}
break;
}
break;
}
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;
break;
}
break;
}
break;
case 94:
++this.frameCounter;
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < 12.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 18.0)
{
this.frame.Y = num1 * 2;
break;
}
this.frame.Y = num1;
if (this.frameCounter >= 23.0)
{
this.frameCounter = 0.0;
break;
}
break;
case 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;
break;
}
break;
case 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;
break;
}
break;
}
break;
case 110:
case 214:
case 215:
case 216:
case 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;
break;
}
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])
{
this.frame.Y = num1 * 6;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
case 111:
case 291:
case 292:
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;
break;
}
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])
{
this.frame.Y = num1 * 7;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * 6;
break;
case 113:
case 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;
break;
}
break;
}
this.frame.Y = 0;
this.frameCounter = -60.0;
break;
case 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;
break;
}
break;
case 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;
break;
}
break;
case 122:
this.spriteDirection = this.direction;
this.rotation = this.velocity.X * 0.05f;
if ((double) this.ai[3] > 0.0)
{
int num55 = (int) ((double) this.ai[3] / 8.0);
this.frameCounter = 0.0;
this.frame.Y = (num55 + 3) * num1;
break;
}
++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;
break;
}
break;
case (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;
break;
}
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * 2;
break;
case 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;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
break;
case 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;
break;
}
break;
case 135:
this.frame.Y = (double) this.ai[2] != 0.0 ? num1 : 0;
break;
case 141:
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0)
{
this.frame.Y = num1 * 2;
break;
}
++this.frameCounter;
if (this.frameCounter >= 8.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1)
{
this.frame.Y = 0;
break;
}
break;
case 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;
break;
}
break;
case 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;
break;
}
break;
}
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;
break;
}
break;
case 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;
break;
}
if ((double) this.ai[2] < 8.0)
{
this.frame.Y = num1;
break;
}
if ((double) this.ai[2] < 12.0)
{
this.frame.Y = num1 * 2;
break;
}
if ((double) this.ai[2] < 16.0)
{
this.frame.Y = num1 * 3;
break;
}
break;
}
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;
break;
}
break;
case 148:
case 149:
case 168:
case 470:
int num56 = 0;
if ((double) this.localAI[0] == 2.0)
num56 = 3;
if ((double) this.localAI[0] == 3.0)
num56 = 6;
if ((double) this.localAI[0] == 4.0)
num56 = 9;
int num57 = num56 * 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 = num57;
this.frameCounter = 0.0;
break;
}
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
if (this.frameCounter < 6.0)
{
this.frame.Y = num57;
break;
}
if (this.frameCounter < 12.0)
{
this.frame.Y = num1 + num57;
break;
}
if (this.frameCounter < 15.0)
{
this.frame.Y = num1 * 2 + num57;
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * 2 + num57;
break;
}
if ((double) this.velocity.Y < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 2 + num57;
break;
}
if ((double) this.velocity.Y > 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 2 + num57;
break;
}
break;
case 150:
case 151:
case 152:
case 158:
case 226:
if (this.type == 151)
{
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: 2f);
Main.dust[index].noGravity = true;
}
if (this.type == 150 && Main.rand.Next(10) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 90, Scale: 1.5f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.2f;
Main.dust[index].noLight = true;
}
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;
break;
}
break;
case 155:
int num58 = this.frame.Y / num1;
if (this.IsABestiaryIconDummy && num58 < 3)
num58 = 3;
if ((double) this.velocity.Y < 0.0)
num58 = 10;
else if ((double) this.velocity.Y > 0.0)
num58 = 11;
else if ((double) this.velocity.X == 0.0)
{
num58 = 0;
this.frameCounter = 0.0;
}
else if ((this.direction > 0 && (double) this.velocity.X < 0.0 || this.direction < 0 && (double) this.velocity.X > 0.0) && (double) Math.Abs(this.velocity.X) < 4.0)
{
this.spriteDirection = this.direction;
if (num58 > 2)
{
num58 = 0;
this.frameCounter = 0.0;
}
if (num58 < 2)
{
++this.frameCounter;
if (this.frameCounter > 5.0)
{
this.frameCounter = 0.0;
++num58;
}
}
else
this.frameCounter = 0.0;
}
else
{
this.spriteDirection = (double) this.velocity.X < 0.0 ? -1 : 1;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 0.400000005960464;
if (num58 == 10 || num58 == 11)
{
num58 = 12;
this.frameCounter = 0.0;
}
else if (this.frameCounter > 8.0)
{
this.frameCounter -= 8.0;
++num58;
if (num58 > 9)
num58 = 3;
}
}
this.frame.Y = num58 * num1;
break;
case 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;
break;
case 157:
this.spriteDirection = this.direction;
++this.frameCounter;
if (!this.wet)
++this.frameCounter;
int num59 = 5;
if (this.frameCounter < (double) num59)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < (double) (num59 * 2))
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < (double) (num59 * 3))
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < (double) (num59 * 4))
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < (double) (num59 * 5))
{
this.frame.Y = num1 * 3;
break;
}
if (this.frameCounter < (double) (num59 * 6))
{
this.frame.Y = num1 * 4;
break;
}
if (this.frameCounter < (double) (num59 * 7))
{
this.frame.Y = num1 * 5;
break;
}
if (this.frameCounter < (double) (num59 * 8))
{
this.frame.Y = num1 * 4;
break;
}
this.frameCounter = 0.0;
break;
case 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;
break;
}
this.spriteDirection = this.direction;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.10000002384186;
if (this.frameCounter < -6.0)
{
this.frame.Y = num1 * 6;
break;
}
if (this.frameCounter < 0.0)
{
this.frame.Y = num1 * 7;
break;
}
if (this.frameCounter < 6.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 12.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 18.0)
{
this.frame.Y = num1 * 3;
break;
}
this.frameCounter = 0.0;
break;
case 164:
case 239:
case 530:
if ((double) this.velocity.Y != 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = (double) this.velocity.Y >= 0.0 ? 0 : num1 * 4;
break;
}
this.spriteDirection = this.direction;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.10000002384186;
if (this.frameCounter < 6.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 12.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 18.0)
{
this.frame.Y = num1 * 3;
break;
}
this.frameCounter = 0.0;
break;
case 165:
case 237:
case 238:
case 240:
case 531:
float num60 = 0.5f;
if (this.type == 531)
num60 = 0.4f;
this.frameCounter += ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * (double) num60;
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < 12.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 18.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 24.0)
{
this.frame.Y = num1 * 3;
break;
}
this.frameCounter = 0.0;
break;
case 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)
{
this.frame.Y = 0;
break;
}
break;
}
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)
{
this.frame.Y = num1 * 7;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * 6;
break;
case 170:
case 171:
case 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;
break;
}
break;
case 174:
if (this.IsABestiaryIconDummy)
{
++this.frameCounter;
if (this.frameCounter > 5.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 4)
{
this.frame.Y = 0;
break;
}
break;
}
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;
break;
case 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;
break;
}
break;
case 177:
if ((double) this.velocity.Y == 0.0)
{
++this.frameCounter;
if (this.frameCounter >= 10.0)
{
this.frameCounter = 30.0;
this.frame.Y = 0;
break;
}
this.frame.Y = num1;
break;
}
if ((double) this.velocity.Y < 0.0)
{
this.frame.Y = num1 * 2;
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * 2;
break;
case 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;
break;
case 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)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
break;
}
break;
}
if ((double) this.velocity.Y == 0.0)
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter > 12.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y > num1 * 7)
{
this.frame.Y = num1 * 3;
break;
}
break;
}
break;
}
break;
case 205:
this.frameCounter += 0.5;
if (this.frameCounter < 2.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < 4.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 6.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 8.0)
{
this.frame.Y = num1;
break;
}
this.frameCounter = 0.0;
break;
case 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;
break;
}
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])
{
this.frame.Y = num1 * 6;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
case 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;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
++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;
break;
}
break;
case 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;
break;
}
break;
}
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;
break;
}
break;
case 224:
case 587:
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;
break;
}
break;
case 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;
break;
}
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])
{
this.frame.Y = 0;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = 0;
if ((double) this.velocity.Y > 4.0)
{
this.rotation -= this.velocity.Y * 0.01f;
break;
}
break;
case 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;
break;
}
break;
case 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;
break;
}
break;
}
if (this.frameCounter < -6.0)
{
if (this.frame.Y > num1 * 9)
{
this.frame.Y = num1 * 12;
break;
}
break;
}
if (this.frameCounter < 0.0)
{
this.frameCounter = 0.0;
if (this.frame.Y > num1 * 9)
{
this.frame.Y = num1 * 11;
break;
}
break;
}
break;
}
this.frameCounter = -18.0;
this.frame.Y = (double) this.velocity.Y >= 0.0 ? num1 * 13 : num1 * 14;
break;
}
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;
break;
}
break;
case 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;
break;
}
break;
case 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;
break;
}
if ((double) this.ai[0] == 1.0)
{
this.frame.Y = 1;
break;
}
break;
case 246:
if ((double) this.ai[0] == 0.0)
{
this.frame.Y = (double) this.localAI[0] != 1.0 ? 0 : num1;
break;
}
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;
break;
}
break;
}
break;
case 249:
this.frame.Y = (double) this.localAI[0] != 1.0 ? 0 : num1;
if (++this.frameCounter >= 16.0)
{
this.frameCounter = 0.0;
break;
}
break;
case 250:
case 264:
case 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;
break;
}
break;
case 252:
case 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;
break;
}
++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;
break;
}
break;
case 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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < 16.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 24.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 32.0)
{
this.frame.Y = num1 * 3;
break;
}
this.frameCounter = 0.0;
break;
case 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)
{
this.frame.Y = num1 * 3;
break;
}
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < 16.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 24.0)
{
this.frame.Y = num1 * 2;
break;
}
this.frameCounter = 0.0;
break;
case 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;
break;
}
break;
}
if (this.frame.Y < num1 * 4)
this.frame.Y = num1 * 4;
if (this.frame.Y > num1 * 7)
{
this.frame.Y = num1 * 4;
break;
}
break;
case 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;
break;
}
break;
}
break;
}
if (this.frame.Y < 2)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
if (this.frame.Y < num1 * 4)
this.frame.Y = num1 * 4;
if (this.frame.Y > num1 * 7)
{
this.frame.Y = num1 * 4;
break;
}
break;
case 269:
case 270:
case 271:
case 272:
case 273:
case 274:
case 275:
case 276:
case 277:
case 278:
case 279:
case 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;
break;
}
this.frame.Y = 0;
this.frameCounter = 0.0;
break;
}
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
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])
{
this.frame.Y = num1 * 2;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
case 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;
break;
}
break;
case 289:
++this.frameCounter;
if (this.frameCounter < 4.0)
this.frame.Y = 0;
else if (this.frameCounter < 8.0)
{
this.frame.Y = num1;
}
else
{
this.frame.Y = num1 * 2;
this.frameCounter = 0.0;
if (this.frameCounter > 12.0)
this.frameCounter = 0.0;
}
if ((double) this.ai[3] == 1.0)
{
this.frame.Y += num1 * 3;
break;
}
break;
case 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)
{
this.frame.Y = (double) this.ai[1] >= 10.0 ? ((double) this.ai[1] >= 20.0 ? num1 * 9 : num1 * 10) : num1 * 11;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
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)
{
this.frame.Y = num1 * 2;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 299:
case 538:
case 539:
case 639:
case 640:
case 641:
case 642:
case 643:
case 644:
case 645:
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;
break;
}
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)
{
this.frame.Y = num1;
break;
}
break;
}
if ((double) this.velocity.Y < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 2;
break;
}
if ((double) this.velocity.Y > 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 4;
break;
}
break;
case 300:
case 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)
{
this.frame.Y = 0;
break;
}
break;
}
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])
{
this.frame.Y = num1 * 2;
break;
}
break;
}
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])
{
this.frame.Y = num1 * 2;
break;
}
break;
case 305:
case 306:
case 307:
case 308:
case 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;
break;
case 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;
break;
}
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;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
++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;
break;
}
break;
case 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;
break;
}
break;
}
break;
case 329:
if ((double) this.velocity.Y > 0.0)
{
this.frame.Y = num1 * 3;
this.frameCounter = 0.0;
break;
}
if ((double) this.velocity.Y < 0.0)
{
this.frame.Y = num1 * 2;
this.frameCounter = 0.0;
break;
}
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;
break;
}
break;
}
break;
case 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;
break;
}
break;
case 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;
break;
}
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
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;
break;
}
break;
}
this.frame.Y = (double) this.velocity.Y >= 0.0 ? num1 : 0;
this.frameCounter = 0.0;
break;
case 344:
if ((double) this.velocity.X == 0.0)
{
++this.frameCounter;
if (this.frameCounter > 5.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 9)
{
this.frame.Y = 0;
break;
}
break;
}
this.frameCounter += (double) Math.Max(1f, Math.Abs(this.velocity.X) * 0.75f);
if (this.frameCounter > 5.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 9)
{
this.frame.Y = 0;
break;
}
break;
case 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;
break;
}
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;
break;
}
break;
}
if ((double) this.ai[0] == 2.0)
{
this.frame.Y = num1 * 5;
break;
}
break;
case 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;
break;
}
break;
}
if ((double) this.velocity.X == 0.0)
{
ref int local = ref this.frame.Y;
local = local;
this.frameCounter = 0.0;
break;
}
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;
break;
}
break;
case 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;
break;
}
break;
case 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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
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)
{
this.frame.Y = num1;
break;
}
break;
case 349:
++this.frameCounter;
if (this.frameCounter > 3.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y > num1 * 7)
{
this.frame.Y = 0;
break;
}
break;
case 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;
break;
}
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])
{
this.frame.Y = num1 * 7;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * 5;
break;
case 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;
break;
}
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
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])
{
this.frame.Y = num1 * 2;
break;
}
break;
}
this.frame.Y = (double) this.velocity.Y >= 0.0 ? num1 : num1;
this.frameCounter = 0.0;
break;
case 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;
break;
}
break;
case 355:
case 358:
case 654:
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;
break;
}
break;
case 356:
case 444:
case 653:
case 661:
int num61 = 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) num61)
this.frame.Y = 0;
else if (this.frameCounter < (double) (num61 * 2))
this.frame.Y = num1;
else if (this.frameCounter < (double) (num61 * 3))
{
this.frame.Y = num1 * 2;
}
else
{
this.frame.Y = num1;
if (this.frameCounter >= (double) (num61 * 4 - 1))
this.frameCounter = 0.0;
}
if (this.type != 444 && this.type != 653 && this.type != 661)
{
this.frame.Y += (int) ((double) (num1 * 3) * ((double) this.ai[2] - 1.0));
break;
}
break;
case 357:
case 448:
case 484:
case 606:
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 i1 = (int) this.Center.X / 16;
int j1 = (int) this.position.Y / 16;
Tile tileSafely1 = Framing.GetTileSafely(i1, j1);
if (tileSafely1 != null)
{
if (tileSafely1.slope() == (byte) 0)
{
int j2 = j1 + 1;
tileSafely1 = Framing.GetTileSafely(i1, j2);
}
if (tileSafely1.slope() == (byte) 1)
{
this.rotation = 0.785f;
this.localAI[0] = 0.0f;
break;
}
if (tileSafely1.slope() == (byte) 2)
{
this.rotation = -0.785f;
this.localAI[0] = 0.0f;
break;
}
break;
}
break;
case 359:
case 360:
case 655:
if ((double) this.velocity.Y > 1.0)
{
++this.frameCounter;
int num62 = 6;
if (this.frameCounter < (double) num62)
{
this.frame.Y = num1 * 4;
break;
}
this.frame.Y = num1 * 5;
if (this.frameCounter >= (double) (num62 * 2 - 1))
{
this.frameCounter = 0.0;
break;
}
break;
}
++this.frameCounter;
int num63 = 10;
if (this.frameCounter < (double) num63)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < (double) (num63 * 2))
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < (double) (num63 * 3))
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < (double) (num63 * 4))
{
this.frame.Y = num1 * 3;
break;
}
if (this.frameCounter < (double) (num63 * 5))
{
this.frame.Y = num1 * 2;
break;
}
this.frame.Y = num1;
if (this.frameCounter >= (double) (num63 * 6 - 1))
{
this.frameCounter = 0.0;
break;
}
break;
case 361:
case 445:
this.spriteDirection = this.direction;
if (this.wet)
{
this.frameCounter = 0.0;
this.frame.Y = (double) this.velocity.X > 0.25 || (double) this.velocity.X < -0.25 ? num1 * 10 : ((double) this.velocity.X > 0.150000005960464 || (double) this.velocity.X < -0.150000005960464 ? num1 * 11 : num1 * 12);
break;
}
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)
{
this.frame.Y = 0;
break;
}
break;
}
++this.frameCounter;
int num64 = 6;
if (this.frameCounter < (double) num64)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < (double) (num64 * 2))
{
this.frame.Y = num1 * 6;
break;
}
if (this.frameCounter < (double) (num64 * 3))
{
this.frame.Y = num1 * 8;
break;
}
this.frame.Y = num1 * 9;
if (this.frameCounter >= (double) (num64 * 4 - 1))
{
this.frameCounter = 0.0;
break;
}
break;
}
this.frame.Y = (double) this.velocity.Y <= 0.0 ? num1 * 8 : num1 * 9;
break;
case 362:
case 364:
case 608:
this.spriteDirection = this.direction;
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
++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;
break;
}
break;
case 363:
case 365:
case 609:
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;
break;
}
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;
break;
}
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;
break;
}
break;
case 366:
case 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;
break;
}
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 = 0;
break;
}
break;
case 370:
if ((double) this.ai[0] == 0.0 || (double) this.ai[0] == 5.0)
{
int num65 = 5;
if ((double) this.ai[0] == 5.0)
num65 = 4;
++this.frameCounter;
if (this.frameCounter > (double) num65)
{
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 num66 = 90;
if ((double) this.ai[2] < (double) (num66 - 30) || (double) this.ai[2] > (double) (num66 - 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) (num66 - 20) && (double) this.ai[2] < (double) (num66 - 15))
this.frame.Y = num1 * 7;
}
}
if ((double) this.ai[0] == 4.0 || (double) this.ai[0] == 9.0)
{
int num67 = 180;
if ((double) this.ai[2] < (double) (num67 - 60) || (double) this.ai[2] > (double) (num67 - 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;
break;
}
break;
}
this.frame.Y = num1 * 6;
if ((double) this.ai[2] > (double) (num67 - 50) && (double) this.ai[2] < (double) (num67 - 25))
{
this.frame.Y = num1 * 7;
break;
}
break;
}
break;
case 371:
case 372:
case 373:
this.frame.Y = num1;
break;
case 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;
break;
}
++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;
break;
}
break;
}
break;
}
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;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
break;
case 377:
case 446:
if (this.IsABestiaryIconDummy)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1)
this.frame.Y = 0;
}
else
this.frame.Y = (double) this.velocity.Y == 0.0 ? 0 : num1;
this.spriteDirection = this.direction;
break;
case 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;
break;
}
break;
}
break;
case 379:
case 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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
break;
}
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;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 381:
case 382:
case 383:
case 385:
case 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;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 386:
if ((double) this.ai[2] > 0.0)
{
int num68 = (int) this.ai[2] / 12;
this.frame.Y = num1 * (9 + num68 % 2);
break;
}
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;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 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;
break;
}
break;
}
break;
}
++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;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
break;
case 390:
if (this.IsABestiaryIconDummy)
{
this.frameCounter += (double) Math.Abs(this.velocity.X) * 0.5;
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
++this.localAI[3];
if ((double) this.localAI[3] >= (double) Main.npcFrameCount[391])
this.localAI[3] = 0.0f;
}
}
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);
break;
case 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;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
case 392:
float num69 = 20f;
float num70 = 240f;
bool flag1 = (double) this.ai[3] >= (double) num69 && (double) this.ai[3] < (double) num69 + (double) num70;
++this.frameCounter;
if (flag1)
++this.frameCounter;
if (this.frameCounter >= 12.0)
this.frameCounter = 0.0;
int num71 = (int) this.frameCounter % 12 / 3;
this.frame.Y = num1 * num71;
break;
case 393:
Vector2 rotationVector2 = this.ai[2].ToRotationVector2();
int num72 = (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 * num72;
float num73 = 280f;
float num74 = 140f;
if ((double) this.ai[3] >= (double) num73 && (double) this.ai[3] < (double) num73 + (double) num74 && (int) this.ai[3] % 6 <= 2)
{
this.frame.Y += num1 * 9;
break;
}
break;
case 394:
int num75 = (int) this.ai[3] - 300;
if (num75 >= 120)
{
int num76 = num75 - 120;
this.frame.Y = num76 < 160 ? (num76 < 20 ? num1 * (4 + num76 / 5) : num1 * (num76 / 4 % 4)) : num1 * (7 - (num76 - 160) / 5);
break;
}
this.frame.Y = num1 * 4;
break;
case 395:
float num77 = 20f;
float num78 = 240f;
bool flag2 = (double) this.ai[3] >= (double) num77 && (double) this.ai[3] < (double) num77 + (double) num78;
++this.frameCounter;
if (this.frameCounter >= 66.0)
this.frameCounter = 0.0;
if (flag2)
{
++this.frameCounter;
if (this.frameCounter >= 54.0 || this.frameCounter < 36.0)
this.frameCounter = 36.0;
}
int num79 = (int) this.frameCounter % 66 / 6;
this.frame.Y = num1 * num79;
break;
case 397:
int num80 = (int) this.frameCounter / 7;
this.frame.Y = num1 * num80;
break;
case 398:
if ((double) this.ai[0] <= 0.0)
{
this.frame.Y = 0;
break;
}
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 num81 = (int) this.frameCounter % 30 / 6;
this.frame.Y = num1 * num81;
break;
case 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;
break;
case 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 num82 = (int) this.frameCounter % 16 / 4;
this.frame.Y = num1 * num82;
break;
case 405:
case 406:
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;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
break;
case 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;
break;
}
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;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
break;
case 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;
break;
}
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;
break;
}
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
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;
break;
}
break;
}
this.frame.Y = num1;
this.frameCounter = 0.0;
break;
case 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 num83 = 0;
int num84 = 18;
int num85 = 4;
if (this.frameCounter > (double) (num84 - num85 * 2))
num83 = 8 + (int) this.frameCounter / 4 % 2;
if (this.frameCounter > (double) (num84 + num85 * 6))
{
num83 = 0;
this.frameCounter = 0.0;
}
this.frame.Y = num1 * num83;
break;
}
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;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 416:
if (this.IsABestiaryIconDummy)
{
++this.frameCounter;
if (this.frameCounter > 5.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y < num1 * 2 || this.frame.Y > num1 * 7)
{
this.frame.Y = num1 * 2;
break;
}
break;
}
if (Main.netMode != 2 && !Main.dedServ)
{
int index = (int) this.ai[0];
if (Main.npc[index].active && Main.npc[index].type == 415 && TextureAssets.Npc[415].IsLoaded)
{
this.frame.Y = Main.npc[index].frame.Y / (TextureAssets.Npc[415].Height() / Main.npcFrameCount[415]) * num1;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
if ((double) this.ai[0] == 1.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * (9 + (int) ((double) this.ai[1] / 6.0));
break;
}
if ((double) this.ai[0] == 5.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * (13 - (int) ((double) this.ai[1] / 6.0));
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * 14;
break;
case 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;
break;
}
break;
}
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;
break;
}
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;
break;
}
break;
}
break;
case 419:
if ((double) this.ai[2] < 0.0)
{
int num86 = 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) (num86 * 4 + 6))
this.frameCounter = 8.0;
this.frame.Y = this.frameCounter >= 6.0 ? num1 * (int) (4.0 + (this.frameCounter - 6.0) / (double) num86) : num1 * (int) (2.0 + this.frameCounter / 3.0);
break;
}
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;
break;
}
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;
break;
}
break;
}
this.frame.Y = num1;
this.frameCounter = 0.0;
break;
case 420:
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;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
break;
case 423:
if ((double) this.ai[2] == 1.0)
{
int num87 = 2;
if ((double) this.ai[1] >= 30.0 && (double) this.ai[1] < 45.0)
num87 = 3;
this.frame.Y = num87 * num1;
break;
}
if ((double) this.velocity.Y != 0.0)
{
this.frame.Y = num1;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
break;
}
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;
break;
}
break;
case 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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
break;
}
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;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 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;
break;
}
break;
}
if ((double) this.velocity.Y != 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
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;
break;
}
break;
case 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;
break;
}
++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;
break;
}
break;
}
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;
break;
}
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
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;
break;
}
break;
case 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;
break;
}
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
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;
break;
}
break;
case 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;
break;
}
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;
break;
}
break;
}
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;
break;
}
break;
}
break;
case 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;
break;
}
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
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;
break;
}
break;
}
this.frame.Y = num1;
this.frameCounter = 0.0;
break;
case 430:
case 431:
case 432:
case 433:
case 434:
case 435:
case 436:
case 591:
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;
break;
}
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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < 16.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 24.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 32.0)
{
this.frame.Y = num1;
break;
}
this.frameCounter = 0.0;
break;
case 437:
++this.frameCounter;
if (this.frameCounter >= 20.0)
this.frameCounter = 0.0;
int num88 = (int) this.frameCounter % 20 / 5;
this.frame.Y = num1 * num88;
break;
case 438:
++this.frameCounter;
if ((double) this.ai[1] == 1.0)
++this.frameCounter;
if (this.frameCounter >= 49.0)
this.frameCounter = 0.0;
int num89 = (int) this.frameCounter % 49 / 7;
if (num89 >= 4)
num89 = 6 - num89;
this.frame.Y = num1 * num89;
break;
case 439:
case 440:
int num90 = (int) this.localAI[2];
if (this.IsABestiaryIconDummy)
{
if (this.frameCounter > 5.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y < num1 * 4 || this.frame.Y > num1 * 6)
this.frame.Y = num1 * 4;
}
else
{
switch (num90)
{
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;
break;
case 449:
case 450:
case 451:
case 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 num91 = Main.npcFrameCount[this.type] - 5;
int num92 = 7;
int num93 = (double) this.ai[1] < 50.0 ? ((double) this.ai[1] < (double) (50 - num92) ? ((double) this.ai[1] < (double) (50 - num92 * 2) ? ((double) this.ai[1] < (double) (50 - num92 * 3) ? 0 : 4) : 3) : 2) : 1;
this.frame.Y = num1 * (num91 + num93);
this.frameCounter = 0.0;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
break;
}
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
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;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 454:
int num94 = (int) (this.frameCounter / 2.0);
this.frame.Y = num1 * num94;
break;
case 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 num95 = (float) Math.Atan2((double) this.velocity.Y * (double) this.direction, (double) this.velocity.X * (double) this.direction);
if ((double) Math.Abs(this.rotation - num95) >= 3.14)
{
if ((double) num95 < (double) this.rotation)
this.rotation -= 6.28f;
else
this.rotation += 6.28f;
}
this.rotation = (float) (((double) this.rotation * 4.0 + (double) num95) / 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;
break;
}
if (this.frame.Y / num1 < 16)
{
this.frame.Y = num1 * 19;
break;
}
break;
}
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;
break;
}
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
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)
{
this.frame.Y = num1 * 2;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 466:
if (!this.IsABestiaryIconDummy && (double) this.ai[2] <= 0.0)
{
if (this.direction == 1)
this.spriteDirection = 1;
if (this.direction == -1)
this.spriteDirection = -1;
this.frame.Y = (double) this.ai[2] != 0.0 ? ((double) this.ai[2] >= -8.0 ? num1 * 2 : num1) : 0;
break;
}
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;
break;
}
if (this.frame.Y / num1 < 4)
this.frame.Y = num1 * 4;
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)
{
this.frame.Y = num1 * 4;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * 3;
break;
case 467:
if ((double) this.ai[0] == 1.0 || this.IsABestiaryIconDummy)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
if (this.frame.Y < num1 * 6)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
break;
}
if (this.IsABestiaryIconDummy)
{
this.frame.Y = 0;
break;
}
break;
}
break;
}
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
if (this.frame.Y > num1 * 3)
this.frame.Y = num1 * 3;
if (this.frame.Y > 0)
{
this.frame.Y -= num1;
this.frameCounter = 0.0;
break;
}
break;
}
break;
case 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 num96 = 0;
if ((double) this.ai[1] < 22.0)
num96 = -15;
else if ((double) this.ai[1] < 28.0)
num96 = 3;
else if ((double) this.ai[1] < 34.0)
num96 = 2;
else if ((double) this.ai[1] < 40.0)
num96 = 1;
this.frame.Y = num1 * (15 + num96);
this.frameCounter = 0.0;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
break;
}
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;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 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)
{
this.frame.Y = num1 * 2;
break;
}
break;
}
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;
break;
}
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)
{
this.frame.Y = num1 * 6;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 471:
bool flag3 = false;
if ((double) this.ai[3] < 0.0)
flag3 = true;
if (flag3)
{
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;
break;
}
if (this.frameCounter < 12.0)
{
this.frame.Y = num1 * 18;
break;
}
if (this.frameCounter < 18.0)
{
this.frame.Y = num1 * 19;
break;
}
if (this.frameCounter < 23.0)
{
this.frame.Y = num1 * 18;
break;
}
this.frame.Y = num1 * 18;
this.frameCounter = 0.0;
break;
}
if ((double) this.ai[3] == 1.0)
{
this.frame.Y = num1 * 16;
this.frameCounter = 0.0;
break;
}
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;
break;
}
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)
{
this.frame.Y = num1 * 2;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 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;
break;
}
break;
case 473:
case 474:
case 475:
case 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;
break;
}
if ((double) this.ai[0] == 1.0)
{
this.rotation = 0.0f;
this.frameCounter = 0.0;
int num97 = 6;
this.frame.Y = (double) this.ai[1] >= (double) num97 ? ((double) this.ai[1] >= (double) (num97 * 2) ? ((double) this.ai[1] >= (double) (num97 * 3) ? ((double) this.ai[1] >= (double) (num97 * 4) ? ((double) this.ai[1] >= (double) (num97 * 5) ? num1 * 6 : num1 * 5) : num1 * 4) : num1 * 3) : num1 * 2) : num1;
break;
}
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 num98 = 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) (num98 * 2);
break;
}
break;
}
break;
}
if (this.frameCounter < (double) num98)
{
this.frame.Y = num1 * 12;
break;
}
if (this.frameCounter < (double) (num98 * 2))
{
this.frame.Y = num1 * 11;
break;
}
if (this.frameCounter < (double) (num98 * 3))
{
this.frame.Y = num1 * 10;
break;
}
this.frame.Y = num1 * 11;
if (this.frameCounter >= (double) (num98 * 4 - 1))
{
this.frameCounter = 0.0;
break;
}
break;
}
this.frame.Y = num1 * 13;
this.frameCounter = 0.0;
break;
}
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;
break;
}
break;
}
break;
}
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;
break;
}
if ((double) this.ai[0] == 4.09999990463257)
{
this.rotation = 0.0f;
if (this.frame.Y > num1 * 6)
this.frameCounter = 0.0;
++this.frameCounter;
int num99 = 4;
if (this.frameCounter < (double) num99)
{
this.frame.Y = num1 * 6;
break;
}
if (this.frameCounter < (double) (num99 * 2))
{
this.frame.Y = num1 * 5;
break;
}
if (this.frameCounter < (double) (num99 * 3))
{
this.frame.Y = num1 * 4;
break;
}
if (this.frameCounter < (double) (num99 * 4))
{
this.frame.Y = num1 * 3;
break;
}
if (this.frameCounter < (double) (num99 * 5))
{
this.frame.Y = num1 * 4;
break;
}
this.frame.Y = num1 * 5;
if (this.frameCounter >= (double) (num99 * 6 - 1))
{
this.frameCounter = 0.0;
break;
}
break;
}
break;
case 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;
break;
}
break;
case 479:
++this.frameCounter;
int num100 = 4;
if (this.frameCounter < (double) num100)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < (double) (num100 * 2))
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < (double) (num100 * 3))
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < (double) (num100 * 4 - 1))
{
this.frame.Y = num1;
break;
}
this.frameCounter = 0.0;
break;
case 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;
break;
}
if (this.frame.Y < num1 * 21)
{
this.frame.Y = num1 * 21;
break;
}
break;
}
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)
{
this.frame.Y = 0;
break;
}
break;
}
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;
break;
}
if (this.frame.Y / num1 < 10)
{
this.frame.Y = num1 * 10;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * 8;
break;
case 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 num101 = 0;
if ((double) this.ai[1] < 22.0)
num101 = -14;
else if ((double) this.ai[1] < 28.0)
num101 = 3;
else if ((double) this.ai[1] < 34.0)
num101 = 2;
else if ((double) this.ai[1] < 40.0)
num101 = 1;
this.frame.Y = num1 * (15 + num101);
this.frameCounter = 0.0;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = num1;
break;
}
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;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
case 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;
break;
}
if (this.frame.Y < num1 * 11)
{
this.frame.Y = num1 * 11;
break;
}
break;
}
if ((double) this.velocity.X == 0.0)
{
++this.frameCounter;
this.frame.Y = 0;
break;
}
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;
break;
}
if (this.frame.Y / num1 < 2)
{
this.frame.Y = num1 * 2;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 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;
break;
}
++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;
break;
case 485:
case 486:
case 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 i2 = (int) this.Center.X / 16;
int j3 = (int) this.position.Y / 16;
Tile tileSafely2 = Framing.GetTileSafely(i2, j3);
if (tileSafely2 != null)
{
if (tileSafely2.slope() == (byte) 0)
{
int j4 = j3 + 1;
tileSafely2 = Framing.GetTileSafely(i2, j4);
}
if (tileSafely2.slope() == (byte) 1)
{
this.rotation = 0.785f;
this.localAI[0] = 0.0f;
break;
}
if (tileSafely2.slope() == (byte) 2)
{
this.rotation = -0.785f;
this.localAI[0] = 0.0f;
break;
}
break;
}
break;
case 488:
int num102 = (int) this.localAI[1];
if (Framing.GetTileSafely((int) this.ai[0], (int) this.ai[1]).frameX >= (short) 36)
num102 *= -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 num103 = num102 == -1 ? 4 : 6;
int num104 = (int) this.localAI[0] / num103;
if ((double) this.localAI[0] % (double) num103 != 0.0)
++num104;
if (num104 != 0 && num102 == 1)
num104 += 5;
this.frame.Y = num104 * num1;
break;
case 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;
break;
}
break;
case 492:
this.frame.Y = num1 * (int) this.ai[2];
break;
case 494:
case 495:
if ((double) this.ai[2] > 0.0)
{
if ((double) this.ai[2] < 7.0)
{
this.frame.Y = num1 * 5;
break;
}
if ((double) this.ai[2] < 14.0)
{
this.frame.Y = num1 * 6;
break;
}
if ((double) this.ai[2] < 20.0)
{
this.frame.Y = num1 * 7;
break;
}
break;
}
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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
{
this.frame.Y = 0;
break;
}
if (this.frameCounter < 16.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 24.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 32.0)
{
this.frame.Y = num1 * 3;
break;
}
if (this.frameCounter < 39.0)
{
this.frame.Y = num1 * 4;
break;
}
this.frame.Y = num1 * 4;
this.frameCounter = 0.0;
break;
case 496:
case 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;
break;
}
if (this.frameCounter < 12.0)
{
this.frame.Y = num1;
break;
}
if (this.frameCounter < 18.0)
{
this.frame.Y = num1 * 2;
break;
}
if (this.frameCounter < 24.0)
{
this.frame.Y = num1 * 3;
break;
}
this.frameCounter = 0.0;
break;
}
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;
break;
}
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;
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * 7;
break;
case 498:
case 499:
case 500:
case 501:
case 502:
case 503:
case 504:
case 505:
case 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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
break;
}
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;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1 * 10;
break;
case 508:
case 532:
case 580:
case 582:
if ((double) this.velocity.Y != 0.0)
{
this.frame.Y = num1;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = 0;
break;
}
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;
break;
}
break;
case 509:
case 581:
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;
break;
}
break;
}
break;
case 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;
break;
}
break;
}
break;
case 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;
break;
}
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
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;
break;
}
break;
}
this.frame.Y = num1;
this.frameCounter = 0.0;
break;
case 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;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 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;
break;
}
break;
}
break;
case 523:
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;
break;
}
break;
}
break;
case 524:
case 525:
case 526:
case 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;
break;
}
if (this.frame.Y <= num1)
this.frame.Y = num1 * 2;
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;
break;
}
break;
}
this.frame.Y = num1;
this.frameCounter = 0.0;
break;
case 528:
case 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;
break;
}
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;
break;
}
break;
}
this.frame.Y = num1 * (Main.npcFrameCount[this.type] - 1);
this.frameCounter = 0.0;
break;
case 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;
break;
}
break;
case 541:
if ((double) this.ai[0] > 0.0)
{
float num105 = this.ai[0];
this.frame.Y = (double) num105 >= 6.0 ? ((double) num105 >= 105.0 ? ((double) num105 >= 114.0 ? ((double) num105 >= 135.0 ? num1 : num1 * (int) (((double) num105 - 99.0 - 15.0) / 7.0 + 10.0)) : num1 * 9) : num1 * (int) ((double) num105 / 8.0 % 4.0 + 5.0)) : num1 * 4;
break;
}
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;
break;
}
break;
case 542:
case 543:
case 544:
case 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);
break;
case 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;
break;
}
break;
}
break;
case 551:
int num106 = this.frame.Y / num1;
int num107;
if ((double) this.ai[0] == 4.0)
{
float num108 = 60f;
int num109 = 6 * 10;
if (num106 < 5)
this.frameCounter = 0.0;
num107 = 5;
this.frameCounter = (double) (int) this.ai[1];
int num110 = 0;
int num111;
if (this.frameCounter >= (double) (5 * (num111 = num110 + 1)))
num107 = 6;
num111 = 0;
if (this.frameCounter >= (double) num108 - 6.0)
num107 = 7;
if (this.frameCounter >= (double) num108 - 3.0)
num107 = 8;
if (this.frameCounter >= (double) num108)
num107 = 9 + (int) this.frameCounter / 3 % 2;
int num112 = 0;
if (this.frameCounter >= (double) num108 + (double) num109 + 3.0)
num107 = 8;
int num113;
if (this.frameCounter >= (double) num108 + (double) num109 + 3.0 + (double) (5 * (num113 = num112 + 1)))
num107 = 7;
if (this.frameCounter >= (double) num108 + (double) num109 + 3.0 + (double) (5 * (num111 = num113 + 1)))
num107 = 0;
}
else if ((double) this.ai[0] == 3.0)
{
float num114 = 40f;
float num115 = 80f;
float num116 = num114 + num115;
float num117 = 25f;
if (num106 < 5)
this.frameCounter = 0.0;
num107 = 5;
this.frameCounter = (double) (int) this.ai[1];
int num118 = 0;
int num119;
if (this.frameCounter >= (double) (5 * (num119 = num118 + 1)))
num107 = 6;
num119 = 0;
if (this.frameCounter >= (double) num114 - 6.0)
num107 = 7;
if (this.frameCounter >= (double) num114 - 3.0)
num107 = 8;
if (this.frameCounter >= (double) num114)
num107 = 9 + (int) this.frameCounter / 3 % 2;
int num120 = 0;
if (this.frameCounter >= (double) num116 - (double) num117 + 3.0)
num107 = 8;
int num121;
if (this.frameCounter >= (double) num116 - (double) num117 + 3.0 + (double) (5 * (num121 = num120 + 1)))
num107 = 7;
if (this.frameCounter >= (double) num116 - (double) num117 + 3.0 + (double) (5 * (num119 = num121 + 1)))
num107 = 0;
}
else if ((double) this.ai[0] == 5.0)
num107 = 3;
else if ((double) this.ai[0] == 6.0)
{
if (num106 > 4)
this.frameCounter = 0.0;
num107 = 1;
this.frameCounter = (double) (int) this.ai[1];
int num122 = 0;
int num123;
if (this.frameCounter >= (double) (8 * (num123 = num122 + 1)))
num107 = 2;
int num124;
if (this.frameCounter >= (double) (8 * (num124 = num123 + 1)))
num107 = 3;
int num125;
if (this.frameCounter >= (double) (8 * (num125 = num124 + 1)))
num107 = 4;
int num126;
if (this.frameCounter >= (double) (8 * (num126 = num125 + 1)))
num107 = 3;
int num127;
if (this.frameCounter >= (double) (8 * (num127 = num126 + 1)))
num107 = 4;
int num128;
if (this.frameCounter >= (double) (8 * (num128 = num127 + 1)))
num107 = 3;
int num129;
if (this.frameCounter >= (double) (8 * (num129 = num128 + 1)))
num107 = 2;
int num130;
if (this.frameCounter >= (double) (8 * (num130 = num129 + 1)))
num107 = 1;
int num131;
if (this.frameCounter >= (double) (8 * (num131 = num130 + 1)))
num107 = 0;
}
else
num107 = 0;
this.frame.Y = num1 * num107;
break;
case 552:
case 553:
case 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;
break;
}
break;
}
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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 9;
break;
}
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);
break;
case 555:
case 556:
case 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;
break;
}
break;
}
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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
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);
break;
case 558:
case 559:
case 560:
if ((double) this.velocity.X > 0.0)
this.spriteDirection = 1;
if ((double) this.velocity.X < 0.0)
this.spriteDirection = -1;
float num132 = this.velocity.ToRotation();
if ((double) this.velocity.X < 0.0)
num132 += 3.141593f;
if ((double) this.ai[0] != 2.0)
num132 = this.velocity.X * 0.1f;
this.rotation = num132;
if ((double) this.ai[0] == 2.0)
{
this.frame.Y = num1 * 4;
break;
}
if (++this.frameCounter >= 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
if (this.frame.Y >= num1 * 4)
{
this.frame.Y = 0;
break;
}
break;
}
break;
case 561:
case 562:
case 563:
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;
break;
}
break;
}
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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 9;
break;
}
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);
break;
case 564:
case 565:
int y = this.frame.Y;
this.frame.Width = 80;
this.frame.Height = 80;
int num133;
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;
num133 = 5;
++this.frameCounter;
int num134 = 0;
int num135;
if (this.frameCounter >= (double) (7 * (num135 = num134 + 1)))
num133 = 6;
int num136;
if (this.frameCounter >= (double) (7 * (num136 = num135 + 1)))
num133 = 7;
int num137;
if (this.frameCounter >= (double) (7 * (num137 = num136 + 1)))
num133 = 5;
int num138;
if (this.frameCounter >= (double) (7 * (num138 = num137 + 1)))
num133 = 6;
int num139;
if (this.frameCounter >= (double) (7 * (num139 = num138 + 1)))
num133 = 7;
int num140;
if (this.frameCounter >= (double) (7 * (num140 = num139 + 1)))
num133 = 5;
int num141;
if (this.frameCounter >= (double) (7 * (num141 = num140 + 1)))
num133 = 6;
int num142;
if (this.frameCounter >= (double) (7 * (num142 = num141 + 1)))
num133 = 7;
int num143;
if (this.frameCounter >= (double) (7 * (num143 = num142 + 1)))
num133 = 8;
int num144;
if (this.frameCounter >= (double) (7 * (num144 = num143 + 1)))
num133 = 9;
double frameCounter1 = this.frameCounter;
int num145 = num144 + 1;
int num146 = num145;
double num147 = (double) (7 * num145);
if (frameCounter1 >= num147)
num133 = 10;
double frameCounter2 = this.frameCounter;
int num148 = num146 + 1;
int num149 = num148;
double num150 = (double) (7 * num148);
if (frameCounter2 >= num150)
num133 = 11;
double frameCounter3 = this.frameCounter;
int num151 = num149 + 1;
int num152 = num151;
double num153 = (double) (7 * num151);
if (frameCounter3 >= num153)
num133 = 12;
if (this.frameCounter >= (double) (7 * (num152 + 1)))
{
num133 = 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;
num133 = 13;
++this.frameCounter;
int num154 = 0;
double frameCounter4 = this.frameCounter;
int num155 = num154 + 1;
int num156 = num155;
double num157 = (double) (8 * num155);
if (frameCounter4 >= num157)
num133 = 14;
double frameCounter5 = this.frameCounter;
int num158 = num156 + 1;
int num159 = num158;
double num160 = (double) (8 * num158);
if (frameCounter5 >= num160)
num133 = 15;
double frameCounter6 = this.frameCounter;
int num161 = num159 + 1;
int num162 = num161;
double num163 = (double) (8 * num161);
if (frameCounter6 >= num163)
num133 = 16;
double frameCounter7 = this.frameCounter;
int num164 = num162 + 1;
int num165 = num164;
double num166 = (double) (8 * num164);
if (frameCounter7 >= num166)
num133 = 17;
double frameCounter8 = this.frameCounter;
int num167 = num165 + 1;
int num168 = num167;
double num169 = (double) (8 * num167);
if (frameCounter8 >= num169)
num133 = 18;
double frameCounter9 = this.frameCounter;
int num170 = num168 + 1;
int num171 = num170;
double num172 = (double) (8 * num170);
if (frameCounter9 >= num172)
num133 = 19;
double frameCounter10 = this.frameCounter;
int num173 = num171 + 1;
int num174 = num173;
double num175 = (double) (8 * num173);
if (frameCounter10 >= num175)
num133 = 20;
double frameCounter11 = this.frameCounter;
int num176 = num174 + 1;
int num177 = num176;
double num178 = (double) (8 * num176);
if (frameCounter11 >= num178)
num133 = 18;
double frameCounter12 = this.frameCounter;
int num179 = num177 + 1;
int num180 = num179;
double num181 = (double) (8 * num179);
if (frameCounter12 >= num181)
num133 = 19;
double frameCounter13 = this.frameCounter;
int num182 = num180 + 1;
int num183 = num182;
double num184 = (double) (8 * num182);
if (frameCounter13 >= num184)
num133 = 20;
double frameCounter14 = this.frameCounter;
int num185 = num183 + 1;
int num186 = num185;
double num187 = (double) (8 * num185);
if (frameCounter14 >= num187)
num133 = 21;
double frameCounter15 = this.frameCounter;
int num188 = num186 + 1;
int num189 = num188;
double num190 = (double) (8 * num188);
if (frameCounter15 >= num190)
num133 = 22;
double frameCounter16 = this.frameCounter;
int num191 = num189 + 1;
int num192 = num191;
double num193 = (double) (8 * num191);
if (frameCounter16 >= num193)
num133 = 23;
double frameCounter17 = this.frameCounter;
int num194 = num192 + 1;
int num195 = num194;
double num196 = (double) (8 * num194);
if (frameCounter17 >= num196)
num133 = 24;
double frameCounter18 = this.frameCounter;
int num197 = num195 + 1;
int num198 = num197;
double num199 = (double) (8 * num197);
if (frameCounter18 >= num199)
num133 = 25;
if (this.frameCounter >= (double) (8 * (num198 + 1)))
{
num133 = 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;
num133 = 26;
++this.frameCounter;
int num200 = 0;
double frameCounter19 = this.frameCounter;
int num201 = num200 + 1;
int num202 = num201;
double num203 = (double) (8 * num201);
if (frameCounter19 >= num203)
num133 = 27;
double frameCounter20 = this.frameCounter;
int num204 = num202 + 1;
int num205 = num204;
double num206 = (double) (8 * num204);
if (frameCounter20 >= num206)
num133 = 28;
double frameCounter21 = this.frameCounter;
int num207 = num205 + 1;
int num208 = num207;
double num209 = (double) (8 * num207);
if (frameCounter21 >= num209)
num133 = 29;
double frameCounter22 = this.frameCounter;
int num210 = num208 + 1;
int num211 = num210;
double num212 = (double) (8 * num210);
if (frameCounter22 >= num212)
num133 = 26;
double frameCounter23 = this.frameCounter;
int num213 = num211 + 1;
int num214 = num213;
double num215 = (double) (8 * num213);
if (frameCounter23 >= num215)
num133 = 27;
double frameCounter24 = this.frameCounter;
int num216 = num214 + 1;
int num217 = num216;
double num218 = (double) (8 * num216);
if (frameCounter24 >= num218)
num133 = 28;
double frameCounter25 = this.frameCounter;
int num219 = num217 + 1;
int num220 = num219;
double num221 = (double) (8 * num219);
if (frameCounter25 >= num221)
num133 = 29;
double frameCounter26 = this.frameCounter;
int num222 = num220 + 1;
int num223 = num222;
double num224 = (double) (8 * num222);
if (frameCounter26 >= num224)
num133 = 26;
double frameCounter27 = this.frameCounter;
int num225 = num223 + 1;
int num226 = num225;
double num227 = (double) (8 * num225);
if (frameCounter27 >= num227)
num133 = 27;
double frameCounter28 = this.frameCounter;
int num228 = num226 + 1;
int num229 = num228;
double num230 = (double) (8 * num228);
if (frameCounter28 >= num230)
num133 = 28;
double frameCounter29 = this.frameCounter;
int num231 = num229 + 1;
int num232 = num231;
double num233 = (double) (8 * num231);
if (frameCounter29 >= num233)
num133 = 29;
double frameCounter30 = this.frameCounter;
int num234 = num232 + 1;
int num235 = num234;
double num236 = (double) (8 * num234);
if (frameCounter30 >= num236)
num133 = 30;
double frameCounter31 = this.frameCounter;
int num237 = num235 + 1;
int num238 = num237;
double num239 = (double) (8 * num237);
if (frameCounter31 >= num239)
num133 = 31;
double frameCounter32 = this.frameCounter;
int num240 = num238 + 1;
int num241 = num240;
double num242 = (double) (8 * num240);
if (frameCounter32 >= num242)
num133 = 32;
double frameCounter33 = this.frameCounter;
int num243 = num241 + 1;
int num244 = num243;
double num245 = (double) (8 * num243);
if (frameCounter33 >= num245)
num133 = 33;
double frameCounter34 = this.frameCounter;
int num246 = num244 + 1;
int num247 = num246;
double num248 = (double) (8 * num246);
if (frameCounter34 >= num248)
num133 = 34;
double frameCounter35 = this.frameCounter;
int num249 = num247 + 1;
int num250 = num249;
double num251 = (double) (8 * num249);
if (frameCounter35 >= num251)
num133 = 35;
double frameCounter36 = this.frameCounter;
int num252 = num250 + 1;
int num253 = num252;
double num254 = (double) (8 * num252);
if (frameCounter36 >= num254)
num133 = 36;
double frameCounter37 = this.frameCounter;
int num255 = num253 + 1;
int num256 = num255;
double num257 = (double) (8 * num255);
if (frameCounter37 >= num257)
num133 = 37;
double frameCounter38 = this.frameCounter;
int num258 = num256 + 1;
int num259 = num258;
double num260 = (double) (8 * num258);
if (frameCounter38 >= num260)
num133 = 38;
double frameCounter39 = this.frameCounter;
int num261 = num259 + 1;
int num262 = num261;
double num263 = (double) (8 * num261);
if (frameCounter39 >= num263)
num133 = 39;
double frameCounter40 = this.frameCounter;
int num264 = num262 + 1;
int num265 = num264;
double num266 = (double) (8 * num264);
if (frameCounter40 >= num266)
num133 = 40;
if (this.frameCounter >= (double) (8 * (num265 + 1)))
{
num133 = 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;
num133 = (int) (this.frameCounter / 8.0);
}
this.frame.Y = num133;
break;
case 566:
case 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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
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);
break;
case 568:
case 569:
if ((double) this.ai[0] > 0.0)
{
int num267 = this.frame.Y / num1;
this.spriteDirection = this.direction;
if (num267 < 5 || num267 > 16)
this.frameCounter = 0.0;
int num268 = 7;
++this.frameCounter;
int num269 = 0;
int num270;
if (this.frameCounter >= (double) (5 * (num270 = num269 + 1)))
num268 = 8;
int num271;
if (this.frameCounter >= (double) (5 * (num271 = num270 + 1)))
num268 = 9;
int num272;
if (this.frameCounter >= (double) (5 * (num272 = num271 + 1)))
num268 = 10;
int num273;
if (this.frameCounter >= (double) (5 * (num273 = num272 + 1)))
num268 = 7;
int num274;
if (this.frameCounter >= (double) (5 * (num274 = num273 + 1)))
num268 = 8;
int num275;
if (this.frameCounter >= (double) (5 * (num275 = num274 + 1)))
num268 = 9;
int num276;
if (this.frameCounter >= (double) (5 * (num276 = num275 + 1)))
num268 = 10;
int num277;
if (this.frameCounter >= (double) (5 * (num277 = num276 + 1)))
num268 = 7;
int num278;
if (this.frameCounter >= (double) (5 * (num278 = num277 + 1)))
num268 = 8;
int num279;
if (this.frameCounter >= (double) (5 * (num279 = num278 + 1)))
num268 = 9;
int num280;
if (this.frameCounter >= (double) (5 * (num280 = num279 + 1)))
num268 = 10;
int num281;
if (this.frameCounter >= (double) (5 * (num281 = num280 + 1)))
num268 = 7;
int num282;
if (this.frameCounter >= (double) (5 * (num282 = num281 + 1)))
num268 = 8;
int num283;
if (this.frameCounter >= (double) (5 * (num283 = num282 + 1)))
num268 = 9;
int num284;
if (this.frameCounter >= (double) (5 * (num284 = num283 + 1)))
num268 = 10;
int num285;
if (this.frameCounter >= (double) (5 * (num285 = num284 + 1)))
num268 = 7;
int num286;
if (this.frameCounter >= (double) (5 * (num286 = num285 + 1)))
num268 = 8;
int num287;
if (this.frameCounter >= (double) (5 * (num287 = num286 + 1)))
num268 = 9;
int num288;
if (this.frameCounter >= (double) (5 * (num288 = num287 + 1)))
num268 = 10;
int num289;
if (this.frameCounter >= (double) (5 * (num289 = num288 + 1)))
num268 = 7;
int num290;
if (this.frameCounter >= (double) (5 * (num290 = num289 + 1)))
num268 = 8;
int num291;
if (this.frameCounter >= (double) (5 * (num291 = num290 + 1)))
num268 = 9;
int num292;
if (this.frameCounter >= (double) (5 * (num292 = num291 + 1)))
num268 = 10;
int num293;
if (this.frameCounter >= (double) (5 * (num293 = num292 + 1)))
num268 = 11;
int num294;
if (this.frameCounter >= (double) (5 * (num294 = num293 + 1)))
num268 = 12;
int num295;
if (this.frameCounter >= (double) (5 * (num295 = num294 + 1)))
num268 = 13;
int num296;
if (this.frameCounter >= (double) (5 * (num296 = num295 + 1)))
num268 = 14;
if (this.frameCounter >= 270.0)
{
num268 = 14;
this.frameCounter -= 10.0;
}
this.frame.Y = num1 * num268;
break;
}
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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 6;
break;
}
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);
break;
case 570:
case 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 num297 = 5;
if (this.frame.Y == num1 * 14)
num297 = 35;
if (++this.frameCounter >= (double) num297 && this.frame.Y < num1 * 15)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
break;
}
break;
}
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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 9;
break;
}
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);
break;
case 572:
case 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);
break;
}
break;
}
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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 8;
break;
}
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);
break;
}
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;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
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);
break;
case 574:
case 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 num298 = 4;
if (this.frame.Y >= num1 * 5)
num298 = 8;
Vector2 Position = this.Center + new Vector2((float) (56 * this.spriteDirection), -30f).RotatedBy((double) this.rotation);
if (++this.frameCounter >= (double) num298 && 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;
}
}
break;
}
break;
}
if (++this.frameCounter >= 6.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
if (this.frame.Y >= num1 * 2)
{
this.frame.Y = 0;
break;
}
break;
}
break;
case 576:
case 577:
int num299 = 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 (num299 < 11 || num299 > 20)
{
num299 = 11;
this.frameCounter = 0.0;
}
int num300 = 4;
if (num299 == 13 || num299 == 19)
num300 = 8;
if (num299 == 14 || num299 == 18)
num300 = 2;
if (++this.frameCounter >= (double) num300 && num299 < 20)
{
this.frameCounter = 0.0;
++num299;
}
}
else if ((double) this.ai[0] > 0.0 && (double) this.ai[1] == 2.0)
{
this.spriteDirection = this.direction;
if (num299 < 37 || num299 > 47)
{
num299 = 39;
this.frameCounter = 0.0;
}
int num301 = 5;
if (num299 == 42)
num301 = 6;
if (num299 == 45)
num301 = 8;
if (num299 == 46)
num301 = 4;
if (num299 == 47)
num301 = 26;
if (num299 == 37 || num299 == 38)
num301 = 7;
bool flag4 = true;
if (num299 == 46 && (double) this.velocity.Y != 0.0)
flag4 = false;
if (num299 == 38)
flag4 = false;
if (flag4)
++this.frameCounter;
if (this.frameCounter >= (double) num301)
{
if (num299 < 47)
{
this.frameCounter = 0.0;
++num299;
}
else
{
num299 = 37;
this.frameCounter = 0.0;
}
}
}
else if ((double) this.ai[0] > 0.0 && (double) this.ai[1] == 1.0)
{
this.spriteDirection = this.direction;
if (num299 < 21 || num299 > 38)
{
num299 = 21;
this.frameCounter = 0.0;
}
if (++this.frameCounter >= 5.0 && num299 < 38)
{
this.frameCounter = 0.0;
++num299;
}
}
else
{
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.Y != 0.0)
{
this.frameCounter = 0.0;
num299 = 43;
}
else if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
num299 = 0;
}
else
{
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter >= 60.0 || this.frameCounter < 0.0)
this.frameCounter = 0.0;
num299 = 1 + (int) (this.frameCounter / 6.0);
}
}
this.frame.Y = num299;
break;
case 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;
break;
}
break;
}
break;
case 583:
case 584:
case 585:
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;
break;
}
break;
}
break;
case 586:
if (this.wet)
{
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());
++this.frameCounter;
if (this.frameCounter > 60.0)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 > 1)
{
this.frame.Y = 0;
break;
}
if (this.frame.Y / num1 < 0)
{
this.frame.Y = 0;
break;
}
break;
}
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.X == 0.0)
{
this.frame.Y = num1;
this.frameCounter = 0.0;
break;
}
int num302 = 8;
this.frameCounter += (double) Math.Abs(this.velocity.X) * 1.0;
this.frameCounter += 0.5;
if (this.frameCounter > (double) num302)
{
this.frame.Y += num1;
this.frameCounter = 0.0;
}
if (this.frame.Y / num1 >= Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
break;
}
break;
case 589:
int num303 = this.frame.Y / num1;
++this.frameCounter;
if ((double) this.velocity.Y != 0.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
if (num303 >= 12)
{
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;
break;
}
break;
}
break;
}
if (num303 >= 11)
{
if (this.frameCounter > (double) Main.rand.Next(40, 140))
{
this.frameCounter = 0.0;
this.frame.Y += num1;
break;
}
break;
}
if (num303 >= 8)
{
if (this.frameCounter > 3.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y == num1 * 9)
{
Vector2 position = this.position;
position.Y += (float) (this.height - 6);
if (this.direction == 1)
position.X += 30f;
else
position.X -= 22f;
for (int index = 0; index < 4; ++index)
Dust.NewDust(position, 1, 1, 32);
break;
}
break;
}
break;
}
if (num303 >= 7)
{
if (this.frameCounter > (double) Main.rand.Next(30, 90))
{
this.frameCounter = 0.0;
this.frame.Y += num1;
break;
}
break;
}
if (num303 >= 4)
{
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
break;
}
break;
}
if (num303 >= 1)
{
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y >= num1 * 4 && Main.rand.Next(3) != 0)
{
this.frame.Y = 0;
break;
}
break;
}
break;
}
if (this.frameCounter > (double) Main.rand.Next(90, 450))
{
this.frameCounter = 0.0;
this.frame.Y += num1;
break;
}
break;
case 593:
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;
break;
}
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])
{
this.frame.Y = 0;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = 0;
if ((double) this.velocity.Y > 4.0)
{
this.rotation -= this.velocity.Y * 0.01f;
break;
}
break;
case 594:
this.spriteDirection = 1;
this.frame.Y = (int) this.ai[2];
this.frame.Width = 32;
break;
case 595:
case 596:
case 597:
case 598:
case 599:
case 600:
case 601:
this.spriteDirection = this.direction;
int num304 = 3;
if (++this.frameCounter >= (double) (Main.npcFrameCount[this.type] * num304))
this.frameCounter = 0.0;
this.frame.Y = num1 * ((int) this.frameCounter / num304);
break;
case 602:
this.spriteDirection = this.direction;
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
++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;
break;
}
break;
case 603:
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;
break;
}
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;
break;
}
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;
break;
}
break;
case 604:
case 605:
this.spriteDirection = this.direction;
int num305 = 2;
if (++this.frameCounter >= (double) (4 * num305))
this.frameCounter = 0.0;
this.frame.Y = (double) this.velocity.Y != 0.0 ? num1 * (4 + (int) this.frameCounter / num305) : num1 * ((int) this.frameCounter / num305);
break;
case 610:
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)
{
this.frame.Y = 0;
break;
}
break;
}
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])
{
this.frame.Y = num1 * 2;
break;
}
break;
}
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])
{
this.frame.Y = num1 * 2;
break;
}
break;
case 611:
this.spriteDirection = -this.direction;
this.rotation = this.velocity.X * 0.1f;
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
{
switch (this.frame.Y / num1)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
if ((int) this.frameCounter % 40 != 0 || Main.rand.Next(80) == 0)
++this.frameCounter;
if ((this.frameCounter + 1.0) % 40.0 == 39.0)
this.frameCounter = (double) (40 * Main.rand.Next(3));
int num306 = (int) this.frameCounter % 40 / 10;
int num307 = (int) this.frameCounter / 40;
int num308 = 0;
switch (num307)
{
case 0:
if (num306 == 3)
num306 = 1;
num308 = num306;
break;
case 1:
if (num306 == 3)
num306 = 1;
num308 = 0;
if (num306 != 0)
{
num308 = 2 + num306;
break;
}
break;
case 2:
num308 = 0;
if (num306 != 0)
{
num308 = 4 + num306;
break;
}
break;
}
this.frame.Y = num1 * num308;
break;
default:
this.frame.Y = 0;
goto case 0;
}
}
else
{
++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 < num1 * 8)
{
this.frame.Y = num1 * 8;
break;
}
break;
}
break;
case 612:
case 613:
if (this.IsABestiaryIconDummy)
{
++this.frameCounter;
if (this.frameCounter > 50.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
this.frame.Y = (int) Utils.WrappedLerp(0.0f, 4f, (float) this.frameCounter / 50f) * num1;
break;
}
bool flag5 = true;
if (this.frame.Y == 0 && Main.rand.Next(180) != 0)
flag5 = false;
if (flag5)
++this.frameCounter;
if ((double) this.velocity.X != 0.0)
this.spriteDirection = Math.Sign(this.velocity.X);
int num309 = 10;
bool flag6 = (double) Math.Abs(this.velocity.X) > 1.0;
if ((double) this.ai[1] == 1.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 4;
}
if ((double) Math.Abs(this.velocity.Y) > 0.100000001490116 | flag6)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 4;
}
else if (this.frame.Y == 0)
num309 = 2;
if (this.frame.Y == num1 * 4)
{
num309 = 60;
if (!flag6)
num309 = 2;
}
if (this.frameCounter >= (double) num309)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y / num1 >= 5)
{
this.frame.Y = 0;
break;
}
break;
}
break;
case 615:
this.spriteDirection = this.direction;
if (!this.wet && (double) this.ai[2] == 1.0)
{
this.frame.Y = 4 * num1;
break;
}
if (!this.wet)
++this.frameCounter;
if (++this.frameCounter >= (double) (7 * (Main.npcFrameCount[this.type] - 1)))
this.frameCounter = 0.0;
this.frame.Y = (int) (this.frameCounter / 7.0) * num1;
break;
case 616:
case 617:
int num310 = 8;
int num311 = 5;
if ((double) this.velocity.X == 0.0)
num311 = 10;
this.spriteDirection = this.direction;
if (this.wet)
{
++this.frameCounter;
if (this.frameCounter > (double) num311)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y > num1 * 13)
{
this.frame.Y = num1 * 8;
break;
}
break;
}
break;
}
++this.frameCounter;
if (this.frameCounter > (double) num310)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y > num1 * 7)
this.frame.Y = 0;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
if ((double) this.velocity.Y != 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = num1 * 8;
break;
}
break;
case 618:
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;
break;
}
break;
}
break;
case 619:
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;
break;
}
break;
}
break;
case 620:
if ((double) this.ai[1] > 0.0 && (double) this.ai[0] > 0.0)
{
this.spriteDirection = this.direction;
if (this.frame.Y < num1 * 14 || this.frame.Y > num1 * 20 || (double) this.ai[1] == 59.0)
{
this.frame.Y = num1 * 14;
this.frameCounter = 0.0;
}
int num312 = 5;
if (this.frame.Y == num1 * 17 || this.frame.Y == num1 * 16)
num312 = 3;
if (++this.frameCounter >= (double) num312 && this.frame.Y < num1 * 20)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if ((double) this.ai[1] > 0.0 && this.frame.Y == num1 * 18)
{
this.frame.Y = num1 * 16;
break;
}
break;
}
break;
}
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 num313 = (float) Math.Atan2((double) this.velocity.Y * (double) this.direction, (double) this.velocity.X * (double) this.direction);
if ((double) Math.Abs(this.rotation - num313) >= 3.14159274101257)
{
if ((double) num313 < (double) this.rotation)
this.rotation -= 6.283185f;
else
this.rotation += 6.283185f;
}
this.rotation = (float) (((double) this.rotation * 4.0 + (double) num313) / 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 > 13)
{
this.frame.Y = num1 * 8;
break;
}
if (this.frame.Y / num1 < 8)
{
this.frame.Y = num1 * 13;
break;
}
break;
}
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;
break;
}
if (this.frame.Y < num1 * 2)
this.frame.Y = num1 * 2;
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 > 7)
{
this.frame.Y = num1 * 2;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = num1;
break;
case 624:
if ((double) this.velocity.Y == 0.0)
this.spriteDirection = this.direction;
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
if ((double) this.velocity.Y < 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 9 * num1;
break;
}
if ((double) this.velocity.Y > 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 10 * num1;
break;
}
this.frameCounter += (double) Math.Abs(this.velocity.X);
if (this.frameCounter > 8.0)
{
int num314 = this.frame.Y / num1;
this.frameCounter -= 8.0;
int num315 = num314 + 1;
if (num315 > 8)
num315 = 1;
this.frame.Y = num315 * num1;
break;
}
break;
case 625:
int num316 = 7;
int num317 = 4;
if ((double) this.velocity.X == 0.0)
num317 = 8;
this.spriteDirection = this.direction;
if (this.wet)
{
if (this.frame.Y < num1 * 6)
this.frame.Y = num1 * 6;
++this.frameCounter;
if (this.frameCounter > (double) num317)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y > num1 * 11)
{
this.frame.Y = num1 * 6;
break;
}
break;
}
break;
}
if (this.frame.Y > num1 * 5)
this.frame.Y = 0;
++this.frameCounter;
if (this.frameCounter > (double) num316)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
if (this.frame.Y > num1 * 5)
this.frame.Y = 0;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
break;
case 626:
case 627:
if ((double) this.velocity.X != 0.0)
this.spriteDirection = (double) this.velocity.X < 0.0 ? -1 : 1;
if (this.IsABestiaryIconDummy)
{
++this.frameCounter;
if (this.frameCounter > 5.0)
{
this.frameCounter = 0.0;
this.frame.Y += num1;
}
if (this.frame.Y > num1 * 5)
{
this.frame.Y = 0;
break;
}
break;
}
this.frame.Y = this.wet ? ((double) this.velocity.Length() <= 0.150000005960464 ? ((double) this.velocity.Length() <= 0.0500000007450581 ? ((double) this.velocity.Length() <= 0.025000000372529 ? 0 : num1) : num1 * 2) : num1 * 3) : 0;
break;
case 628:
this.spriteDirection = (double) Main.WindForVisuals > 0.0 ? -1 : 1;
if (this.IsABestiaryIconDummy)
{
int num318 = this.frame.Y / num1;
int num319 = 5;
this.spriteDirection = 1;
++this.frameCounter;
if (this.frameCounter > (double) num319)
{
this.frameCounter -= (double) num319;
int num320 = num318 + 1;
if (num320 > 5)
num320 = 0;
this.frame.Y = num320 * num1;
break;
}
break;
}
if ((double) this.ai[0] == 0.0)
{
int num321 = this.frame.Y / num1;
int num322 = 8;
if (num321 == 6)
{
this.frameCounter += 1.0 + 0.5 * (double) Math.Abs(Main.WindForVisuals);
if (this.frameCounter > (double) num322)
{
this.frameCounter -= (double) num322;
this.frame.Y = 0 * num1;
break;
}
break;
}
if (num321 > 5)
{
int num323 = 6;
this.frameCounter = 0.0;
this.frame.Y = num323 * num1;
break;
}
this.frameCounter += 1.0 + 0.5 * (double) Math.Abs(Main.WindForVisuals);
if (this.frameCounter > (double) num322)
{
this.frameCounter -= (double) num322;
int num324 = num321 + 1;
if (num324 > 5)
num324 = 0;
this.frame.Y = num324 * num1;
break;
}
break;
}
if ((double) this.localAI[0] == 0.0)
{
++this.frameCounter;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
int num325 = this.frame.Y / num1;
int num326;
if (num325 == 6)
num326 = 7;
else if (num325 < 7)
{
num326 = 6;
}
else
{
num326 = num325 + 1;
if (num326 > 10)
num326 = 7;
}
this.frame.Y = num326 * num1;
break;
}
break;
}
if ((double) this.localAI[0] == 1.0)
{
int num327 = this.frame.Y / num1;
int num328 = (int) MathHelper.Lerp(7f, 20f, (float) this.frameCounter / 80f);
if (num328 > 19)
num328 = 19;
if (num328 > 16)
num328 -= 9;
++this.frameCounter;
if (this.frameCounter > 80.0)
this.frameCounter = 0.0;
this.frame.Y = num328 * num1;
break;
}
break;
case 631:
int num329 = 8;
if ((double) this.velocity.Y == 0.0)
{
this.spriteDirection = this.direction;
if ((double) this.ai[2] != 0.0 && (double) this.ai[2] < 100.0)
{
float amount = (this.ai[2] - 76f) / 24f;
Player player = Main.player[this.target];
bool flag7 = player != null && ((double) player.Center.X < (double) this.Center.X ? this.direction == -1 : this.direction == 1);
bool flag8 = player != null && player.Hitbox.Intersects(this.Hitbox);
this.frame.Y = !(player != null & flag7) || flag8 || !Collision.CanHit((Entity) player, (Entity) this) ? (!(flag7 & flag8) ? 0 : (int) MathHelper.Lerp(10f, 15f, amount) * num1) : (int) MathHelper.Lerp(15f, (float) Main.npcFrameCount[this.type], amount) * num1;
break;
}
if ((double) this.velocity.X == 0.0)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
}
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 >= num329 * num1)
{
this.frame.Y = num1;
break;
}
if (this.frame.Y / num1 < 1)
{
this.frame.Y = num1;
break;
}
break;
}
this.frameCounter = 0.0;
this.frame.Y = 0;
break;
case 636:
this.frame.Y = this.AI_120_HallowBoss_IsInPhase2() ? num1 : 0;
break;
case 657:
bool flag9 = this.life <= this.lifeMax / 2;
this.frame.Width = 180;
int num330 = this.frame.Y / num1;
if (flag9 && this.noGravity || (double) this.velocity.Y < 0.0)
{
if (num330 < 20 || num330 > 23)
{
if (num330 < 4 || num330 > 7)
{
num330 = 4;
this.frameCounter = -1.0;
}
if (++this.frameCounter >= 4.0)
{
this.frameCounter = 0.0;
++num330;
if (num330 >= 7)
num330 = !flag9 ? 7 : 22;
}
}
else if (++this.frameCounter >= 5.0)
{
this.frameCounter = 0.0;
++num330;
if (num330 >= 24)
num330 = 20;
}
this.frame.Y = num330 * num1;
break;
}
if ((double) this.velocity.Y > 0.0)
{
if (num330 < 8 || num330 > 10)
{
num330 = 8;
this.frameCounter = -1.0;
}
if (++this.frameCounter >= 8.0)
{
this.frameCounter = 0.0;
++num330;
if (num330 >= 10)
num330 = 10;
}
this.frame.Y = num330 * num1;
break;
}
if ((double) this.velocity.Y == 0.0)
{
if ((double) this.ai[0] == 5.0)
{
this.frameCounter = 0.0;
switch ((int) this.ai[1] / 3 % 3)
{
case 1:
num330 = 14;
break;
case 2:
num330 = 15;
break;
default:
num330 = 13;
break;
}
}
else if ((double) this.ai[0] == 4.0)
{
this.frameCounter = 0.0;
switch ((int) this.ai[1] / 15)
{
case 1:
num330 = 11;
break;
case 2:
case 3:
num330 = 10;
break;
default:
num330 = 12;
break;
}
}
else
{
bool flag10 = num330 >= 10 && num330 <= 12;
int num331 = 10;
if (flag10)
num331 = 6;
if (!flag10 && num330 >= 4)
{
num330 = 0;
this.frameCounter = -1.0;
}
if (++this.frameCounter >= (double) num331)
{
this.frameCounter = 0.0;
++num330;
if ((!flag10 || num330 == 13) && num330 >= 4)
num330 = 0;
}
}
this.frame.Y = num330 * num1;
break;
}
break;
}
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;
}
}
this.position = this.position - this.netOffset;
}
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 index = 0; index < 40; ++index)
Main.chest[chest1].item[index] = new Item();
Chest.DestroyChest(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].ClearTile();
}
}
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)
{
int aggro = Main.player[this.target].aggro;
int num6 = (Main.player[this.target].height + Main.player[this.target].width + this.height + this.width) / 4;
if (Main.player[this.target].itemAnimation != 0 || Main.player[this.target].aggro >= 0 || 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 bool DoesntDespawnToInactivity()
{
switch (this.type)
{
case 8:
case 9:
case 11:
case 12:
case 14:
case 15:
case 36:
case 40:
case 41:
case 88:
case 89:
case 90:
case 91:
case 92:
case 96:
case 97:
case 99:
case 100:
case 113:
case 114:
case 115:
case 118:
case 119:
case 128:
case 129:
case 130:
case 131:
case 134:
case 135:
case 136:
case 246:
case 247:
case 248:
case 249:
case 263:
case 267:
case 328:
case 379:
case 380:
case 392:
case 393:
case 394:
case 396:
case 397:
case 398:
case 400:
case 422:
case 437:
case 438:
case 439:
case 440:
case 488:
case 492:
case 493:
case 507:
case 517:
case 548:
case 549:
case 551:
case 564:
case 565:
return true;
case 139:
if (NPC.npcsFoundForCheckActive[134])
return true;
break;
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 true;
break;
}
return false;
}
public void CheckActive()
{
if (!this.active || this.DoesntDespawnToInactivity())
return;
if (this.townNPC)
{
this.AddIntoPlayersTownNPCSlots();
}
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 plr = 0; plr < (int) byte.MaxValue; ++plr)
{
if (Main.player[plr].active)
{
Microsoft.Xna.Framework.Rectangle hitbox = Main.player[plr].Hitbox;
if (rectangle1.Intersects(hitbox))
{
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[plr].nearbyActiveNPCs += this.npcSlots * Main.slimeRainNPCSlots;
else
Main.player[plr].nearbyActiveNPCs += this.npcSlots;
}
}
if (rectangle2.Intersects(hitbox))
{
this.timeLeft = NPC.activeTime;
this.despawnEncouraged = false;
if (plr == Main.myPlayer && (this.type == 604 || this.type == 605))
this.LadyBugLuck(plr, this.type == 605);
}
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;
case 583:
case 584:
case 585:
if (!Main.dayTime && (double) this.ai[2] == 0.0)
{
flag = true;
this.timeLeft = NPC.activeTime;
continue;
}
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.extraValue > 0)
NPC.RevengeManager.CacheEnemy(this);
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);
}
}
}
}
}
private void AddIntoPlayersTownNPCSlots()
{
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(Main.player[index].Hitbox))
Main.player[index].townNPCs += this.npcSlots;
}
}
public void checkDead()
{
if (!this.active || this.realLife >= 0 && this.realLife != this.whoAmI || this.life > 0)
return;
if (this.type == 604 || this.type == 605)
NPC.LadyBugKilled(this.Center, this.type == 605);
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)
{
if (Main.netMode != 2)
this.NPCLuck();
bool flag = true;
NetworkText fullNetName = this.GetFullNetName();
int index1 = 19;
if (this.type == 369 || NPCID.Sets.IsTownPet[this.type])
{
index1 = 36;
flag = false;
}
NetworkText networkText = NetworkText.FromKey(Lang.misc[index1].Key, (object) fullNetName);
if (flag)
{
for (int index2 = 0; index2 < (int) byte.MaxValue; ++index2)
{
Player player = Main.player[index2];
if (player != null && player.active && player.difficulty != (byte) 2)
{
flag = false;
break;
}
}
}
if (flag)
this.DropTombstoneTownNPC(networkText);
switch (Main.netMode)
{
case 0:
Main.NewText(networkText.ToString(), G: (byte) 25, B: (byte) 25);
break;
case 2:
ChatHelper.BroadcastChatMessage(networkText, 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.prioritizedTownNPCType == this.type)
WorldGen.prioritizedTownNPCType = 0;
if (this.DeathSound != null)
SoundEngine.PlaySound(this.DeathSound, this.position);
if (this.type == 13 || this.type == 14 || this.type == 15)
this.DropEoWLoot();
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 npcInvasionGroup = NPC.GetNPCInvasionGroup(this.type);
if (npcInvasionGroup <= 0 || npcInvasionGroup != Main.invasionType)
return;
int num = 1;
switch (this.type)
{
case 216:
num = 5;
break;
case 387:
num = 0;
break;
case 395:
num = 10;
break;
case 471:
num = 10;
break;
case 472:
num = 0;
break;
case 491:
num = 10;
break;
}
if (num <= 0)
return;
Main.invasionSize -= num;
if (Main.invasionSize < 0)
Main.invasionSize = 0;
if (Main.netMode != 1)
Main.ReportInvasionProgress(Main.invasionSizeStart - Main.invasionSize, Main.invasionSizeStart, npcInvasionGroup + 3, 0);
if (Main.netMode != 2)
return;
NetMessage.SendData(78, number: Main.invasionProgress, number2: ((float) Main.invasionProgressMax), number3: ((float) Main.invasionProgressIcon));
}
}
public void DropTombstoneTownNPC(NetworkText deathText)
{
if (Main.netMode == 1)
return;
float num1 = 0.1f;
if (Main.rand.Next(2) == 0)
num1 = -0.1f;
float num2 = (float) Main.rand.Next(-35, 36) * 0.1f;
while ((double) num2 < 2.0 && (double) num2 > -2.0)
num2 += (float) Main.rand.Next(-30, 31) * 0.1f;
int num3 = Main.rand.Next(6);
int Type = this.type == 17 || this.type == 441 ? Main.rand.Next(5) + 527 : (num3 != 0 ? num3 + 200 : 43);
int index = Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), (float) Main.rand.Next(10, 30) * num1 + num2, (float) Main.rand.Next(-40, -20) * 0.1f, Type, 0, 0.0f, Main.myPlayer);
Main.projectile[index].miscText = deathText.ToString();
}
public static int GetNPCInvasionGroup(int npcID)
{
int num = 0;
if (npcID <= 216)
{
if (npcID <= 111)
{
if ((uint) (npcID - 26) > 3U && npcID != 111)
goto label_18;
}
else if ((uint) (npcID - 143) > 2U)
{
if ((uint) (npcID - 212) <= 4U)
goto label_13;
else
goto label_18;
}
else
{
num = 2;
goto label_18;
}
}
else if (npcID <= 395)
{
switch (npcID - 305)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 20:
case 21:
case 22:
case 24:
case 25:
num = -2;
goto label_18;
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 23:
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
case 32:
goto label_18;
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
case 39:
case 40:
case 41:
case 42:
case 43:
case 44:
case 45:
num = -1;
goto label_18;
default:
switch (npcID - 381)
{
case 0:
case 1:
case 2:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 14:
num = 4;
goto label_18;
default:
goto label_18;
}
}
}
else if ((uint) (npcID - 471) > 1U)
{
if (npcID != 491)
{
if ((uint) (npcID - 547) <= 31U)
{
num = -3;
goto label_18;
}
else
goto label_18;
}
else
goto label_13;
}
num = 1;
goto label_18;
label_13:
num = 3;
label_18:
return num;
}
private void DropEoWLoot(bool fromCheckDead = true)
{
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();
}
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:
ChatHelper.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:
ChatHelper.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 < 663; ++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 static void SetEventFlagCleared(ref bool eventFlag, int gameEventId)
{
bool flag = eventFlag;
eventFlag = true;
if (eventFlag == flag)
return;
NPC.OnGameEventClearedForTheFirstTime(gameEventId);
}
public static void OnGameEventClearedForTheFirstTime(int gameEventId)
{
switch (gameEventId)
{
case 4:
break;
case 21:
case 22:
break;
default:
LanternNight.NextNightIsLanternNight = true;
break;
}
}
public void NPCLootOld()
{
if (Main.netMode == 1 || this.type >= 663)
return;
bool flag1 = false;
bool flag2 = NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3;
Player closestPlayer = Main.player[(int) Player.FindClosest(this.position, this.width, this.height)];
if (!flag1)
{
this.CountKillForAchievements();
if (this.GetWereThereAnyInteractions())
this.CountKillForBannersAndDropThem();
}
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;
this.NPCLoot_DropFood(closestPlayer);
if (this.type == 86)
{
int range = Main.expertMode ? 30 : 40;
if (closestPlayer.RollLuck(range) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3260);
}
if (Main.slimeRain && Main.slimeRainNPC[this.type] && !flag1 && !NPC.AnyNPCs(50))
{
int num = 150;
if (NPC.downedSlimeKing)
num /= 2;
++Main.slimeRainKillCount;
if (Main.slimeRainKillCount >= num)
{
NPC.SpawnOnPlayer(closestPlayer.whoAmI, 50);
Main.slimeRainKillCount = -num / 2;
}
}
if (!closestPlayer.ZoneDungeon && !flag1)
{
bool flag3 = false;
if (Main.expertMode && closestPlayer.RollLuck(5) == 0)
flag3 = true;
else if (closestPlayer.RollLuck(5) == 0)
flag3 = true;
if (this.boss)
flag3 = false;
switch (this.type)
{
case 1:
case 13:
case 14:
case 15:
case 535:
flag3 = false;
break;
}
if (((!Main.hardMode || this.lifeMax <= 1 || this.damage <= 0 || this.friendly ? 0 : ((double) this.position.Y > Main.rockLayer * 16.0 ? 1 : 0)) & (flag3 ? 1 : 0)) != 0 && this.type != 121 && (double) this.value > 0.0)
{
if (closestPlayer.ZoneCorrupt || closestPlayer.ZoneCrimson)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 521);
if (closestPlayer.ZoneHallow)
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 < 5045)
{
int forSlimeItemDrop = NPC.GetStackForSlimeItemDrop(Type);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, forSlimeItemDrop);
}
}
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 == 178 && this.GivenOrTypeName == "Whitney")
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4372);
if (this.type == 353 && closestPlayer.RollLuck(8) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3352);
if (this.type == 441 && closestPlayer.RollLuck(8) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3351);
if (this.type == 227 && closestPlayer.RollLuck(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3350);
if (this.type == 550 && closestPlayer.RollLuck(6) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3821);
if (this.type == 208 && closestPlayer.RollLuck(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 && closestPlayer.RollLuck(8) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3349);
if (Main.hardMode && !flag1 && (double) this.value > 0.0)
{
if (!NPC.downedMechBoss1 && closestPlayer.RollLuck(2500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 556);
else if (!NPC.downedMechBoss2 && closestPlayer.RollLuck(2500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 544);
else if (!NPC.downedMechBoss3 && closestPlayer.RollLuck(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 && !flag1)
{
if (closestPlayer.RollLuck(2000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1825);
else if (closestPlayer.RollLuck(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 && !flag1)
{
if (closestPlayer.RollLuck(2500) == 0 && closestPlayer.ZoneJungle)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1533);
if (closestPlayer.RollLuck(2500) == 0 && closestPlayer.ZoneCorrupt)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1534);
if (closestPlayer.RollLuck(2500) == 0 && closestPlayer.ZoneCrimson)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1535);
if (closestPlayer.RollLuck(2500) == 0 && closestPlayer.ZoneHallow)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1536);
if (closestPlayer.RollLuck(2500) == 0 && closestPlayer.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 range = (int) ((double) (30 - waveNumber) / 2.5);
if (Main.expertMode)
range -= 2;
if (range < 1)
range = 1;
if (this.type == 344)
NPC.SetEventFlagCleared(ref NPC.downedChristmasTree, 21);
if (this.type == 345)
NPC.SetEventFlagCleared(ref NPC.downedChristmasIceQueen, 20);
if (this.type == 346)
NPC.SetEventFlagCleared(ref NPC.downedChristmasSantank, 22);
if ((this.type == 344 || this.type == 345 || this.type == 346) && closestPlayer.RollLuck(range) == 0 && waveNumber >= 15)
{
int maxValue = 4;
if (waveNumber == 16)
maxValue = 4;
if (waveNumber == 17)
maxValue = 3;
if (waveNumber == 18)
maxValue = 3;
if (waveNumber == 19)
maxValue = 2;
if (waveNumber >= 20)
maxValue = 2;
if (Main.expertMode && Main.rand.Next(3) == 0)
--maxValue;
if (Main.rand.Next(maxValue) == 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 (closestPlayer.RollLuck(range) == 0)
{
if (this.type == 344)
{
int num = Main.rand.Next(3);
if (closestPlayer.RollLuck(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 && closestPlayer.RollLuck(30) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1914);
else if (closestPlayer.RollLuck(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 index = 0; index < num; ++index)
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 && closestPlayer.RollLuck(5) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (this.type >= 338 && this.type <= 340 && closestPlayer.RollLuck(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.SetEventFlagCleared(ref NPC.downedHalloweenTree, 4);
if (this.type == 327)
NPC.SetEventFlagCleared(ref NPC.downedHalloweenKing, 5);
int waveNumber = NPC.waveNumber;
if (Main.expertMode)
waveNumber += 6;
int maxValue = (int) ((double) (17 - waveNumber) / 1.25);
if (Main.expertMode)
--maxValue;
if (maxValue < 1)
maxValue = 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(maxValue) == 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 (Main.expertMode && Main.rand.Next(5) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4444);
}
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 && closestPlayer.RollLuck(80) == 0 && !flag1)
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 && closestPlayer.RollLuck(13) == 0 && !flag1)
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.UnderworldLayer && !flag1 && closestPlayer.RollLuck(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 index = 0; index < num; ++index)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
}
if (this.type == 156 && closestPlayer.RollLuck(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1518);
if (this.type == 243 && closestPlayer.RollLuck(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1519);
if (this.type >= 269 && this.type <= 280 && closestPlayer.RollLuck(450) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1517);
if ((this.type == 158 || this.type == 159) && closestPlayer.RollLuck(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1520);
if (this.type == 48 && closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1516);
if (this.type == 176 && closestPlayer.RollLuck(150) == 0 && NPC.downedMechBossAny)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1521);
if (this.type == 205 && closestPlayer.RollLuck(2) == 0 && NPC.downedMechBossAny)
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 && closestPlayer.RollLuck(100) == 0 && this.HasPlayerTarget && this.lifeMax > 5 && !this.friendly && !flag1 && closestPlayer.RollLuck(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 && closestPlayer.RollLuck(300) == 0 && this.HasPlayerTarget && this.lifeMax > 5 && !this.friendly && (double) this.value > 0.0 && !flag1)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3289, pfix: -1);
else if (Main.hardMode && closestPlayer.RollLuck(200) == 0 && this.HasPlayerTarget && this.lifeMax > 5 && !this.friendly && (double) this.value > 0.0 && !flag1)
{
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)) / 3.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 index = 0; index < num1; ++index)
{
if (this.type == 461 && closestPlayer.RollLuck(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) && closestPlayer.RollLuck(35) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 900, pfix: -1);
if (this.type == 251 && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(20) == 0 && NPC.downedPlantBoss)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2770, pfix: -1);
++index;
}
if (closestPlayer.RollLuck(4) == 0)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1570, pfix: -1);
++index;
}
else if (closestPlayer.RollLuck(3) == 0 && NPC.downedPlantBoss)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3292, pfix: -1);
++index;
}
}
if (this.type == 253 && closestPlayer.RollLuck(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 && closestPlayer.RollLuck(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3098, pfix: -1);
if (this.type == 468 && closestPlayer.RollLuck(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3105, pfix: -1);
if (this.type == 466 && closestPlayer.RollLuck(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3106, pfix: -1);
if (this.type == 467 && closestPlayer.RollLuck(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3249, pfix: -1);
if (this.type == 463 && closestPlayer.RollLuck(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 && closestPlayer.RollLuck(1000) == 0 && (double) this.value > 0.0 && !flag1)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1314, pfix: -1);
if (this.type == 77 && closestPlayer.RollLuck(150) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 723, pfix: -1);
if (this.type == 47 && closestPlayer.RollLuck(25) == 0 && Main.IsItAHappyWindyDay)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4670, pfix: -1);
if (this.type == 464 && closestPlayer.RollLuck(25) == 0 && Main.IsItAHappyWindyDay)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4671, pfix: -1);
if (closestPlayer.RollLuck(100) == 0 || Main.expertMode && closestPlayer.RollLuck(100) == 0)
{
int Type1 = -1;
int Type2 = -1;
switch (this.type)
{
case 34:
case 83:
case 84:
case 179:
case 289:
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 (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(100) == 0)
{
Type2 = Type1 != 888 ? 888 : 890;
break;
}
break;
case 80:
case 93:
case 109:
Type1 = 893;
break;
case 81:
case 183:
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 index = 0; index < num2; ++index)
{
if (this.type == 290)
{
if (closestPlayer.RollLuck(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1513, pfix: -1);
else if (closestPlayer.RollLuck(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 938, pfix: -1);
}
if (this.type == 287 && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(12) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1300, pfix: -1);
else if (closestPlayer.RollLuck(12) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1254, pfix: -1);
}
if (this.type == 292)
{
if (closestPlayer.RollLuck(12) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1514, pfix: -1);
else if (closestPlayer.RollLuck(12) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 679, pfix: -1);
}
if (this.type == 293 && closestPlayer.RollLuck(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) && closestPlayer.RollLuck(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) && closestPlayer.RollLuck(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) && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(400) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1183, pfix: -1);
else if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1266, pfix: -1);
else if (closestPlayer.RollLuck(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 && !flag1)
{
int range = 13;
if (Main.expertMode)
range = 9;
if (closestPlayer.RollLuck(range) == 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 && closestPlayer.RollLuck(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 || closestPlayer.RollLuck(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 (closestPlayer.RollLuck(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2110, pfix: -1);
if (closestPlayer.RollLuck(4) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1294, pfix: -1);
switch (Main.rand.Next(7))
{
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, 1295, pfix: -1);
break;
case 5:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1296, pfix: -1);
break;
case 6:
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.SetEventFlagCleared(ref NPC.downedGolemBoss, 6);
}
if (this.type == 471 && (Main.expertMode || closestPlayer.RollLuck(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.SetEventFlagCleared(ref NPC.downedFishron, 7);
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
if (closestPlayer.RollLuck(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2588, pfix: -1);
if (closestPlayer.RollLuck(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 == 614)
Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 281, 175, 0.0f, Main.myPlayer, -2f, (float) ((int) this.releaseOwner + 1));
if (this.type == 109 && !NPC.downedClown)
{
NPC.downedClown = true;
if (Main.netMode == 2)
NetMessage.SendData(7);
}
if (this.type == 153 && closestPlayer.RollLuck(17) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1328, pfix: -1);
if (this.type == 120)
{
if (Main.expertMode)
{
if (closestPlayer.RollLuck(400) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1326, pfix: -1);
}
else if (closestPlayer.RollLuck(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1326, pfix: -1);
}
if (this.type == 49 && closestPlayer.RollLuck(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1325, pfix: -1);
if (this.type == 185 && closestPlayer.RollLuck(150) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 951, pfix: -1);
if (this.type == 44 && closestPlayer.RollLuck(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1320, pfix: -1);
if (this.type == 44 && closestPlayer.RollLuck(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 88, pfix: -1);
if (this.type == 110 && closestPlayer.RollLuck(80) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1321, pfix: -1);
if (this.type == 60 && closestPlayer.RollLuck(150) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1322, pfix: -1);
if (this.type == 151 && closestPlayer.RollLuck(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1322, pfix: -1);
if (this.type == 24 && closestPlayer.RollLuck(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1323, pfix: -1);
if (this.type == 109 && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(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) && closestPlayer.RollLuck(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 && closestPlayer.RollLuck(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 && closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 682, pfix: -1);
if (this.type == 170 || this.type == 180 || this.type == 171)
{
if (closestPlayer.RollLuck(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4428, pfix: -1);
else if (closestPlayer.RollLuck(25) == 0 && Main.IsItAHappyWindyDay)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4613);
}
if (this.type == 154 && closestPlayer.RollLuck(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) && closestPlayer.RollLuck(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 && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(1000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1172, pfix: -1);
if (closestPlayer.RollLuck(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1293, pfix: -1);
if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 870, pfix: -1);
if (closestPlayer.RollLuck(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 871, pfix: -1);
if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(25) == 0 && Main.IsItAHappyWindyDay)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4379);
else 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 (!flag1)
{
if (closestPlayer.RollLuck(8000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 905, pfix: -1);
if (closestPlayer.RollLuck(4000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 855, pfix: -1);
if (closestPlayer.RollLuck(2000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 854, pfix: -1);
if (closestPlayer.RollLuck(2000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2584, pfix: -1);
if (closestPlayer.RollLuck(1000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3033, pfix: -1);
if (closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 672, pfix: -1);
if (closestPlayer.RollLuck(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1277);
if (closestPlayer.RollLuck(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1278);
if (closestPlayer.RollLuck(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1279);
if (closestPlayer.RollLuck(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1280);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1704);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1705);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1710);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1716);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1720);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2379);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2389);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2405);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2843);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3885);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2663);
if (closestPlayer.RollLuck(150) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3904, Main.rand.Next(6, 11) * 5);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3910);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2238);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2133);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2137);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2143);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2147);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2151);
if (closestPlayer.RollLuck(300) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2155);
if (closestPlayer.RollLuck(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3263);
if (closestPlayer.RollLuck(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3264);
if (closestPlayer.RollLuck(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3265);
}
}
else if (this.type == 216)
{
if (closestPlayer.RollLuck(2000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 905, pfix: -1);
if (closestPlayer.RollLuck(1000) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 855, pfix: -1);
if (closestPlayer.RollLuck(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 854, pfix: -1);
if (closestPlayer.RollLuck(500) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2584, pfix: -1);
if (closestPlayer.RollLuck(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3033, pfix: -1);
if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(400) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 905, pfix: -1);
else if (closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 855, pfix: -1);
else if (closestPlayer.RollLuck(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 854, pfix: -1);
else if (closestPlayer.RollLuck(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2584, pfix: -1);
else if (closestPlayer.RollLuck(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3033, pfix: -1);
else if (closestPlayer.RollLuck(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4471, pfix: -1);
else if (closestPlayer.RollLuck(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) && closestPlayer.RollLuck(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 && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 527);
}
else if (this.type == 80 && closestPlayer.RollLuck(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 528);
if (this.type == 524 && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3794);
if (closestPlayer.RollLuck(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 522, Main.rand.Next(1, 4));
if (closestPlayer.RollLuck(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 527);
}
if (this.type == 526)
{
if (closestPlayer.RollLuck(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3794);
if (closestPlayer.RollLuck(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1332, Main.rand.Next(1, 4));
if (closestPlayer.RollLuck(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 527);
}
if (this.type == 527)
{
if (closestPlayer.RollLuck(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3794);
if (closestPlayer.RollLuck(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 528);
}
if (this.type == 532)
{
if (closestPlayer.RollLuck(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3380);
if (closestPlayer.RollLuck(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3771);
}
if (this.type == 528)
{
if (closestPlayer.RollLuck(25) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2802);
if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(25) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2801);
if (closestPlayer.RollLuck(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) && closestPlayer.RollLuck(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) && closestPlayer.RollLuck(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 393, pfix: -1);
if (this.type == 58 && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(80) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 18, pfix: -1);
else if (closestPlayer.RollLuck(80) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 393, pfix: -1);
else if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 954, pfix: -1);
else if (closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 955, pfix: -1);
else if (closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1166, pfix: -1);
else if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(450) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 959, pfix: -1);
if (closestPlayer.RollLuck(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) && closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 996);
if ((this.type == 98 || this.type == 83 || this.type == 94 || this.type == 81) && closestPlayer.RollLuck(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 == 98 && closestPlayer.RollLuck(25) == 0 && Main.IsItAHappyWindyDay)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4611);
if (this.type == 86)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 526);
if (closestPlayer.RollLuck(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 856);
}
if (this.type == 224 && closestPlayer.RollLuck(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4057);
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 (closestPlayer.RollLuck(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)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 23, Main.rand.Next(2, 4));
int range = 8000;
if (Main.expertMode)
range = (int) ((double) range * 0.7);
if (closestPlayer.RollLuck(range) == 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 && closestPlayer.RollLuck(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 range = 100;
if (Main.expertMode)
range = (int) ((double) range * 0.7);
if (closestPlayer.RollLuck(range) == 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 (this.netID == -6 || this.netID == -7 || this.netID == -8 || this.netID == -9)
Stack += Main.rand.Next(1, 4);
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 range = 10000;
if (Main.expertMode)
range = (int) ((double) range * 0.7);
if (closestPlayer.RollLuck(range) == 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 (closestPlayer.RollLuck(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 236);
else if (closestPlayer.RollLuck(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 38);
}
if (this.type == 104 && closestPlayer.RollLuck(60) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 485, pfix: -1);
if (this.type == 58)
{
if (closestPlayer.RollLuck(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 263);
else if (closestPlayer.RollLuck(30) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 118);
}
if (this.type == 102 && closestPlayer.RollLuck(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 263);
if (this.type == 3 || this.type == 591 || this.type == 590 || 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 (closestPlayer.RollLuck(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 216, pfix: -1);
if (closestPlayer.RollLuck(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1304, pfix: -1);
if (this.type == 590 || this.type == 591)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 8, Main.rand.Next(5, 21));
}
if ((this.type == 587 || this.type == 586) && closestPlayer.RollLuck(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4608, Main.rand.Next(5, 7));
if ((this.type == 620 || this.type == 621) && closestPlayer.RollLuck(2) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4608, Main.rand.Next(7, 11));
if ((this.type == 587 || this.type == 586) && closestPlayer.RollLuck(15) == 0)
{
switch (Main.rand.Next(3))
{
case 0:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4273);
break;
case 1:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4381);
break;
case 2:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4325);
break;
}
}
if (this.type == 620)
{
if (closestPlayer.RollLuck(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4270);
if (closestPlayer.RollLuck(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4317);
}
if (this.type == 621)
{
if (closestPlayer.RollLuck(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4272);
if (closestPlayer.RollLuck(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4317);
}
if (this.type == 618)
{
if (closestPlayer.RollLuck(5) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4269);
if (closestPlayer.RollLuck(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4054);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4608, Main.rand.Next(7, 11));
}
if (!Main.dayTime && Main.bloodMoon && !this.SpawnedFromStatue && !flag1)
{
if ((this.type == 587 || this.type == 586 || this.type == 489 || this.type == 490 || this.type == 109 || this.type == 621 || this.type == 620 || this.type == 619) && closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4271);
if ((this.type == 53 || this.type == 536 || this.type == 618) && closestPlayer.RollLuck(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4271);
}
if ((this.type == 489 || this.type == 490) && (Main.expertMode || closestPlayer.RollLuck(2) == 0))
{
if (closestPlayer.RollLuck(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3212, pfix: -1);
if (closestPlayer.RollLuck(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3213, pfix: -1);
}
if (this.type == 223 && closestPlayer.RollLuck(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) && closestPlayer.RollLuck(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)) && !flag1 && closestPlayer.RollLuck(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 == 581 || this.type == 580 || this.type == 508 || this.type == 509) && closestPlayer.RollLuck(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 == 582 && closestPlayer.RollLuck(6) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 323);
if ((this.type == 580 || this.type == 508 || this.type == 581 || this.type == 509) && closestPlayer.RollLuck(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)
{
if (closestPlayer.RollLuck(30) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3109);
if (closestPlayer.RollLuck(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4400);
}
if ((this.type == 6 || this.type == 94) && closestPlayer.RollLuck(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) && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(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) && (closestPlayer.RollLuck(50) == 0 || Main.expertMode && closestPlayer.RollLuck(50) == 0))
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 215);
if ((this.type == 47 || this.type == 464) && closestPlayer.RollLuck(75) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 243);
if ((this.type == 168 || this.type == 470) && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3795);
else if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2112, pfix: -1);
if (closestPlayer.RollLuck(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1299);
int num3 = 1;
for (int index = 0; index < num3; ++index)
{
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 (closestPlayer.RollLuck(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2104, pfix: -1);
if (closestPlayer.RollLuck(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3060);
}
}
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 && closestPlayer.statLife < closestPlayer.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 (closestPlayer.RollLuck(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 994);
if (closestPlayer.RollLuck(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 && closestPlayer.statLife < closestPlayer.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 (closestPlayer.RollLuck(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2108, pfix: -1);
int Type = Main.rand.Next(3);
switch (Type)
{
case 0:
Type = 1121;
break;
case 1:
Type = 1123;
break;
case 2:
Type = 2888;
break;
}
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, pfix: -1);
if (closestPlayer.RollLuck(3) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1132, pfix: -1);
if (closestPlayer.RollLuck(15) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1170);
if (closestPlayer.RollLuck(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2502);
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)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1130, Main.rand.Next(10, 30));
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2431, Main.rand.Next(16, 27));
}
NPC.SetEventFlagCleared(ref NPC.downedQueenBee, 8);
if (Main.netMode == 2)
NetMessage.SendData(7);
}
if (this.type == 35)
{
if (Main.expertMode)
this.DropBossBags();
else if (closestPlayer.RollLuck(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1281, pfix: -1);
else if (closestPlayer.RollLuck(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1273, pfix: -1);
else if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(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.rand.Next(2) == 0)
{
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);
}
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 && !flag1)
{
int num5 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
int num6 = (int) ((double) this.position.Y + (double) (this.height / 2)) / 16;
int num7 = this.width / 2 / 16 + 1;
for (int index1 = num5 - num7; index1 <= num5 + num7; ++index1)
{
for (int index2 = num6 - num7; index2 <= num6 + num7; ++index2)
{
if ((index1 == num5 - num7 || index1 == num5 + num7 || index2 == num6 - num7 || index2 == num6 + num7) && !Main.tile[index1, index2].active())
{
Main.tile[index1, index2].type = WorldGen.crimson ? (ushort) 347 : (ushort) 140;
Main.tile[index1, index2].active(true);
}
Main.tile[index1, index2].lava(false);
Main.tile[index1, index2].liquid = (byte) 0;
if (Main.netMode == 2)
NetMessage.SendTileSquare(-1, index1, index2, 1);
else
WorldGen.SquareTileFrame(index1, index2);
}
}
}
}
if (this.type == 439)
{
NPC.SetEventFlagCleared(ref NPC.downedAncientCultist, 9);
if (closestPlayer.RollLuck(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.SetEventFlagCleared(ref NPC.downedMoonlord, 10);
NPC.LunarApocalypseIsUp = false;
if (Main.expertMode)
{
this.DropBossBags();
}
else
{
if (closestPlayer.RollLuck(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3373, pfix: -1);
if (closestPlayer.RollLuck(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4469, 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, 3930, 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 num8 = Main.rand.Next(25, 41) / 2;
if (Main.expertMode)
num8 = (int) ((double) num8 * 1.5);
for (int index = 0; index < num8; ++index)
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 num9 = Main.rand.Next(25, 41) / 2;
if (Main.expertMode)
num9 = (int) ((double) num9 * 1.5);
for (int index = 0; index < num9; ++index)
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 num10 = Main.rand.Next(25, 41) / 2;
if (Main.expertMode)
num10 = (int) ((double) num10 * 1.5);
for (int index = 0; index < num10; ++index)
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 num11 = Main.rand.Next(25, 41) / 2;
if (Main.expertMode)
num11 = (int) ((double) num11 * 1.5);
for (int index = 0; index < num11; ++index)
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 (closestPlayer.RollLuck(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 381:
case 382:
case 383:
case 385:
case 386:
case 389:
case 390:
case 520:
if (closestPlayer.RollLuck(600) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2798);
if (closestPlayer.RollLuck(600) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2800);
if (closestPlayer.RollLuck(600) == 0)
{
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2882);
break;
}
break;
}
switch (this.type)
{
case 383:
case 386:
case 389:
if (closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2806);
if (closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2807);
if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2803);
if (closestPlayer.RollLuck(200) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2804);
if (closestPlayer.RollLuck(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, 2796, 2880, 2769));
if (this.type == 390 && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(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 == 63 && closestPlayer.RollLuck(50) == 0 && Main.IsItAHappyWindyDay)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4649);
if (this.type == 64 && closestPlayer.RollLuck(50) == 0 && Main.IsItAHappyWindyDay)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4650);
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 && closestPlayer.RollLuck(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3187 + Main.rand.Next(3));
if (this.type == 481 && closestPlayer.RollLuck(40) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4463);
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 (closestPlayer.RollLuck(25) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 118);
else if (this.type == 44)
{
if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(4) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2430);
if (closestPlayer.RollLuck(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.SetEventFlagCleared(ref NPC.downedSlimeKing, 11);
if (Main.netMode == 2)
NetMessage.SendData(7);
}
if (this.type == 23 && closestPlayer.RollLuck(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 116);
if (this.type == 24 && closestPlayer.RollLuck(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 || this.type >= 294 && this.type <= 296)
{
if (closestPlayer.RollLuck(250) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 932);
else if (closestPlayer.RollLuck(100) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3095);
else if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(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 && closestPlayer.RollLuck(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)
{
if (closestPlayer.RollLuck(25) == 0 && Main.IsItAHappyWindyDay)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4648);
else if (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 == 39 && closestPlayer.RollLuck(25) == 0 && Main.IsItAHappyWindyDay)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4610);
if (this.type == 65)
{
if (closestPlayer.RollLuck(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 268);
else if (closestPlayer.RollLuck(25) == 0 && Main.IsItAHappyWindyDay)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4651);
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 || this.type == 543 || this.type == 544 || this.type == 545) && closestPlayer.RollLuck(10) == 0 && Main.IsItAHappyWindyDay)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 4669);
if (this.type == 542 && closestPlayer.RollLuck(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 (closestPlayer.RollLuck(25) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 527);
if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(25) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 528);
if (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(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 (closestPlayer.RollLuck(7) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2109, pfix: -1);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1141, pfix: -1);
if (closestPlayer.RollLuck(20) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1182, pfix: -1);
if (closestPlayer.RollLuck(50) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1305, pfix: -1);
if (closestPlayer.RollLuck(4) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1157, pfix: -1);
if (closestPlayer.RollLuck(10) == 0)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3021, pfix: -1);
int num12 = 1;
for (int index = 0; index < num12; ++index)
{
int num13 = Main.rand.Next(7);
if (!NPC.downedPlantBoss)
num13 = 0;
switch (num13)
{
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 num14 = NPC.downedPlantBoss ? 1 : 0;
NPC.SetEventFlagCleared(ref NPC.downedPlantBoss, 12);
if (num14 == 0)
{
switch (Main.netMode)
{
case 0:
Main.NewText(Lang.misc[33].Value, (byte) 50, B: (byte) 130);
break;
case 2:
ChatHelper.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) && closestPlayer.RollLuck(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.SetEventFlagCleared(ref NPC.downedBoss1, 13);
else if (this.type == 13 || this.type == 14 || this.type == 15)
NPC.SetEventFlagCleared(ref NPC.downedBoss2, 14);
else if (this.type == 266)
NPC.SetEventFlagCleared(ref NPC.downedBoss2, 14);
else if (this.type == 35)
NPC.SetEventFlagCleared(ref NPC.downedBoss3, 15);
if (this.type == (int) sbyte.MaxValue)
{
NPC.SetEventFlagCleared(ref NPC.downedMechBoss3, 18);
NPC.downedMechBossAny = true;
}
if (this.type == 134)
{
NPC.SetEventFlagCleared(ref NPC.downedMechBoss1, 16);
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 = 3544;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack);
int num15 = Main.rand.Next(5) + 5;
for (int index = 0; index < num15; ++index)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (this.type == 125 || this.type == 126)
{
NPC.SetEventFlagCleared(ref NPC.downedMechBoss2, 17);
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:
ChatHelper.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:
ChatHelper.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:
ChatHelper.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;
if (!flag1)
WorldGen.StartHardmode();
if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 && !hardMode)
{
switch (Main.netMode)
{
case 0:
Main.NewText(Lang.misc[32].Value, (byte) 50, B: (byte) 130);
break;
case 2:
ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[32].Key), new Color(50, (int) byte.MaxValue, 130));
break;
}
}
NPC.SetEventFlagCleared(ref hardMode, 19);
}
if (Main.netMode == 2)
NetMessage.SendData(7);
}
if (!flag2 && 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:
ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[32].Key), new Color(50, (int) byte.MaxValue, 130));
break;
}
}
this.NPCLoot_DropCommonLifeAndMana(closestPlayer);
this.NPCLoot_DropMoney(closestPlayer);
}
public void NPCLoot()
{
if (Main.netMode == 1 || this.type >= 663)
return;
Player closestPlayer = Main.player[(int) Player.FindClosest(this.position, this.width, this.height)];
if (true)
{
this.CountKillForAchievements();
if (this.GetWereThereAnyInteractions())
{
if (this.IsNPCValidForBestiaryKillCredit())
Main.BestiaryTracker.Kills.RegisterKill(this);
this.CountKillForBannersAndDropThem();
}
}
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;
int num = !NPC.downedMechBoss1 || !NPC.downedMechBoss2 ? 0 : (NPC.downedMechBoss3 ? 1 : 0);
this.DoDeathEvents_BeforeLoot(closestPlayer);
this.NPCLoot_DropItems(closestPlayer);
this.DoDeathEvents(closestPlayer);
if (num == 0 && 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:
ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[32].Key), new Color(50, (int) byte.MaxValue, 130));
break;
}
}
this.NPCLoot_DropMoney(closestPlayer);
this.NPCLoot_DropHeals(closestPlayer);
}
private bool IsNPCValidForBestiaryKillCredit()
{
switch (this.type)
{
case 13:
case 14:
case 15:
return this.boss;
default:
return true;
}
}
private void DoDeathEvents_BeforeLoot(Player closestPlayer)
{
switch (this.type)
{
case 125:
case 126:
if (!NPC.AnyNPCs(this.type == 125 ? 126 : 125))
break;
this.value = 0.0f;
this.boss = false;
break;
}
}
private void NPCLoot_DropItems(Player closestPlayer)
{
DropAttemptInfo info = new DropAttemptInfo()
{
player = closestPlayer,
npc = this,
IsExpertMode = Main.expertMode,
IsMasterMode = Main.masterMode,
IsInSimulation = false,
rng = Main.rand
};
Main.ItemDropSolver.TryDropping(info);
}
public static void ResetBadgerHatTime()
{
NPC.EoCKilledToday = false;
NPC.WoFKilledToday = false;
}
private void DoDeathEvents_DropBossPotionsAndHearts()
{
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 == 657)
Type = 499;
else if (this.type > 113 && this.type < 222)
Type = 499;
else if (this.type == 636)
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 = 3544;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack);
int num = Main.rand.Next(5) + 5;
for (int index = 0; index < num; ++index)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
if (this.type == 4)
NPC.EoCKilledToday = true;
else if (this.type == 113)
NPC.WoFKilledToday = true;
if (!NPC.EoCKilledToday || !NPC.WoFKilledToday)
return;
NPC.ResetBadgerHatTime();
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 5004);
}
private void DoDeathEvents_CelebrateBossDeath()
{
if (this.type == 125 || this.type == 126)
{
if (Main.netMode == 0)
{
Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Plural", (object) Language.GetTextValue("Enemies.TheTwins")), (byte) 175, (byte) 75);
}
else
{
if (Main.netMode != 2)
return;
ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Plural", (object) NetworkText.FromKey("Enemies.TheTwins")), new Color(175, 75, (int) byte.MaxValue));
}
}
else if (this.type == 398)
{
if (Main.netMode == 0)
{
Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Single", (object) Language.GetTextValue("Enemies.MoonLord")), (byte) 175, (byte) 75);
}
else
{
if (Main.netMode != 2)
return;
ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Single", (object) NetworkText.FromKey("Enemies.MoonLord")), new Color(175, 75, (int) byte.MaxValue));
}
}
else if (Main.netMode == 0)
{
Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Single", (object) this.TypeName), (byte) 175, (byte) 75);
}
else
{
if (Main.netMode != 2)
return;
ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Single", (object) this.GetTypeNetName()), new Color(175, 75, (int) byte.MaxValue));
}
}
private void CreateBrickBoxForWallOfFlesh()
{
int num1 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
int num2 = (int) ((double) this.position.Y + (double) (this.height / 2)) / 16;
int num3 = this.width / 2 / 16 + 1;
for (int index1 = num1 - num3; index1 <= num1 + num3; ++index1)
{
for (int index2 = num2 - num3; index2 <= num2 + num3; ++index2)
{
if ((index1 == num1 - num3 || index1 == num1 + num3 || index2 == num2 - num3 || index2 == num2 + num3) && !Main.tile[index1, index2].active())
{
Main.tile[index1, index2].type = WorldGen.crimson ? (ushort) 347 : (ushort) 140;
Main.tile[index1, index2].active(true);
}
Main.tile[index1, index2].lava(false);
Main.tile[index1, index2].liquid = (byte) 0;
if (Main.netMode == 2)
NetMessage.SendTileSquare(-1, index1, index2, 1);
else
WorldGen.SquareTileFrame(index1, index2);
}
}
}
private void DoDeathEvents_SummonDungeonSpirit(Player closestPlayer)
{
if (this.lifeMax <= 100 || this.type == 288 || (double) this.value <= 0.0 || !this.HasPlayerTarget || !Main.hardMode || !NPC.downedPlantBoss || !Main.player[this.target].ZoneDungeon)
return;
int range = 13;
if (Main.expertMode)
range = 9;
if (closestPlayer.RollLuck(range) != 0 || !Main.wallDungeon[(int) Main.tile[(int) this.Center.X / 16, (int) this.Center.Y / 16].wall])
return;
NPC.NewNPC((int) this.Center.X, (int) this.Center.Y, 288);
}
private void DoDeathEvents_AdvanceSlimeRain(Player closestPlayer)
{
if (!Main.slimeRain || !Main.slimeRainNPC[this.type] || NPC.AnyNPCs(50))
return;
int num = 150;
if (NPC.downedSlimeKing)
num /= 2;
++Main.slimeRainKillCount;
if (Main.slimeRainKillCount < num)
return;
NPC.SpawnOnPlayer(closestPlayer.whoAmI, 50);
Main.slimeRainKillCount = -num / 2;
}
private void NPCLoot_DropHeals(Player closestPlayer)
{
this.NPCLoot_DropCommonLifeAndMana(closestPlayer);
switch (this.type)
{
case 13:
case 14:
case 15:
if (Main.rand.Next(4) != 0 || closestPlayer.statLife >= closestPlayer.statLifeMax2)
break;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
break;
case 116:
case 117:
case 118:
case 119:
if (Main.expertMode && Main.rand.Next(5) != 0)
break;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
break;
case 139:
if (Main.rand.Next(2) != 0)
break;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
break;
case 267:
if (Main.rand.Next(2) != 0 || closestPlayer.statLife >= closestPlayer.statLifeMax2)
break;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
break;
case 305:
case 306:
case 307:
case 308:
case 309:
case 310:
case 311:
case 312:
case 313:
case 314:
case 329:
case 330:
if (closestPlayer.RollLuck(4) != 0)
break;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
break;
case 315:
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
break;
case 325:
case 327:
case 344:
case 345:
case 346:
int num1 = Main.rand.Next(6) + 6;
for (int index = 0; index < num1; ++index)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
break;
case 326:
if (closestPlayer.RollLuck(6) != 0)
break;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
break;
case 338:
case 339:
case 340:
if (closestPlayer.RollLuck(5) != 0)
break;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
break;
case 341:
int num2 = Main.rand.Next(5, 11);
for (int index = 0; index < num2; ++index)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
break;
case 342:
if (Main.rand.Next(3) == 0)
break;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 58);
break;
}
}
private void DoDeathEvents(Player closestPlayer)
{
this.DoDeathEvents_AdvanceSlimeRain(closestPlayer);
this.DoDeathEvents_SummonDungeonSpirit(closestPlayer);
switch (this.type)
{
case 4:
NPC.SetEventFlagCleared(ref NPC.downedBoss1, 13);
break;
case 13:
case 14:
case 15:
case 266:
if (this.boss)
{
if (!NPC.downedBoss2 || Main.rand.Next(2) == 0)
WorldGen.spawnMeteor = true;
NPC.SetEventFlagCleared(ref NPC.downedBoss2, 14);
break;
}
break;
case 22:
if (Collision.LavaCollision(this.position, this.width, this.height))
{
NPC.SpawnWOF(this.position);
break;
}
break;
case 35:
if (this.boss)
{
NPC.SetEventFlagCleared(ref NPC.downedBoss3, 15);
break;
}
break;
case 50:
if (Main.slimeRain)
{
Main.StopSlimeRain();
AchievementsHelper.NotifyProgressionEvent(16);
}
NPC.SetEventFlagCleared(ref NPC.downedSlimeKing, 11);
if (Main.netMode == 2)
{
NetMessage.SendData(7);
break;
}
break;
case 109:
if (!NPC.downedClown)
{
NPC.downedClown = true;
if (Main.netMode == 2)
{
NetMessage.SendData(7);
break;
}
break;
}
break;
case 113:
if (Main.netMode != 1)
{
this.CreateBrickBoxForWallOfFlesh();
bool hardMode = Main.hardMode;
WorldGen.StartHardmode();
if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 && !hardMode)
{
switch (Main.netMode)
{
case 0:
Main.NewText(Lang.misc[32].Value, (byte) 50, B: (byte) 130);
break;
case 2:
ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[32].Key), new Color(50, (int) byte.MaxValue, 130));
break;
}
}
NPC.SetEventFlagCleared(ref hardMode, 19);
break;
}
break;
case 125:
case 126:
if (this.boss)
{
NPC.SetEventFlagCleared(ref NPC.downedMechBoss2, 17);
NPC.downedMechBossAny = true;
break;
}
break;
case (int) sbyte.MaxValue:
if (this.boss)
{
NPC.SetEventFlagCleared(ref NPC.downedMechBoss3, 18);
NPC.downedMechBossAny = true;
break;
}
break;
case 134:
if (this.boss)
{
NPC.SetEventFlagCleared(ref NPC.downedMechBoss1, 16);
NPC.downedMechBossAny = true;
break;
}
break;
case 216:
NPC.SpawnBoss((int) this.position.X, (int) this.position.Y, 662, this.target);
break;
case 222:
NPC.SetEventFlagCleared(ref NPC.downedQueenBee, 8);
if (Main.netMode == 2)
{
NetMessage.SendData(7);
break;
}
break;
case 245:
NPC.SetEventFlagCleared(ref NPC.downedGolemBoss, 6);
break;
case 262:
int num = NPC.downedPlantBoss ? 1 : 0;
NPC.SetEventFlagCleared(ref NPC.downedPlantBoss, 12);
if (num == 0)
{
switch (Main.netMode)
{
case 0:
Main.NewText(Lang.misc[33].Value, (byte) 50, B: (byte) 130);
break;
case 2:
ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[33].Key), new Color(50, (int) byte.MaxValue, 130));
break;
}
}
else
break;
break;
case 325:
if (Main.pumpkinMoon)
{
NPC.SetEventFlagCleared(ref NPC.downedHalloweenTree, 4);
break;
}
break;
case 327:
if (Main.pumpkinMoon)
{
NPC.SetEventFlagCleared(ref NPC.downedHalloweenKing, 5);
break;
}
break;
case 344:
if (Main.snowMoon)
{
NPC.SetEventFlagCleared(ref NPC.downedChristmasTree, 21);
break;
}
break;
case 345:
if (Main.snowMoon)
{
NPC.SetEventFlagCleared(ref NPC.downedChristmasIceQueen, 20);
break;
}
break;
case 346:
if (Main.snowMoon)
{
NPC.SetEventFlagCleared(ref NPC.downedChristmasSantank, 22);
break;
}
break;
case 370:
NPC.SetEventFlagCleared(ref NPC.downedFishron, 7);
break;
case 398:
NPC.SetEventFlagCleared(ref NPC.downedMoonlord, 10);
NPC.LunarApocalypseIsUp = false;
break;
case 402:
case 405:
case 407:
case 409:
case 411:
if (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:
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 439:
NPC.SetEventFlagCleared(ref NPC.downedAncientCultist, 9);
WorldGen.TriggerLunarApocalypse();
break;
case 493:
NPC.downedTowerStardust = true;
NPC.TowerActiveStardust = false;
WorldGen.UpdateLunarApocalypse();
WorldGen.MessageLunarApocalypse();
break;
case 507:
NPC.downedTowerNebula = true;
NPC.TowerActiveNebula = false;
WorldGen.UpdateLunarApocalypse();
WorldGen.MessageLunarApocalypse();
break;
case 517:
NPC.downedTowerSolar = true;
NPC.TowerActiveSolar = false;
WorldGen.UpdateLunarApocalypse();
WorldGen.MessageLunarApocalypse();
break;
case 552:
case 553:
case 554:
if (DD2Event.Ongoing)
{
DD2Event.AnnounceGoblinDeath(this);
if (DD2Event.ShouldDropCrystals())
{
Item.NewItem(this.position, this.Size, 3822);
break;
}
break;
}
break;
case 555:
case 556:
case 557:
case 558:
case 559:
case 560:
case 561:
case 562:
case 563:
case 564:
case 565:
case 568:
case 569:
case 570:
case 571:
case 572:
case 573:
case 574:
case 575:
case 576:
case 577:
case 578:
if (DD2Event.ShouldDropCrystals())
{
Item.NewItem(this.position, this.Size, 3822);
break;
}
break;
case 614:
int Damage = 175;
if (this.SpawnedFromStatue)
Damage = 0;
Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 281, Damage, 0.0f, Main.myPlayer, -2f, (float) ((int) this.releaseOwner + 1));
break;
case 636:
NPC.SetEventFlagCleared(ref NPC.downedEmpressOfLight, 23);
break;
case 657:
NPC.SetEventFlagCleared(ref NPC.downedQueenSlime, 24);
break;
case 661:
if (Main.netMode != 1 && this.GetWereThereAnyInteractions())
{
int Type = 636;
if (!NPC.AnyNPCs(Type))
{
Vector2 vector2 = this.Center + new Vector2(0.0f, -200f) + Main.rand.NextVector2Circular(50f, 50f);
NPC.SpawnBoss((int) vector2.X, (int) vector2.Y, Type, closestPlayer.whoAmI);
break;
}
break;
}
break;
}
if (!this.boss)
return;
this.DoDeathEvents_DropBossPotionsAndHearts();
this.DoDeathEvents_CelebrateBossDeath();
if (Main.netMode != 2)
return;
NetMessage.SendData(7);
}
private void NPCLoot_DropCommonLifeAndMana(Player closestPlayer)
{
if (this.type != 16 && this.type != 81 && this.type != 121 && closestPlayer.RollLuck(6) == 0 && this.lifeMax > 1 && this.damage > 0)
{
if (Main.rand.Next(2) == 0 && closestPlayer.statMana < closestPlayer.statManaMax2)
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 184);
else if (Main.rand.Next(2) == 0 && closestPlayer.statLife < closestPlayer.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 || closestPlayer.RollLuck(2) != 0 || this.lifeMax <= 1 || this.damage <= 0 || closestPlayer.statMana >= closestPlayer.statManaMax2)
return;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 184);
}
private void NPCLoot_DropMoney(Player closestPlayer)
{
float num1 = 0.0f;
float luck = closestPlayer.luck;
int num2 = 1;
if ((double) Main.rand.NextFloat() < (double) Math.Abs(luck))
num2 = 2;
for (int index = 0; index < num2; ++index)
{
float num3 = this.value;
if (this.midas)
num3 *= (float) (1.0 + (double) Main.rand.Next(10, 51) * 0.00999999977648258);
float num4 = num3 * (float) (1.0 + (double) Main.rand.Next(-20, 76) * 0.00999999977648258);
if (Main.rand.Next(2) == 0)
num4 *= (float) (1.0 + (double) Main.rand.Next(5, 11) * 0.00999999977648258);
if (Main.rand.Next(4) == 0)
num4 *= (float) (1.0 + (double) Main.rand.Next(10, 21) * 0.00999999977648258);
if (Main.rand.Next(8) == 0)
num4 *= (float) (1.0 + (double) Main.rand.Next(15, 31) * 0.00999999977648258);
if (Main.rand.Next(16) == 0)
num4 *= (float) (1.0 + (double) Main.rand.Next(20, 41) * 0.00999999977648258);
if (Main.rand.Next(32) == 0)
num4 *= (float) (1.0 + (double) Main.rand.Next(25, 51) * 0.00999999977648258);
if (Main.rand.Next(64) == 0)
num4 *= (float) (1.0 + (double) Main.rand.Next(50, 101) * 0.00999999977648258);
if (Main.bloodMoon)
num4 *= (float) (1.0 + (double) Main.rand.Next(101) * 0.00999999977648258);
if (index == 0)
num1 = num4;
else if ((double) luck < 0.0)
{
if ((double) num4 < (double) num1)
num1 = num4;
}
else if ((double) num4 > (double) num1)
num1 = num4;
}
float num5 = num1 + (float) this.extraValue;
while ((int) num5 > 0)
{
if ((double) num5 > 1000000.0)
{
int num6 = (int) ((double) num5 / 1000000.0);
if (num6 > 50 && Main.rand.Next(5) == 0)
num6 /= Main.rand.Next(3) + 1;
if (Main.rand.Next(5) == 0)
num6 /= Main.rand.Next(3) + 1;
int Stack = num6;
while (Stack > 999)
{
Stack -= 999;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 74, 999);
}
num5 -= (float) (1000000 * num6);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 74, Stack);
}
else if ((double) num5 > 10000.0)
{
int Stack = (int) ((double) num5 / 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;
num5 -= (float) (10000 * Stack);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 73, Stack);
}
else if ((double) num5 > 100.0)
{
int Stack = (int) ((double) num5 / 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;
num5 -= (float) (100 * Stack);
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 72, Stack);
}
else
{
int Stack = (int) num5;
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;
num5 -= (float) Stack;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 71, Stack);
}
}
}
public static int GetStackForSlimeItemDrop(int item)
{
int num = 1;
switch (item)
{
case 8:
num = Main.rand.Next(5, 11);
break;
case 166:
num = Main.rand.Next(2, 7);
break;
case 965:
num = Main.rand.Next(20, 46);
break;
default:
if (item >= 11 && item <= 14 || item >= 699 && item <= 702)
{
num = Main.rand.Next(3, 9);
if (Main.rand.Next(2) == 0)
{
num += 5;
break;
}
break;
}
switch (item)
{
case 71:
num = Main.rand.Next(50, 100);
break;
case 72:
num = Main.rand.Next(20, 100);
break;
case 73:
num = Main.rand.Next(1, 3);
break;
}
break;
}
return num;
}
public bool ExcludedFromDeathTally()
{
if (this.netID >= 0)
return NPCID.Sets.PositiveNPCTypesExcludedFromDeathTally[this.netID];
return this.netID == -5 || this.netID == -1;
}
private void CountKillForBannersAndDropThem()
{
int index1 = Item.NPCtoBanner(this.BannerID());
if (index1 <= 0 || this.ExcludedFromDeathTally())
return;
++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)
return;
int npc = Item.BannerToNPC(index1);
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:
ChatHelper.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);
}
private bool GetWereThereAnyInteractions() => this.realLife < 0 ? this.AnyInteractions() : Main.npc[this.realLife].AnyInteractions();
private void CountKillForAchievements()
{
switch (this.type)
{
case 13:
case 14:
case 15:
if (!this.boss)
break;
AchievementsHelper.NotifyNPCKilled(this);
break;
case 125:
case 126:
if (NPC.AnyNPCs(this.type == 126 ? 125 : 126))
break;
AchievementsHelper.NotifyNPCKilled(this);
AchievementsHelper.CheckMechaMayhem(this.type);
break;
case (int) sbyte.MaxValue:
case 134:
AchievementsHelper.CheckMechaMayhem(this.type);
AchievementsHelper.NotifyNPCKilled(this);
break;
default:
AchievementsHelper.NotifyNPCKilled(this);
break;
}
}
private void NPCLoot_DropFood(Player closestPlayer)
{
int Type = 0;
int range = 0;
switch (this.type)
{
case 6:
case 173:
Type = 4015;
range = 100;
break;
case 34:
Type = 4018;
range = 100;
break;
case 39:
case 156:
Type = 4025;
range = 30;
break;
case 44:
Type = 4037;
range = 10;
break;
case 48:
Type = 4016;
range = 50;
break;
case 65:
case 67:
Type = 4035;
range = 50;
break;
case 69:
case 508:
case 509:
case 580:
case 581:
Type = 4012;
range = 15;
break;
case 120:
case 137:
case 138:
Type = 4011;
range = 150;
break;
case 122:
Type = 4017;
range = 75;
break;
case 150:
case 184:
Type = 4026;
range = 150;
break;
case 152:
case 177:
Type = 4023;
range = 15;
break;
case 154:
case 206:
Type = 4027;
range = 75;
break;
case 163:
case 164:
case 165:
case 238:
case 530:
case 531:
Type = 4020;
range = 30;
break;
case 170:
case 171:
case 180:
Type = 3532;
range = 15;
break;
case 224:
Type = 4021;
range = 50;
break;
case 289:
Type = 4018;
range = 50;
break;
case 290:
Type = 4013;
range = 21;
break;
case 291:
case 292:
case 293:
Type = 4013;
range = 7;
break;
case 469:
Type = 4037;
range = 100;
break;
case 480:
case 481:
Type = 4029;
range = 50;
break;
case 482:
case 483:
Type = 4036;
range = 50;
break;
case 494:
case 495:
case 496:
case 497:
case 498:
case 499:
case 500:
case 501:
case 502:
case 503:
case 504:
case 505:
case 506:
Type = 4030;
range = 75;
break;
case 542:
case 543:
case 544:
case 545:
case 546:
Type = 4028;
range = 30;
break;
}
if (this.SpawnedFromStatue || Type == 0 || range == 0 || closestPlayer.RollLuck(range) != 0)
return;
Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type);
}
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.timeItemSlotCannotBeReusedFor[number] = 54000;
for (int remoteClient = 0; remoteClient < (int) byte.MaxValue; ++remoteClient)
{
if (Main.player[remoteClient].active && (this.playerInteraction[remoteClient] || !interactionRequired))
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 >= 663 || !Main.npcCatchable[Type] || !NPC.CanReleaseNPCs(who))
return;
switch (Type)
{
case 148:
int Type1 = Type + Main.rand.Next(2);
int index1 = NPC.NewNPC(x, y, Type1);
Main.npc[index1].releaseOwner = (short) who;
break;
case 356:
int index2 = NPC.NewNPC(x, y, Type);
Main.npc[index2].ai[2] = (float) Style;
Main.npc[index2].releaseOwner = (short) who;
break;
case 583:
case 584:
case 585:
int index3 = NPC.NewNPC(x, y, Type);
Main.npc[index3].releaseOwner = (short) who;
Main.npc[index3].ai[2] = 2f;
Main.npc[index3].TargetClosest();
Main.npc[index3].ai[3] = 0.0f;
Main.npc[index3].netUpdate = true;
break;
case 614:
int index4 = NPC.NewNPC(x, y, Type);
Main.npc[index4].releaseOwner = (short) who;
int num = Main.player[who].direction;
if (Style > 2)
{
Style -= 2;
Main.npc[index4].SpawnedFromStatue = true;
}
if (Style == 1)
num = 1;
if (Style == 2)
num = -1;
Main.npc[index4].direction = num;
Main.npc[index4].spriteDirection = num;
Main.npc[index4].netUpdate = true;
break;
default:
int index5 = NPC.NewNPC(x, y, Type);
Main.npc[index5].releaseOwner = (short) who;
break;
}
}
}
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.nearbyActiveNPCs > (double) num1)
return;
int maxValue1 = 45 + (int) (450.0 * (double) (player.nearbyActiveNPCs / 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 bool Spawning_FlyingAntlionCheck(int x, int y)
{
if (!WorldGen.InWorld(x, y, 10))
return false;
for (int index = 0; index < 50 && y - index >= 10; ++index)
{
Tile tile = Main.tile[x, y - index];
if (!WallID.Sets.Conversion.HardenedSand[(int) tile.wall] && !WallID.Sets.Conversion.Sandstone[(int) tile.wall])
return false;
}
return true;
}
private static int RollDragonflyType(int tileType = 2) => tileType == 53 ? (int) Main.rand.NextFromList<short>((short) 595, (short) 598, (short) 600) : (int) Main.rand.NextFromList<short>((short) 596, (short) 597, (short) 599);
public static void SpawnNPC()
{
if (NPC.noSpawnCycle)
{
NPC.noSpawnCycle = false;
}
else
{
bool windyForButterflies = NPC.TooWindyForButterflies;
bool flag1 = (double) Main.windSpeedTarget < -0.2 || (double) Main.windSpeedTarget > 0.2;
NPC.RevengeManager.CheckRespawns();
bool flag2 = false;
int index1 = 0;
int index2 = 0;
int num1 = 0;
int num2 = 0;
for (int index3 = 0; index3 < (int) byte.MaxValue; ++index3)
{
if (Main.player[index3].active)
++num2;
}
float num3 = 0.0f;
for (int index4 = 0; index4 < 200; ++index4)
{
if (Main.npc[index4].active)
{
switch (Main.npc[index4].type)
{
case 315:
case 325:
case 327:
case 328:
case 344:
case 345:
case 346:
num3 += Main.npc[index4].npcSlots;
continue;
default:
continue;
}
}
}
float num4 = (float) (int) ((double) NPC.defaultMaxSpawns * (2.0 + 0.300000011920929 * (double) num2));
for (int index5 = 0; index5 < (int) byte.MaxValue; ++index5)
{
if (Main.player[index5].active && !Main.player[index5].dead)
{
bool flag3 = false;
if (!Main.player[index5].isNearNPC(398, (float) NPC.MoonLordFightingDistance))
{
if (Main.slimeRain)
NPC.SlimeRainSpawns(index5);
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 = NPC.downedPlantBoss && Main.hardMode;
bool itAhappyWindyDay = Main.IsItAHappyWindyDay;
if (Main.player[index5].active && Main.invasionType > 0 && Main.invasionDelay == 0 && Main.invasionSize > 0 && (double) Main.player[index5].position.Y < Main.worldSurface * 16.0 + (double) NPC.sHeight)
{
int num5 = 3000;
if ((double) Main.player[index5].position.X > Main.invasionX * 16.0 - (double) num5 && (double) Main.player[index5].position.X < Main.invasionX * 16.0 + (double) num5)
flag6 = true;
else if (Main.invasionX >= (double) (Main.maxTilesX / 2 - 5) && Main.invasionX <= (double) (Main.maxTilesX / 2 + 5))
{
for (int index6 = 0; index6 < 200; ++index6)
{
if (Main.npc[index6].townNPC && (double) Math.Abs(Main.player[index5].position.X - Main.npc[index6].Center.X) < (double) num5)
{
if (Main.rand.Next(3) != 0)
{
flag6 = true;
break;
}
break;
}
}
}
}
if (Main.player[index5].ZoneTowerSolar || Main.player[index5].ZoneTowerNebula || Main.player[index5].ZoneTowerVortex || Main.player[index5].ZoneTowerStardust)
flag6 = true;
int index7 = (int) ((double) Main.player[index5].position.X + (double) (Main.player[index5].width / 2)) / 16;
int index8 = (int) ((double) Main.player[index5].position.Y + (double) (Main.player[index5].height / 2)) / 16;
if (Main.wallHouse[(int) Main.tile[index7, index8].wall])
flag5 = true;
if (Main.tile[index7, index8].wall == (ushort) 87)
flag4 = true;
bool flag15 = 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[index5].position.Y > (double) (Main.UnderworldLayer * 16))
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 2.0);
else if ((double) Main.player[index5].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[index5].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[index5].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[index5].ZoneSnow && (double) Main.player[index5].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.drunkWorld && Main.tile[index7, index8].wall == (ushort) 86)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.3);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.79999995231628);
}
if (Main.player[index5].ZoneDungeon)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.3);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.79999995231628);
}
else if (Main.player[index5].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[index5].ZoneUndergroundDesert)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.200000002980232);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 3.0);
}
else if (Main.player[index5].ZoneJungle)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.4);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.5);
}
else if (Main.player[index5].ZoneCorrupt || Main.player[index5].ZoneCrimson)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.65);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.29999995231628);
}
else if (Main.player[index5].ZoneMeteor)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.4);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.10000002384186);
}
if (Main.player[index5].ZoneHallow && (double) Main.player[index5].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.wofNPCIndex >= 0 && (double) Main.player[index5].position.Y > (double) (Main.UnderworldLayer * 16))
{
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.300000011920929);
NPC.spawnRate *= 3;
}
if ((double) Main.player[index5].nearbyActiveNPCs < (double) NPC.maxSpawns * 0.2)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.600000023841858);
else if ((double) Main.player[index5].nearbyActiveNPCs < (double) NPC.maxSpawns * 0.4)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.699999988079071);
else if ((double) Main.player[index5].nearbyActiveNPCs < (double) NPC.maxSpawns * 0.6)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.800000011920929);
else if ((double) Main.player[index5].nearbyActiveNPCs < (double) NPC.maxSpawns * 0.8)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.899999976158142);
if ((double) Main.player[index5].position.Y / 16.0 > (Main.worldSurface + Main.rockLayer) / 2.0 || Main.player[index5].ZoneCorrupt || Main.player[index5].ZoneCrimson)
{
if ((double) Main.player[index5].nearbyActiveNPCs < (double) NPC.maxSpawns * 0.2)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.699999988079071);
else if ((double) Main.player[index5].nearbyActiveNPCs < (double) NPC.maxSpawns * 0.4)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.899999976158142);
}
if (Main.player[index5].invis)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.20000004768372);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.800000011920929);
}
if (Main.player[index5].calmed)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.29999995231628);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.699999988079071);
}
if (Main.player[index5].sunflower)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.20000004768372);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.800000011920929);
}
if (Main.player[index5].enemySpawns)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.5);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 2.0);
}
if (Main.player[index5].ZoneWaterCandle || Main.player[index5].inventory[Main.player[index5].selectedItem].type == 148)
{
if (!Main.player[index5].ZonePeaceCandle && Main.player[index5].inventory[Main.player[index5].selectedItem].type != 3117)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.75);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.5);
}
}
else if (Main.player[index5].ZonePeaceCandle || Main.player[index5].inventory[Main.player[index5].selectedItem].type == 3117)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.3);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.699999988079071);
}
if (Main.player[index5].ZoneWaterCandle && (double) Main.player[index5].position.Y / 16.0 < Main.worldSurface * 0.349999994039536)
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.5);
if (Main.player[index5].isNearFairy())
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.20000004768372);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.800000011920929);
}
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.getGoodWorld)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.800000011920929);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.20000004768372);
}
if (Main.GameModeInfo.IsJourneyMode)
{
CreativePowers.SpawnRateSliderPerPlayerPower power = CreativePowerManager.Instance.GetPower<CreativePowers.SpawnRateSliderPerPlayerPower>();
if (power != null && power.GetIsUnlocked())
{
if (!power.GetShouldDisableSpawnsFor(index5))
{
float num6;
if (power.GetRemappedSliderValueFor(index5, out num6))
{
NPC.spawnRate = (int) ((double) NPC.spawnRate / (double) num6);
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * (double) num6);
}
}
else
continue;
}
}
if ((Main.pumpkinMoon || Main.snowMoon) && (double) Main.player[index5].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[index5].ZoneOldOneArmy)
{
NPC.maxSpawns = NPC.defaultMaxSpawns;
NPC.spawnRate = NPC.defaultSpawnRate;
}
if (flag6)
{
NPC.maxSpawns = (int) ((double) NPC.defaultMaxSpawns * (2.0 + 0.3 * (double) num2));
NPC.spawnRate = 20;
}
if (Main.player[index5].ZoneDungeon && !NPC.downedBoss3)
NPC.spawnRate = 10;
if (!flag6 && (!Main.bloodMoon && !Main.pumpkinMoon && !Main.snowMoon || Main.dayTime) && (!Main.eclipse || !Main.dayTime) && !Main.player[index5].ZoneDungeon && !Main.player[index5].ZoneCorrupt && !Main.player[index5].ZoneCrimson && !Main.player[index5].ZoneMeteor && !Main.player[index5].ZoneOldOneArmy)
{
if ((double) Main.player[index5].Center.Y / 16.0 > (double) Main.UnderworldLayer)
{
if ((double) Main.player[index5].townNPCs == 1.0)
{
if (Main.rand.Next(2) == 0)
flag5 = true;
if (Main.rand.Next(10) == 0)
{
flag12 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.5);
}
else
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.25);
}
else if ((double) Main.player[index5].townNPCs == 2.0)
{
if (Main.rand.Next(4) != 0)
flag5 = true;
if (Main.rand.Next(5) == 0)
{
flag12 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.5);
}
else
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.5);
}
else if ((double) Main.player[index5].townNPCs >= 3.0)
{
if (Main.rand.Next(10) != 0)
flag5 = true;
if (Main.rand.Next(3) == 0)
{
flag12 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.5);
}
else
NPC.spawnRate = (int) ((double) NPC.spawnRate * 2.0);
}
}
else if ((double) Main.player[index5].townNPCs == 1.0)
{
flag5 = true;
if (Main.player[index5].ZoneGraveyard)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 1.66);
if (Main.rand.Next(9) == 1)
{
flag12 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6);
}
}
else if (Main.rand.Next(3) == 1)
{
flag12 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6);
}
else
NPC.spawnRate = (int) ((double) NPC.spawnRate * 2.0);
}
else if ((double) Main.player[index5].townNPCs == 2.0)
{
flag5 = true;
if (Main.player[index5].ZoneGraveyard)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 2.33);
if (Main.rand.Next(6) == 1)
{
flag12 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6);
}
}
else if (Main.rand.Next(3) != 0)
{
flag12 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6);
}
else
NPC.spawnRate = (int) ((double) NPC.spawnRate * 3.0);
}
else if ((double) Main.player[index5].townNPCs >= 3.0)
{
flag5 = true;
if (Main.player[index5].ZoneGraveyard)
{
NPC.spawnRate = (int) ((double) NPC.spawnRate * 3.0);
if (Main.rand.Next(3) == 1)
{
flag12 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6);
}
}
else
{
if (!Main.expertMode || Main.rand.Next(30) != 0)
flag12 = true;
NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6);
}
}
}
bool flag16 = false;
if (Main.player[index5].active && !Main.player[index5].dead && (double) Main.player[index5].nearbyActiveNPCs < (double) NPC.maxSpawns && Main.rand.Next(NPC.spawnRate) == 0)
{
bool flag17 = Main.player[index5].ZoneTowerNebula || Main.player[index5].ZoneTowerSolar || Main.player[index5].ZoneTowerStardust || Main.player[index5].ZoneTowerVortex;
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[index5].inventory[Main.player[index5].selectedItem].type == 1254 || Main.player[index5].inventory[Main.player[index5].selectedItem].type == 1299 || Main.player[index5].scope)
{
float num7 = 1.5f;
if (Main.player[index5].inventory[Main.player[index5].selectedItem].type == 1254 && Main.player[index5].scope)
num7 = 1.25f;
else if (Main.player[index5].inventory[Main.player[index5].selectedItem].type == 1254)
num7 = 1.5f;
else if (Main.player[index5].inventory[Main.player[index5].selectedItem].type == 1299)
num7 = 1.5f;
else if (Main.player[index5].scope)
num7 = 2f;
NPC.spawnRangeX += (int) ((double) (NPC.sWidth / 16) * 0.5 / (double) num7);
NPC.spawnRangeY += (int) ((double) (NPC.sHeight / 16) * 0.5 / (double) num7);
NPC.safeRangeX += (int) ((double) (NPC.sWidth / 16) * 0.5 / (double) num7);
NPC.safeRangeY += (int) ((double) (NPC.sHeight / 16) * 0.5 / (double) num7);
}
int minValue1 = (int) ((double) Main.player[index5].position.X / 16.0) - NPC.spawnRangeX;
int maxValue1 = (int) ((double) Main.player[index5].position.X / 16.0) + NPC.spawnRangeX;
int minValue2 = (int) ((double) Main.player[index5].position.Y / 16.0) - NPC.spawnRangeY;
int maxValue2 = (int) ((double) Main.player[index5].position.Y / 16.0) + NPC.spawnRangeY;
int num8 = (int) ((double) Main.player[index5].position.X / 16.0) - NPC.safeRangeX;
int num9 = (int) ((double) Main.player[index5].position.X / 16.0) + NPC.safeRangeX;
int num10 = (int) ((double) Main.player[index5].position.Y / 16.0) - NPC.safeRangeY;
int num11 = (int) ((double) Main.player[index5].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 index9 = 0; index9 < 50; ++index9)
{
int index10 = Main.rand.Next(minValue1, maxValue1);
int index11 = Main.rand.Next(minValue2, maxValue2);
if (!Main.tile[index10, index11].nactive() || !Main.tileSolid[(int) Main.tile[index10, index11].type])
{
if (flag17 || !Main.wallHouse[(int) Main.tile[index10, index11].wall])
{
if (!flag6 && (double) index11 < Main.worldSurface * 0.349999994039536 && !flag12 && ((double) index10 < (double) Main.maxTilesX * 0.45 || (double) index10 > (double) Main.maxTilesX * 0.55 || Main.hardMode))
{
num1 = (int) Main.tile[index10, index11].type;
index1 = index10;
index2 = index11;
flag15 = true;
flag3 = true;
}
else if (!flag6 && (double) index11 < Main.worldSurface * 0.449999988079071 && !flag12 && Main.hardMode && Main.rand.Next(10) == 0)
{
num1 = (int) Main.tile[index10, index11].type;
index1 = index10;
index2 = index11;
flag15 = true;
flag3 = true;
}
else
{
for (int index12 = index11; index12 < Main.maxTilesY && index12 < maxValue2; ++index12)
{
if (Main.tile[index10, index12].nactive() && Main.tileSolid[(int) Main.tile[index10, index12].type])
{
if (index10 < num8 || index10 > num9 || index12 < num10 || index12 > num11)
{
num1 = (int) Main.tile[index10, index12].type;
index1 = index10;
index2 = index12;
flag15 = true;
break;
}
break;
}
}
}
if (!flag3 && Main.player[index5].afkCounter >= NPC.AFKTimeNeededForNoWorms)
flag5 = true;
if (flag15)
{
int num12 = index1 - NPC.spawnSpaceX / 2;
int num13 = index1 + NPC.spawnSpaceX / 2;
int num14 = index2 - NPC.spawnSpaceY;
int num15 = index2;
if (num12 < 0)
flag15 = false;
if (num13 > Main.maxTilesX)
flag15 = false;
if (num14 < 0)
flag15 = false;
if (num15 > Main.maxTilesY)
flag15 = false;
if (flag15)
{
for (int index13 = num12; index13 < num13; ++index13)
{
for (int index14 = num14; index14 < num15; ++index14)
{
if (Main.tile[index13, index14].nactive() && Main.tileSolid[(int) Main.tile[index13, index14].type])
{
flag15 = false;
break;
}
if (Main.tile[index13, index14].lava())
{
flag15 = false;
break;
}
}
}
}
if (index1 >= num8 && index1 <= num9)
flag16 = true;
}
}
else
continue;
}
if (flag15 || flag15)
break;
}
}
if (flag15)
{
Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle(index1 * 16, index2 * 16, 16, 16);
for (int index15 = 0; index15 < (int) byte.MaxValue; ++index15)
{
if (Main.player[index15].active)
{
Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.player[index15].position.X + (double) (Main.player[index15].width / 2) - (double) (NPC.sWidth / 2) - (double) NPC.safeRangeX), (int) ((double) Main.player[index15].position.Y + (double) (Main.player[index15].height / 2) - (double) (NPC.sHeight / 2) - (double) NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2);
if (rectangle1.Intersects(rectangle2))
flag15 = false;
}
}
}
if (flag15)
{
if (Main.player[index5].ZoneDungeon && (!Main.tileDungeon[(int) Main.tile[index1, index2].type] || Main.tile[index1, index2 - 1].wall == (ushort) 0))
flag15 = false;
if (Main.tile[index1, index2 - 1].liquid > (byte) 0 && Main.tile[index1, index2 - 2].liquid > (byte) 0 && !Main.tile[index1, index2 - 1].lava())
{
if (Main.tile[index1, index2 - 1].honey())
flag8 = true;
else
flag7 = true;
}
int index16 = (int) Main.player[index5].Center.X / 16;
int index17 = (int) ((double) Main.player[index5].Bottom.Y + 8.0) / 16;
if (Main.tile[index1, index2].type == (ushort) 367)
flag10 = true;
else if (Main.tile[index1, index2].type == (ushort) 368)
flag9 = true;
else if (Main.tile[index16, index17].type == (ushort) 367)
flag10 = true;
else if (Main.tile[index16, index17].type == (ushort) 368)
{
flag9 = true;
}
else
{
int num16 = Main.rand.Next(20, 31);
int num17 = Main.rand.Next(1, 4);
if (index1 - num16 < 0)
num16 = index1;
if (index2 - num16 < 0)
num16 = index2;
if (index1 + num16 >= Main.maxTilesX)
num16 = Main.maxTilesX - index1 - 1;
if (index2 + num16 >= Main.maxTilesY)
num16 = Main.maxTilesY - index2 - 1;
for (int index18 = index1 - num16; index18 <= index1 + num16; index18 += num17)
{
int num18 = Main.rand.Next(1, 4);
for (int index19 = index2 - num16; index19 <= index2 + num16; index19 += num18)
{
if (Main.tile[index18, index19].type == (ushort) 367)
flag10 = true;
if (Main.tile[index18, index19].type == (ushort) 368)
flag9 = true;
}
}
int num19 = Main.rand.Next(30, 61);
int num20 = Main.rand.Next(3, 7);
if (index16 - num19 < 0)
num19 = index16;
if (index17 - num19 < 0)
num19 = index17;
if (index16 + num19 >= Main.maxTilesX)
num19 = Main.maxTilesX - index16 - 2;
if (index17 + num19 >= Main.maxTilesY)
num19 = Main.maxTilesY - index17 - 2;
for (int index20 = index16 - num19; index20 <= index16 + num19; index20 += num20)
{
int num21 = Main.rand.Next(3, 7);
for (int index21 = index17 - num19; index21 <= index17 + num19; index21 += num21)
{
if (Main.tile[index20, index21].type == (ushort) 367)
flag10 = true;
if (Main.tile[index20, index21].type == (ushort) 368)
flag9 = true;
}
}
}
if (flag8)
flag15 = false;
if ((num1 == 477 || num1 == 492) && !Main.bloodMoon && !Main.eclipse && Main.invasionType <= 0 && !Main.pumpkinMoon && !Main.snowMoon && !Main.slimeRain && Main.rand.Next(100) < 10)
flag15 = false;
}
if (flag15)
{
if ((double) index2 > Main.rockLayer && index2 < Main.UnderworldLayer && !Main.player[index5].ZoneDungeon && !flag6)
{
if (Main.rand.Next(3) == 0)
{
int num22 = Main.rand.Next(5, 15);
if (index1 - num22 >= 0 && index1 + num22 < Main.maxTilesX)
{
for (int index22 = index1 - num22; index22 < index1 + num22; ++index22)
{
for (int index23 = index2 - num22; index23 < index2 + num22; ++index23)
{
if (Main.tile[index22, index23].wall == (ushort) 62)
flag11 = true;
}
}
}
}
else
{
int index24 = (int) Main.player[index5].position.X / 16;
int index25 = (int) Main.player[index5].position.Y / 16;
if (Main.tile[index24, index25].wall == (ushort) 62)
flag11 = true;
}
}
if ((double) index2 < Main.rockLayer && index2 > 200 && !Main.player[index5].ZoneDungeon && !flag6)
{
if (Main.rand.Next(3) == 0)
{
int num23 = Main.rand.Next(5, 15);
if (index1 - num23 >= 0 && index1 + num23 < Main.maxTilesX)
{
for (int index26 = index1 - num23; index26 < index1 + num23; ++index26)
{
for (int index27 = index2 - num23; index27 < index2 + num23; ++index27)
{
if (WallID.Sets.Conversion.Sandstone[(int) Main.tile[index26, index27].wall] || WallID.Sets.Conversion.HardenedSand[(int) Main.tile[index26, index27].wall])
flag13 = true;
}
}
}
}
else
{
int index28 = (int) Main.player[index5].position.X / 16;
int index29 = (int) Main.player[index5].position.Y / 16;
if (WallID.Sets.Conversion.Sandstone[(int) Main.tile[index28, index29].wall] || WallID.Sets.Conversion.HardenedSand[(int) Main.tile[index28, index29].wall])
flag13 = true;
}
}
flag2 = false;
int type = (int) Main.tile[index1, index2].type;
int num24 = (int) Main.tile[index1, index2 - 1].wall;
if (Main.tile[index1, index2 - 2].wall == (ushort) 244 || Main.tile[index1, index2].wall == (ushort) 244)
num24 = 244;
bool flag18 = (double) new Point(index7 - index1, index8 - index2).X * (double) Main.windSpeedTarget > 0.0;
int tileType = NPC.SpawnNPC_TryFindingProperGroundTileType(type, index1, index2);
int newNPC = 200;
if (Main.player[index5].ZoneTowerNebula)
{
bool flag19 = true;
int Type = 0;
while (flag19)
{
Type = Utils.SelectRandom<int>(Main.rand, 424, 424, 424, 423, 423, 423, 421, 421, 421, 421, 421, 420);
flag19 = false;
if (Type == 424 && NPC.CountNPCS(Type) >= 2)
flag19 = true;
if (Type == 423 && NPC.CountNPCS(Type) >= 3)
flag19 = true;
if (Type == 420 && NPC.CountNPCS(Type) >= 2)
flag19 = true;
}
if (Type != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Type, 1);
}
else if (Main.player[index5].ZoneTowerVortex)
{
bool flag20 = true;
int Type = 0;
while (flag20)
{
Type = Utils.SelectRandom<int>(Main.rand, 429, 429, 429, 429, 427, 427, 425, 425, 426);
flag20 = false;
if (Type == 425 && NPC.CountNPCS(Type) >= 3)
flag20 = true;
if (Type == 426 && NPC.CountNPCS(Type) >= 3)
flag20 = true;
if (Type == 429 && NPC.CountNPCS(Type) >= 4)
flag20 = true;
}
if (Type != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Type, 1);
}
else if (Main.player[index5].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, index2 * 16, Type, 1);
}
else if (Main.player[index5].ZoneTowerSolar)
{
bool flag21 = true;
int Type = 0;
while (flag21)
{
Type = Utils.SelectRandom<int>(Main.rand, 518, 419, 418, 412, 417, 416, 415);
flag21 = false;
if (Type == 415 && NPC.CountNPCS(Type) >= 2)
flag21 = true;
if (Type == 416 && NPC.CountNPCS(Type) >= 1)
flag21 = true;
if (Type == 518 && NPC.CountNPCS(Type) >= 2)
flag21 = true;
if (Type == 412 && NPC.CountNPCS(Type) >= 1)
flag21 = true;
}
if (Type != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Type, 1);
}
else if (flag3)
{
int maxValue3 = 8;
int maxValue4 = 30;
bool flag22 = (double) Math.Abs(index1 - Main.maxTilesX / 2) / (double) (Main.maxTilesX / 2) > 0.330000013113022 && (Main.wallLight[(int) Main.tile[index7, index8].wall] || Main.tile[index7, index8].wall == (ushort) 73);
if (flag22 && NPC.AnyDanger())
flag22 = false;
if (Main.player[index5].ZoneWaterCandle)
{
maxValue3 = 3;
maxValue4 = 10;
}
if (flag6 && Main.invasionType == 4)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 388);
else if (flag22 && Main.hardMode && NPC.downedGolemBoss && (!NPC.downedMartians && Main.rand.Next(maxValue3) == 0 || Main.rand.Next(maxValue4) == 0) && !NPC.AnyNPCs(399))
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 399);
else if (flag22 && Main.hardMode && NPC.downedGolemBoss && (!NPC.downedMartians && Main.rand.Next(maxValue3) == 0 || Main.rand.Next(maxValue4) == 0) && !NPC.AnyNPCs(399) && (Main.player[index5].inventory[Main.player[index5].selectedItem].type == 148 || Main.player[index5].ZoneWaterCandle))
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 399);
else if (Main.hardMode && !NPC.AnyNPCs(87) && !flag5 && Main.rand.Next(10) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 87, 1);
else if (Main.hardMode && !NPC.AnyNPCs(87) && !flag5 && Main.rand.Next(10) == 0 && (Main.player[index5].inventory[Main.player[index5].selectedItem].type == 148 || Main.player[index5].ZoneWaterCandle))
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 87, 1);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 48);
}
else if (flag6)
{
switch (Main.invasionType)
{
case 1:
if (Main.hardMode && !NPC.AnyNPCs(471) && Main.rand.Next(30) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 471);
break;
}
if (Main.rand.Next(9) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 29);
break;
}
if (Main.rand.Next(5) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 26);
break;
}
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 111);
break;
}
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 27);
break;
}
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 28);
break;
case 2:
if (Main.rand.Next(7) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 145);
break;
}
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 143);
break;
}
NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 - 40, index2 - 10))
{
NPC.NewNPC(index1 * 16 + 8, (index2 - 10) * 16, 491);
break;
}
if (Main.rand.Next(30) == 0 && !NPC.AnyNPCs(216))
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 216);
break;
}
if (Main.rand.Next(11) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 215);
break;
}
if (Main.rand.Next(9) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 252);
break;
}
if (Main.rand.Next(7) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 214);
break;
}
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 213);
break;
}
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 212);
break;
case 4:
int Type1 = 0;
int num25 = Main.rand.Next(7);
bool flag23 = (double) (Main.invasionSizeStart - Main.invasionSize) / (double) Main.invasionSizeStart >= 0.300000011920929 && !NPC.AnyNPCs(395);
if (Main.rand.Next(45) == 0 & flag23)
Type1 = 395;
else if (num25 >= 6)
{
if (Main.rand.Next(20) == 0 & flag23)
{
Type1 = 395;
}
else
{
int num26 = Main.rand.Next(2);
if (num26 == 0)
Type1 = 390;
if (num26 == 1)
Type1 = 386;
}
}
else if (num25 >= 4)
{
int num27 = Main.rand.Next(5);
Type1 = num27 >= 2 ? (num27 >= 4 ? 388 : 381) : 382;
}
else
{
int num28 = Main.rand.Next(4);
if (num28 == 3)
{
if (!NPC.AnyNPCs(520))
Type1 = 520;
else
num28 = Main.rand.Next(3);
}
if (num28 == 0)
Type1 = 385;
if (num28 == 1)
Type1 = 389;
if (num28 == 2)
Type1 = 383;
}
if (Type1 != 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Type1, 1);
break;
}
break;
}
}
else if (num24 == 244)
{
if (flag7)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 55);
else if ((double) index2 > Main.worldSurface)
{
if (Main.rand.Next(3) == 0)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 447);
else
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 300);
}
else if (Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 359);
else if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 448);
else if (Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 357);
}
else if (Main.player[index5].RollLuck(2) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 624);
Main.npc[newNPC].timeLeft *= 10;
}
else if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 443);
else if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 539);
else if (Main.halloween && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 303);
else if (Main.xMas && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 337);
else if (BirthdayParty.PartyIsUp && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 540);
else if (Main.rand.Next(3) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, (int) Utils.SelectRandom<short>(Main.rand, (short) 299, (short) 538));
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 46);
}
else if (!NPC.savedBartender && DD2Event.ReadyToFindBartender && !NPC.AnyNPCs(579) && Main.rand.Next(80) == 0 && !flag7)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 579);
else if (Main.tile[index1, index2].wall == (ushort) 62 | flag11)
{
if (Main.tile[index1, index2].wall == (ushort) 62 && Main.rand.Next(8) == 0 && !flag7 && (double) index2 >= Main.rockLayer && index2 < Main.maxTilesY - 210 && !NPC.savedStylist && !NPC.AnyNPCs(354))
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 354);
else if (Main.hardMode && Main.rand.Next(10) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 163);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 164);
}
else if (((WallID.Sets.Conversion.HardenedSand[(int) Main.tile[index1, index2].wall] ? 1 : (WallID.Sets.Conversion.Sandstone[(int) Main.tile[index1, index2].wall] ? 1 : 0)) | (flag13 ? 1 : 0)) != 0 && WorldGen.checkUnderground(index1, index2) && NPC.Spawning_FlyingAntlionCheck(index1, index2))
{
float num29 = 1f;
if ((double) index2 > (Main.rockLayer * 2.0 + (double) Main.maxTilesY) / 3.0)
num29 *= 0.5f;
else if ((double) index2 > Main.rockLayer)
num29 *= 0.75f;
if (Main.rand.Next(20) == 0 && !flag7 && !NPC.savedGolfer && !NPC.AnyNPCs(589))
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 589);
else if (Main.hardMode && Main.rand.Next((int) (33.0 * (double) num29)) == 0 && !flag5 && (double) index2 > Main.worldSurface + 100.0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 510);
else if (Main.rand.Next((int) (33.0 * (double) num29)) == 0 && !flag5 && (double) index2 > Main.worldSurface + 100.0 && NPC.CountNPCS(513) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 513);
else if (Main.hardMode && Main.rand.Next(5) != 0)
{
List<int> intList = new List<int>();
if (Main.player[index5].ZoneCorrupt)
{
intList.Add(525);
intList.Add(525);
}
if (Main.player[index5].ZoneCrimson)
{
intList.Add(526);
intList.Add(526);
}
if (Main.player[index5].ZoneHallow)
{
intList.Add(527);
intList.Add(527);
}
if (intList.Count == 0)
{
intList.Add(524);
intList.Add(524);
}
if (Main.player[index5].ZoneCorrupt || Main.player[index5].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, index2 * 16, Type2);
intList.Clear();
}
else
{
int Type3 = Utils.SelectRandom<int>(Main.rand, 69, 580, 580, 580, 581);
if (Main.rand.Next(15) == 0)
Type3 = 537;
else if (Main.rand.Next(10) == 0)
{
switch (Type3)
{
case 580:
Type3 = 508;
break;
case 581:
Type3 = 509;
break;
}
}
NPC.NewNPC(index1 * 16 + 8, index2 * 16, Type3);
}
}
else if (Main.hardMode & flag7 && Main.player[index5].ZoneJungle && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 157);
else if (Main.hardMode & flag7 && Main.player[index5].ZoneCrimson && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 242);
else if (Main.hardMode & flag7 && Main.player[index5].ZoneCrimson && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 241);
else if (((!flag12 ? 1 : (NPC.savedAngler ? 0 : (!NPC.AnyNPCs(376) ? 1 : 0))) & (flag7 ? 1 : 0)) != 0 && ((index1 < WorldGen.oceanDistance || index1 > Main.maxTilesX - WorldGen.oceanDistance) && Main.tileSand[tileType] && (double) index2 < Main.rockLayer || num1 == 53 && WorldGen.oceanDepths(index1, index2)))
{
bool flag24 = false;
if (!NPC.savedAngler && !NPC.AnyNPCs(376) && (double) index2 < Main.worldSurface - 10.0)
{
int num30 = -1;
for (int j = index2 - 1; j > index2 - 50; --j)
{
if (Main.tile[index1, j].liquid == (byte) 0 && !WorldGen.SolidTile(index1, j) && !WorldGen.SolidTile(index1, j + 1) && !WorldGen.SolidTile(index1, j + 2))
{
num30 = j + 2;
break;
}
}
if (num30 > index2)
num30 = index2;
if (num30 > 0 && !flag16)
{
NPC.NewNPC(index1 * 16 + 8, num30 * 16, 376);
flag24 = true;
}
}
if (!flag24)
{
int num31 = -1;
int num32 = -1;
if ((double) index2 < Main.worldSurface && index2 > 50)
{
for (int j = index2 - 1; j > index2 - 50; --j)
{
if (Main.tile[index1, j].liquid == (byte) 0 && !WorldGen.SolidTile(index1, j) && !WorldGen.SolidTile(index1, j + 1) && !WorldGen.SolidTile(index1, j + 2))
{
num31 = j + 2;
if (!WorldGen.SolidTile(index1, num31 + 1) && !WorldGen.SolidTile(index1, num31 + 2))
{
num32 = num31 + 2;
break;
}
break;
}
}
if (num31 > index2)
num31 = index2;
if (num32 > index2)
num32 = index2;
}
if (num31 > 0 && !flag16 && Main.rand.Next(10) == 0)
NPC.NewNPC(index1 * 16 + 8, num31 * 16, 602);
else if (Main.rand.Next(10) == 0)
{
int num33 = Main.rand.Next(3);
if (num33 == 0 && num31 > 0)
NPC.NewNPC(index1 * 16 + 8, num31 * 16, 625);
else if (num33 == 1 && num32 > 0)
NPC.NewNPC(index1 * 16 + 8, num32 * 16, 615);
else if (num33 == 2 && num32 > 0)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, num32 * 16, 627);
else
NPC.NewNPC(index1 * 16 + 8, num32 * 16, 626);
}
}
else if (Main.rand.Next(40) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 220);
else if (Main.rand.Next(18) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 221);
else if (Main.rand.Next(8) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 65);
else if (Main.rand.Next(3) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 67);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 64);
}
}
else if (!flag7 && !NPC.savedAngler && !NPC.AnyNPCs(376) && (index1 < WorldGen.beachDistance || index1 > Main.maxTilesX - WorldGen.beachDistance) && Main.tileSand[tileType] && (double) index2 < Main.worldSurface)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 376);
else if (!flag12 & flag7 && ((double) index2 > Main.rockLayer && Main.rand.Next(2) == 0 || tileType == 60))
{
bool flag25 = false;
if (tileType == 60 && (double) index2 < Main.worldSurface && index2 > 50 && Main.rand.Next(3) == 0 && Main.dayTime)
{
int num34 = -1;
for (int j = index2 - 1; j > index2 - 50; --j)
{
if (Main.tile[index1, j].liquid == (byte) 0 && !WorldGen.SolidTile(index1, j) && !WorldGen.SolidTile(index1, j + 1) && !WorldGen.SolidTile(index1, j + 2))
{
num34 = j + 2;
break;
}
}
if (num34 > index2)
num34 = index2;
if (num34 > 0 && !flag16)
{
flag25 = true;
if (Main.rand.Next(4) == 0)
{
flag25 = true;
NPC.NewNPC(index1 * 16 + 8, num34 * 16, 617);
}
else if (!flag1 && (double) Main.cloudAlpha == 0.0)
{
flag25 = true;
int num35 = Main.rand.Next(1, 4);
for (int index30 = 0; index30 < num35; ++index30)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8 + Main.rand.Next(-16, 17), num34 * 16 - 16, 613);
else
NPC.NewNPC(index1 * 16 + 8 + Main.rand.Next(-16, 17), num34 * 16 - 16, 612);
}
}
}
}
if (!flag25)
{
if (Main.hardMode && Main.rand.Next(3) > 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 102);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 58);
}
}
else if (!flag12 & flag7 && (double) index2 > Main.worldSurface && Main.rand.Next(3) == 0)
{
if (Main.hardMode && Main.rand.Next(3) > 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 103);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 63);
}
else if (flag7 && Main.rand.Next(4) == 0 && (index1 > WorldGen.oceanDistance && index1 < Main.maxTilesX - WorldGen.oceanDistance || (double) index2 > Main.worldSurface + 50.0))
{
if (Main.player[index5].ZoneCorrupt)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 57);
else if ((double) index2 < Main.worldSurface && index2 > 50 && Main.rand.Next(3) != 0 && Main.dayTime)
{
int num36 = -1;
for (int j = index2 - 1; j > index2 - 50; --j)
{
if (Main.tile[index1, j].liquid == (byte) 0 && !WorldGen.SolidTile(index1, j) && !WorldGen.SolidTile(index1, j + 1) && !WorldGen.SolidTile(index1, j + 2))
{
num36 = j + 2;
break;
}
}
if (num36 > index2)
num36 = index2;
if (num36 > 0 && !flag16)
{
if (Main.rand.Next(5) == 0 && (num1 == 2 || num1 == 477))
NPC.NewNPC(index1 * 16 + 8, num36 * 16, 616);
else if (num1 == 53)
{
if (Main.rand.Next(2) == 0 && !flag1 && (double) Main.cloudAlpha == 0.0)
{
int num37 = Main.rand.Next(1, 4);
for (int index31 = 0; index31 < num37; ++index31)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8 + Main.rand.Next(-16, 17), num36 * 16 - 16, 613);
else
NPC.NewNPC(index1 * 16 + 8 + Main.rand.Next(-16, 17), num36 * 16 - 16, 612);
}
}
else
NPC.NewNPC(index1 * 16 + 8, num36 * 16, 608);
}
else if (Main.rand.Next(2) == 0)
NPC.NewNPC(index1 * 16 + 8, num36 * 16, 362);
else
NPC.NewNPC(index1 * 16 + 8, num36 * 16, 364);
}
else if (num1 == 53)
NPC.NewNPC(index1 * 16 + 8, num36 * 16, 607);
else if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 592);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 55);
}
else if (num1 == 53)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 607);
else if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 592);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 55);
}
else if (NPC.downedGoblins && Main.player[index5].RollLuck(20) == 0 && !flag7 && (double) index2 >= Main.rockLayer && index2 < Main.maxTilesY - 210 && !NPC.savedGoblin && !NPC.AnyNPCs(105))
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 105);
else if (Main.hardMode && Main.player[index5].RollLuck(20) == 0 && !flag7 && (double) index2 >= Main.rockLayer && index2 < Main.maxTilesY - 210 && !NPC.savedWizard && !NPC.AnyNPCs(106))
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 106);
else if (flag12)
{
if (Main.player[index5].ZoneGraveyard)
{
if (!flag7)
{
if (Main.rand.Next(2) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 606);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 610);
}
}
else if ((double) index2 <= Main.worldSurface && (index1 < WorldGen.beachDistance || index1 > Main.maxTilesX - WorldGen.beachDistance))
{
if (flag7)
{
int num38 = -1;
int num39 = -1;
if ((double) index2 < Main.worldSurface && index2 > 50)
{
for (int j = index2 - 1; j > index2 - 50; --j)
{
if (Main.tile[index1, j].liquid == (byte) 0 && !WorldGen.SolidTile(index1, j) && !WorldGen.SolidTile(index1, j + 1) && !WorldGen.SolidTile(index1, j + 2))
{
num38 = j + 2;
if (!WorldGen.SolidTile(index1, num38 + 1) && !WorldGen.SolidTile(index1, num38 + 2))
{
num39 = num38 + 2;
break;
}
break;
}
}
if (num38 > index2)
num38 = index2;
if (num39 > index2)
num39 = index2;
}
if (Main.rand.Next(2) == 0)
{
int num40 = Main.rand.Next(3);
if (num40 == 0 && num38 > 0)
NPC.NewNPC(index1 * 16 + 8, num38 * 16, 625);
else if (num40 == 1 && num39 > 0)
NPC.NewNPC(index1 * 16 + 8, num39 * 16, 615);
else if (num40 == 2 && num39 > 0)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, num39 * 16, 627);
else
NPC.NewNPC(index1 * 16 + 8, num39 * 16, 626);
}
}
else if (num38 > 0 && !flag16)
NPC.NewNPC(index1 * 16 + 8, num38 * 16, 602);
}
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 602);
}
else
{
int cattailX;
int cattailY;
if ((tileType == 2 || tileType == 477 || tileType == 53) && !windyForButterflies && !Main.raining && Main.dayTime && Main.rand.Next(2) == 0 && (double) index2 <= Main.worldSurface && NPC.FindCattailTop(index1, index2, out cattailX, out cattailY))
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(cattailX * 16 + 8, cattailY * 16, 601);
else
NPC.NewNPC(cattailX * 16 + 8, cattailY * 16, NPC.RollDragonflyType(tileType));
if (Main.rand.Next(3) == 0)
NPC.NewNPC(cattailX * 16 + 8 - 16, cattailY * 16, NPC.RollDragonflyType(tileType));
if (Main.rand.Next(3) == 0)
NPC.NewNPC(cattailX * 16 + 8 + 16, cattailY * 16, NPC.RollDragonflyType(tileType));
}
else if (flag7)
{
if ((double) index2 < Main.worldSurface && index2 > 50 && Main.rand.Next(3) != 0 && Main.dayTime)
{
int num41 = -1;
for (int j = index2 - 1; j > index2 - 50; --j)
{
if (Main.tile[index1, j].liquid == (byte) 0 && !WorldGen.SolidTile(index1, j) && !WorldGen.SolidTile(index1, j + 1) && !WorldGen.SolidTile(index1, j + 2))
{
num41 = j + 2;
break;
}
}
if (num41 > index2)
num41 = index2;
if (num41 > 0 && !flag16)
{
switch (num1)
{
case 53:
if (Main.rand.Next(2) == 0 && !flag1 && (double) Main.cloudAlpha == 0.0)
{
int num42 = Main.rand.Next(1, 4);
for (int index32 = 0; index32 < num42; ++index32)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8 + Main.rand.Next(-16, 17), num41 * 16 - 16, 613);
else
NPC.NewNPC(index1 * 16 + 8 + Main.rand.Next(-16, 17), num41 * 16 - 16, 612);
}
break;
}
NPC.NewNPC(index1 * 16 + 8, num41 * 16, 608);
break;
case 60:
if (Main.rand.Next(2) == 0 && !flag1 && (double) Main.cloudAlpha == 0.0)
{
int num43 = Main.rand.Next(1, 4);
for (int index33 = 0; index33 < num43; ++index33)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8 + Main.rand.Next(-16, 17), num41 * 16 - 16, 613);
else
NPC.NewNPC(index1 * 16 + 8 + Main.rand.Next(-16, 17), num41 * 16 - 16, 612);
}
break;
}
NPC.NewNPC(index1 * 16 + 8, num41 * 16, 617);
break;
default:
if (Main.rand.Next(5) == 0 && (num1 == 2 || num1 == 477))
{
NPC.NewNPC(index1 * 16 + 8, num41 * 16, 616);
break;
}
if (Main.rand.Next(2) == 0)
{
NPC.NewNPC(index1 * 16 + 8, num41 * 16, 362);
break;
}
NPC.NewNPC(index1 * 16 + 8, num41 * 16, 364);
break;
}
}
else if (num1 == 53)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 607);
else if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 592);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 55);
}
else if (num1 == 53)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 607);
else if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 592);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 55);
}
else
{
switch (tileType)
{
case 2:
case 109:
case 477:
case 492:
bool flag26 = (double) index2 <= Main.worldSurface;
if (Main.raining && index2 <= Main.UnderworldLayer)
{
if ((double) index2 >= Main.rockLayer && Main.rand.Next(5) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(639, 646));
break;
}
if ((double) index2 >= Main.rockLayer && Main.rand.Next(5) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(646, 653));
break;
}
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 448);
break;
}
if (Main.rand.Next(3) != 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 357);
break;
}
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 593);
break;
}
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 230);
break;
}
if (((Main.dayTime || Main.numClouds > 55 || (double) Main.cloudBGActive != 0.0 ? 0 : ((double) Star.starfallBoost > 3.0 ? 1 : 0)) & (flag26 ? 1 : 0)) != 0 && Main.player[index5].RollLuck(2) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 484);
break;
}
if (((windyForButterflies || Main.dayTime ? 0 : (Main.rand.Next(NPC.fireFlyFriendly) == 0 ? 1 : 0)) & (flag26 ? 1 : 0)) != 0)
{
int Type4 = 355;
if (tileType == 109)
Type4 = 358;
NPC.NewNPC(index1 * 16 + 8, index2 * 16, Type4);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8 - 16, index2 * 16, Type4);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8 + 16, index2 * 16, Type4);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16 - 16, Type4);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16 + 16, Type4);
break;
}
break;
}
if ((((double) Main.cloudAlpha != 0.0 || Main.dayTime ? 0 : (Main.rand.Next(5) == 0 ? 1 : 0)) & (flag26 ? 1 : 0)) != 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 611);
break;
}
if (((!Main.dayTime || Main.time >= 18000.0 ? 0 : ((uint) Main.rand.Next(3) > 0U ? 1 : 0)) & (flag26 ? 1 : 0)) != 0)
{
int num44 = Main.rand.Next(4);
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 442);
break;
}
switch (num44)
{
case 0:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 297);
break;
case 1:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 298);
break;
default:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 74);
break;
}
}
else
{
if (((windyForButterflies || Main.raining || !Main.dayTime ? 0 : (Main.rand.Next(NPC.butterflyChance) == 0 ? 1 : 0)) & (flag26 ? 1 : 0)) != 0)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 444);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 356);
if (Main.rand.Next(4) == 0)
NPC.NewNPC(index1 * 16 + 8 - 16, index2 * 16, 356);
if (Main.rand.Next(4) == 0)
{
NPC.NewNPC(index1 * 16 + 8 + 16, index2 * 16, 356);
break;
}
break;
}
if (((!windyForButterflies || Main.raining || !Main.dayTime ? 0 : (Main.rand.Next(NPC.butterflyChance / 2) == 0 ? 1 : 0)) & (flag26 ? 1 : 0)) != 0)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 605);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 604);
if (Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 604);
if (Main.rand.Next(2) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 604);
if (Main.rand.Next(3) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 604);
if (Main.rand.Next(4) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 604);
break;
}
break;
}
if (Main.rand.Next(2) == 0 & flag26)
{
int num45 = Main.rand.Next(4);
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 442);
break;
}
switch (num45)
{
case 0:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 297);
break;
case 1:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 298);
break;
default:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 74);
break;
}
}
else
{
if (index2 > Main.UnderworldLayer)
{
newNPC = NPC.SpawnNPC_SpawnLavaBaitCritters(index1, index2);
break;
}
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 443);
break;
}
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0 & flag26)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 539);
break;
}
if (Main.halloween && Main.rand.Next(3) != 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 303);
break;
}
if (Main.xMas && Main.rand.Next(3) != 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 337);
break;
}
if (BirthdayParty.PartyIsUp && Main.rand.Next(3) != 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 540);
break;
}
if (Main.rand.Next(3) == 0)
{
if ((double) index2 >= Main.rockLayer && index2 <= Main.UnderworldLayer)
{
if (Main.rand.Next(5) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(639, 646));
break;
}
break;
}
if (flag26)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, (int) Utils.SelectRandom<short>(Main.rand, (short) 299, (short) 538));
break;
}
break;
}
if ((double) index2 >= Main.rockLayer && index2 <= Main.UnderworldLayer)
{
if (Main.rand.Next(5) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(646, 653));
break;
}
break;
}
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 46);
break;
}
}
break;
case 53:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(366, 368));
break;
case 60:
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 445);
break;
}
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 361);
break;
case 147:
case 161:
if (Main.rand.Next(2) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 148);
break;
}
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 149);
break;
default:
if ((double) index2 <= Main.worldSurface)
return;
goto case 2;
}
}
}
}
else if (Main.player[index5].ZoneDungeon)
{
int num46 = 0;
if (Main.tile[index1, index2].wall == (ushort) 94 || Main.tile[index1, index2].wall == (ushort) 96 || Main.tile[index1, index2].wall == (ushort) 98)
num46 = 1;
if (Main.tile[index1, index2].wall == (ushort) 95 || Main.tile[index1, index2].wall == (ushort) 97 || Main.tile[index1, index2].wall == (ushort) 99)
num46 = 2;
if (Main.player[index5].RollLuck(7) == 0)
num46 = Main.rand.Next(3);
bool flag27 = !NPC.downedBoss3;
if (Main.drunkWorld && (double) Main.player[index5].position.Y / 16.0 < (double) (Main.dungeonY + 40))
flag27 = false;
if (flag27)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 68);
else if (!NPC.savedMech && Main.rand.Next(5) == 0 && !flag7 && !NPC.AnyNPCs(123) && (double) index2 > Main.rockLayer)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 123);
else if (flag14 && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 287);
else if (flag14 && num46 == 0 && Main.rand.Next(15) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 293);
else if (flag14 && num46 == 1 && Main.rand.Next(15) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 291);
else if (flag14 && num46 == 2 && Main.rand.Next(15) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 292);
else if (flag14 && !NPC.AnyNPCs(290) && num46 == 0 && Main.rand.Next(35) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 290);
else if (flag14 && (num46 == 1 || num46 == 2) && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 289);
else if (flag14 && Main.rand.Next(20) == 0)
{
int num47 = 281;
if (num46 == 0)
num47 += 2;
if (num46 == 2)
num47 += 4;
int Type5 = num47 + Main.rand.Next(2);
if (!NPC.AnyNPCs(Type5))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Type5);
}
else if (flag14 && Main.rand.Next(3) != 0)
{
int num48 = 269;
if (num46 == 0)
num48 += 4;
if (num46 == 2)
num48 += 8;
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, num48 + Main.rand.Next(4));
}
else if (Main.player[index5].RollLuck(35) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 71);
else if (num46 == 1 && Main.rand.Next(3) == 0 && !NPC.NearSpikeBall(index1, index2))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 70);
else if (num46 == 2 && Main.rand.Next(5) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 72);
else if (num46 == 0 && Main.rand.Next(7) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 34);
else if (Main.rand.Next(7) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 32);
}
else
{
switch (Main.rand.Next(5))
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 294);
break;
case 1:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 295);
break;
case 2:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 296);
break;
default:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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[index5].ZoneMeteor)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 23);
else if (DD2Event.Ongoing && Main.player[index5].ZoneOldOneArmy)
DD2Event.SpawnNPC(ref newNPC);
else if ((double) index2 <= 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, index2 * 16, 341);
else if (waveNumber >= 20)
{
int num49 = Main.rand.Next(3);
if ((double) num3 < (double) num2 * (double) num4)
{
switch (num49)
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 345);
break;
case 1:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 346);
break;
default:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 343) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 343) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 351)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 343) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 351)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 343) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 352)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 343) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 345);
else if (waveNumber == 14)
{
if (Main.rand.Next(10) == 0 && !NPC.AnyNPCs(345))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 345);
else if (Main.rand.Next(10) == 0 && !NPC.AnyNPCs(346))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 346);
else if (Main.rand.Next(10) == 0 && !NPC.AnyNPCs(344))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 344);
else if (Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 342)) : (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 350))) : (Main.rand.Next(8) != 0 ? (Main.rand.Next(4) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 350)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 350)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 350)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 350) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 350)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 350) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 351)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 342) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 347)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 348)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 351)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 352)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(338, 341)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 343)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 344)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 347) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 342)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 343)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 352)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 346)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 345));
}
else if ((double) index2 <= Main.worldSurface && !Main.dayTime && Main.pumpkinMoon)
{
int waveNumber = NPC.waveNumber;
int num50;
if (NPC.waveNumber >= 15)
{
if ((double) num3 < (double) num2 * (double) num4)
newNPC = Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 325) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 327);
}
else
{
switch (waveNumber)
{
case 2:
newNPC = Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 326);
break;
case 3:
newNPC = Main.rand.Next(6) != 0 ? (Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 326)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 326)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 326)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 326) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 326) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 325)) : NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 326) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 325)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 327);
break;
case 11:
if (Main.rand.Next(10) == 0 && !NPC.AnyNPCs(327))
num50 = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, Main.rand.Next(305, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 326)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 325);
break;
case 12:
if (Main.rand.Next(7) == 0 && NPC.CountNPCS(327) < 2)
num50 = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 326) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 329)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 325);
break;
case 13:
if (Main.rand.Next(7) == 0 && NPC.CountNPCS(327) < 2)
num50 = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 329) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 330)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 315)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 325);
break;
case 14:
if (Main.rand.Next(5) == 0 && NPC.CountNPCS(327) < 3)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 327);
break;
}
if (Main.rand.Next(5) == 0 && NPC.CountNPCS(325) < 3)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 325);
break;
}
if ((double) num3 < (double) num2 * (double) num4)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 315);
break;
}
break;
default:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(305, 315));
break;
}
}
}
else if ((double) index2 <= Main.worldSurface && Main.dayTime && Main.eclipse)
{
bool flag28 = false;
if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3)
flag28 = true;
newNPC = !flag28 || 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 ? (!flag28 || 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, index2 * 16, 166) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 462)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 461)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 162)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 460)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 468)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 469)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 253)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 159)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 467)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 463)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 466)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 251)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 477);
}
else if (NPC.fairyLog && Main.player[index5].RollLuck(500) == 0 && !NPC.AnyHelpfulFairies() && (double) index2 >= (Main.worldSurface + Main.rockLayer) / 2.0 && index2 < Main.maxTilesY - 300)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(583, 586));
Main.npc[newNPC].ai[2] = 2f;
Main.npc[newNPC].TargetClosest();
Main.npc[newNPC].ai[3] = 0.0f;
}
else if (!flag7 && (!Main.dayTime || Main.tile[index1, index2].wall > (ushort) 0) && Main.tile[index7, index8].wall == (ushort) 244 && !Main.eclipse && !Main.bloodMoon && Main.player[index5].RollLuck(30) == 0 && NPC.CountNPCS(624) <= Main.rand.Next(3))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 624);
else if (!flag7 && !Main.eclipse && !Main.bloodMoon && Main.player[index5].RollLuck(10) == 0 && (double) index2 >= Main.worldSurface * 0.800000011920929 && (double) index2 < Main.worldSurface * 1.10000002384186 && NPC.CountNPCS(624) <= Main.rand.Next(3) && (!Main.dayTime || Main.tile[index1, index2].wall > (ushort) 0) && (Main.tile[index1, index2].wall == (ushort) 2 || Main.tile[index1, index2].wall == (ushort) 196 || Main.tile[index1, index2].wall == (ushort) 197 || Main.tile[index1, index2].wall == (ushort) 198 || Main.tile[index1, index2].wall == (ushort) 199))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 624);
else if (((!Main.hardMode ? 0 : (num1 == 70 ? 1 : 0)) & (flag7 ? 1 : 0)) != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 256);
else if (num1 == 70 && (double) index2 <= 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, index2 * 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, index2 * 16, 260);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) index2;
Main.npc[newNPC].netUpdate = true;
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 259);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) index2;
Main.npc[newNPC].netUpdate = true;
}
}
else
newNPC = Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 258) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 257);
}
else
newNPC = Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, (int) byte.MaxValue) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 254);
}
else if (num1 == 70 && Main.hardMode && (double) index2 >= Main.worldSurface && Main.rand.Next(3) != 0)
{
if (Main.hardMode && Main.rand.Next(5) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 374);
else if (!Main.hardMode && Main.rand.Next(4) == 0 || Main.rand.Next(8) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 360);
else if (Main.rand.Next(4) == 0)
{
if (Main.hardMode && Main.rand.Next(3) != 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 260);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) index2;
Main.npc[newNPC].netUpdate = true;
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 259);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) index2;
Main.npc[newNPC].netUpdate = true;
}
}
else
newNPC = Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 258) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 257);
}
else if (Main.player[index5].ZoneCorrupt && Main.rand.Next(65) == 0 && !flag5)
newNPC = !Main.hardMode || Main.rand.Next(4) == 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 7, 1) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 98, 1);
else if (Main.hardMode && (double) index2 > Main.worldSurface && Main.player[index5].RollLuck(75) == 0)
newNPC = Main.rand.Next(2) != 0 || !Main.player[index5].ZoneCorrupt || NPC.AnyNPCs(473) ? (Main.rand.Next(2) != 0 || !Main.player[index5].ZoneCrimson || NPC.AnyNPCs(474) ? (Main.rand.Next(2) != 0 || !Main.player[index5].ZoneHallow || NPC.AnyNPCs(475) ? (!Main.player[index5].ZoneSnow ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 85) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 629)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 475)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 474)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 473);
else if (Main.hardMode && (double) index2 <= Main.worldSurface && !Main.dayTime && (Main.rand.Next(20) == 0 || Main.rand.Next(5) == 0 && Main.moonPhase == 4))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 82);
else if (Main.hardMode && Main.halloween && (double) index2 <= Main.worldSurface && !Main.dayTime && Main.rand.Next(10) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 304);
else if (tileType == 60 && Main.player[index5].RollLuck(500) == 0 && !Main.dayTime)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 52);
else if (tileType == 60 && (double) index2 > Main.worldSurface && Main.rand.Next(60) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 219);
else if ((double) index2 > Main.worldSurface && index2 < Main.maxTilesY - 210 && !Main.player[index5].ZoneSnow && !Main.player[index5].ZoneCrimson && !Main.player[index5].ZoneCorrupt && !Main.player[index5].ZoneJungle && !Main.player[index5].ZoneHallow && Main.rand.Next(8) == 0)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 448);
else
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 357);
}
else if ((double) index2 > Main.worldSurface && index2 < Main.maxTilesY - 210 && !Main.player[index5].ZoneSnow && !Main.player[index5].ZoneCrimson && !Main.player[index5].ZoneCorrupt && !Main.player[index5].ZoneJungle && !Main.player[index5].ZoneHallow && Main.rand.Next(13) == 0)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 447);
else
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 300);
}
else if ((double) index2 > Main.worldSurface && (double) index2 < (Main.rockLayer + (double) Main.maxTilesY) / 2.0 && !Main.player[index5].ZoneSnow && !Main.player[index5].ZoneCrimson && !Main.player[index5].ZoneCorrupt && !Main.player[index5].ZoneHallow && Main.rand.Next(13) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 359);
else if ((double) index2 < Main.worldSurface && Main.player[index5].ZoneJungle && Main.rand.Next(7) == 0)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 445);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 361);
}
else if (tileType == 225 && Main.rand.Next(2) == 0)
{
if (Main.hardMode && Main.rand.Next(4) != 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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
{
switch (Main.rand.Next(8))
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 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, index2 * 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, index2 * 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, index2 * 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, index2 * 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 (tileType == 60 && Main.hardMode && Main.rand.Next(3) != 0)
{
if ((double) index2 < Main.worldSurface && !Main.dayTime && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 152);
else if ((double) index2 < Main.worldSurface && Main.dayTime && Main.rand.Next(4) != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 177);
else if ((double) index2 > Main.worldSurface && Main.rand.Next(100) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 205);
else if ((double) index2 > Main.worldSurface && Main.rand.Next(5) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 236);
else if ((double) index2 > Main.worldSurface && Main.rand.Next(4) != 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 175);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) index2;
Main.npc[newNPC].netUpdate = true;
}
else
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 153);
}
else if (tileType == 226 & flag4)
newNPC = Main.rand.Next(3) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 198) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 226);
else if (num24 == 86 && Main.rand.Next(8) != 0)
{
switch (Main.rand.Next(8))
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 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, index2 * 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, index2 * 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, index2 * 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, index2 * 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 (tileType == 60 && (double) index2 > (Main.worldSurface + Main.rockLayer) / 2.0)
{
if (Main.rand.Next(4) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 204);
else if (Main.rand.Next(4) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 43);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) index2;
Main.npc[newNPC].netUpdate = true;
}
else
{
switch (Main.rand.Next(8))
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 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, index2 * 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, index2 * 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, index2 * 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, index2 * 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 (tileType == 60 && Main.rand.Next(4) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 51);
else if (tileType == 60 && Main.rand.Next(8) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 56);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) index2;
Main.npc[newNPC].netUpdate = true;
}
else if (Sandstorm.Happening && Main.player[index5].ZoneSandstorm && TileID.Sets.Conversion.Sand[tileType] && NPC.Spawning_SandstoneCheck(index1, index2))
{
if (!NPC.downedBoss1 && !Main.hardMode)
newNPC = Main.rand.Next(2) != 0 ? (Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 69) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 61)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 546);
else if (Main.hardMode && Main.rand.Next(20) == 0 && !NPC.AnyNPCs(541))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 541);
else if (Main.hardMode && !flag5 && Main.rand.Next(3) == 0 && NPC.CountNPCS(510) < 4)
newNPC = NPC.NewNPC(index1 * 16 + 8, (index2 + 10) * 16, 510);
else if (Main.hardMode && !flag5 && Main.rand.Next(2) == 0)
{
int Type6 = 542;
if (TileID.Sets.Corrupt[tileType])
Type6 = 543;
if (TileID.Sets.Crimson[tileType])
Type6 = 544;
if (TileID.Sets.Hallow[tileType])
Type6 = 545;
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Type6);
}
else
newNPC = !Main.hardMode || tileType != 53 || Main.rand.Next(3) != 0 ? (!Main.hardMode || tileType != 112 || Main.rand.Next(3) != 0 ? (!Main.hardMode || tileType != 234 || Main.rand.Next(3) != 0 ? (!Main.hardMode || tileType != 116 || Main.rand.Next(3) != 0 ? (Main.rand.Next(2) != 0 ? (Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 581) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 580)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 546)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 80)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 630)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 79)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 78);
}
else if (Main.hardMode && tileType == 53 && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 78);
else if (Main.hardMode && tileType == 112 && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 79);
else if (Main.hardMode && tileType == 234 && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 630);
else if (Main.hardMode && tileType == 116 && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 80);
else if (Main.hardMode && !flag7 && (double) index2 < Main.rockLayer && (tileType == 116 || tileType == 117 || tileType == 109 || tileType == 164))
{
if (NPC.downedPlantBoss && !Main.dayTime && Main.time < 16200.0 && (double) index2 < Main.worldSurface && Main.rand.Next(10) == 0 && !NPC.AnyNPCs(661))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 661);
else if ((double) Main.cloudAlpha > 0.0 && !NPC.AnyNPCs(244) && Main.rand.Next(12) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 244);
else
newNPC = Main.dayTime || Main.rand.Next(2) != 0 ? (Main.rand.Next(10) == 0 || Main.player[index5].ZoneWaterCandle && Main.rand.Next(10) == 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 86) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 75)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 122);
}
else if (!flag5 && Main.hardMode && Main.rand.Next(50) == 0 && !flag7 && (double) index2 >= Main.rockLayer && (tileType == 116 || tileType == 117 || tileType == 109 || tileType == 164))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 84);
else if (tileType == 204 && Main.player[index5].ZoneCrimson || tileType == 199 || tileType == 200 || tileType == 203 || tileType == 234)
{
if (Main.hardMode && (double) index2 >= Main.rockLayer && Main.rand.Next(5) == 0 && !flag5)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 182);
else if (Main.hardMode && (double) index2 >= Main.rockLayer && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 268);
else if (Main.hardMode && Main.rand.Next(3) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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) index2 >= Main.rockLayer && Main.rand.Next(40) == 0 && !flag5)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 179);
else if (Main.hardMode && (Main.rand.Next(2) == 0 || (double) index2 > Main.worldSurface))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 174);
else if (Main.tile[index1, index2].wall > (ushort) 0 && Main.rand.Next(4) != 0 || Main.rand.Next(8) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 239);
else if (Main.rand.Next(2) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 181);
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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 (tileType == 22 && Main.player[index5].ZoneCorrupt || tileType == 23 || tileType == 25 || tileType == 112 || tileType == 163)
{
if (Main.hardMode && (double) index2 >= Main.rockLayer && Main.rand.Next(3) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 101);
Main.npc[newNPC].ai[0] = (float) index1;
Main.npc[newNPC].ai[1] = (float) index2;
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, index2 * 16, 81) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 121);
else if (Main.hardMode && (double) index2 >= Main.rockLayer && Main.rand.Next(40) == 0 && !flag5)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 83);
else if (Main.hardMode && (Main.rand.Next(2) == 0 || (double) index2 > Main.rockLayer))
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 94);
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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) index2 <= Main.worldSurface)
{
bool flag29 = (double) Math.Abs(index1 - Main.maxTilesX / 2) / (double) (Main.maxTilesX / 2) > 0.330000013113022;
if (flag29 && NPC.AnyDanger())
flag29 = false;
if (Main.player[index5].ZoneGraveyard && !flag7 && (num1 == 2 || num1 == 477) && Main.rand.Next(10) == 0)
{
if (Main.rand.Next(2) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 606);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 610);
}
else if (Main.player[index5].ZoneSnow && Main.hardMode && (double) Main.cloudAlpha > 0.0 && !NPC.AnyNPCs(243) && Main.player[index5].RollLuck(20) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 243);
else if (!Main.player[index5].ZoneSnow && Main.hardMode && (double) Main.cloudAlpha > 0.0 && NPC.CountNPCS(250) < 2 && Main.rand.Next(10) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 250);
else if (flag29 && Main.hardMode && NPC.downedGolemBoss && (!NPC.downedMartians && Main.rand.Next(100) == 0 || Main.rand.Next(400) == 0) && !NPC.AnyNPCs(399))
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 399);
else if (!Main.player[index5].ZoneGraveyard && Main.dayTime)
{
int num51 = Math.Abs(index1 - Main.spawnTileX);
if (!flag7 && num51 < Main.maxTilesX / 2 && Main.rand.Next(15) == 0 && (tileType == 2 || tileType == 477 || tileType == 109 || tileType == 492 || tileType == 147 || tileType == 161))
{
if (tileType == 147 || tileType == 161)
{
if (Main.rand.Next(2) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 148);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 149);
}
else if (!windyForButterflies && !Main.raining && Main.dayTime && Main.rand.Next(NPC.butterflyChance / 2) == 0 && (double) index2 <= Main.worldSurface)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 444);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 356);
if (Main.rand.Next(4) == 0)
NPC.NewNPC(index1 * 16 + 8 - 16, index2 * 16, 356);
if (Main.rand.Next(4) == 0)
NPC.NewNPC(index1 * 16 + 8 + 16, index2 * 16, 356);
}
else if (windyForButterflies && !Main.raining && Main.dayTime && Main.rand.Next(NPC.butterflyChance) == 0 && (double) index2 <= Main.worldSurface)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 605);
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 604);
if (Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 604);
if (Main.rand.Next(2) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 604);
if (Main.rand.Next(3) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 604);
if (Main.rand.Next(4) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 604);
}
else if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 443);
else if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0 && (double) index2 <= Main.worldSurface)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 539);
else if (Main.halloween && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 303);
else if (Main.xMas && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 337);
else if (BirthdayParty.PartyIsUp && Main.rand.Next(3) != 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 540);
else if (Main.rand.Next(3) == 0 && (double) index2 <= Main.worldSurface)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, (int) Utils.SelectRandom<short>(Main.rand, (short) 299, (short) 538));
else
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 46);
}
else if (!flag7 && index1 > WorldGen.beachDistance && index1 < Main.maxTilesX - WorldGen.beachDistance && Main.rand.Next(12) == 0 && tileType == 53)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(366, 368));
}
else
{
int cattailX;
int cattailY;
if ((tileType == 2 || tileType == 477 || tileType == 53) && !windyForButterflies && !Main.raining && Main.dayTime && Main.rand.Next(3) != 0 && (double) index2 <= Main.worldSurface && NPC.FindCattailTop(index1, index2, out cattailX, out cattailY))
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(cattailX * 16 + 8, cattailY * 16, 601);
else
NPC.NewNPC(cattailX * 16 + 8, cattailY * 16, NPC.RollDragonflyType(tileType));
if (Main.rand.Next(3) == 0)
NPC.NewNPC(cattailX * 16 + 8 - 16, cattailY * 16, NPC.RollDragonflyType(tileType));
if (Main.rand.Next(3) == 0)
NPC.NewNPC(cattailX * 16 + 8 + 16, cattailY * 16, NPC.RollDragonflyType(tileType));
}
else if (!flag7 && num51 < Main.maxTilesX / 3 && Main.dayTime && Main.time < 18000.0 && (tileType == 2 || tileType == 477 || tileType == 109 || tileType == 492) && Main.rand.Next(4) == 0 && (double) index2 <= Main.worldSurface && NPC.CountNPCS(74) + NPC.CountNPCS(297) + NPC.CountNPCS(298) < 6)
{
int num52 = Main.rand.Next(4);
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 442);
}
else
{
switch (num52)
{
case 0:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 297);
break;
case 1:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 298);
break;
default:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 74);
break;
}
}
}
else if (!flag7 && num51 < Main.maxTilesX / 3 && Main.rand.Next(15) == 0 && (tileType == 2 || tileType == 477 || tileType == 109 || tileType == 492 || tileType == 147))
{
int num53 = Main.rand.Next(4);
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
{
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 442);
}
else
{
switch (num53)
{
case 0:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 297);
break;
case 1:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 298);
break;
default:
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 74);
break;
}
}
}
else if (!flag7 && num51 > Main.maxTilesX / 3 && tileType == 2 && Main.rand.Next(300) == 0 && !NPC.AnyNPCs(50))
NPC.SpawnOnPlayer(index5, 50);
else if (tileType == 53 && (index1 < WorldGen.beachDistance || index1 > Main.maxTilesX - WorldGen.beachDistance))
{
if (!flag7 && Main.rand.Next(10) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 602);
else if (flag7)
{
int num54 = -1;
int num55 = -1;
if ((double) index2 < Main.worldSurface && index2 > 50)
{
for (int j = index2 - 1; j > index2 - 50; --j)
{
if (Main.tile[index1, j].liquid == (byte) 0 && !WorldGen.SolidTile(index1, j) && !WorldGen.SolidTile(index1, j + 1) && !WorldGen.SolidTile(index1, j + 2))
{
num54 = j + 2;
if (!WorldGen.SolidTile(index1, num54 + 1) && !WorldGen.SolidTile(index1, num54 + 2))
{
num55 = num54 + 2;
break;
}
break;
}
}
if (num54 > index2)
num54 = index2;
if (num55 > index2)
num55 = index2;
}
if (Main.rand.Next(10) == 0)
{
int num56 = Main.rand.Next(3);
if (num56 == 0 && num54 > 0)
NPC.NewNPC(index1 * 16 + 8, num54 * 16, 625);
else if (num56 == 1 && num55 > 0)
NPC.NewNPC(index1 * 16 + 8, num55 * 16, 615);
else if (num56 == 2 && num55 > 0)
{
if (Main.player[index5].RollLuck(NPC.goldCritterChance) == 0)
NPC.NewNPC(index1 * 16 + 8, num55 * 16, 627);
else
NPC.NewNPC(index1 * 16 + 8, num55 * 16, 626);
}
}
}
}
else if (!flag7 && tileType == 53 && Main.rand.Next(5) == 0 && NPC.Spawning_SandstoneCheck(index1, index2) && !flag7)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 69);
else if (tileType == 53 && !flag7)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 61);
else if (!flag7 && num51 > Main.maxTilesX / 3 && (Main.rand.Next(15) == 0 || !NPC.downedGoblins && WorldGen.shadowOrbSmashed && Main.rand.Next(7) == 0))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 73);
else if (Main.raining && Main.rand.Next(4) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 224);
else if (!flag7 && Main.raining && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 225);
else if (((flag7 ? 0 : (num24 == 0 ? 1 : 0)) & (itAhappyWindyDay ? 1 : 0) & (flag18 ? 1 : 0)) != 0 && Main.rand.Next(3) != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 594);
else if (((flag7 || num24 != 0 ? 0 : (num1 == 2 ? 1 : (num1 == 477 ? 1 : 0))) & (itAhappyWindyDay ? 1 : 0) & (flag18 ? 1 : 0)) != 0 && Main.rand.Next(10) != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 628);
else if (!flag7)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 1);
switch (tileType)
{
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 || num51 < 200 && !Main.expertMode)
{
Main.npc[newNPC].SetDefaults(-3);
break;
}
if (Main.rand.Next(10) == 0 && (num51 > 400 || Main.expertMode))
{
Main.npc[newNPC].SetDefaults(-7);
break;
}
break;
}
}
}
}
else
{
if (!Main.player[index5].ZoneGraveyard && !windyForButterflies && (tileType == 2 || tileType == 477 || tileType == 109 || tileType == 492) && !Main.raining && Main.rand.Next(NPC.fireFlyChance) == 0 && (double) index2 <= Main.worldSurface)
{
int Type7 = 355;
if (tileType == 109)
Type7 = 358;
NPC.NewNPC(index1 * 16 + 8, index2 * 16, Type7);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8 - 16, index2 * 16, Type7);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8 + 16, index2 * 16, Type7);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16 - 16, Type7);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(index1 * 16 + 8, index2 * 16 + 16, Type7);
}
else if ((Main.halloween || Main.player[index5].ZoneGraveyard) && Main.rand.Next(12) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 301);
else if (Main.player[index5].ZoneGraveyard && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 316);
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, index2 * 16, 133);
else if (Main.halloween && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(317, 319));
else if (Main.rand.Next(2) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 190);
if (Main.rand.Next(3) == 0)
{
Main.npc[newNPC].SetDefaults(-38);
break;
}
break;
case 1:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 191);
if (Main.rand.Next(3) == 0)
{
Main.npc[newNPC].SetDefaults(-39);
break;
}
break;
case 2:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 192);
if (Main.rand.Next(3) == 0)
{
Main.npc[newNPC].SetDefaults(-40);
break;
}
break;
case 3:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 193);
if (Main.rand.Next(3) == 0)
{
Main.npc[newNPC].SetDefaults(-41);
break;
}
break;
case 4:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 16, 109);
else if (Main.rand.Next(250) == 0 && (Main.bloodMoon || Main.player[index5].ZoneGraveyard))
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 53);
else if (Main.rand.Next(250) == 0 && (Main.bloodMoon || Main.player[index5].ZoneGraveyard))
NPC.NewNPC(index1 * 16 + 8, index2 * 16, 536);
else if (!Main.dayTime && Main.moonPhase == 0 && Main.hardMode && Main.rand.Next(3) != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 104);
else if (!Main.dayTime && Main.hardMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 140);
else if (Main.bloodMoon && Main.rand.Next(5) < 2)
newNPC = Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 490) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 489);
else if (num1 == 147 || num1 == 161 || num1 == 163 || num1 == 164 || num1 == 162)
newNPC = Main.player[index5].ZoneGraveyard || !Main.hardMode || Main.rand.Next(4) != 0 ? (Main.player[index5].ZoneGraveyard || !Main.hardMode || Main.rand.Next(3) != 0 ? (!Main.expertMode || Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 161) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 431)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 155)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 169);
else if (Main.raining && Main.rand.Next(2) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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 num57 = Main.rand.Next(7);
int maxValue5 = 12;
int maxValue6 = 20;
if (Main.player[index5].statLifeMax <= 100)
{
maxValue5 = 5 - Main.CurrentFrameFlags.ActivePlayersCount / 2;
if (maxValue5 < 2)
maxValue5 = 2;
}
if (Main.player[index5].ZoneGraveyard && Main.rand.Next(maxValue6) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 632);
else if (Main.rand.Next(maxValue5) == 0)
newNPC = !Main.expertMode || Main.rand.Next(2) != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 590) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 591);
else if (Main.halloween && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(319, 322));
else if (Main.xMas && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(331, 333));
else if (num57 == 0 && Main.expertMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 430);
else if (num57 == 2 && Main.expertMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 432);
else if (num57 == 3 && Main.expertMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 433);
else if (num57 == 4 && Main.expertMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 434);
else if (num57 == 5 && Main.expertMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 435);
else if (num57 == 6 && Main.expertMode && Main.rand.Next(3) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 436);
}
else
{
switch (num57)
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 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, index2 * 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, index2 * 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, index2 * 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, index2 * 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, index2 * 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;
}
}
}
if (Main.player[index5].ZoneGraveyard)
Main.npc[newNPC].target = index5;
}
}
else if ((double) index2 <= Main.rockLayer)
{
if (!flag5 && Main.rand.Next(50) == 0 && !Main.player[index5].ZoneSnow)
newNPC = !Main.hardMode ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 10, 1) : (Main.rand.Next(3) == 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 10, 1) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 95, 1));
else if (Main.hardMode && Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 140);
else if (Main.hardMode && Main.rand.Next(4) != 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 141);
else if (tileType == 147 || tileType == 161 || Main.player[index5].ZoneSnow)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 147);
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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 (index2 > Main.maxTilesY - 190)
newNPC = !Main.hardMode || NPC.savedTaxCollector || Main.rand.Next(20) != 0 || NPC.AnyNPCs(534) ? (Main.rand.Next(8) != 0 ? (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, index2 * 16, 60) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 151)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 59)) : (Main.rand.Next(10) != 0 ? (!Main.hardMode || !NPC.downedMechBossAny || Main.rand.Next(5) == 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 62) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 156)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 66))) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 24)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 39, 1)) : NPC.SpawnNPC_SpawnLavaBaitCritters(index1, index2)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 534);
else if (NPC.SpawnNPC_CheckToSpawnRockGolem(index1, index2, tileType, index5))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 631);
else if (Main.rand.Next(60) == 0)
newNPC = !Main.player[index5].ZoneSnow ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 217) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 218);
else if ((tileType == 116 || tileType == 117 || tileType == 164) && Main.hardMode && !flag5 && Main.rand.Next(8) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 120);
else if ((num1 == 147 || num1 == 161 || num1 == 162 || num1 == 163 || num1 == 164 || num1 == 200) && !flag5 && Main.hardMode && Main.player[index5].ZoneCorrupt && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 170);
else if ((num1 == 147 || num1 == 161 || num1 == 162 || num1 == 163 || num1 == 164 || num1 == 200) && !flag5 && Main.hardMode && Main.player[index5].ZoneHallow && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 171);
else if ((num1 == 147 || num1 == 161 || num1 == 162 || num1 == 163 || num1 == 164 || num1 == 200) && !flag5 && Main.hardMode && Main.player[index5].ZoneCrimson && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 180);
else if (Main.hardMode && Main.player[index5].ZoneSnow && Main.rand.Next(10) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 154);
else if (!flag5 && Main.rand.Next(100) == 0 && !Main.player[index5].ZoneHallow)
newNPC = !Main.hardMode ? (!Main.player[index5].ZoneSnow ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 10, 1) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 185)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 95, 1);
else if (Main.player[index5].ZoneSnow && Main.rand.Next(20) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 185);
else if (!Main.hardMode && Main.rand.Next(10) == 0 || Main.hardMode && Main.rand.Next(20) == 0)
{
if (Main.player[index5].ZoneSnow)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 184);
else if (Main.rand.Next(3) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 1);
Main.npc[newNPC].SetDefaults(-6);
}
else
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 16);
}
else if (!Main.hardMode && Main.rand.Next(4) == 0)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 1);
if (Main.player[index5].ZoneJungle)
Main.npc[newNPC].SetDefaults(-10);
else if (Main.player[index5].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, index2 * 16, 453);
else if (!Main.hardMode && Main.rand.Next(80) == 0 || Main.rand.Next(200) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 195);
else if (Main.hardMode && (double) index2 > (Main.rockLayer + (double) Main.maxTilesY) / 2.0 && Main.rand.Next(300) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 172);
else if ((double) index2 > (Main.rockLayer + (double) Main.maxTilesY) / 2.0 && (Main.rand.Next(200) == 0 || Main.rand.Next(50) == 0 && (Main.player[index5].armor[1].type == 4256 || Main.player[index5].armor[1].type >= 1282 && Main.player[index5].armor[1].type <= 1287) && Main.player[index5].armor[0].type != 238))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 45);
else if (flag10 && Main.rand.Next(4) != 0)
newNPC = Main.rand.Next(6) == 0 || NPC.AnyNPCs(480) || !Main.hardMode ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 481) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 480);
else if (flag9 && Main.rand.Next(5) != 0)
newNPC = Main.rand.Next(6) == 0 || NPC.AnyNPCs(483) ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 482) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 483);
else if (Main.hardMode && Main.rand.Next(10) != 0)
{
if (Main.rand.Next(2) == 0)
{
if (Main.player[index5].ZoneSnow)
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 197);
}
else
{
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 77);
if ((double) index2 > (Main.rockLayer + (double) Main.maxTilesY) / 2.0 && Main.rand.Next(5) == 0)
Main.npc[newNPC].SetDefaults(-15);
}
}
else
newNPC = !Main.player[index5].ZoneSnow ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 110) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 206);
}
else if (!flag5 && (Main.halloween || Main.player[index5].ZoneGraveyard) && Main.rand.Next(30) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 316);
else if (Main.rand.Next(20) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 44);
else if (num1 == 147 || num1 == 161 || num1 == 162)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 167);
else if (Main.player[index5].ZoneSnow)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 185);
else if (Main.rand.Next(3) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, NPC.cavernMonsterType[Main.rand.Next(2), Main.rand.Next(3)]);
else if (Main.player[index5].ZoneGlowshroom && (num1 == 70 || num1 == 190))
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, 635);
else if (Main.halloween && Main.rand.Next(2) == 0)
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 16, Main.rand.Next(322, 325));
else if (Main.expertMode && Main.rand.Next(3) == 0)
{
int num58 = Main.rand.Next(4);
newNPC = num58 != 0 ? (num58 != 0 ? (num58 != 0 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 452) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 451)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 450)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 449);
}
else
{
switch (Main.rand.Next(4))
{
case 0:
newNPC = NPC.NewNPC(index1 * 16 + 8, index2 * 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, index2 * 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, index2 * 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, index2 * 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[index5].ZoneHallow & Main.rand.Next(2) == 0) ? (!Main.player[index5].ZoneJungle ? (!Main.player[index5].ZoneGlowshroom || num1 != 70 && num1 != 190 ? (!Main.hardMode || !Main.player[index5].ZoneHallow ? (!Main.hardMode || Main.rand.Next(6) <= 0 ? (num1 == 147 || num1 == 161 || num1 == 162 ? (!Main.hardMode ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 150) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 169)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 49)) : (Main.rand.Next(3) != 0 || num1 != 147 && num1 != 161 && num1 != 162 ? NPC.NewNPC(index1 * 16 + 8, index2 * 16, 93) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 150))) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 137)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 634)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 51)) : NPC.NewNPC(index1 * 16 + 8, index2 * 16, 138);
if (Main.npc[newNPC].type == 1 && Main.player[index5].RollLuck(180) == 0)
Main.npc[newNPC].SetDefaults(-4);
if (Main.netMode != 2 || newNPC >= 200)
break;
NetMessage.SendData(23, number: newNPC);
break;
}
}
}
}
}
}
private static bool SpawnNPC_CheckToSpawnRockGolem(
int spawnTileX,
int spawnTileY,
int tileType,
int plr)
{
return Main.hardMode && (tileType == 1 || TileID.Sets.Conversion.Moss[tileType]) && !Main.player[plr].ZoneSnow && Main.rand.Next(30) == 0 && !WorldGen.SolidTile(spawnTileX - 1, spawnTileY - 4) && !WorldGen.SolidTile(spawnTileX, spawnTileY - 4) && !WorldGen.SolidTile(spawnTileX + 1, spawnTileY - 4);
}
private static int SpawnNPC_SpawnLavaBaitCritters(int spawnTileX, int spawnTileY)
{
if (Main.rand.Next(3) == 0)
return NPC.NewNPC(spawnTileX * 16 + 8, spawnTileY * 16, 655);
if (Main.dayTime)
return NPC.NewNPC(spawnTileX * 16 + 8, spawnTileY * 16, 653);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(spawnTileX * 16 + 8 - 16, spawnTileY * 16, 654);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(spawnTileX * 16 + 8 + 16, spawnTileY * 16, 654);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(spawnTileX * 16 + 8, spawnTileY * 16 - 16, 654);
if (Main.rand.Next(NPC.fireFlyMultiple) == 0)
NPC.NewNPC(spawnTileX * 16 + 8, spawnTileY * 16 + 16, 654);
return NPC.NewNPC(spawnTileX * 16 + 8, spawnTileY * 16, 654);
}
private static int SpawnNPC_TryFindingProperGroundTileType(int spawnTileType, int x, int y)
{
if (!NPC.IsValidSpawningGroundTile(x, y))
{
for (int y1 = y + 1; y1 < y + 30; ++y1)
{
if (NPC.IsValidSpawningGroundTile(x, y1))
return (int) Main.tile[x, y1].type;
}
}
return spawnTileType;
}
private static bool IsValidSpawningGroundTile(int x, int y)
{
Tile tile = Main.tile[x, y];
return tile.nactive() && Main.tileSolid[(int) tile.type] && !Main.tileSolidTop[(int) tile.type] && !TileID.Sets.IsSkippedForNPCSpawningGroundTypeCheck[(int) tile.type];
}
public static bool FindCattailTop(int landX, int landY, out int cattailX, out int cattailY)
{
cattailX = landX;
cattailY = landY;
if (!WorldGen.InWorld(landX, landY, 31))
return false;
int maxValue = 1;
for (int index1 = landX - 30; index1 <= landX + 30; ++index1)
{
for (int index2 = landY - 20; index2 <= landY + 20; ++index2)
{
Tile tile = Main.tile[index1, index2];
if (tile != null && tile.active() && tile.type == (ushort) 519 && tile.frameX >= (short) 180 && Main.rand.Next(maxValue) == 0)
{
cattailX = index1;
cattailY = index2;
++maxValue;
}
}
}
return cattailX != landX || cattailY != landY;
}
public static bool FindTreeBranch(
int landX,
int landY,
out int treeBranchX,
out int treeBranchY)
{
treeBranchX = landX;
treeBranchY = landY;
if (!WorldGen.InWorld(landX, landY, 11))
return false;
int maxValue = 1;
for (int index1 = landX - 10; index1 <= landX + 10; ++index1)
{
for (int index2 = landY - 30; index2 <= landY + 30; ++index2)
{
Tile tile = Main.tile[index1, index2];
if (tile != null && tile.active() && TileID.Sets.IsATreeTrunk[(int) tile.type])
{
int num1 = (int) tile.frameX / 22;
int num2 = (int) tile.frameY / 66;
if ((num1 == 3 && num2 == 0 || num1 == 3 && num2 == 3 || num1 == 4 && num2 == 1 || num1 == 4 && num2 == 3 || num1 == 2 && num2 == 3) && Main.rand.Next(maxValue) == 0)
{
treeBranchX = index1;
treeBranchY = index2;
++maxValue;
}
}
}
}
return treeBranchX != landX || treeBranchY != landY;
}
public static bool AnyDanger(bool quickBossNPCCheck = false)
{
bool flag = false;
if (NPC.MoonLordCountdown > 0)
flag = true;
if (Main.invasionType > 0)
flag = true;
if (Main.snowMoon || Main.pumpkinMoon || DD2Event.Ongoing)
flag = true;
if (!flag)
{
if (quickBossNPCCheck)
{
flag |= Main.CurrentFrameFlags.AnyActiveBossNPC;
}
else
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && (Main.npc[index].boss || NPCID.Sets.DangerThatPreventsOtherDangers[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.wofNPCIndex >= 0 || Main.netMode == 1 || NPC.AnyNPCs(113))
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;
ChatHelper.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;
ChatHelper.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 - 50; --j)
{
if (WorldGen.SolidTile(i, j))
{
num4 = j;
break;
}
}
for (int j = num3; j < num3 + 50; ++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;
ChatHelper.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;
ChatHelper.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;
ChatHelper.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 <= (ushort) 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;
NPC.SpawnBoss(num7 * 16 + 8, num8 * 16, Type, plr);
break;
}
}
public static void SpawnBoss(
int spawnPositionX,
int spawnPositionY,
int Type,
int targetPlayerIndex)
{
int number = NPC.NewNPC(spawnPositionX, spawnPositionY, Type, 1);
if (number == 200)
return;
Main.npc[number].target = targetPlayerIndex;
Main.npc[number].timeLeft *= 20;
string typeName = 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);
}
else
{
if (Main.netMode != 2)
return;
ChatHelper.BroadcastChatMessage(Lang.misc[48].ToNetworkText(), new Color(175, 75, (int) byte.MaxValue));
}
}
else
{
if (Type == 316 || Type == 662 || Type == 82 || Type == 126 || Type == 50 || Type == 398 || Type == 551)
return;
if (Main.netMode == 0)
{
Main.NewText(Language.GetTextValue("Announcement.HasAwoken", (object) typeName), (byte) 175, (byte) 75);
}
else
{
if (Main.netMode != 2)
return;
ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", (object) Main.npc[number].GetTypeNetName()), new Color(175, 75, (int) byte.MaxValue));
}
}
}
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)
{
if (Main.getGoodWorld)
{
if (Type == 46)
Type = 614;
if (Type == 62)
Type = 66;
}
int nextNPC = -1;
if (Type == 222)
{
for (int index = 199; index >= 0; --index)
{
if (!Main.npc[index].active)
{
nextNPC = index;
break;
}
}
}
else
{
for (int index = Start; index < 200; ++index)
{
if (!Main.npc[index].active)
{
nextNPC = index;
break;
}
}
}
if (nextNPC < 0)
return 200;
Main.npc[nextNPC] = new NPC();
Main.npc[nextNPC].SetDefaults(Type);
Main.npc[nextNPC].whoAmI = nextNPC;
NPC.GiveTownUniqueDataToNPCsThatNeedIt(Type, nextNPC);
Main.npc[nextNPC].position.X = (float) (X - Main.npc[nextNPC].width / 2);
Main.npc[nextNPC].position.Y = (float) (Y - Main.npc[nextNPC].height);
Main.npc[nextNPC].active = true;
Main.npc[nextNPC].timeLeft = (int) ((double) NPC.activeTime * 1.25);
Main.npc[nextNPC].wet = Collision.WetCollision(Main.npc[nextNPC].position, Main.npc[nextNPC].width, Main.npc[nextNPC].height);
Main.npc[nextNPC].ai[0] = ai0;
Main.npc[nextNPC].ai[1] = ai1;
Main.npc[nextNPC].ai[2] = ai2;
Main.npc[nextNPC].ai[3] = ai3;
Main.npc[nextNPC].target = Target;
if (Type == 50)
{
switch (Main.netMode)
{
case 0:
Main.NewText(Language.GetTextValue("Announcement.HasAwoken", (object) Main.npc[nextNPC].TypeName), (byte) 175, (byte) 75);
break;
case 2:
ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", (object) Main.npc[nextNPC].GetTypeNetName()), new Color(175, 75, (int) byte.MaxValue));
break;
}
}
return nextNPC;
}
private static void GiveTownUniqueDataToNPCsThatNeedIt(int Type, int nextNPC)
{
if (NPC.TypeToDefaultHeadIndex(Type) == -1 && Type != 453)
return;
Main.npc[nextNPC].GivenName = NPC.getNewNPCName(Type);
ITownNPCProfile profile;
if (TownNPCProfiles.Instance.GetProfile(Type, out profile))
{
Main.npc[nextNPC].townNpcVariationIndex = profile.RollVariation();
Main.npc[nextNPC].GivenName = profile.GetNameForVariant(Main.npc[nextNPC]);
}
Main.npc[nextNPC].needsUniqueInfoUpdate = true;
}
public void TransformVisuals(int oldType, int newType)
{
this.position = this.position + this.netOffset;
if (oldType == 158 && newType == 159 || oldType == 159 && newType == 158)
{
SoundEngine.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)
{
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;
}
}
this.position = this.position - this.netOffset;
}
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;
Vector2 position = this.position;
Main.TeleportEffect(this.getRect(), Style, extraInfo1, dustCountMult, otherPosition: newPos);
this.position = newPos;
if (Style == 4)
{
this.lastPortalColorIndex = extraInfo;
extraInfo1 = this.lastPortalColorIndex;
}
Main.TeleportEffect(this.getRect(), Style, extraInfo1, dustCountMult, TeleportationSide.Exit, position);
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;
int extraValue = this.extraValue;
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;
for (int index = 0; index < 5; ++index)
{
this.buffType[index] = numArray1[index];
this.buffTime[index] = numArray2[index];
}
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;
}
this.extraValue = extraValue;
if (Main.netMode == 2)
{
this.netUpdate = true;
NetMessage.SendData(23, number: this.whoAmI);
NetMessage.SendData(54, number: this.whoAmI);
}
this.TransformVisuals(type, newType);
NPC.GiveTownUniqueDataToNPCsThatNeedIt(this.type, this.whoAmI);
if (this.townNPC)
{
this.homeless = true;
WorldGen.CheckAchievement_RealEstate();
}
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.CalculateDamageNPCsTake((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.type == 438 || this.type == 379) && Main.netMode != 1)
{
int index = (int) (-(double) this.ai[3] - 1.0);
if (index > -1 && (double) Main.npc[index].localAI[0] == 0.0)
Main.npc[index].localAI[0] = 1f;
}
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 (this.onFire2)
num2 *= 1.1f;
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)
SoundEngine.PlaySound(this.HitSound, this.position);
if (this.realLife >= 0)
Main.npc[this.realLife].checkDead();
else
this.checkDead();
return dmg;
}
public static void LadyBugKilled(Vector2 Position, bool GoldLadyBug = false)
{
Main.ladyBugRainBoost += NPC.ladyBugRainTime;
int player = Main.myPlayer;
if (!Main.player[player].active || Main.player[player].dead)
return;
Vector2 vector2 = Position - Main.player[player].Center;
int num1 = 400;
if ((double) vector2.Length() >= (double) num1)
return;
if ((double) vector2.Length() < 100.0)
vector2 = new Vector2();
double num2 = 1.0 - (double) vector2.Length() / (double) num1;
int num3 = (int) ((double) NPC.ladyBugBadLuckTime * num2);
if (GoldLadyBug)
num3 *= 2;
if (num3 >= Main.player[player].ladyBugLuckTimeLeft)
return;
Main.player[player].ladyBugLuckTimeLeft = num3;
Main.player[player].luckNeedsSync = true;
}
private void LadyBugLuck(int plr, bool GoldLadyBug = false)
{
if (this.releaseOwner != (short) byte.MaxValue || Main.player[plr].ladyBugLuckTimeLeft < 0)
return;
Vector2 vector2 = this.Center - Main.player[plr].Center;
int num1 = 800;
if ((double) vector2.Length() >= (double) num1)
return;
if ((double) vector2.Length() < 30.0)
vector2 = new Vector2();
double num2 = Math.Pow(1.0 - (double) vector2.Length() / (double) num1, 6.0);
int num3 = (int) ((double) NPC.ladyBugGoodLuckTime * num2);
if (GoldLadyBug)
num3 *= 2;
if (num3 <= Main.player[plr].ladyBugLuckTimeLeft)
return;
Main.player[plr].ladyBugLuckTimeLeft = num3;
Main.player[plr].luckNeedsSync = true;
}
private void NPCLuck()
{
int player = Main.myPlayer;
if (this.type == 22)
{
if (Main.player[player].ladyBugLuckTimeLeft < 0 || !Main.player[player].active || Main.player[player].dead)
return;
int num = NPC.ladyBugGoodLuckTime / 3;
if (num <= Main.player[player].ladyBugLuckTimeLeft)
return;
Main.player[player].ladyBugLuckTimeLeft = num;
Main.player[player].luckNeedsSync = true;
}
else
{
if (this.type == 54 || !Main.player[player].active || Main.player[player].dead)
return;
int num = NPC.ladyBugBadLuckTime / 3;
if (num >= Main.player[player].ladyBugLuckTimeLeft)
return;
Main.player[player].ladyBugLuckTimeLeft = num;
Main.player[player].luckNeedsSync = true;
}
}
public void HitEffect(int hitDirection = 0, double dmg = 10.0)
{
// ISSUE: The method is too long to display (53918 instructions)
}
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 AnyHelpfulFairies()
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && (Main.npc[index].type == 583 || Main.npc[index].type == 584 || Main.npc[index].type == 585) && (double) Main.npc[index].ai[2] > 1.0)
return true;
}
return false;
}
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 buffIndex = -1;
for (int index3 = 0; index3 < 5; ++index3)
{
if (!Main.debuff[this.buffType[index3]])
{
buffIndex = index3;
break;
}
}
if (buffIndex == -1)
return;
for (int index4 = buffIndex; index4 < 5; ++index4)
{
if (this.buffType[index4] == 0)
{
index1 = index4;
break;
}
}
if (index1 == -1)
this.DelBuff(buffIndex);
}
this.buffType[index1] = type;
this.buffTime[index1] = time;
}
public void RequestBuffRemoval(int buffTypeToRemove)
{
if (buffTypeToRemove < 0 || buffTypeToRemove >= 323 || !BuffID.Sets.CanBeRemovedByNetMessage[buffTypeToRemove])
return;
int buffIndex = this.FindBuffIndex(buffTypeToRemove);
if (buffIndex == -1)
return;
this.DelBuff(buffIndex);
if (Main.netMode != 1)
return;
NetMessage.SendData(137, number: this.whoAmI, number2: ((float) buffTypeToRemove));
}
public void DelBuff(int buffIndex)
{
this.buffTime[buffIndex] = 0;
this.buffType[buffIndex] = 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 bool CountsAsACritter => this.lifeMax <= 5 && this.damage == 0 && this.type != 594;
public void moneyPing(Vector2 pos)
{
SoundEngine.PlaySound(38, pos);
int Type = 244;
if (this.extraValue >= 1000000)
Type = 247;
else if (this.extraValue >= 10000)
Type = 246;
else if (this.extraValue >= 100)
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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, 32);
else if (this.type == 153 && Main.rand.Next(1000) == 0)
SoundEngine.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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(41, 44));
else if (this.type == 580 && Main.rand.Next(800) == 0)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, 44);
else if (this.type == 582 && Main.rand.Next(800) == 0)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, 44);
else if (this.type == 581 && Main.rand.Next(800) == 0)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(44, 47));
else if (this.type == 508 && Main.rand.Next(800) == 0)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, 44);
else if (this.type == 509 && Main.rand.Next(800) == 0)
SoundEngine.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)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, 47);
else if (this.type == 467 && Main.rand.Next(700) == 0)
SoundEngine.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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.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)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, 73);
else if (this.type == 258 && Main.rand.Next(700) == 0)
SoundEngine.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)
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, 78);
else if (this.type == 469 && Main.rand.Next(700) == 0)
SoundEngine.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)
SoundEngine.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)
{
SoundEngine.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;
SoundEngine.PlaySound(29, (int) this.position.X, (int) this.position.Y, Main.rand.Next(86, 87));
}
}
public void UpdateAltTexture()
{
if (!this.townNPC)
return;
int altTexture = this.altTexture;
bool flag = BirthdayParty.PartyIsUp || this.ForcePartyHatOn;
if (this.type == 441 || this.type == 453 || this.type == 633)
flag = false;
this.altTexture = 0;
if (flag)
this.altTexture = 1;
if (this.type == 633 && this.ShouldBestiaryGirlBeLycantrope())
this.altTexture = 2;
if (this.ForcePartyHatOn)
return;
this.MakeTransitionEffectsForTextureChanges(altTexture, this.altTexture);
}
private void MakeTransitionEffectsForTextureChanges(int oldAltTexture, int currentAltTexture)
{
if (oldAltTexture == 0 && currentAltTexture == 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 (oldAltTexture == 1 && currentAltTexture == 0)
Utils.PoofOfSmoke(this.position);
if (this.type != 633)
return;
int num = 2;
if ((oldAltTexture != 0 || currentAltTexture != num ? (oldAltTexture != num ? 0 : (currentAltTexture == 0 ? 1 : 0)) : 1) == 0)
return;
for (int index = 0; index < 20; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 262, SpeedY: -2f);
dust.noGravity = true;
dust.scale = 2f;
}
}
public static void ResetNetOffsets()
{
NPC.offSetDelayTime = 180;
for (int index = 0; index < 200; ++index)
Main.npc[index].netOffset *= 0.0f;
}
public void UpdateNPC(int i)
{
this.whoAmI = i;
if (!this.active)
return;
if (NPC.offSetDelayTime > 0)
this.netOffset *= 0.0f;
else if (Main.netMode == 2)
this.netOffset *= 0.0f;
else if (Main.multiplayerNPCSmoothingRange <= 0)
this.netOffset *= 0.0f;
else if (this.netOffset != new Vector2(0.0f, 0.0f))
{
if (NPCID.Sets.NoMultiplayerSmoothingByType[this.type])
this.netOffset *= 0.0f;
else if (NPCID.Sets.NoMultiplayerSmoothingByAI[this.aiStyle])
{
this.netOffset *= 0.0f;
}
else
{
float num1 = 2f;
float npcSmoothingRange = (float) Main.multiplayerNPCSmoothingRange;
float num2 = this.netOffset.Length();
if ((double) num2 > (double) npcSmoothingRange)
{
this.netOffset.Normalize();
this.netOffset *= npcSmoothingRange;
num2 = this.netOffset.Length();
}
float num3 = num1 + num2 / npcSmoothingRange * num1;
Vector2 netOffset = this.netOffset;
netOffset.Normalize();
this.netOffset -= netOffset * num3;
if ((double) this.netOffset.Length() < (double) num3)
this.netOffset *= 0.0f;
if (this.townNPC && (double) Vector2.Distance(this.position, new Vector2((float) (this.homeTileX * 16 + 8 - this.width / 2), (float) (this.homeTileY * 16 - this.height) - 0.1f)) < 1.0)
this.netOffset *= 0.0f;
}
}
this.UpdateAltTexture();
if (this.type == 368)
NPC.travelNPC = true;
if (Main.netMode != 2)
this.UpdateNPC_CastLights();
this.UpdateNPC_TeleportVisuals();
this.UpdateNPC_CritterSounds();
this.TrySyncingUniqueTownNPCData(i);
if (this.aiStyle == 7 && (double) this.position.Y > (double) Main.bottomWorld - 640.0 + (double) this.height && Main.netMode != 1 && !Main.xMas)
{
this.StrikeNPCNoInteraction(9999, 0.0f, 0);
if (Main.netMode == 2)
NetMessage.SendData(28, number: this.whoAmI, number2: 9999f);
}
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_BuffApplyVFX();
this.UpdateNPC_BloodMoonTransformations();
float maxFallSpeed;
this.UpdateNPC_UpdateGravity(out maxFallSpeed);
if (this.soundDelay > 0)
--this.soundDelay;
if (this.life <= 0)
{
this.active = false;
this.UpdateNetworkCode(i);
this.netUpdate = false;
this.justHit = false;
}
else
{
this.oldTarget = this.target;
this.oldDirection = this.direction;
this.oldDirectionY = this.directionY;
float num4 = (float) (1.0 + (double) Math.Abs(this.velocity.X) / 3.0);
if ((double) this.gfxOffY > 0.0)
{
this.gfxOffY -= num4 * this.stepSpeed;
if ((double) this.gfxOffY < 0.0)
this.gfxOffY = 0.0f;
}
else if ((double) this.gfxOffY < 0.0)
{
this.gfxOffY += num4 * 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 && this.extraValue > 0)
{
int Type = 244;
float num5 = 30f;
if (this.extraValue >= 1000000)
{
Type = 247;
num5 *= 0.25f;
}
else if (this.extraValue >= 10000)
{
Type = 246;
num5 *= 0.5f;
}
else if (this.extraValue >= 100)
{
Type = 245;
num5 *= 0.75f;
}
if (Main.rand.Next((int) num5) == 0)
{
this.position = this.position + this.netOffset;
int index = Dust.NewDust(this.position, this.width, this.height, Type, Alpha: 254, Scale: 0.25f);
Main.dust[index].velocity *= 0.1f;
this.position = this.position - this.netOffset;
}
}
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 || NPCID.Sets.TakesDamageFromHostilesWithoutBeingFriendly[this.type]))
{
if (this.townNPC)
this.CheckDrowning();
this.CheckLifeRegen();
this.GetHurtByOtherNPCs(NPCID.Sets.AllNPCs);
}
if (Main.netMode != 1 && (NPC.npcsFoundForCheckActive[210] || NPC.npcsFoundForCheckActive[211]) && !NPCID.Sets.HurtingBees[this.type])
this.GetHurtByOtherNPCs(NPCID.Sets.HurtingBees);
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 buffIndex = 0; buffIndex < 5; ++buffIndex)
{
if (this.buffType[buffIndex] == 24)
this.DelBuff(buffIndex);
}
}
}
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.type == 602 || this.type == 608 || this.type == 614))
{
this.ai[0] = 1f;
this.ai[1] = 400f;
this.ai[2] = 0.0f;
}
this.FindFrame();
this.UpdateNPC_UpdateTrails();
this.UpdateNetworkCode(i);
this.CheckActive();
this.netUpdate = false;
this.justHit = false;
}
}
private void TrySyncingUniqueTownNPCData(int npcIndex)
{
if (Main.netMode != 1 || !this.needsUniqueInfoUpdate || !this.townNPC && this.type != 453 || this.type == 37)
return;
this.needsUniqueInfoUpdate = false;
NetMessage.SendData(56, number: npcIndex);
}
private void UpdateNetworkCode(int i)
{
if (!this.active)
this.netUpdate = true;
if (Main.netMode != 2)
return;
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)
{
this.netStream = (byte) 0;
float num = Math.Abs(this.Center.X - Main.player[remoteClient].Center.X) + Math.Abs(this.Center.Y - Main.player[remoteClient].Center.Y);
if ((double) num < 250.0)
this.streamPlayer[remoteClient] -= (byte) 8;
else if ((double) num < 500.0)
this.streamPlayer[remoteClient] -= (byte) 4;
else if ((double) num < 1000.0)
this.streamPlayer[remoteClient] -= (byte) 2;
else if ((double) num < 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.TypeToDefaultHeadIndex(this.type) <= 0)
return;
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;
}
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.netOffset;
}
--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 + this.netOffset;
}
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.netOffset;
this.oldRot[0] = this.rotation;
}
else
{
for (int index = this.oldPos.Length - 1; index >= 0; --index)
{
this.oldPos[index] = this.position + this.netOffset;
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.netOffset;
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 + this.netOffset;
}
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 + this.netOffset;
}
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 + this.netOffset;
}
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.netOffset;
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);
}
}
}
}
public static Color buffColor(Color newColor, float R, float G, float B, float A)
{
newColor.R = (byte) ((double) newColor.R * (double) R);
newColor.G = (byte) ((double) newColor.G * (double) G);
newColor.B = (byte) ((double) newColor.B * (double) B);
newColor.A = (byte) ((double) newColor.A * (double) A);
return newColor;
}
public Color GetNPCColorTintedByBuffs(Color npcColor)
{
float R = 1f;
float G1 = 1f;
float B1 = 1f;
float A = 1f;
if (this.poisoned)
{
R *= 0.65f;
B1 *= 0.75f;
npcColor = NPC.buffColor(npcColor, R, G1, B1, A);
}
if (this.venom)
{
G1 *= 0.45f;
R *= 0.75f;
npcColor = NPC.buffColor(npcColor, R, G1, B1, A);
}
if (this.midas)
{
B1 *= 0.3f;
R *= 0.85f;
npcColor = NPC.buffColor(npcColor, R, G1, B1, A);
}
if (this.betsysCurse)
{
R *= 0.8f;
G1 *= 0.6f;
npcColor = NPC.buffColor(npcColor, R, G1, B1, A);
}
if (this.oiled)
{
R *= 0.7f;
G1 *= 0.7f;
B1 *= 0.7f;
npcColor = NPC.buffColor(npcColor, R, G1, B1, A);
}
if (this.stinky)
{
R *= 0.7f;
B1 *= 0.55f;
npcColor = NPC.buffColor(npcColor, R, G1, B1, A);
}
if (this.drippingSlime)
{
R *= 0.8f;
G1 *= 0.8f;
npcColor = NPC.buffColor(npcColor, R, G1, B1, A);
}
if (this.drippingSparkleSlime)
{
float B2 = B1 * 0.85f;
float G2 = G1 * 0.75f;
npcColor = NPC.buffColor(npcColor, R, G2, B2, A);
}
if (this.ichor)
npcColor = new Color((int) byte.MaxValue, (int) byte.MaxValue, 0, (int) byte.MaxValue);
if (Main.player[Main.myPlayer].detectCreature && this.lifeMax > 1)
{
byte num1;
byte num2;
byte num3;
if (this.friendly || this.catchItem > (short) 0 || this.damage == 0 && this.lifeMax == 5)
{
num1 = (byte) 50;
num2 = byte.MaxValue;
num3 = (byte) 50;
}
else
{
num1 = byte.MaxValue;
num2 = (byte) 50;
num3 = (byte) 50;
}
if ((int) npcColor.R < (int) num1)
npcColor.R = num1;
if ((int) npcColor.G < (int) num2)
npcColor.G = num2;
if ((int) npcColor.B < (int) num3)
npcColor.B = num3;
}
return npcColor;
}
private void UpdateNPC_BuffApplyVFX()
{
this.position = this.position + this.netOffset;
if (this.markedByScytheWhip && Main.rand.Next(3) == 0)
ParticleOrchestrator.RequestParticleSpawn(true, ParticleOrchestraType.BlackLightningSmall, new ParticleOrchestraSettings()
{
MovementVector = Main.rand.NextVector2Circular(1f, 1f),
PositionInWorld = Main.rand.NextVector2FromRectangle(this.Hitbox)
});
if (this.poisoned && Main.rand.Next(30) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 46, Alpha: 120, Scale: 0.2f);
dust.noGravity = true;
dust.fadeIn = 1.9f;
}
if (this.venom && Main.rand.Next(10) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 171, Alpha: 100, Scale: 0.5f);
dust.noGravity = true;
dust.fadeIn = 1.5f;
}
if (this.shadowFlame && Main.rand.Next(5) < 4)
{
Dust dust = Dust.NewDustDirect(new Vector2(this.position.X - 2f, this.position.Y - 2f), this.width + 4, this.height + 4, 27, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 180, Scale: 1.95f);
dust.noGravity = true;
dust.velocity *= 0.75f;
dust.velocity.X *= 0.75f;
--dust.velocity.Y;
if (Main.rand.Next(4) == 0)
{
dust.noGravity = false;
dust.scale *= 0.5f;
}
}
if (this.onFire)
{
if (Main.rand.Next(4) < 3)
{
Dust dust = Dust.NewDustDirect(new Vector2(this.position.X - 2f, this.position.Y - 2f), this.width + 4, this.height + 4, 6, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, Scale: 3.5f);
dust.noGravity = true;
dust.velocity *= 1.8f;
dust.velocity.Y -= 0.5f;
if (Main.rand.Next(4) == 0)
{
dust.noGravity = false;
dust.scale *= 0.5f;
}
}
Lighting.AddLight((int) ((double) this.position.X / 16.0), (int) ((double) this.position.Y / 16.0 + 1.0), 1f, 0.3f, 0.1f);
}
if (this.daybreak)
{
if (Main.rand.Next(4) < 3)
{
Dust dust = Dust.NewDustDirect(new Vector2(this.position.X - 2f, this.position.Y - 2f), this.width + 4, this.height + 4, 158, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, Scale: 3.5f);
dust.noGravity = true;
dust.velocity *= 2.8f;
dust.velocity.Y -= 0.5f;
if (Main.rand.Next(4) == 0)
{
dust.noGravity = false;
dust.scale *= 0.5f;
}
}
Lighting.AddLight((int) ((double) this.position.X / 16.0), (int) ((double) this.position.Y / 16.0 + 1.0), 1f, 0.3f, 0.1f);
}
if (this.betsysCurse)
{
if (Main.rand.Next(4) < 3)
{
Dust dust = Dust.NewDustDirect(new Vector2(this.position.X - 2f, this.position.Y - 2f), this.width + 4, this.height + 4, 55, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, Scale: 3.5f);
dust.noGravity = true;
dust.velocity *= 2.8f;
dust.velocity.Y -= 1.5f;
dust.noGravity = false;
dust.scale = 0.9f;
dust.color = new Color(0, 0, 180, (int) byte.MaxValue);
dust.velocity *= 0.2f;
}
Lighting.AddLight((int) ((double) this.position.X / 16.0), (int) ((double) this.position.Y / 16.0 + 1.0), 0.6f, 0.1f, 0.9f);
}
if (this.oiled && Main.rand.Next(3) != 0)
{
int Alpha = 175;
Color newColor = new Color(0, 0, 0, 140);
Vector2 position = this.position;
position.X -= 2f;
position.Y -= 2f;
if (Main.rand.Next(2) == 0)
{
Dust dust = Dust.NewDustDirect(position, this.width + 4, this.height + 2, 4, Alpha: Alpha, newColor: newColor, Scale: 1.4f);
if (Main.rand.Next(2) == 0)
dust.alpha += 25;
if (Main.rand.Next(2) == 0)
dust.alpha += 25;
dust.noLight = true;
dust.velocity *= 0.2f;
dust.velocity.Y += 0.2f;
dust.velocity += this.velocity;
}
}
if (this.dryadWard && (double) this.velocity.X != 0.0 && Main.rand.Next(4) == 0)
{
Dust dust = Dust.NewDustDirect(new Vector2(this.position.X - 2f, (float) ((double) this.position.Y + (double) this.height - 2.0)), this.width + 4, 4, 163, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, Scale: 1.5f);
dust.noGravity = true;
dust.noLight = true;
dust.velocity *= 0.0f;
}
if (this.dryadBane && Main.rand.Next(4) == 0)
{
Dust dust = Dust.NewDustDirect(new Vector2(this.position.X - 2f, this.position.Y), this.width + 4, this.height, 163, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, Scale: 1.5f);
dust.noGravity = true;
dust.velocity *= new Vector2((float) ((double) Main.rand.NextFloat() * 4.0 - 2.0), 0.0f);
dust.noLight = true;
}
if (this.loveStruck && Main.rand.Next(5) == 0)
{
Vector2 vector2 = new Vector2((float) Main.rand.Next(-10, 11), (float) Main.rand.Next(-10, 11));
vector2.Normalize();
vector2.X *= 0.66f;
int index = Gore.NewGore(this.position + new Vector2((float) Main.rand.Next(this.width + 1), (float) Main.rand.Next(this.height + 1)), vector2 * (float) Main.rand.Next(3, 6) * 0.33f, 331, (float) Main.rand.Next(40, 121) * 0.01f);
Main.gore[index].sticky = false;
Main.gore[index].velocity *= 0.4f;
Main.gore[index].velocity.Y -= 0.6f;
}
if (this.stinky && Main.rand.Next(5) == 0)
{
Vector2 vector2_1 = new Vector2((float) Main.rand.Next(-10, 11), (float) Main.rand.Next(-10, 11));
vector2_1.Normalize();
vector2_1.X *= 0.66f;
vector2_1.Y = Math.Abs(vector2_1.Y);
Vector2 vector2_2 = vector2_1 * (float) Main.rand.Next(3, 5) * 0.25f;
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 188, vector2_2.X, vector2_2.Y * 0.5f, 100, Scale: 1.5f);
dust.velocity *= 0.1f;
dust.velocity.Y -= 0.5f;
}
if (this.dripping && Main.rand.Next(4) != 0)
{
Vector2 position = this.position;
position.X -= 2f;
position.Y -= 2f;
if (Main.rand.Next(2) == 0)
{
Dust dust = Dust.NewDustDirect(position, this.width + 4, this.height + 2, 211, Alpha: 50, Scale: 0.8f);
if (Main.rand.Next(2) == 0)
dust.alpha += 25;
if (Main.rand.Next(2) == 0)
dust.alpha += 25;
dust.noLight = true;
dust.velocity *= 0.2f;
dust.velocity.Y += 0.2f;
dust.velocity += this.velocity;
}
else
{
Dust dust = Dust.NewDustDirect(position, this.width + 8, this.height + 8, 211, Alpha: 50, Scale: 1.1f);
if (Main.rand.Next(2) == 0)
dust.alpha += 25;
if (Main.rand.Next(2) == 0)
dust.alpha += 25;
dust.noLight = true;
dust.noGravity = true;
dust.velocity *= 0.2f;
++dust.velocity.Y;
dust.velocity += this.velocity;
}
}
if (this.drippingSlime && Main.rand.Next(4) != 0)
{
int Alpha = 175;
Color newColor = new Color(0, 80, (int) byte.MaxValue, 100);
Vector2 position = this.position;
position.X -= 2f;
position.Y -= 2f;
if (Main.rand.Next(2) == 0)
{
Dust dust = Dust.NewDustDirect(position, this.width + 4, this.height + 2, 4, Alpha: Alpha, newColor: newColor, Scale: 1.4f);
if (Main.rand.Next(2) == 0)
dust.alpha += 25;
if (Main.rand.Next(2) == 0)
dust.alpha += 25;
dust.noLight = true;
dust.velocity *= 0.2f;
dust.velocity.Y += 0.2f;
dust.velocity += this.velocity;
}
}
if (this.drippingSparkleSlime && Main.rand.Next(4) != 0)
{
int Alpha = 150;
Vector2 position = this.position;
position.X -= 2f;
position.Y -= 2f;
if (Main.rand.Next(2) == 0)
{
Dust dust = Dust.NewDustDirect(position, this.width + 4, this.height + 2, 243, Alpha: Alpha);
if (Main.rand.Next(2) == 0)
dust.alpha += 25;
if (Main.rand.Next(2) == 0)
dust.alpha += 25;
dust.noLight = true;
dust.velocity *= 0.2f;
dust.velocity.Y += 0.2f;
dust.velocity += this.velocity;
}
}
if (this.onFrostBurn)
{
if (Main.rand.Next(4) < 3)
{
Dust dust = Dust.NewDustDirect(new Vector2(this.position.X - 2f, this.position.Y - 2f), this.width + 4, this.height + 4, 135, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, Scale: 3.5f);
dust.noGravity = true;
dust.velocity *= 1.8f;
dust.velocity.Y -= 0.5f;
if (Main.rand.Next(4) == 0)
{
dust.noGravity = false;
dust.scale *= 0.5f;
}
}
Lighting.AddLight((int) ((double) this.position.X / 16.0), (int) ((double) this.position.Y / 16.0 + 1.0), 0.1f, 0.6f, 1f);
}
if (this.onFire2)
{
if (Main.rand.Next(4) < 3)
{
Dust dust = Dust.NewDustDirect(new Vector2(this.position.X - 2f, this.position.Y - 2f), this.width + 4, this.height + 4, 75, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, Scale: 3.5f);
dust.noGravity = true;
dust.velocity *= 1.8f;
dust.velocity.Y -= 0.5f;
if (Main.rand.Next(4) == 0)
{
dust.noGravity = false;
dust.scale *= 0.5f;
}
}
Lighting.AddLight((int) ((double) this.position.X / 16.0), (int) ((double) this.position.Y / 16.0 + 1.0), 1f, 0.3f, 0.1f);
}
this.position = this.position - this.netOffset;
}
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 -= 24;
if (amount < 4)
amount = 4;
}
if (this.venom)
{
if (this.lifeRegen > 0)
this.lifeRegen = 0;
this.lifeRegen -= 30;
if (amount < 5)
amount = 5;
}
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.GameModeInfo.TownNPCDamageMultiplier;
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 buffIndex = 0; buffIndex < 5; ++buffIndex)
{
if (this.buffType[buffIndex] > 0 && this.buffTime[buffIndex] <= 0)
{
this.DelBuff(buffIndex);
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 || this.type == 592 || this.type == 593)
{
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;
}
public void UpdateNPC_BuffSetFlags(bool lowerBuffTime = true)
{
for (int index = 0; index < 5; ++index)
{
if (this.buffType[index] > 0 && this.buffTime[index] > 0)
{
if (lowerBuffTime)
--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] == 320)
this.drippingSparkleSlime = 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;
if (this.buffType[index] == 310)
this.markedByScytheWhip = true;
if (this.buffType[index] == 313)
this.markedByFireWhip = true;
if (this.buffType[index] == 309)
this.markedBySwordWhip = true;
if (this.buffType[index] == 315)
this.markedByThornWhip = true;
if (this.buffType[index] == 307)
this.markedByBlandWhip = true;
if (this.buffType[index] == 319)
this.markedByMaceWhip = true;
if (this.buffType[index] == 316)
this.markedByRainbowWhip = 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.drippingSparkleSlime = false;
this.daybreak = false;
this.javelined = false;
this.celled = false;
this.dryadBane = false;
this.betsysCurse = false;
this.oiled = false;
this.markedByScytheWhip = false;
this.markedByThornWhip = false;
this.markedByFireWhip = false;
this.markedByRainbowWhip = false;
this.markedByBlandWhip = false;
this.markedBySwordWhip = false;
this.markedByMaceWhip = 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 == 611 && !Main.dayTime && Main.rand.Next(700) == 0)
SoundEngine.PlaySound(46, (int) this.position.X, (int) this.position.Y);
if (this.type >= 602 && this.type <= 603 && Main.dayTime && Main.rand.Next(1200) == 0)
SoundEngine.PlaySound(44, (int) this.position.X, (int) this.position.Y);
if (this.type >= 362 && this.type <= 365)
{
if (!Main.dayTime || Main.rand.Next(200) != 0)
return;
SoundEngine.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;
SoundEngine.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)
SoundEngine.PlaySound(32, (int) this.position.X, (int) this.position.Y, 14);
else
SoundEngine.PlaySound(32, (int) this.position.X, (int) this.position.Y, 18);
}
if (this.type == 297)
SoundEngine.PlaySound(32, (int) this.position.X, (int) this.position.Y, 16);
if (this.type == 298)
{
if (Main.rand.Next(3) != 0)
SoundEngine.PlaySound(32, (int) this.position.X, (int) this.position.Y, 17);
else
SoundEngine.PlaySound(32, (int) this.position.X, (int) this.position.Y, 19);
}
if (this.type != 442)
return;
switch (Main.rand.Next(5))
{
case 0:
SoundEngine.PlaySound(32, (int) this.position.X, (int) this.position.Y, 16);
break;
case 1:
SoundEngine.PlaySound(32, (int) this.position.X, (int) this.position.Y, 17);
break;
case 2:
SoundEngine.PlaySound(32, (int) this.position.X, (int) this.position.Y, 19);
break;
case 3:
SoundEngine.PlaySound(32, (int) this.position.X, (int) this.position.Y, 14);
break;
default:
SoundEngine.PlaySound(32, (int) this.position.X, (int) this.position.Y, 18);
break;
}
}
else
{
if (this.type != 300 && this.type != 447 && this.type != 610 || Main.rand.Next(1800) != 0)
return;
SoundEngine.PlaySound(33, (int) this.position.X, (int) this.position.Y);
}
}
private void UpdateNPC_CastLights()
{
if (this.type >= 442 && this.type <= 448 || this.type == 539 || this.type == 592 || this.type == 593 || this.type == 601 || this.type == 605 || this.type == 627)
{
this.position = this.position + this.netOffset;
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;
}
}
this.position = this.position - this.netOffset;
}
if (this.type >= 254 && this.type <= 261 || this.type == 160 || this.type == 634 || this.type == 635)
{
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;
if (this.type == 634)
num7 = 0.65f;
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 GetHurtByOtherNPCs(bool[] acceptableNPCIDs)
{
if (this.dontTakeDamageFromHostiles)
return;
int specialHitSetter = 1;
float damageMultiplier = 1f;
if (this.immune[(int) byte.MaxValue] != 0)
return;
Microsoft.Xna.Framework.Rectangle hitbox1 = this.Hitbox;
for (int index = 0; index < 200; ++index)
{
NPC thatNPC = Main.npc[index];
if (acceptableNPCIDs[thatNPC.type] && thatNPC.active && !thatNPC.friendly && thatNPC.damage > 0)
{
Microsoft.Xna.Framework.Rectangle hitbox2 = thatNPC.Hitbox;
NPC.GetMeleeCollisionData(hitbox1, index, ref specialHitSetter, ref damageMultiplier, ref hitbox2);
if (hitbox1.Intersects(hitbox2) && (this.type != 453 || !NPCID.Sets.Skeletons[thatNPC.type]) && thatNPC.type != 624)
this.BeHurtByOtherNPC(index, thatNPC);
}
}
}
private void BeHurtByOtherNPC(int npcIndex, NPC thatNPC)
{
int num1 = 30;
if (this.type == 548)
num1 = 20;
int Damage1 = Main.DamageVar((float) thatNPC.damage);
int num2 = 6;
int hitDirection1 = (double) thatNPC.Center.X > (double) this.Center.X ? -1 : 1;
double num3 = this.StrikeNPCNoInteraction(Damage1, (float) num2, hitDirection1);
if (Main.netMode != 0)
NetMessage.SendData(28, number: this.whoAmI, number2: ((float) Damage1), number3: ((float) num2), number4: ((float) hitDirection1));
this.netUpdate = true;
this.immune[(int) byte.MaxValue] = num1;
if (this.dryadWard)
{
int Damage2 = (int) num3 / 3;
int num4 = 6;
hitDirection1 *= -1;
thatNPC.StrikeNPCNoInteraction(Damage2, (float) num4, hitDirection1);
if (Main.netMode != 0)
NetMessage.SendData(28, number: npcIndex, number2: ((float) Damage2), number3: ((float) num4), number4: ((float) hitDirection1));
thatNPC.netUpdate = true;
thatNPC.immune[(int) byte.MaxValue] = num1;
}
if (!NPCID.Sets.HurtingBees[thatNPC.type])
return;
int damage = this.damage;
int num5 = 6;
int hitDirection2 = hitDirection1 * -1;
thatNPC.StrikeNPCNoInteraction(damage, (float) num5, hitDirection2);
if (Main.netMode != 0)
NetMessage.SendData(28, number: npcIndex, number2: ((float) damage), number3: ((float) num5), number4: ((float) hitDirection2));
thatNPC.netUpdate = true;
thatNPC.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;
}
public void GetImmuneTime(int fromWho, int time)
{
if (fromWho == -1)
{
for (int index = 0; index < this.immune.Length; ++index)
this.immune[index] = time;
}
else
{
if (fromWho < 0 || fromWho >= this.immune.Length)
return;
this.immune[fromWho] = time;
}
}
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 (!this.townNPC)
flag = false;
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_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;
}
public void GetTileCollisionParameters(out Vector2 cPosition, out int cWidth, out int cHeight)
{
cPosition = this.position;
cWidth = this.width;
cHeight = this.height;
if (this.type == 594)
{
int num = (int) (44.0 + 20.0 * (double) this.ai[1]);
cPosition.Y += (float) num;
cHeight += num;
cPosition.X += (float) (cWidth / 2);
cWidth = (int) (6.0 + 26.0 * (double) this.ai[1]);
cPosition.X -= (float) (cWidth / 2);
}
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)
{
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;
}
else if (this.type == 593 && this.wet)
{
int direction = this.direction;
Vector2 velocity = this.velocity;
this.Transform(592);
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 != 592 || this.wet || !Main.raining)
return;
int direction = this.direction;
Vector2 velocity = this.velocity;
this.Transform(593);
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 == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194 || this.type == 317 || this.type == 318 || this.type == 133)
flag1 = true;
if (this.aiStyle == 10)
flag1 = true;
if (this.aiStyle == 5)
flag1 = true;
if (this.aiStyle == 40)
flag1 = true;
if (this.aiStyle == 44)
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 == 657 && this.target >= 0 && (double) Main.player[this.target].position.Y > (double) this.Bottom.Y)
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.type == 405 || this.type == 406)
flag1 = true;
if (this.type == 490)
flag1 = true;
if (this.type == 301)
flag1 = true;
if (this.aiStyle == 7)
{
int num = 16;
bool flag2 = false;
if (this.townNPC && (!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 (this.aiStyle == 116)
this.wetCount = (byte) 10;
if (flag)
{
if (this.onFire && !this.lavaWet && Main.netMode != 1)
{
for (int buffIndex = 0; buffIndex < 5; ++buffIndex)
{
if (this.buffType[buffIndex] == 24)
this.DelBuff(buffIndex);
}
}
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)
SoundEngine.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
else if (this.type != 617 && this.type != 616 && this.type != 625)
{
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 || this.type == 615)
SoundEngine.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)
SoundEngine.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.type == 620 && (double) this.GetTargetData().Center.Y < (double) this.Center.Y)
this.velocity.Y -= 8f;
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)
SoundEngine.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
else if (this.type != 617 && this.type != 616 && this.type != 625)
{
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 || this.type == 615)
SoundEngine.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)
SoundEngine.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(4) != 0)
return;
NPC.butterflyChance = 999999;
}
public Color GetBestiaryEntryColor() => Color.White;
public Color GetAlpha(Color newColor)
{
if (this.IsABestiaryIconDummy)
newColor = Color.White;
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 == 662)
{
Color color = Color.Lerp(Color.White, Color.Cyan, 0.5f);
color.A /= (byte) 4;
return color * this.Opacity;
}
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 == 636)
{
newColor = Color.Lerp(newColor, Color.White, 0.25f);
return newColor * this.Opacity;
}
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 == 583 || this.type == 584 || this.type == 585)
{
newColor = Color.Lerp(newColor, Color.White, 0.5f);
return newColor;
}
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.IsABestiaryIconDummy && (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 == 655)
{
int r3 = (int) newColor.R;
int g3 = (int) newColor.G;
int b3 = (int) newColor.B;
if (r3 < (int) byte.MaxValue)
r3 = (int) byte.MaxValue;
if (g3 < 100)
g3 = 100;
if (b3 < 50)
b3 = 50;
return new Color(r3, g3, b3, (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 || this.type == 634 || this.type == 635)
{
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)
{
if (this.IsABestiaryIconDummy)
newColor = this.GetBestiaryEntryColor();
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);
}
public bool ShouldBestiaryGirlBeLycantrope()
{
if (Main.bloodMoon && !Main.dayTime)
return true;
return Main.moonPhase == 0 && !Main.dayTime;
}
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;
bool flag17 = false;
object substitutionObject = Lang.CreateDialogSubstitutionObject(this);
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 == 441)
flag17 = true;
}
}
string str = "";
string specialEventText = "";
if (this.type == 17)
{
if (this.HasSpecialEventText("Merchant", out specialEventText))
str = specialEventText;
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 (this.HasSpecialEventText("Nurse", out specialEventText))
str = specialEventText;
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 (flag16 && 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 (this.HasSpecialEventText("ArmsDealer", out specialEventText))
str = specialEventText;
else if (flag16 && 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 (this.HasSpecialEventText("Dryad", out specialEventText))
str = specialEventText;
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 (this.HasSpecialEventText("Demolitionist", out specialEventText))
str = specialEventText;
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 (this.HasSpecialEventText("Clothier", out specialEventText))
str = specialEventText;
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 (this.HasSpecialEventText("GoblinTinkerer", out specialEventText))
str = specialEventText;
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 (this.HasLuckTextForWizard(out specialEventText))
str = specialEventText;
else if (this.HasSpecialEventText("Wizard", out specialEventText))
str = specialEventText;
else if (DD2Event.DownedInvasionT1 && Main.rand.Next(6) == 0)
str = Language.GetTextValueWith("WizardSpecialText.AfterDD2Tier1", substitutionObject);
else if (Main.player[Main.myPlayer].Male & flag16 && 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 (this.HasSpecialEventText("Mechanic", out specialEventText))
str = specialEventText;
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 (this.HasSpecialEventText("Guide", out specialEventText))
str = specialEventText;
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 (LanternNight.LanternsUp && !NPC.downedMoonlord)
str = Language.GetTextValue("GuideSpecialText.Lantern1");
else if (LanternNight.LanternsUp && NPC.downedMoonlord)
str = Language.GetTextValue("GuideSpecialText.Lantern2");
else if (Main.eclipse)
str = Language.GetTextValue("GuideSpecialText.Eclipse");
else if (Main.slimeRain)
str = Language.GetTextValue("GuideSpecialText.SlimeRain");
else if (!Main.dayTime)
str = Lang.dialog(173);
else if (Main.hardMode & flag17 && Main.rand.Next(8) == 0)
str = Language.GetTextValueWith("GuideChatter.Chatter_1", substitutionObject);
else if (Main.hardMode && Main.rand.Next(8) == 0)
{
str = Language.GetTextValue("GuideChatter.Chatter_2");
}
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 (this.HasSpecialEventText("Santa", out specialEventText))
{
str = specialEventText;
}
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 (this.HasSpecialEventText("Truffle", out specialEventText))
str = specialEventText;
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 (this.HasSpecialEventText("Steampunker", out specialEventText))
str = specialEventText;
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 (this.HasSpecialEventText("DyeTrader", out specialEventText))
str = specialEventText;
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)
{
if (NPC.freeCake)
{
str = Language.GetTextValueWith("PartyGirlSpecialText.Cake" + (object) Main.rand.Next(1, 4), substitutionObject);
}
else
{
int num = Main.rand.Next(7);
if (this.HasSpecialEventText("PartyGirl", out specialEventText))
str = specialEventText;
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 (this.HasSpecialEventText("Cyborg", out specialEventText))
str = specialEventText;
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 (this.HasSpecialEventText("Painter", out specialEventText))
str = specialEventText;
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 (this.HasSpecialEventText("WitchDoctor", out specialEventText))
str = specialEventText;
else if (flag2 && Main.rand.Next(4) == 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 (this.HasSpecialEventText("Pirate", out specialEventText))
str = specialEventText;
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 (this.HasSpecialEventText("Stylist", out specialEventText))
str = specialEventText;
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 = !this.HasSpecialEventText("TravellingMerchant", out specialEventText) ? (!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)) : specialEventText;
else if (this.type == 376)
str = Lang.dialog(Main.rand.Next(353, 356));
else if (this.type == 369)
str = Main.rand.Next(5) != 0 || Main.LocalPlayer.anglerQuestsFinished <= 1 ? (!this.HasSpecialEventText("Angler", out specialEventText) ? (!Main.bloodMoon ? (Main.anglerQuestFinished ? (!flag4 || Main.rand.Next(5) != 0 ? Language.SelectRandom(Lang.CreateDialogFilter("AnglerChatter.", substitutionObject)).FormatWith(substitutionObject) : Lang.dialog(347)) : Lang.dialog(Main.rand.Next(334, 338))) : (Main.rand.Next(3) != 0 ? (Main.anglerQuestFinished ? Lang.dialog(Main.rand.Next(350, 353)) : Lang.dialog(Main.rand.Next(348, 350))) : Language.SelectRandom(Lang.CreateDialogFilter("AnglerSpecialText.BloodMoonFishing")).FormatWith(substitutionObject))) : specialEventText) : Lang.AnglerQuestCountChat(this);
else if (this.type == 453)
str = !this.HasSpecialEventText("SkeletonMerchant", out specialEventText) ? Lang.dialog(Main.rand.Next(356, 364)) : specialEventText;
else if (this.type == 441)
str = !this.HasSpecialEventText("TaxCollector", out specialEventText) ? (!(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)) : specialEventText;
else if (this.type == 579)
str = Language.GetTextValue("BartenderSpecialText.FirstMeeting");
else if (this.type == 550)
str = !this.HasSpecialEventText("Bartender", out specialEventText) ? Lang.BartenderChat(this) : specialEventText;
else if (this.type == 589)
str = Main.rand.Next(2) != 0 ? Language.GetTextValue("GolferSpecialText.FirstMeeting2") : Language.GetTextValue("GolferSpecialText.FirstMeeting1");
else if (this.type == 588)
str = Main.rand.Next(3) == 0 || !this.HasSpecialEventText("Golfer", out specialEventText) ? (Main.rand.Next(3) != 0 ? Lang.GolferChat(this) : Language.SelectRandom(Lang.CreateDialogFilter((Main.LocalPlayer.golferScoreAccumulated < 2000 ? (Main.LocalPlayer.golferScoreAccumulated < 1000 ? (Main.LocalPlayer.golferScoreAccumulated < 500 ? "GolferQuestsChatterBeginner" : "GolferQuestsChatterApprentice") : "GolferQuestsChatterJourneyman") : "GolferQuestsChatterMaster") + ".")).FormatWith(substitutionObject)) : specialEventText;
else if (this.type == 633)
str = this.ShouldBestiaryGirlBeLycantrope() || !this.HasSpecialEventText("BestiaryGirl", out specialEventText) ? Lang.BestiaryGirlChat(this) : specialEventText;
else if (this.type == 637)
str = !this.HasSpecialEventText("Cat", out specialEventText) ? Lang.CatChat(this) : specialEventText;
else if (this.type == 638)
str = !this.HasSpecialEventText("Dog", out specialEventText) ? Lang.DogChat(this) : specialEventText;
else if (this.type == 656)
str = !this.HasSpecialEventText("Bunny", out specialEventText) ? Lang.BunnyChat(this) : specialEventText;
return str;
}
public object Clone() => this.MemberwiseClone();
public bool HasLuckTextForWizard(out string specialEventText)
{
specialEventText = (string) null;
object substitutionObject = Lang.CreateDialogSubstitutionObject(this);
if (Main.rand.Next(3) != 0)
return false;
float normalizedLuck = Main.player[Main.myPlayer].NormalizedLuck;
if ((double) normalizedLuck == 0.0)
return false;
string startsWith = (double) normalizedLuck >= -0.600000023841858 ? ((double) normalizedLuck >= -0.400000005960464 ? ((double) normalizedLuck >= -0.200000002980232 ? ((double) normalizedLuck >= 0.0 ? ((double) normalizedLuck >= 0.25 ? ((double) normalizedLuck >= 0.5 ? ((double) normalizedLuck >= 0.75 ? "WizardSpecialText.LuckIsGodly" : "WizardSpecialText.LuckIsAmazing") : "WizardSpecialText.LuckIsGreat") : "WizardSpecialText.LuckIsGood") : "WizardSpecialText.LuckIsBad") : "WizardSpecialText.LuckIsPoor") : "WizardSpecialText.LuckIsTerrible") : "WizardSpecialText.LuckIsCursed";
specialEventText = Language.SelectRandom(Lang.CreateDialogFilter(startsWith)).FormatWith(substitutionObject);
return true;
}
public bool HasSpecialEventText(string specialTextCategoryKey, out string specialEventText)
{
specialEventText = (string) null;
object substitutionObject = Lang.CreateDialogSubstitutionObject(this);
return Main.LocalPlayer.ZoneGraveyard && Main.rand.Next(3) == 0 && this.GetSpecialEventTextIfNotEmpty(specialTextCategoryKey + "SpecialText.Graveyard", substitutionObject, ref specialEventText) || BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0 && !NPCID.Sets.HasNoPartyText[this.type] && this.GetSpecialEventTextIfNotEmpty(specialTextCategoryKey + "SpecialText.Party", substitutionObject, ref specialEventText) || Main.raining && !Main.IsItStorming && Main.rand.Next(3) == 0 && this.GetSpecialEventTextIfNotEmpty(specialTextCategoryKey + "SpecialText.Rain", substitutionObject, ref specialEventText) || Main.IsItAHappyWindyDay && Main.rand.Next(3) == 0 && this.GetSpecialEventTextIfNotEmpty(specialTextCategoryKey + "SpecialText.Windy", substitutionObject, ref specialEventText) || Main.IsItStorming && Main.rand.Next(3) == 0 && this.GetSpecialEventTextIfNotEmpty(specialTextCategoryKey + "SpecialText.Storm", substitutionObject, ref specialEventText);
}
public bool GetSpecialEventTextIfNotEmpty(
string specialTextKey,
object substitutes,
ref string specialEventText)
{
LocalizedText localizedText = Language.SelectRandom(Lang.CreateDialogFilter(specialTextKey));
if (localizedText == LocalizedText.Empty)
return false;
specialEventText = localizedText.FormatWith(substitutes);
return true;
}
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 || npc1.type == 591) && (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 string GetBestiaryCreditId() => ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[this.netID];
public override string ToString() => "name:" + this.TypeName + ", active:" + this.active.ToString() + ", whoAmI:" + (object) this.whoAmI;
}
}